From d21931f33025c2288da76e5778fc72dd55c34e0c Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Sun, 26 Nov 2006 01:55:23 +0000 Subject: [PATCH] * out of dialog REFER creates a new dialout session * fixed bug in error reply git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@146 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmInterfaceHandler.cpp | 30 +++++++++++++++++++++++++++--- core/AmSipDialog.cpp | 2 -- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/core/AmInterfaceHandler.cpp b/core/AmInterfaceHandler.cpp index 43a46506..2ed7e134 100644 --- a/core/AmInterfaceHandler.cpp +++ b/core/AmInterfaceHandler.cpp @@ -278,9 +278,33 @@ void AmRequestHandler::dispatch(AmSipRequest& req) if(req.method == "INVITE"){ - sess_cont->startSessionUAS(req); - } - else { + sess_cont->startSessionUAS(req); + + } else if(req.method == "REFER"){ + // Out-of-dialog REFER + AmSipRequest n_req; + n_req.method = "INVITE"; + n_req.dstip = AmConfig::LocalIP; + + n_req.from = req.to; + n_req.from_uri = req.r_uri; + n_req.from_tag = AmSession::getNewId(); + n_req.user = req.user; + + n_req.r_uri = uri_from_name_addr(getHeader(req.hdrs, "Refer-To")); + n_req.to = getHeader(req.hdrs, "Refer-To"); + n_req.to_tag = ""; + n_req.cmd = req.cmd; // application from REFER + + n_req.callid = AmSession::getNewId() + "@" + AmConfig::LocalIP; + + if (AmSessionContainer::instance()->startSessionUAC(n_req) + != NULL) + AmSipDialog::reply_error(req,202,"Accepted"); + else + AmSipDialog::reply_error(req,500,"Not supported here"); + + } else { if(!local_tag.empty() || req.method == "CANCEL"){ AmSipDialog::reply_error(req,481,"Call leg/Transaction does not exist"); diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index 39e4d743..f6a3c05e 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -302,8 +302,6 @@ int AmSipDialog::reply_error(const AmSipRequest& req, unsigned int code, AmSession::getNewId() + "\n"; if(!hdrs.empty()) msg += hdrs; - else - msg += "\n"; msg += ".\n.\n\n";