diff --git a/core/plug-in/sipctrl/SipCtrlInterface.cpp b/core/plug-in/sipctrl/SipCtrlInterface.cpp index fa30f8f7..409424ad 100644 --- a/core/plug-in/sipctrl/SipCtrlInterface.cpp +++ b/core/plug-in/sipctrl/SipCtrlInterface.cpp @@ -466,7 +466,7 @@ void SipCtrlInterface::handle_sip_request(const char* tid, sip_msg* msg) req.body = c2stlstr(msg->body); req.serKey = tid; - prepare_routes(msg->record_route, req.route); + prepare_routes_uas(msg->record_route, req.route); for (list::iterator it = msg->hdrs.begin(); it != msg->hdrs.end(); ++it) { @@ -531,7 +531,7 @@ void SipCtrlInterface::handle_sip_reply(sip_msg* msg) // // reply.next_hop; - prepare_routes(msg->record_route, reply.route); + prepare_routes_uac(msg->record_route, reply.route); for (list::iterator it = msg->hdrs.begin(); it != msg->hdrs.end(); ++it) { @@ -544,7 +544,7 @@ void SipCtrlInterface::handle_sip_reply(sip_msg* msg) handleSipMsg(reply); } -void SipCtrlInterface::prepare_routes(const list& routes, string& route_field) +void SipCtrlInterface::prepare_routes_uac(const list& routes, string& route_field) { if(!routes.empty()){ @@ -560,6 +560,22 @@ void SipCtrlInterface::prepare_routes(const list& routes, string& r } } +void SipCtrlInterface::prepare_routes_uas(const list& routes, string& route_field) +{ + if(!routes.empty()){ + + list::const_iterator it = routes.begin(); + + route_field = c2stlstr((*it)->value); + ++it; + + for(; it != routes.end(); ++it) { + + route_field += ", " + c2stlstr((*it)->value); + } + } +} + /** EMACS ** * Local variables: * mode: c++ diff --git a/core/plug-in/sipctrl/SipCtrlInterface.h b/core/plug-in/sipctrl/SipCtrlInterface.h index 1ec74d3c..bd29298d 100644 --- a/core/plug-in/sipctrl/SipCtrlInterface.h +++ b/core/plug-in/sipctrl/SipCtrlInterface.h @@ -64,7 +64,8 @@ class SipCtrlInterface: trans_layer* tl; - void prepare_routes(const list& routes, string& route_field); + void prepare_routes_uac(const list& routes, string& route_field); + void prepare_routes_uas(const list& routes, string& route_field); int cancel(const AmSipRequest& req); protected: