Author: sayer
Date: 2008-09-24 01:58:35 +0200 (Wed, 24 Sep 2008)
New Revision: 1100
Modified:
trunk/core/AmSessionContainer.cpp
Log:
add session to event dispatcher before sending out INVITE. Should fix issues
reported by Paul ("change in session container") and Bogdan ("session queuing").
Modified: trunk/core/AmSessionContainer.cpp
===================================================================
--- trunk/core/AmSessionContainer.cpp 2008-09-23 23:52:58 UTC (rev 1099)
+++ trunk/core/AmSessionContainer.cpp 2008-09-23 23:58:35 UTC (rev 1100)
@@ -178,8 +178,7 @@
s->getCallID(),
s->getRemoteTag());
- if(q) {
-
+ if(q) {
stopAndQueue(s);
}
else {
@@ -195,9 +194,20 @@
session->setCallgroup(req.from_tag);
session->setNegotiateOnReply(true);
+
+ if (!addSession("","",req.from_tag,session)) {
+ ERROR("adding session to session container\n");
+ delete session;
+ return NULL;
+ }
+
if (int err = session->sendInvite(req.hdrs)) {
ERROR("INVITE could not be sent: error code = %d.\n",
err);
+ AmEventDispatcher::instance()->
+ delEventQueue(session->getLocalTag(),
+ session->getCallID(),
+ session->getRemoteTag());
delete session;
return NULL;
}
@@ -209,7 +219,6 @@
session->start();
- addSession("","",req.from_tag,session);
}
}
catch(const AmSession::Exception& e){
@@ -243,12 +252,17 @@
if (AmConfig::LogSessions) {
INFO("Starting UAS session %s app %s\n",
- session->getLocalTag().c_str(), req.cmd.c_str());
+ local_tag.c_str(), req.cmd.c_str());
}
+ if (!addSession(req.callid,req.from_tag,local_tag,session)) {
+ ERROR("adding session to session container\n");
+ delete session;
+ throw string("internal server error");
+ }
+
session->start();
- addSession(req.callid,req.from_tag,local_tag,session);
session->postEvent(new AmSipRequestEvent(req));
}
}
@@ -352,7 +366,7 @@
const string& local_tag,
AmSession* session)
{
- if(_container_closed.get())
+ if(_container_closed.get())
return false;
return AmEventDispatcher::instance()->
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev