session's local tag may be set in SessionFactory's onInvite method

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@518 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 19 years ago
parent 733e7599bd
commit b7a06b5c71

@ -241,6 +241,15 @@ void AmSession::setUri(const string& uri)
sdp.uri = uri;
}
void AmSession::setLocalTag()
{
if (dlg.local_tag.empty()) {
dlg.local_tag = getNewId();
DBG("AmSession::setLocalTag() - session id set to %s\n",
dlg.local_tag.c_str());
}
}
void AmSession::setLocalTag(const string& tag)
{
DBG("AmSession::setLocalTag(%s)\n",tag.c_str());

@ -286,6 +286,9 @@ public:
/** Gets the Session's local tag */
const string& getLocalTag() const;
/** Sets the Session's local tag if not set already */
void setLocalTag();
/** Sets the Session's local tag */
void setLocalTag(const string& tag);

@ -233,22 +233,18 @@ void AmSessionContainer::startSessionUAS(AmSipRequest& req)
AmSession* session;
if((session = createSession(req)) != 0){
string local_tag = AmSession::getNewId();
session->setLocalTag(local_tag);
// update session's local tag (ID) if not already set
session->setLocalTag();
const string& local_tag = session->getLocalTag();
// by default each session is in its own callgroup
session->setCallgroup(local_tag);
session->start();
addSession_unsafe(req.callid,req.from_tag,local_tag,session);
session->postEvent(new AmSipRequestEvent(req));
}
//else
//throw AmSession::Exception(500,"internal error");
}
}
// catch(const AmSession::SessionTimerException& e){
// ERROR("%i %s\n",e.code,e.reason.c_str());
// AmSipDialog::reply_error(req,e.code,e.reason,e.getErrorHeaders());
// }
catch(const AmSession::Exception& e){
ERROR("%i %s\n",e.code,e.reason.c_str());
AmSipDialog::reply_error(req,e.code,e.reason);

Loading…
Cancel
Save