add session to event dispatcher before sending out INVITE. Should fix issues reported by Paul ("change in session container") and Bogdan ("session queuing").

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1100 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 18 years ago
parent 7872fb3de9
commit 0eadc6482a

@ -178,8 +178,7 @@ void AmSessionContainer::destroySession(AmSession* s)
s->getCallID(),
s->getRemoteTag());
if(q) {
if(q) {
stopAndQueue(s);
}
else {
@ -195,9 +194,20 @@ AmSession* AmSessionContainer::startSessionUAC(AmSipRequest& req, AmArg* session
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 @@ AmSession* AmSessionContainer::startSessionUAC(AmSipRequest& req, AmArg* session
session->start();
addSession("","",req.from_tag,session);
}
}
catch(const AmSession::Exception& e){
@ -243,12 +252,17 @@ void AmSessionContainer::startSessionUAS(AmSipRequest& req)
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 @@ bool AmSessionContainer::addSession(const string& callid,
const string& local_tag,
AmSession* session)
{
if(_container_closed.get())
if(_container_closed.get())
return false;
return AmEventDispatcher::instance()->

Loading…
Cancel
Save