Module: sems Branch: sayer/offer_answer Commit: d7bf019593c01a1dcb8d8964166addc9baaaacca URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=d7bf019593c01a1dcb8d8964166addc9baaaacca
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Tue Oct 19 22:28:53 2010 +0200 dont overwrite SDP with oa if present e.g. sent by b2b, or saved SDP --- core/AmB2BSession.cpp | 6 +++--- core/AmSipDialog.cpp | 18 ++++++++---------- core/AmSipDialog.h | 11 +++++------ 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp index b341728..f2dff24 100644 --- a/core/AmB2BSession.cpp +++ b/core/AmB2BSession.cpp @@ -365,7 +365,7 @@ void AmB2BSession::relaySip(const AmSipRequest& req) { if (req.method != "ACK") { relayed_req[dlg.cseq] = AmSipTransaction(req.method,req.cseq,req.tt); - dlg.sendRequest(req.method,req.content_type, req.body, req.hdrs, SIP_FLAGS_VERBATIM, false); + dlg.sendRequest(req.method,req.content_type, req.body, req.hdrs, SIP_FLAGS_VERBATIM); // todo: relay error event back if sending fails if ((req.method == SIP_METH_INVITE || @@ -404,7 +404,7 @@ void AmB2BSession::relaySip(const AmSipRequest& orig, const AmSipReply& reply) { dlg.reply(orig,reply.code,reply.reason, reply.content_type, - reply.body,reply.hdrs,SIP_FLAGS_VERBATIM,false); + reply.body,reply.hdrs,SIP_FLAGS_VERBATIM); if ((orig.method == SIP_METH_INVITE || orig.method == SIP_METH_UPDATE) && @@ -559,7 +559,7 @@ int AmB2BCallerSession::reinviteCaller(const AmSipReply& callee_reply) { return dlg.sendRequest(SIP_METH_INVITE, callee_reply.content_type, callee_reply.body, - "" /* hdrs */, SIP_FLAGS_VERBATIM, false); + "" /* hdrs */, SIP_FLAGS_VERBATIM); } void AmB2BCallerSession::createCalleeSession() { diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index a16e196..0f8f9d9 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -390,7 +390,7 @@ void AmSipDialog::initFromLocalRequest(const AmSipRequest& req) // UAC behavior for locally sent requests // (called from AmSipDialog::sendRequest()) -int AmSipDialog::onTxRequest(AmSipRequest& req, bool do_offeranswer) +int AmSipDialog::onTxRequest(AmSipRequest& req) { if((req.method == "INVITE") && (status == Disconnected)){ status = Trying; @@ -399,7 +399,7 @@ int AmSipDialog::onTxRequest(AmSipRequest& req, bool do_offeranswer) status = Disconnecting; } - if (!do_offeranswer) + if (!req.body.empty()) return 0; if((req.method == "INVITE") || (req.method == "UPDATE")){ @@ -419,7 +419,7 @@ int AmSipDialog::onTxRequest(AmSipRequest& req, bool do_offeranswer) } // UAS behavior for locally sent replies -int AmSipDialog::onTxReply(AmSipReply& reply, bool do_offeranswer) +int AmSipDialog::onTxReply(AmSipReply& reply) { TransMap::iterator t_it = uas_trans.find(reply.cseq); if(t_it == uas_trans.end()){ @@ -471,7 +471,7 @@ int AmSipDialog::onTxReply(AmSipReply& reply, bool do_offeranswer) break; } - if (do_offeranswer) { + if (reply.body.empty()) { // update Offer/Answer state // TODO: support multipart mime if ((reply.cseq_method == "INVITE") || (reply.cseq_method == "UPDATE")) { @@ -707,8 +707,7 @@ int AmSipDialog::reply(const AmSipRequest& req, const string& content_type, const string& body, const string& hdrs, - int flags, - bool do_offeranswer) + int flags) { string m_hdrs = hdrs; @@ -791,7 +790,7 @@ int AmSipDialog::reply(const AmSipRequest& req, reply.content_type = content_type; reply.body = body; - if(onTxReply(reply, do_offeranswer)){ + if(onTxReply(reply)){ DBG("onTxReply failed\n"); return -1; } @@ -1004,8 +1003,7 @@ int AmSipDialog::sendRequest(const string& method, const string& content_type, const string& body, const string& hdrs, - int flags, - bool do_offeranswer) + int flags) { string msg,ser_cmd; string m_hdrs = hdrs; @@ -1065,7 +1063,7 @@ int AmSipDialog::sendRequest(const string& method, req.body = body; } - if(onTxRequest(req, do_offeranswer)) + if(onTxRequest(req)) return -1; if (SipCtrlInterface::send(req)) diff --git a/core/AmSipDialog.h b/core/AmSipDialog.h index a7c240e..e96c04a 100644 --- a/core/AmSipDialog.h +++ b/core/AmSipDialog.h @@ -40,6 +40,7 @@ using std::string; #define CONTACT_USER_PREFIX "sems" // flags which may be used when sending request/reply +#define SIP_FLAGS_NONE 0 // none #define SIP_FLAGS_VERBATIM 1 // send request verbatim, // i.e. modify as little as possible @@ -156,16 +157,14 @@ class AmSipDialog const string& content_type = "", const string& body = "", const string& hdrs = "", - int flags = 0, - bool do_offeranswer = true); + int flags = 0); /** @return 0 on success */ int sendRequest(const string& method, const string& content_type = "", const string& body = "", const string& hdrs = "", - int flags = 0, - bool do_offeranswer = true); + int flags = 0); /** @return 0 on success */ int send_200_ack(unsigned int inv_cseq, @@ -249,8 +248,8 @@ private: AmSipDialogEventHandler* hdl; - int onTxReply(AmSipReply& reply, bool do_offeranswer); - int onTxRequest(AmSipRequest& req, bool do_offeranswer); + int onTxReply(AmSipReply& reply); + int onTxRequest(AmSipRequest& req); int onRxSdp(const string& body, const char** err_txt); int onTxSdp(const string& body); _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
