[SR-Users] (no subject)

Tihomir Culjaga tculjaga at gmail.com
Tue Feb 13 13:42:23 CET 2018


Great!!!
That will do.

Thanks.

Sent from my iPhone

> On 13 Feb 2018, at 12:45, Daniel-Constantin Mierla <miconda at gmail.com> wrote:
> 
> Hello,
> if you set use_received param for path module, then the received address in Route header is set as dst uri, see:
> 
>   - https://www.kamailio.org/docs/modules/stable/modules/path.html#path.p.enable_r2
> 
> All you need to do is:
> 
> loose_route();
> t_relay();
> 
> Note that loose_route() is dealing with a pre-loaded Route header in this case, see the readme of rr module for the return code.
> 
> Cheers,
> Daniel
> 
>> On 13.02.18 12:05, Tihomir Culjaga wrote:
>> Hi Daniel,
>> 
>> thanks for you e-mail... i will try that approach.
>> 
>> in the main time i exploited the "received" parameter in route header sent by freeswitch and with a bit of manipulation i managed to rout the call back to WS client :=)
>> 
>> Im will definitely try to enable r2 and come back with the  results.
>> 
>> 
>> --- snip ---
>> 
>> route[SIPOUT] {
>>         if (!uri==myself) {
>> 
>> 
>>                 xlog("L_INFO", "ROUTE HEADER value: $hdr(Route)\n");
>> 
>> 
>>                 $var(rcv_regex)= $(hdr(Route){re.subst,/.*received=(.*)/\1/});
>> 
>>                 $var(ip)= $(var(rcv_regex){s.select,0,~});
>>                 $var(port)= $(var(rcv_regex){s.select,1,~});
>>                 $var(proto_number)= $(var(rcv_regex){s.select,2,~});
>> 
>>                 if ($var(proto_number) == "1") {
>>                         $var(trans) = "UDP";
>> 
>>                 } else if ($var(proto_number) == "6" ) {
>>                         $var(trans) = "ws";
>> 
>>                 } else {
>>                         # not interested for now
>>                          $var(trans) = "TCP";
>>                 }
>> 
>>                 $var(request_route_regex) = $var(ip) + ":" + $var(port) + ";transport=" +$var(trans);
>> 
>>                 xlog("L_INFO", "ROUTE HEADER - rcv_regex: $var(rcv_regex)\n");
>>                 xlog("L_INFO", "ROUTE HEADER - request route : $var(request_route_regex)\n");
>> 
>> 
>>                 append_hf("P-hint: outbound\r\n");
>>                 $ru="sip:" + $rU + "@"+$var(request_route_regex);
>>                 xlog("SCRIPT: Request uri = $ru\n");
>>                 route(RELAY);
>>         }
>> }
>> 
>> --- snip ---
>> 
>> 
>> 
>> On 13 February 2018 at 11:48, Daniel-Constantin Mierla <miconda at gmail.com> wrote:
>>> Hello,
>>> 
>>> you have an explicit set of $fs, which is setting the send socket. You have to do then when receiving from WS, not when going to WS.
>>> 
>>> In 5.1, you can try to enable:
>>> 
>>>   - https://www.kamailio.org/docs/modules/stable/modules/path.html#path.p.enable_r2
>>> 
>>> and then let kamailio do all about send socket (remove the assignments to $fs).
>>> 
>>> Cheers,
>>> Daniel
>>> 
>>> On 09.02.18 22:57, Tihomir Culjaga wrote:
>>>> Hi,
>>>> 
>>>> Im new to Kamailio so im sorry if some of my questions will sound a bit wierd :=)
>>>> 
>>>> i have a setup like this: (Kamailio version 5.1)
>>>> 
>>>> UA > Kamailio > Freeswitch
>>>> 
>>>> 
>>>> Kamailio forwards registration to freeswitch without saving location.
>>>> 
>>>> I have configured sip over websockets and im able to register to Freeswitcha via kamailio.
>>>> Also, i use add_path_received() so kamailio adds a path header to register messages
>>>> 
>>>> 
>>>> recv 945 bytes from udp/[192.168.50.60]:5060 at 22:38:07.283809:
>>>>    ------------------------------------------------------------------------
>>>>    REGISTER sip:192.168.50.60 SIP/2.0
>>>>    Via: SIP/2.0/UDP 192.168.50.60;branch=z9hG4bKa929.0f66d60c4333f4a3a9d83d41a63295d9.0
>>>>    Via: SIP/2.0/WSS 192.0.2.110;rport=63296;received=192.168.200.77;branch=z9hG4bK6931435
>>>>    Max-Forwards: 69
>>>>    To: <sip:1001 at 192.168.50.60>
>>>>    From: <sip:1001 at 192.168.50.60>;tag=vq30modpgd
>>>>    Call-ID: dlnrna9o4ngn25fb9d1vi2
>>>>    CSeq: 196 REGISTER
>>>>    Authorization: Digest algorithm=MD5, username="1001", realm="192.168.50.60", nonce="744aaa14-4a86-4ce3-b6d6-419b0a34ee90", uri="sip:192.168.50.60",                           response="9b592b874474d4ffe5769f2410baceef", qop=auth, cnonce="sf7ff0fp8tm5", nc=00000001
>>>>    Contact: <sip:1001 at 192.0.2.110;transport=ws>;reg-id=1;+sip.instance="<urn:uuid:587f4694-7e55-46dc-a858-579a82556a20>";expires=600
>>>>    Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
>>>>    Supported: path, gruu, 100rel, outbound
>>>>    User-Agent: SIP.js/0.7.0 BB
>>>>    Content-Length: 0
>>>>    Path: <sip:192.168.50.60;lr;received=192.168.200.77~63296~6>
>>>>    
>>>>    ------------------------------------------------------------------------
>>>> send 719 bytes to udp/[192.168.50.60]:5060 at 22:38:07.329444:
>>>>    ------------------------------------------------------------------------
>>>>    SIP/2.0 200 OK
>>>>    Via: SIP/2.0/UDP 192.168.50.60;branch=z9hG4bKa929.0f66d60c4333f4a3a9d83d41a63295d9.0
>>>>    Via: SIP/2.0/WSS 192.0.2.110;rport=63296;received=192.168.200.77;branch=z9hG4bK6931435
>>>>    From: <sip:1001 at 192.168.50.60>;tag=vq30modpgd
>>>>    To: <sip:1001 at 192.168.50.60>;tag=Spya88DKU9gSQ
>>>>    Call-ID: dlnrna9o4ngn25fb9d1vi2
>>>>    CSeq: 196 REGISTER
>>>>    Contact: <sip:1001 at 192.0.2.110;transport=ws>;expires=600
>>>>    Date: Fri, 09 Feb 2018 21:38:07 GMT
>>>>    User-Agent: FreeSWITCH-mod_sofia/1.6.19+git~20171120T163416Z~b1b21d0695~64bit
>>>>    Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
>>>>    Supported: timer, path, replaces
>>>>    Path: <sip:192.168.50.60>;lr;received=192.168.200.77~63296~6
>>>>    Content-Length: 0
>>>>    
>>>>    ------------------------------------------------------------------------
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Once, registered, im trying to originate a call to the registered endpoint from freeswitch
>>>> 
>>>> 
>>>> this results in an invite like this:
>>>> 
>>>> send 1757 bytes to udp/[192.168.50.60]:5060 at 22:46:21.252549:
>>>>    ------------------------------------------------------------------------
>>>>    INVITE sip:1001 at 192.0.2.110;transport=ws SIP/2.0
>>>>    Via: SIP/2.0/UDP 192.168.50.65:15060;rport;branch=z9hG4bKXHcX316pDgXZB
>>>>    Route: <sip:192.168.50.60>;lr;received=192.168.200.77~63296~6
>>>>    Max-Forwards: 70
>>>>    From: "" <sip:1002 at 192.168.50.65>;tag=tZQ393yprj7BK
>>>>    To: <sip:1001 at 192.0.2.110;transport=ws>
>>>>    Call-ID: 8212b700-8885-1236-08b3-000c293ae94e
>>>>    CSeq: 118770326 INVITE
>>>>    Contact: <sip:mod_sofia at 192.168.50.65:15060>
>>>>    User-Agent: FreeSWITCH-mod_sofia/1.6.19+git~20171120T163416Z~b1b21d0695~64bit
>>>>    Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
>>>>    Supported: timer, path, replaces
>>>>    Allow-Events: talk, hold, conference, refer
>>>>    Content-Type: application/sdp
>>>>    Content-Disposition: session
>>>>    Content-Length: 891
>>>>    X-FS-Support: update_display,send_info
>>>>    Remote-Party-ID: <sip:1002 at 192.168.50.65>;party=calling;screen=yes;privacy=off
>>>> 
>>>> Freeswitch appends a route header to the                         invite specifying kamailio as route and a received with original uri.
>>>> 
>>>> well, here is the issue ... im failing to hit the SIP over websocket client... Kamailio 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> my RELAY route is like this
>>>> 
>>>> 
>>>> 
>>>> route[RELAY] {
>>>> 
>>>>         # enable additional event routes for forwarded requests
>>>>         # - serial forking, RTP relaying handling, a.s.o.
>>>>         if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
>>>>                 if(!t_is_set("branch_route")) {
>>>>                         xlog("L_ALERT", "Its a Branch, go manage that !!!  <$ru>\n");
>>>>                         t_on_branch("MANAGE_BRANCH");
>>>>                 }
>>>>         }
>>>>         if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
>>>>                 if(!t_is_set("onreply_route")) {
>>>>                         xlog("L_ALERT", "its onreply_route, go manage !!!  <$ru>\n");
>>>>                         t_on_reply("MANAGE_REPLY");
>>>> 
>>>>                 }
>>>>         }
>>>>         if (is_method("INVITE")) {
>>>>                 if(!t_is_set("failure_route")) {
>>>>                         xlog("L_ALERT", "Its failure_route, go manage !!!  <$ru>\n");
>>>>                         t_on_failure("MANAGE_FAILURE");
>>>>                 }
>>>>         }
>>>> 
>>>>         $fs = "udp:192.168.50.60:5060";
>>>>         xlog("L_ALERT", "Trying to rely !!!  <$ru>\n");
>>>>         if (!t_relay()) {
>>>>                 xlog("L_ALERT", "failed to rely !!!  <$ru>\n");
>>>>                 sl_reply_error();
>>>>         }
>>>>         exit;
>>>> }
>>>> 
>>>> here is a part of the log:
>>>> 
>>>> Feb  9 22:48:48 incfskamtest01 /usr/sbin/kamailio[14896]: WARNING: <core> [core/forward.c:231]: get_send_socket2(): protocol/port mismatch (forced udp:192.168.50.60:5060, to ws:192.0.2.110:5060)
>>>> Feb  9 22:48:48 incfskamtest01 /usr/sbin/kamailio[14896]: DEBUG: <core> [core/msg_translator.c:424]: clen_builder(): content-length: 916 (916)
>>>> Feb  9 22:48:48 incfskamtest01 /usr/sbin/kamailio[14896]: WARNING: <core> [core/msg_translator.c:2765]: via_builder(): TCP/TLS connection (id: 0) for WebSocket could not be found
>>>> Feb  9 22:48:48 incfskamtest01 /usr/sbin/kamailio[14896]: ERROR: <core> [core/msg_translator.c:1980]: build_req_buf_from_sip_req(): could not create Via header
>>>> Feb  9 22:48:48 incfskamtest01 /usr/sbin/kamailio[14896]: ERROR: tm [t_fwd.c:476]: prepare_new_uac(): could not build request
>>>> Feb  9 22:48:48 incfskamtest01 /usr/sbin/kamailio[14896]: ERROR: tm [t_fwd.c:1735]: t_forward_nonack(): failure to add branches
>>>> Feb  9 22:48:48 incfskamtest01 /usr/sbin/kamailio[14896]: DEBUG: tm [t_funcs.c:334]: t_relay_to(): t_forward_nonack returned error -2 (-2)
>>>> Feb  9 22:48:48 incfskamtest01 /usr/sbin/kamailio[14896]: DEBUG: tm [t_funcs.c:352]: t_relay_to(): -2 error reply                           generation delayed
>>>> Feb  9 22:48:48 incfskamtest01 /usr/sbin/kamailio[14896]: ERROR: *** cfgtrace:request_route=[RELAY] c=[/etc/kamailio/kamailio.cfg] l=744 a=26 n=xlog
>>>> Feb  9 22:48:48 incfskamtest01 /usr/sbin/kamailio[14896]: ALERT: <script>: failed to rely !!!  <sip:1001 at 192.0.2.110;transport=ws>
>>>> 
>>>> 
>>>> is that because i set a $fu before t_relay()                         ?
>>>> 
>>>> 
>>>> any idea how to approach the issue ?
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Kamailio (SER) - Users Mailing List
>>>> sr-users at lists.kamailio.org
>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>> 
>>> -- 
>>> Daniel-Constantin Mierla
>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>> Kamailio Advanced Training - March 5-7, 2018, Berlin - www.asipto.com
>>> Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com
>> 
> 
> -- 
> Daniel-Constantin Mierla
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - March 5-7, 2018, Berlin - www.asipto.com
> Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180213/68d215d4/attachment.html>


More information about the sr-users mailing list