Browse code

initial checkin new open source version.

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@5 8eb893ce-cfd4-0310-b710-fb5ebe64c474

Raphael Coeffic authored on 17/03/2006 13:16:06
Showing 375 changed files
1 1
deleted file mode 100644
... ...
@@ -1,145 +0,0 @@
1
-/*
2
- * $Id: AmApi.cpp,v 1.9.2.1 2005/08/03 21:00:30 sayer Exp $
3
- *
4
- * Copyright (C) 2002-2003 Fhg Fokus
5
- *
6
- * This file is part of sems, a free SIP media server.
7
- *
8
- * sems is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
12
- *
13
- * For a license to use the ser software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18
- * sems is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License 
24
- * along with this program; if not, write to the Free Software 
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
- */
27
-
28
-#include "AmApi.h"
29
-#include "log.h"
30
-
31
-AmStateFactory::AmStateFactory(const string& _app_name)
32
-  : app_name(_app_name)
33
-{
34
-}
35
-
36
-int AmStateFactory::onLoad()
37
-{
38
-    return 0;
39
-}
40
-
41
-AmDialogState::AmDialogState()
42
-    : AmEventQueue(this)
43
-{
44
-}
45
-
46
-void AmDialogState::process(AmEvent* event)
47
-{   
48
-    AmSessionEvent* session_event = dynamic_cast<AmSessionEvent*>(event);
49
-    if(session_event){
50
-
51
-	DBG("in-dialog event received: %s\n",
52
-	    session_event->request.cmd.method.c_str());
53
-
54
-	if(session_event->event_id == AmSessionEvent::Bye)
55
-	    onBye(&session_event->request);
56
-	else if(onSessionEvent(session_event))
57
-	    ERROR("while processing session event (ID=%i).\n",session_event->event_id);
58
-
59
-	return;
60
-	
61
-    } 
62
-
63
-    //  AmRequestUACStatusEvent?
64
-    AmRequestUACStatusEvent* status_event = 
65
-	dynamic_cast<AmRequestUACStatusEvent*>(event);
66
-    
67
-    if(status_event){
68
-	DBG("in-dialog RequestUAC Staus event received: "
69
-	    "method=%s, cseq = %d, \n\t\tcode = %d, reason = %s\n",
70
-	    status_event->request.cmd.method.c_str(), status_event->request.cmd.cseq, 
71
-	    status_event->code, status_event->reason.c_str());
72
-	
73
-	if(onUACRequestStatus(status_event))
74
-	    ERROR("while processing session event (ID=%i).\n", 
75
-		  session_event->event_id);
76
-
77
-	return;
78
-    } 
79
-
80
-    AmAudioEvent* audio_event = dynamic_cast<AmAudioEvent*>(event);
81
-    if(audio_event && (audio_event->event_id == AmAudioEvent::cleared)){
82
-	stopSession();
83
-	return;
84
-    }
85
-    
86
-    ERROR("AmSession: invalid event received.\n");
87
-    return;
88
-}
89
-
90
-void AmDialogState::onError(unsigned int code, const string& reason)
91
-{
92
-}
93
-
94
-void AmDialogState::onBeforeCallAccept(AmRequest*)
95
-{
96
-}
97
-
98
-int AmDialogState::onSessionEvent(AmSessionEvent* event)
99
-{
100
-    if(!event->processed){
101
-	switch(event->event_id){
102
-	case AmSessionEvent::Refer:
103
-	    event->request.reply(488,"Not acceptable here");
104
-	    break;
105
-	case AmSessionEvent::ReInvite:
106
-	    getSession()->negotiate(&event->request);
107
-	    break;
108
-	}
109
-    }
110
-    
111
-    return 0;
112
-}
113
-
114
-int AmDialogState::onUACRequestStatus(AmRequestUACStatusEvent* event) 
115
-{ 
116
-    if(!event->processed){
117
-	switch(event->event_id){
118
-	    case AmRequestUACStatusEvent::Accepted:
119
-		DBG("UAC Request Status: Accepted (method %s, seqnr %d)\n", 
120
-		    event->request.cmd.method.c_str(), event->request.cmd.cseq);
121
-		break;
122
-	    case AmRequestUACStatusEvent::Error:
123
-		DBG("UAC Request Status: Error (method %s, seqnr %d)\n",
124
-		    event->request.cmd.method.c_str(), event->request.cmd.cseq);
125
-		break;
126
-	}
127
-	event->processed = true;
128
-    }
129
-    
130
-    return 0;
131
-}
132
-
133
-void AmDialogState::onDtmf(int event, int duration_msec)
134
-{
135
-}
136
-
137
-AmStateFactory* AmDialogState::getStateFactory() 
138
-{ 
139
-    return state_factory; 
140
-}
141
-
142
-AmSession* AmDialogState::getSession() 
143
-{ 
144
-    return session; 
145
-}
146 1
deleted file mode 100644
... ...
@@ -1,179 +0,0 @@
1
-/*
2
- * $Id: AmApi.h,v 1.9.2.1 2005/06/01 12:00:24 rco Exp $
3
- *
4
- * Copyright (C) 2002-2003 Fhg Fokus
5
- *
6
- * This file is part of sems, a free SIP media server.
7
- *
8
- * sems is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
12
- *
13
- * For a license to use the ser software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18
- * sems is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License 
24
- * along with this program; if not, write to the Free Software 
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
- */
27
-#ifndef _AmApi_h_
28
-#define _AmApi_h_
29
-
30
-#include "AmRequest.h"
31
-#include "AmThread.h"
32
-#include "AmSession.h"
33
-
34
-#include <string>
35
-#include <map>
36
-using std::map;
37
-using std::string;
38
-
39
-class AmSession;
40
-class AmSessionEvent;
41
-class AmDialogState;
42
-
43
-#define FACTORY_EXPORT_NAME app_state_factory
44
-#define FACTORY_EXPORT_STR  "app_state_factory"
45
-#define EXPORT_FACTORY(class_name,app_name) class_name FACTORY_EXPORT_NAME (app_name)
46
-
47
-class AmStateFactory
48
-{
49
-public:
50
-    string app_name;
51
-    AmStateFactory(const string& _app_name);
52
-    virtual ~AmStateFactory() {}
53
-
54
-    /**
55
-     * Enables the plug-in to initialize whatever it needs.
56
-     * Ex. load the configuration.
57
-     * @return 0 everything was ok.
58
-     * @return 1 on error.
59
-     */
60
-    virtual int onLoad();
61
-
62
-    /**
63
-     * Creates a dialog state on new request.
64
-     * @return 0 if the request is not acceptable.
65
-     *
66
-     * Warning:
67
-     *   This method should not make any expensive
68
-     *   processing as it would block the server.
69
-     */
70
-    virtual AmDialogState* onInvite(AmCmd& cmd) = 0;
71
-};
72
-
73
-/** 
74
- * All your dialog relevant datas should be 
75
- * contained in a class inherited from ApiDialogState 
76
- */
77
-
78
-class AmDialogState: public AmEventQueue, public AmEventHandler
79
-{
80
-    AmStateFactory* state_factory;
81
-    AmSession*      session;
82
-
83
-protected:
84
-    /** @see AmEventHandler::process(AmEvent* event) */
85
-    void process(AmEvent* event);
86
-
87
-public:
88
-    AmDialogState();
89
-    virtual ~AmDialogState() {}
90
-
91
-    AmStateFactory* getStateFactory();
92
-    AmSession* getSession();
93
-
94
-    /**
95
-     * This must be called at the end of the application
96
-     * so that the session can end and later be destroyed.
97
-     */
98
-    void stopSession() { getSession()->setStopped(); }
99
-
100
-    bool sessionStopped() { return getSession()->getStopped(); }
101
-
102
-    /**
103
-     * onBeforeCallAccept will be called on incoming 
104
-     * request before the call gets definitely established.
105
-     * 
106
-     * Throw AmSession::Exception if you want to 
107
-     * signal any error.
108
-     */
109
-    virtual void onBeforeCallAccept(AmRequest* req);
110
-
111
-    /**
112
-     * onSessionStart will be called after call setup.
113
-     *
114
-     * Throw AmSession::Exception if you want to 
115
-     * signal any error.
116
-     * 
117
-     * Warning:
118
-     *   The session ends with this method. 
119
-     *   Sems will NOT send any BYE on his own.
120
-     */
121
-    virtual void onSessionStart(AmRequest* req)=0;
122
-
123
-    /**
124
-     * onBye will be called if a BYE has been 
125
-     * sent or received.
126
-     *
127
-     * Warning:
128
-     *   This method should not make any expensive
129
-     *   processing as it would block the session 
130
-     *   cleaner.
131
-     */
132
-    virtual void onBye(AmRequest* req)=0;
133
-
134
-    /**
135
-     * onError will be called if an error
136
-     * occured during call setup.
137
-     */
138
-    virtual void onError(unsigned int code, const string& reason);
139
-
140
-    /**
141
-     * onOther will be called on any other
142
-     * event (ex. REFER).
143
-     *
144
-     * Warning:
145
-     *   This method should not make any expensive
146
-     *   processing as it would block the session.
147
-     *
148
-     * @return !=0 if any error occured.
149
-     */
150
-    virtual int onSessionEvent(AmSessionEvent* event);
151
-
152
-    /**
153
-     * onUACRequestStatus will be called on the result of a 
154
-     * RequestUAC  (ex. REFER).
155
-     *
156
-     * Warning:
157
-     *   This method should not make any expensive
158
-     *   processing as it would block the session.
159
-     *
160
-     * @return !=0 if any error occured.
161
-     */
162
-    virtual int onUACRequestStatus(AmRequestUACStatusEvent* event);
163
-
164
-    virtual void onDtmf(int event, int duration_msec);
165
-
166
-    // needed for session creation
167
-    friend void AmSessionContainer::startSession(const string& hash_str, 
168
-						 string& sess_key,
169
-						 AmRequestUAS* req);
170
-
171
-    friend AmSession* AmSessionContainer::createSession(const string& app_name, 
172
-							AmRequest* req);
173
-
174
-};
175
-
176
-#endif
177
-// Local Variables:
178
-// mode:C++
179
-// End:
180 1
deleted file mode 100644
... ...
@@ -1,464 +0,0 @@
1
-/*
2
- * $Id: AmConference.cpp,v 1.1.2.4 2005/08/31 13:54:29 rco Exp $
3
- *
4
- * Copyright (C) 2002-2003 Fhg Fokus
5
- *
6
- * This file is part of sems, a free SIP media server.
7
- *
8
- * sems is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
12
- *
13
- * For a license to use the ser software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18
- * sems is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License 
24
- * along with this program; if not, write to the Free Software 
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
- */
27
-
28
-#include "AmConference.h"
29
-#include "AmConferenceStatus.h"
30
-#include "AmSession.h"
31
-#include "AmMultiPartyMixerSocket.h"
32
-
33
-#include <utility>
34
-using std::make_pair;
35
-/* ----- audio mixer----------------------- */
36
-
37
-AmConference* AmConference::_instance=0;
38
-
39
-AmConference* AmConference::instance()
40
-{
41
-    if(!_instance)
42
-	_instance = new AmConference();
43
-    return _instance;
44
-}
45
-
46
-AmConference::AmConference() 
47
-    : runcond(true)
48
-{
49
-
50
-}
51
-
52
-AmConference::~AmConference() {
53
-
54
-}
55
-
56
-void AmConference::run() {
57
-    while (runcond.get()) {
58
-	// FIXME check sockets/conferences for inactive/single user ??? 
59
-	sleep(5);
60
-    }
61
-}
62
-
63
-void AmConference::on_stop() {
64
-
65
-}
66
-
67
-AmConference::socketpair* AmConference::find_socketpair(string c_id) {
68
-    map<string, socketpair >::iterator it =  mixer_sockets.find(c_id); 
69
-    if (it != mixer_sockets.end())
70
-	return &(it->second);
71
-    else 
72
-	return 0;
73
-}
74
-
75
-int AmConference::conference_connect_sock(AmSession* session, string conf_id, bool send, bool receive, int options,
76
-					  AmMultiPartyMixerSocket** play_sock, AmMultiPartyMixerSocket** rec_sock) {
77
-
78
-    *play_sock = *rec_sock = 0;
79
-
80
-    AmConferenceStatus* conf_status = AmConferenceStatusContainer::instance()->get_status(conf_id);
81
-
82
-    mixer_sockets_mut.lock();
83
-    // check if already connected to that conference
84
-    if (find_socketpair(make_id(session, conf_id))) {
85
-	mixer_sockets_mut.unlock();
86
-	ERROR("already connected to conference '%s'\n", conf_id.c_str());
87
-	return CONFERENCE_ERR_ALREADY_CONNECTED;
88
-    }
89
-    
90
-    if (!conf_status) {
91
-	if (!(options & CONFERENCE_OPTIONS_CREATE_CONF)) {
92
-	    mixer_sockets_mut.unlock();
93
-	    DBG("conference '%s' does not exist and shall not be created.\n", conf_id.c_str());
94
-	    return CONFERENCE_ERR_NOTEXIST;
95
-	}
96
-	
97
-	conf_status = AmConferenceStatusContainer::instance()->add_status(conf_id);
98
-	if (!conf_status) {
99
-	    mixer_sockets_mut.unlock();
100
-	    ERROR("could not create new conference status\n");
101
-	    return CONFERENCE_ERR_CREATESTATUS;
102
-	}
103
-    }
104
-
105
-    unsigned int channel = conf_status->add_channel(session);
106
-
107
-    if (send) 
108
-	*play_sock = new AmMultiPartyMixerSocket(conf_status->get_mixer(), AmMultiPartyMixerSocket::Play, channel);
109
-    if (receive) 
110
-	*rec_sock = new AmMultiPartyMixerSocket(conf_status->get_mixer(), AmMultiPartyMixerSocket::Record, channel);
111
-
112
-    mixer_sockets[make_id(session, conf_id)] = make_pair(*play_sock, *rec_sock);
113
-    mixer_sockets_mut.unlock();
114
-    
115
-    return 0; // ok
116
-}
117
-
118
-// bool send : send to conference
119
-// bool send : receive from conference (not rcv RTP!)
120
-int AmConference::conference_connect(AmSession* session, string conf_id, bool send, bool receive, int options) 
121
-{
122
-    if (!send && !receive) {
123
-	ERROR("connect must either send or receive or both.\n");
124
-	return CONFERENCE_ERR_CONNTYPE;
125
-    }
126
-    
127
-    AmMultiPartyMixerSocket* play_sock = 0;
128
-    AmMultiPartyMixerSocket* rec_sock = 0; 
129
-    
130
-    if (int errcode = conference_connect_sock(session, conf_id, send, receive, options, &play_sock, &rec_sock))
131
-	return errcode; // error
132
-    
133
-    if (send)
134
-	session->setOutput(play_sock);
135
-    if (receive)
136
-	session->setInput(rec_sock);
137
-    
138
-    return 0;
139
-}
140
-
141
-void AmConference::conference_addToPlaylist(AmSession* session, string conf_id, 
142
-					    AmAudio* src, AmMultiPartyMixerSocket::Type type, 
143
-					    AmMultiPartyMixerSocket::PlayMode mode, 
144
-					    AmMultiPartyMixerSocket::Priority priority) {
145
-
146
-    if (!src) {
147
-	ERROR("called with empty src!\n");
148
-	return;
149
-    }
150
-
151
-    mixer_sockets_mut.lock();
152
-    map<string, socketpair >::iterator it =  mixer_sockets.find(make_id(session, conf_id));
153
-    if (it == mixer_sockets.end()) {
154
-	mixer_sockets_mut.unlock();
155
-	ERROR("session/conf %s not found in mixer socket list.\n", make_id(session, conf_id).c_str());
156
-	return;
157
-    }
158
-
159
-    socketpair sockets = it->second;
160
-
161
-    AmMultiPartyMixerSocket* dst_sock;
162
-    if (type == AmMultiPartyMixerSocket::Play) 
163
-	dst_sock = get_play_sock(sockets);
164
-    else 
165
-	dst_sock = get_rec_sock(sockets);
166
-
167
-    dst_sock->addToPlaylist(src, mode, priority);
168
-    mixer_sockets_mut.unlock();
169
-}
170
-
171
-void AmConference::conference_clearPlaylist(AmSession* session, string conf_id, 
172
-					    AmMultiPartyMixerSocket::Type type, 
173
-					    AmMultiPartyMixerSocket::PlayMode mode) {
174
-    mixer_sockets_mut.lock();
175
-    map<string, socketpair >::iterator it =  mixer_sockets.find(make_id(session, conf_id));
176
-    if (it == mixer_sockets.end()) {
177
-	mixer_sockets_mut.unlock();
178
-	ERROR("session/conf %s not found in mixer socket list.\n", make_id(session, conf_id).c_str());
179
-	return;
180
-    }
181
-
182
-    socketpair sockets = it->second;
183
-
184
-    AmMultiPartyMixerSocket* dst_sock;
185
-    if (type == AmMultiPartyMixerSocket::Play) 
186
-	dst_sock = get_play_sock(sockets);
187
-    else 
188
-	dst_sock = get_rec_sock(sockets);
189
-
190
-    dst_sock->clearPlaylist(mode);
191
-    mixer_sockets_mut.unlock();
192
-}
193
-
194
-int AmConference::conference_disconnect(AmSession* session, string conf_id) {
195
-    mixer_sockets_mut.lock();
196
-    map<string, socketpair>::iterator it =  mixer_sockets.find(make_id(session, conf_id));
197
-    if (it == mixer_sockets.end()) {
198
-	mixer_sockets_mut.unlock();
199
-	ERROR("session/conf %s not found in mixer socket list.\n", make_id(session, conf_id).c_str());
200
-	return CONFERENCE_ERR_NOTEXIST;
201
-    }
202
-
203
-    socketpair sockets = it->second;
204
-
205
-    if (get_play_sock(sockets)) 
206
-	session->setOutput(0);
207
-    if (get_rec_sock(sockets)) 
208
-	session->setInput(0);
209
-
210
-    AmConferenceStatus* conf_status = AmConferenceStatusContainer::instance()->get_status(conf_id);
211
-
212
-//     unsigned int channel;
213
-//     if (AmMultiPartyMixerSocket* s = get_play_sock(sockets)) {
214
-// 	channel = s->getChannel();
215
-//     } else if (AmMultiPartyMixerSocket* s = get_rec_sock(sockets)) {
216
-// 	channel = s->getChannel();
217
-//     }
218
-
219
-    conf_status->remove_channel(session);
220
-
221
-    if (get_play_sock(sockets))
222
-	delete get_play_sock(sockets);
223
-    if (get_rec_sock(sockets))
224
-	delete get_rec_sock(sockets);
225
-
226
-    mixer_sockets.erase(it); // erase it!
227
-    mixer_sockets_mut.unlock();
228
-
229
-    DBG("session 0x%lx disconnected from conference '%s'\n", (unsigned long) session, conf_id.c_str());
230
-   return 0;
231
-}
232
-
233
-// disconnect sockets and destroy only, don't set session.input and session.output 
234
-int AmConference::conference_disconnect_sock(AmSession* session, string conf_id) {
235
-    mixer_sockets_mut.lock();
236
-
237
-    map<string, socketpair>::iterator it =  mixer_sockets.find(make_id(session, conf_id));
238
-    if (it == mixer_sockets.end()) {
239
-	mixer_sockets_mut.unlock();
240
-	ERROR("session/conf %s not found in mixer socket list.\n", make_id(session, conf_id).c_str());
241
-	return CONFERENCE_ERR_NOTEXIST;
242
-    }
243
-
244
-    socketpair sockets = it->second;
245
-
246
-    AmConferenceStatus* conf_status = AmConferenceStatusContainer::instance()->get_status(conf_id);
247
-
248
-    conf_status->remove_channel(session);
249
-    if (get_play_sock(sockets))
250
-	delete get_play_sock(sockets);
251
-    if (get_rec_sock(sockets))
252
-	delete get_rec_sock(sockets);
253
-
254
-    mixer_sockets.erase(it); // erase it!
255
-    mixer_sockets_mut.unlock();
256
-
257
-    DBG("session 0x%lx socket-disconnected from conference '%s'\n", (unsigned long) session, conf_id.c_str());
258
-    return 0;
259
-}
260
-
261
-AmConference::socketpair AmConference::conference_get_sockets(AmSession* session, string conf_id) {
262
-    mixer_sockets_mut.lock();
263
-    map<string, socketpair>::iterator it =  mixer_sockets.find(make_id(session, conf_id));
264
-    if (it == mixer_sockets.end()) {
265
-	mixer_sockets_mut.unlock();
266
-	ERROR("session/conf %s not found in mixer socket list.\n", make_id(session, conf_id).c_str());
267
-	return make_pair((AmMultiPartyMixerSocket*)0,(AmMultiPartyMixerSocket*)0);
268
-    }
269
-    mixer_sockets_mut.unlock();
270
-    return it->second;
271
-}
272
-
273
-string AmConference::make_id(const AmSession* session, const string& conf_id) {
274
-    char sptr_chr[20];
275
-    sprintf(sptr_chr, "%li", (unsigned long) session);
276
-    return string(sptr_chr) + "/" + conf_id;
277
-}
278
-
279
-AmAudioQueue* AmConference::find_queue(string q_id) {
280
-    map<string, AmAudioQueue*>::iterator it =  audio_queues.find(q_id);
281
-    if (it != audio_queues.end())
282
-	return it->second;
283
-    else 
284
-	return 0;
285
-}
286
-
287
-int AmConference::queue_connect(AmSession* session, string queue_id, bool send, bool receive) {
288
-    if (!send && !receive) {
289
-	ERROR("connect must either send or receive or both.\n");
290
-	return CONFERENCE_ERR_CONNTYPE;
291
-    }
292
-
293
-    string q_id = make_id(session, queue_id);
294
-    audio_queues_mut.lock();
295
-    AmAudioQueue* q = find_queue(q_id);
296
-    if (q) {
297
-	audio_queues_mut.unlock();
298
-	ERROR("already connected to queue with id '%s'\n", queue_id.c_str());
299
-	return CONFERENCE_ERR_ALREADY_CONNECTED;
300
-    }
301
-
302
-    q = new AmAudioQueue();
303
-    
304
-    audio_queues[q_id] = q;
305
-    audio_queue_connected[q_id] = make_pair(send, receive);
306
-
307
-    if (send)
308
-	session->setOutput(q);
309
-    if (receive)
310
-	session->setInput(q);
311
-
312
-    audio_queues_mut.unlock();    
313
-    return 0;
314
-}
315
-
316
-int AmConference::queue_disconnect(AmSession* session, string queue_id) {
317
-    string q_id = make_id(session, queue_id);
318
-    audio_queues_mut.lock();
319
-    AmAudioQueue* q = find_queue(q_id);
320
-    if (!q) {
321
-	audio_queues_mut.unlock();
322
-	ERROR("queue with id '%s' not found\n", queue_id.c_str());
323
-	return CONFERENCE_ERR_NOTEXIST;
324
-    }
325
-    
326
-    if (audio_queue_connected[q_id].first)
327
-	session->setOutput(0);
328
-    if (audio_queue_connected[q_id].second)
329
-	session->setInput(0);
330
-
331
-    audio_queues.erase(audio_queues.find(q_id));
332
-    audio_queue_connected.erase(audio_queue_connected.find(q_id));
333
-    audio_queues_mut.unlock();
334
-
335
-    delete q; // delete the queue itself
336
-
337
-    return 0;
338
-}
339
-
340
-int AmConference::queue_pushAudio(AmSession* session, string queue_id, AmAudio* audio, AmAudioQueue::QueueType type, 
341
-				  AmAudioQueue::Pos pos, bool write, bool read) {
342
-    if (!audio) {
343
-	ERROR("not a valid audio source\n");
344
-	return CONFERENCE_ERR_INVALID_AUDIO;
345
-    }
346
-	
347
-    string q_id = make_id(session, queue_id);
348
-    audio_queues_mut.lock();
349
-    AmAudioQueue* q = find_queue(q_id);
350
-    if (!q) {
351
-	audio_queues_mut.unlock();
352
-	ERROR("queue with id '%s' not found\n", queue_id.c_str());
353
-	return CONFERENCE_ERR_NOTEXIST;
354
-    }
355
-
356
-    q->pushAudio(audio, type, pos, write, read);
357
-    audio_queues_mut.unlock();    
358
-    return 0;
359
-}
360
-
361
-int AmConference::queue_popAudio(AmSession* session, string queue_id, AmAudioQueue::QueueType type,
362
-				 AmAudioQueue::Pos pos) {
363
-    string q_id = make_id(session, queue_id);
364
-    audio_queues_mut.lock();
365
-    AmAudioQueue* q = find_queue(q_id);
366
-    if (!q) {
367
-	audio_queues_mut.unlock();
368
-	ERROR("queue with id '%s' not found\n", queue_id.c_str());
369
-	return CONFERENCE_ERR_NOTEXIST;
370
-    }
371
-
372
-    int res = q->popAudio(type, pos);
373
-    audio_queues_mut.unlock();    
374
-    return res;
375
-}
376
-
377
-AmAudio* AmConference::queue_popAndGetAudio(AmSession* session, string queue_id, AmAudioQueue::QueueType type,
378
-					    AmAudioQueue::Pos pos) {
379
-    string q_id = make_id(session, queue_id);
380
-    audio_queues_mut.lock();
381
-    AmAudioQueue* q = find_queue(q_id);
382
-    if (!q) {
383
-	audio_queues_mut.unlock();
384
-	ERROR("queue with id '%s' not found\n", queue_id.c_str());
385
-	return 0; //CONFERENCE_ERR_NOTEXIST;
386
-    }
387
-
388
-    AmAudio* res = q->popAndGetAudio(type, pos);
389
-    audio_queues_mut.unlock();    
390
-
391
-    return res;
392
-}
393
-
394
-int AmConference::queue_pushConference(AmSession* session, string queue_id, string conf_id, 
395
-				       bool write, bool read, 
396
-				       AmAudioQueue::Pos input_queue_pos, AmAudioQueue::Pos output_queue_pos,
397
-				       int options) {
398
-    string q_id = make_id(session, queue_id);
399
-    audio_queues_mut.lock();
400
-    AmAudioQueue* q = find_queue(q_id);
401
-    if (!q) {
402
-	audio_queues_mut.unlock();
403
-	ERROR("queue with id '%s' not found\n", queue_id.c_str());
404
-	return CONFERENCE_ERR_NOTEXIST;
405
-    }
406
-
407
-    AmMultiPartyMixerSocket* play_sock; 
408
-    AmMultiPartyMixerSocket* rec_sock;
409
-
410
-    int res = conference_connect_sock(session, conf_id, write, read, options,
411
-				      &play_sock, &rec_sock);
412
-    if (res) {
413
-	audio_queues_mut.unlock();
414
-	return res;
415
-    }
416
-					  
417
-    if (write) {
418
-	// we should have the play_sock now
419
-	q->pushAudio(play_sock, AmAudioQueue::InputQueue, input_queue_pos, true, false);
420
-    }
421
-
422
-    if (read) {
423
-	// we should have the rec_sock
424
-	q->pushAudio(rec_sock, AmAudioQueue::OutputQueue, output_queue_pos, false, true);
425
-    }
426
-
427
-    audio_queues_mut.unlock();    
428
-    return 0;
429
-}
430
-
431
-int AmConference::queue_removeConference(AmSession* session, string queue_id, string conf_id) {
432
-    string q_id = make_id(session, queue_id);
433
-
434
-    audio_queues_mut.lock();
435
-    AmAudioQueue* q = find_queue(q_id);
436
-    if (!q) {
437
-	audio_queues_mut.unlock();
438
-	ERROR("queue with id '%s' not found\n", queue_id.c_str());
439
-	return CONFERENCE_ERR_NOTEXIST;
440
-    }
441
-    socketpair conf_sockets = conference_get_sockets(session, conf_id);
442
-
443
-    if ((!get_play_sock(conf_sockets))&&(!get_rec_sock(conf_sockets))) {
444
-	audio_queues_mut.unlock();
445
-	ERROR("conference with id '%s' is not connected here\n", conf_id.c_str());
446
-	return CONFERENCE_ERR_NOTEXIST;
447
-    }
448
-
449
-    q->removeAudio(get_play_sock(conf_sockets));
450
-    q->removeAudio(get_rec_sock(conf_sockets));
451
-
452
-    int res = conference_disconnect_sock(session, conf_id);
453
-
454
-    audio_queues_mut.unlock();
455
-    DBG("removed conference from queue\n");
456
-    return res;
457
-}
458
-
459
-int AmConference::queue_pushBackConference(AmSession* session, string queue_id, string conf_id) {
460
-    return queue_pushConference(session, queue_id, conf_id, 
461
-				true, true, AmAudioQueue::Back, AmAudioQueue::Front,
462
-				CONFERENCE_OPTIONS_CREATE_CONF);
463
-}
464
-    
465 1
deleted file mode 100644
... ...
@@ -1,132 +0,0 @@
1
-/*
2
- * $Id: AmConference.h,v 1.1.2.2 2005/03/14 20:58:23 sayer Exp $
3
- *
4
- * Copyright (C) 2002-2003 Fhg Fokus
5
- *
6
- * This file is part of sems, a free SIP media server.
7
- *
8
- * sems is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
12
- *
13
- * For a license to use the ser software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18
- * sems is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License 
24
- * along with this program; if not, write to the Free Software 
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
- */
27
-#ifndef AM_CONFERENCE_H
28
-#define AM_CONFERENCE_H
29
-
30
-#include "AmThread.h"
31
-#include "AmAudio.h"
32
-#include "AmMultiPartyMixerSocket.h"
33
-#include "AmMultiPartyMixer.h"
34
-
35
-#include "AmAdvancedAudio.h"
36
-#include <utility>
37
-#include <map>
38
-using std::map;
39
-using std::pair;
40
-
41
-#define CONFERENCE_OPTIONS_CREATE_CONF   0x00000001
42
-
43
-#define CONFERENCE_ERR_CONNTYPE          -1 
44
-#define CONFERENCE_ERR_NOTEXIST          -2
45
-#define CONFERENCE_ERR_CREATESTATUS      -3 
46
-#define CONFERENCE_ERR_ALREADY_CONNECTED -4 
47
-#define CONFERENCE_ERR_INVALID_AUDIO     -5
48
-
49
-// silly, but makes source clearer
50
-#define CONF_DO_SEND true
51
-#define CONF_DONT_SEND false
52
-#define CONF_DO_RECEIVE true
53
-#define CONF_DONT_RECEIVE false
54
-#define QUEUE_DO_WRITE true
55
-#define QUEUE_DONT_WRITE false
56
-#define QUEUE_DO_READ true
57
-#define QUEUE_DONT_READ false
58
-
59
-class AmSession;
60
-
61
-/* ----- conference mixer: handler and api ----- */
62
-class AmConference : public AmThread {
63
- private:
64
-    static AmConference* _instance;
65
-    AmSharedVar<bool> runcond;
66
-
67
-    typedef pair<AmMultiPartyMixerSocket*, AmMultiPartyMixerSocket*> socketpair;
68
-#define get_play_sock(p) p.first 
69
-#define get_rec_sock(p) p.second 
70
-    map<string, socketpair > mixer_sockets; 
71
-    AmMutex mixer_sockets_mut;
72
-
73
-    map<string, AmAudioQueue*> audio_queues;
74
-    map<string, pair<bool, bool> > audio_queue_connected;
75
-    AmMutex audio_queues_mut;
76
-
77
-    string make_id(const AmSession* session, const string& conf_id);
78
-
79
-    AmAudioQueue* find_queue(string q_id);
80
-    socketpair* find_socketpair(string c_id);
81
-
82
-    // connect and return pointers to the sockets
83
-    int conference_connect_sock(AmSession* session, string conf_id, bool send, bool receive, int options,
84
-				AmMultiPartyMixerSocket** play_sock, AmMultiPartyMixerSocket** rec_sock);
85
-    int conference_disconnect_sock(AmSession* session, string conf_id);
86
-    socketpair conference_get_sockets(AmSession* session, string conf_id);
87
-
88
- protected:
89
-    void run();
90
-    void on_stop();
91
-
92
- public:
93
-    AmConference();
94
-    ~AmConference();
95
-
96
-    static  AmConference* instance();
97
-
98
-/** simple conference functions */    
99
-    int conference_connect(AmSession* session, string conf_id, bool send, bool receive, int options);
100
-//  void conference_change_connection(AmSession* session, string conf_id,  bool send, bool receive);
101
-    int conference_disconnect(AmSession* session, string conf_id);
102
-
103
-
104
-    void conference_addToPlaylist(AmSession* session, string conf_id, 
105
-		       AmAudio* src, AmMultiPartyMixerSocket::Type type, 
106
-		       AmMultiPartyMixerSocket::PlayMode mode, 
107
-		       AmMultiPartyMixerSocket::Priority priority);
108
-    void conference_clearPlaylist(AmSession* session, string conf_id, 
109
-		       AmMultiPartyMixerSocket::Type type, 
110
-		       AmMultiPartyMixerSocket::PlayMode mode);
111
-    // FIXME: implement conference status info (participants count etc)
112
-
113
-/** advanced conference with audioqueue functions */
114
-    int queue_connect(AmSession* session, string queue_id, bool send, bool receive);
115
-    int queue_disconnect(AmSession* session, string queue_id);
116
-//    int queue__change_connection(AmSession* session, string queue_id, bool send, bool receive);
117
-    int queue_pushAudio(AmSession* session, string queue_id, AmAudio* audio, AmAudioQueue::QueueType type, 
118
-			AmAudioQueue::Pos pos, bool write, bool read);
119
-    int queue_popAudio(AmSession* session, string queue_id, AmAudioQueue::QueueType type,
120
-			AmAudioQueue::Pos pos);
121
-    AmAudio* queue_popAndGetAudio(AmSession* session, string queue_id, AmAudioQueue::QueueType type,
122
-				  AmAudioQueue::Pos pos);
123
-    int queue_pushConference(AmSession* session, string queue_id, string conf_id, 
124
-			     bool write, bool read, 
125
-			     AmAudioQueue::Pos input_queue_pos, AmAudioQueue::Pos output_queue_pos,
126
-			     int options);
127
-    int queue_removeConference(AmSession* session, string queue_id, string conf_id);
128
-
129
-    int queue_pushBackConference(AmSession* session, string queue_id, string conf_id);
130
-};
131
-
132
-#endif //AM_CONFERENCE_H
133 1
deleted file mode 100644
... ...
@@ -1,207 +0,0 @@
1
-/*
2
- * $Id: AmConferenceStatus.cpp,v 1.1.2.3 2005/08/25 06:55:12 rco Exp $
3
- *
4
- * Copyright (C) 2002-2003 Fhg Fokus
5
- *
6
- * This file is part of sems, a free SIP media server.
7
- *
8
- * sems is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * For a license to use the sems software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18
- * sems is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License 
24
- * along with this program; if not, write to the Free Software 
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
- */
27
-
28
-#include "AmConferenceStatus.h"
29
-#include "AmConference.h"
30
-#include "AmMultiPartyMixerSocket.h"
31
-#include "AmMultiPartyMixer.h"
32
-
33
-#include "AmAudio.h"
34
-#include "log.h"
35
-
36
-#include <assert.h>
37
-#include <unistd.h>
38
-
39
-AmConferenceStatus::AmConferenceStatus(const string& conference_id)
40
-    : conf_id(conference_id), mixer()
41
-{
42
-// FIXME add tracing
43
-//     if(!ConferenceFactory::TracePath.empty())
44
-// 	str_set.enableRTPTrace(ConferenceFactory::TracePath + "/" + conf_id);
45
-}
46
-
47
-AmConferenceStatus::~AmConferenceStatus()
48
-{
49
-}
50
-
51
-unsigned int AmConferenceStatus::add_channel(AmSession* session) {
52
-    map<AmSession*, unsigned int>::iterator it = sessions.find(session);
53
-    if (it != sessions.end()) {
54
-	ERROR("session already in channel #%i.\n ", it->second);
55
-	return it->second;
56
-    }
57
-
58
-    int channel =  mixer.addChannel();
59
-    
60
-    sessions[session] = channel;
61
-    return channel;
62
-}
63
-
64
-int AmConferenceStatus::remove_channel(AmSession* session) {
65
-    map<AmSession*, unsigned int>::iterator it = sessions.find(session);
66
-    if (it != sessions.end()) {
67
-	DBG("removing session 0x%lX with channel #%i from conference.\n", 
68
-	    (unsigned long) session, it->second);
69
-	sessions.erase(it);
70
-	if (!sessions.size()) {
71
-	    DBG("ConferenceStatus empty, destroying myself...\n");
72
-	    AmConferenceStatusContainer::instance()->destroyStatus(conf_id);
73
-	    runcond.set(false);
74
-	}
75
-	return 0;
76
-    } else {
77
-	ERROR("channel for Session 0X%lx not found.\n", (unsigned long)session);
78
-	return -1;
79
-    }
80
-}
81
-
82
-AmConferenceStatusContainer* AmConferenceStatusContainer::_instance=0;
83
-
84
-AmConferenceStatusContainer::AmConferenceStatusContainer()
85
-    : _run_cond(false)
86
-{
87
-}
88
-
89
-AmConferenceStatusContainer* AmConferenceStatusContainer::instance()
90
-{
91
-    if(!_instance){
92
-	_instance = new AmConferenceStatusContainer();
93
-	_instance->start();
94
-    }
95
-
96
-    return _instance;
97
-}
98
-
99
-AmConferenceStatus* AmConferenceStatusContainer::add_status(const string& conf_id) {
100
-    cid2s_mut.lock();
101
-
102
-    AmConferenceStatus* status=0;
103
-    bool is_new;
104
-
105
-    map<string,AmConferenceStatus*>::iterator conf_it;
106
-    if( ( conf_it = cid2status.find(conf_id) ) 
107
-	!= cid2status.end() ) {
108
-
109
-	status = conf_it->second;
110
-	is_new = false;
111
-    }
112
-    else {
113
-
114
-	DBG("creating new AmConferenceStatus: conf_id=%s\n",conf_id.c_str());
115
-	status = new AmConferenceStatus(conf_id);
116
-	is_new = true;
117
-
118
-	cid2status.insert(std::make_pair(conf_id,status));
119
-    }
120
-    
121
-    cid2s_mut.unlock();
122
-    return status;
123
-}
124
-
125
-AmConferenceStatus* AmConferenceStatusContainer::get_status(const string& conf_id) {
126
-    cid2s_mut.lock();
127
-    map<string,AmConferenceStatus*>::iterator conf_it;
128
-    if( ( conf_it = cid2status.find(conf_id) ) 
129
-	!= cid2status.end() ) {
130
-	cid2s_mut.unlock();
131
-	return conf_it->second;
132
-    }
133
-    cid2s_mut.unlock();
134
-    return 0;
135
-}
136
- 
137
-void AmConferenceStatusContainer::destroyStatus(const string& conf_id)
138
-{
139
-    cid2s_mut.lock();
140
-    map<string,AmConferenceStatus*>::iterator conf_it;
141
-    if( ( conf_it = cid2status.find(conf_id) ) 
142
-	!= cid2status.end() ) {
143
-
144
-	AmConferenceStatus* status = conf_it->second;
145
-	cid2status.erase(conf_it);
146
-	
147
-	ds_mut.lock();
148
-//	status->stop();
149
-	d_status.push(status);
150
-	ds_mut.unlock();
151
-	_run_cond.set(true);
152
-    }    
153
-    cid2s_mut.unlock();
154
-}
155
-
156
-
157
-// garbage collector
158
-void AmConferenceStatusContainer::run()
159
-{
160
-    while(1){
161
-
162
-	_run_cond.wait_for();
163
-
164
-	// Let some time to Status to stop 
165
-	sleep(5);
166
-
167
-	ds_mut.lock();
168
-	DBG("ConferenceStatus cleaner starting its work\n");
169
-
170
-	try {
171
-	    queue<AmConferenceStatus*> n_status;
172
-
173
-	    while(!d_status.empty()){
174
-
175
-	        AmConferenceStatus* cur_status = d_status.front();
176
-		d_status.pop();
177
-
178
-		ds_mut.unlock();
179
-
180
-		if(cur_status->getStopped()){
181
-		    delete cur_status;
182
-		    DBG("status 0x%lX has been destroyed'\n",(unsigned long)cur_status);
183
-		}
184
-		else {
185
-		    DBG("status 0x%lX still running\n",(unsigned long)cur_status);
186
-		    n_status.push(cur_status);
187
-		}
188
-
189
-		ds_mut.lock();
190
-	    }
191
-
192
-	    swap(d_status,n_status);
193
-
194
-	}catch(...){}
195
-
196
-	bool more = !d_status.empty();
197
-	ds_mut.unlock();
198
-
199
-	DBG("ConferenceStatus cleaner finished\n");
200
-	if(!more)
201
-	    _run_cond.set(false);
202
-    }
203
-}
204
-
205
-void AmConferenceStatusContainer::on_stop()
206
-{
207
-}
208 1
deleted file mode 100644
... ...
@@ -1,245 +0,0 @@
1
-/*
2
- * $Id: AmConfig.cpp,v 1.18 2004/08/13 13:50:38 rco Exp $
3
- *
4
- * Copyright (C) 2002-2003 Fhg Fokus
5
- *
6
- * This file is part of sems, a free SIP media server.
7
- *
8
- * sems is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
12
- *
13
- * For a license to use the ser software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18
- * sems is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License 
24
- * along with this program; if not, write to the Free Software 
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
- */
27
-
28
-#include <sys/types.h>
29
-#include <sys/socket.h>
30
-#include <netinet/in.h>
31
-#include <arpa/inet.h>
32
-#include <netdb.h>
33
-#include "AmConfig.h"
34
-#include "sems.h"
35
-#include "log.h"
36
-#include "SemsConfiguration.h"
37
-
38
-string       AmConfig::ConfigurationFile    = CONFIG_FILE;
39
-string       AmConfig::FifoName             = ""; //FIFO_NAME;
40
-string       AmConfig::SerFIFO              = ""; //SER_FIFO;
41
-string       AmConfig::SocketName           = "";
42
-string       AmConfig::SerSocketName        = "";
43
-string       AmConfig::SendMethod           = SEND_METHOD;
44
-string       AmConfig::SmtpServerAddress    = SMTP_ADDRESS_IP;
45
-unsigned int AmConfig::SmtpServerPort       = SMTP_PORT;
46
-string       AmConfig::PlugInPath           = PLUG_IN_PATH;
47
-int          AmConfig::DaemonMode           = DEFAULT_DAEMON_MODE;
48
-string       AmConfig::LocalIP              = "";
49
-char         AmConfig::PrefixSep            = PREFIX_SEPARATOR;
50
-short        AmConfig::RtpLowPort           = RTP_LOWPORT;
51
-short        AmConfig::RtpHighPort          = RTP_HIGHPORT;
52
-
53
-int AmConfig::setSmtpPort(char *port) 
54
-{
55
-    if(sscanf(port,"%u",&AmConfig::SmtpServerPort) != 1) {
56
-	return 0;
57
-    }
58
-    return 1;
59
-}
60
-
61
-int AmConfig::setRtpLowPort(char* port)
62
-{
63
-    if(sscanf(port,"%hu",&AmConfig::RtpLowPort) != 1) {
64
-	return 0;
65
-    }
66
-    return 1;
67
-}
68
-
69
-int AmConfig::setRtpHighPort(char* port)
70
-{
71
-    if(sscanf(port,"%hu",&AmConfig::RtpHighPort) != 1) {
72
-	return 0;
73
-    }
74
-    return 1;
75
-}
76
-
77
-int AmConfig::setLoglevel(char *ll) {
78
-    if(sscanf(ll,"%u",&log_level) != 1) {
79
-	return 0;
80
-    }
81
-    return 1;
82
-}
83
-
84
-int AmConfig::setFork(char *fork) {
85
-	if ( strcasecmp(fork, "yes") == 0 ) {
86
-		DaemonMode = 1;
87
-	} else if ( strcasecmp(fork, "no") == 0 ) {
88
-		DaemonMode = 0;
89
-	} else {
90
-		return 0;
91
-	}	
92
-	return 1;
93
-}		
94
-
95
-int AmConfig::setStderr(char *s) {
96
-	if ( strcasecmp(s, "yes") == 0 ) {
97
-		log_stderr = 1;
98
-		AmConfig::DaemonMode = 0;
99
-	} else if ( strcasecmp(s, "no") == 0 ) {
100
-		log_stderr = 0;
101
-	} else {
102
-		return 0;
103
-	}	
104
-	return 1;
105
-}		
106
-
107
-int AmConfig::readConfiguration()
108
-{
109
-	// take values from global configuration file
110
-	// they will be overwritten by command line args
111
-	char* temp;
112
-	// smtp_server
113
-	temp = semsConfig.getValueForKey("smtp_server");
114
-	if (temp) AmConfig::SmtpServerAddress = temp;
115
-	// smtp_port
116
-	temp = semsConfig.getValueForKey("smtp_port");
117
-	if (temp) {
118
-		if (!AmConfig::setSmtpPort(temp)) {
119
-			semsConfig.reportConfigError("smtp_port", 
120
-						     "invalid smtp port specified", 
121
-						     true);
122
-			return 0;
123
-		}	
124
-	}	
125
-	// local_ip
126
- 	temp = semsConfig.getValueForKey("local_ip");
127
- 	if (temp) AmConfig::LocalIP = temp;
128
-	// fifo_name
129
-	temp = semsConfig.getValueForKey("fifo_name");
130
-	if (temp) AmConfig::FifoName = temp;
131
-	// ser_fifo_name
132
-	temp = semsConfig.getValueForKey("ser_fifo_name");
133
-	if (temp) AmConfig::SerFIFO = temp;
134
-	// socket_name
135
-	temp = semsConfig.getValueForKey("socket_name");
136
-	if (temp) AmConfig::SocketName = temp;
137
-	// ser_fifo_name
138
-	temp = semsConfig.getValueForKey("ser_socket_name");
139
-	if (temp) AmConfig::SerSocketName = temp;
140
-	// send_method
141
-	temp = semsConfig.getValueForKey("send_method");
142
-	if (temp) AmConfig::SendMethod = temp;
143
-	if ( AmConfig::SendMethod != "fifo" && 
144
-	     AmConfig::SendMethod != "unix_socket" ){
145
-	    semsConfig.reportConfigError("send_method",
146
-					 "invalid send_method specified "
147
-					 "(valid values are: fifo, unix_socket).",
148
-					 true);
149
-	    return 0;
150
-	}
151
-	// plugin_path
152
-	temp = semsConfig.getValueForKey("plugin_path");
153
-	if (temp) AmConfig::PlugInPath = temp;
154
-	// log_level
155
-	temp = semsConfig.getValueForKey("loglevel");
156
-	if (temp) {
157
-		if(!AmConfig::setLoglevel(temp)){
158
-			semsConfig.reportConfigError("loglevel", 
159
-						     "invalid log level specified", 
160
-						     true);
161
-			return 0;
162
-		}	
163
-	}	
164
-	// fork 
165
-	temp = semsConfig.getValueForKey("fork");
166
-	if (temp) {
167
-		if (!AmConfig::setFork(temp)) {
168
-			semsConfig.reportConfigError("fork", 
169
-						     "invalid value specified,"
170
-						     " valid are only yes or no", 
171
-						     true);
172
-			return 0;
173
-		}	
174
-	}	
175
-	// stderr 
176
-	temp = semsConfig.getValueForKey("stderr");
177
-	if (temp) {
178
-		if (!AmConfig::setStderr(temp)) {
179
-			semsConfig.reportConfigError("stderr", 
180
-						     "invalid value specified,"
181
-						     " valid are only yes or no", 
182
-						     true);
183
-			return 0;
184
-		}	
185
-	}	
186
-	// user_prefix_separator
187
-	temp = semsConfig.getValueForKey("user_prefix_separator");
188
-	if(temp) AmConfig::PrefixSep = *temp;
189
-
190
-	// rtp_low_port
191
-	temp = semsConfig.getValueForKey("rtp_low_port");
192
-	if (temp) {
193
-		if (!AmConfig::setRtpLowPort(temp)) {
194
-			semsConfig.reportConfigError("rtp_low_port", 
195
-						     "invalid rtp low"
196
-						     " port specified", 
197
-						     true);
198
-			return 0;
199
-		}	
200
-	}