From 8564e378f0c9af188435f79ef2f74946dcb14404 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Mon, 25 May 2009 07:48:48 +0000 Subject: [PATCH] * Added transparent_destination conf parameter to b2b_connect application. If set to true, Request URI and To URI are passed unaltered to the second leg. git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1411 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/examples/b2b_connect/Readme.b2b_connect | 7 ++++++- apps/examples/b2b_connect/b2b_connect.cpp | 16 +++++++++++++--- apps/examples/b2b_connect/b2b_connect.h | 1 + apps/examples/b2b_connect/etc/b2b_connect.conf | 7 +++++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/apps/examples/b2b_connect/Readme.b2b_connect b/apps/examples/b2b_connect/Readme.b2b_connect index 3d7b44e9..804559c5 100644 --- a/apps/examples/b2b_connect/Readme.b2b_connect +++ b/apps/examples/b2b_connect/Readme.b2b_connect @@ -25,4 +25,9 @@ This will result in sems trying to set up a call to john@ser.mydomain.com:5060. If a 407 Authentication required is received, semsuser and 'password' will be used as credentials. -Improvements are of course welcome as svn diff to the semsdev mailing list. +If b2b_connect.conf parameter transparent_destination is set to true +(default is false), then Request URI and To URI are passed to the second +leg unaltered. + +Improvements are of course welcome as svn diff to the semsdev mailing +list. diff --git a/apps/examples/b2b_connect/b2b_connect.cpp b/apps/examples/b2b_connect/b2b_connect.cpp index 0c5702b8..7c35c520 100644 --- a/apps/examples/b2b_connect/b2b_connect.cpp +++ b/apps/examples/b2b_connect/b2b_connect.cpp @@ -34,6 +34,7 @@ #include "AmSessionContainer.h" bool b2b_connectFactory::TransparentHeaders = true; // default +bool b2b_connectFactory::TransparentDestination = false; // default EXPORT_SESSION_FACTORY(b2b_connectFactory,MOD_NAME); @@ -55,6 +56,9 @@ int b2b_connectFactory::onLoad() if (cfg.getParameter("transparent_headers")=="false") TransparentHeaders = false; + + if (cfg.getParameter("transparent_ruri")=="true") + TransparentDestination = true; // user_timer_fact = AmPlugIn::instance()->getFactory4Di("user_timer"); // if(!user_timer_fact) { @@ -105,6 +109,7 @@ void b2b_connectDialog::onInvite(const AmSipRequest& req) } string app_param = getHeader(req.hdrs, PARAM_HDR); + string remote_party, remote_uri; if (!app_param.length()) { throw AmSession::Exception(500, "b2b_connect: parameters not found"); @@ -115,8 +120,13 @@ void b2b_connectDialog::onInvite(const AmSipRequest& req) password = get_header_keyvalue(app_param,"p"); from = "sip:"+user+"@"+domain; - to = "sip:"+req.user+"@"+domain; - + if (b2b_connectFactory::TransparentDestination) { + remote_uri = req.r_uri; + remote_party = to = req.to; + } else { + remote_uri = to = "sip:"+req.user+"@"+domain; + remote_party = "<" + to + ">"; + } if(dlg.reply(req, 100, "Connecting") != 0) { throw AmSession::Exception(500,"Failed to reply 100"); } @@ -132,7 +142,7 @@ void b2b_connectDialog::onInvite(const AmSipRequest& req) dlg.updateStatus(req); recvd_req.insert(std::make_pair(req.cseq,req)); - connectCallee("<" + to + ">", to, from, from, + connectCallee(remote_party, remote_uri, from, from, b2b_connectFactory::TransparentHeaders ? invite_req.hdrs : ""); MONITORING_LOG(other_id.c_str(), diff --git a/apps/examples/b2b_connect/b2b_connect.h b/apps/examples/b2b_connect/b2b_connect.h index 657eaa23..487fa295 100644 --- a/apps/examples/b2b_connect/b2b_connect.h +++ b/apps/examples/b2b_connect/b2b_connect.h @@ -46,6 +46,7 @@ class b2b_connectFactory: public AmSessionFactory AmSession* onInvite(const AmSipRequest& req); static bool TransparentHeaders; // default + static bool TransparentDestination; // default }; diff --git a/apps/examples/b2b_connect/etc/b2b_connect.conf b/apps/examples/b2b_connect/etc/b2b_connect.conf index a8a6082b..c191a27c 100644 --- a/apps/examples/b2b_connect/etc/b2b_connect.conf +++ b/apps/examples/b2b_connect/etc/b2b_connect.conf @@ -5,3 +5,10 @@ # # default: # transparent_headers = true + +# transparent_destination = [true|false] +# +# relay Request URI and To URI from initial INVITE into callee leg? +# +# default: +# transparent_destination = false