[SR-Users] fix_nated_sdp issue

Ric Marques rmarques at teamonenetworking.com
Wed Feb 22 19:50:06 CET 2012


Daniel -

Thank you for your assistance..

first, here's the sections of my routing where I'm calling fix_nated_sdp, and subsequent call:

# Routing to foreign domains
route[SIPOUT] {
                xlog("---------------------- checking of outbound to somewhere else -----------------------------------------");

                if (!uri==myself)
                {
                                xlog("<---------------------------------- Sending call out to some other domain ------------------------------>");
                                append_hf("P-hint: outbound\r\n");
                                set_advertised_address("10.50.50.8");
                                xlog("--------------------------bing--------------------------");
                                fix_nated_sdp("2", "10.50.50.8");
                                xlog("--------------------------bong--------------------------");
                                route(RELAY);
                }
}

route[RELAY] {
                xlog("------------------------------ relaying -------------------------------");
                # enable additional event routes for forwarded requests
                # - serial forking, RTP relaying handling, a.s.o.
                if (is_method("INVITE|SUBSCRIBE")) {
                                t_on_branch("MANAGE_BRANCH");
                                t_on_reply("MANAGE_REPLY");
                }
                if (is_method("INVITE")) {
                                t_on_failure("MANAGE_FAILURE");
                }

                if (!t_relay()) {
                                sl_reply_error();
                }
                xlog("------------------------------ exiting relaying -------------------------------");
                exit;
}

and here's the section of the log where that's found:
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: ERROR: <script>: ---------------------- checking of outbound to somewhere else -----------------------------------------
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <core> [socket_info.c:502]: grep_sock_info - checking if host==us: 13==10 &&  [xxx.xxx.xxx.xxx] == [10.0.10.10]
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <core> [socket_info.c:505]: grep_sock_info - checking if port 5060 matches port 5060
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <core> [forward.c:448]: check_self: host != me
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: ERROR: <script>: <---------------------------------- Sending call out to some other domain ------------------------------>
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: ERROR: <script>: --------------------------bing--------------------------
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: nathelper [nhelpr_funcs.c:148]: type <application/sdp> found valid
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: ERROR: <script>: --------------------------bong--------------------------
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: ERROR: <script>: ------------------------------ relaying -------------------------------
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: tm [t_lookup.c:1379]: DEBUG: t_newtran: msg id=3 , global msg id=3 , T on entrance=(nil)
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: tm [t_lookup.c:527]: t_lookup_request: start searching: hash=34053, isACK=0
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: tm [t_lookup.c:485]: DEBUG: RFC3261 transaction matching failed
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: tm [t_lookup.c:709]: DEBUG: t_lookup_request: no transaction found
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: tm [t_hooks.c:374]: DBG: trans=0x7fb56c0478e8, callback type 1, id 0 entered
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: tm [t_funcs.c:351]: SER: new INVITE
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <core> [msg_translator.c:204]: check_via_address(10.0.10.11, 10.0.10.11, 0)
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <core> [mem/shm_mem.c:111]: WARNING:vqm_resize: resize(0) called
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: tm [t_reply.c:667]: DEBUG: reply sent out. buf=0x7fb571968880: SIP/2.0 100 trying -..., shmem=0x7fb56c049eb8: SIP/2.0 100 trying -
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: tm [t_reply.c:677]: DEBUG: _reply_light: finished
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <script>: new branch [1] to sip:19165551212 at xxx.xxx.xxx.xxx
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: siputils [checks.c:104]: no totag
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <core> [parser/sdp/sdp_helpr_funcs.c:479]: located IP address [10.0.10.11] in `o=' field
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <core> [parser/sdp/sdp_helpr_funcs.c:479]: located IP address [10.0.10.11] in `c=' field
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: rtpproxy [rtpproxy_funcs.c:148]: type <application/sdp> found valid
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: rtpproxy [rtpproxy.c:2237]: proxy reply: 38946 10.0.10.10#012
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: siputils [checks.c:104]: no totag
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <core> [msg_translator.c:457]: clen_builder: content-length: 347 (347)
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <core> [msg_translator.c:204]: check_via_address(10.0.10.11, 10.0.10.11, 0)
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: tm [t_funcs.c:388]: SER: new transaction fwd'ed
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: ERROR: <script>: ------------------------------ exiting relaying -------------------------------
Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: <core> [usr_avp.c:644]: DEBUG:destroy_avp_list: destroying list (nil)


Walking through the log makes me think that because I'm using rtpproxy and nathelper, when the t_relay fires it errantly appends the address for rtpproxy to the c= line...

Am I going about this all wrong - is there a better approach?

Ric


From: Daniel-Constantin Mierla [mailto:miconda at gmail.com]
Sent: Wednesday, February 22, 2012 12:52 AM
To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Cc: Ric Marques
Subject: Re: [SR-Users] fix_nated_sdp issue

Hello,

can you set debug=3 in the config file and send the output (syslog messages) of processing such invite?

Cheers,
Daniel

On 2/22/12 4:31 AM, Ric Marques wrote:
Greetings,

I'm not sure if I found a bug, or if I just have something completely misconfigured... I'm a total newb with Kamailio, working on a proof of concept design.

Here's my configuration:

                provider -> nat firewall -> kamailio/rtpproxy -> asterisk

For outbound calls from a phone registered to asterisk via kamailio, I'm trying to use fix_nated_sdp("2", "10.50.50.8") to rewrite the media ip address to resolve my audio issues, where 10.50.50.8 is the address outside my firewall.  What I'm running into is the 'c=' line doesn't get re-written properly... it inserts the specified address in front of the existing address, and I end up with the following line in my INVITE:
c=IN IP4 10.50.50.810.0.10.10

I have the fix_nated_sdp command under route[sipout], because I only want to use it on calls being sent outside the nat firewall.


Here's the sip invite without the 'fix_nated_sdp' command:
--------------------------------------------------------------------------------------------------------------
INVITE sip:19165551212 at xxx.xxx.xxx.xxx SIP/2.0
Record-Route: <sip:10.0.10.10;lr=on;ftag=as5498b77e;nat=yes><sip:10.0.10.10;lr=on;ftag=as5498b77e;nat=yes>
Via: SIP/2.0/UDP 10.50.50.8.;branch=z9hG4bK4b3a.960f6466.0
Via: SIP/2.0/UDP 10.0.10.11:5060;branch=z9hG4bK145db73e;rport=5060
Max-Forwards: 69
From: "1009" <sip:1009 at 10.0.10.11><sip:1009 at 10.0.10.11>;tag=as5498b77e
To: <sip:19165551212 at xxx.xxx.xxx.xxx><sip:19165551212 at xxx.xxx.xxx.xxx>
Contact: <sip:1009 at 10.0.10.11:5060><sip:1009 at 10.0.10.11:5060>
Call-ID: 06b8bb1b7dd7801d7b3b9c917fcb9b12 at 10.0.10.11:5060<mailto:06b8bb1b7dd7801d7b3b9c917fcb9b12 at 10.0.10.11:5060>
CSeq: 102 INVITE
User-Agent: Asterisk PBX SVN-branch-1.8-r356107
Date: Wed, 22 Feb 2012 03:06:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 309
P-hint: outbound

v=0
o=root 604360056 604360056 IN IP4 10.0.10.10
s=Asterisk PBX SVN-branch-1.8-r356107
c=IN IP4 10.0.10.10
t=0 0
m=audio 9702 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
a=nortpproxy:yes
--------------------------------------------------------------------------------------------------------------


Here's the sip invite with the 'fix_nated_sdp' command:
--------------------------------------------------------------------------------------------------------------
INVITE sip:19167828326 at xxx.xxx.xxx.xxx SIP/2.0
Record-Route: <sip:10.0.10.10;lr=on;ftag=as49e00c81;nat=yes><sip:10.0.10.10;lr=on;ftag=as49e00c81;nat=yes>
Via: SIP/2.0/UDP 10.50.50.8.;branch=z9hG4bK1eab.800c4724.0
Via: SIP/2.0/UDP 10.0.10.11:5060;branch=z9hG4bK20d28324;rport=5060
Max-Forwards: 69
From: "1009" <sip:1009 at 10.0.10.11><sip:1009 at 10.0.10.11>;tag=as49e00c81
To: <sip:19167828326 at xxx.xxx.xxx.xxx><sip:19167828326 at xxx.xxx.xxx.xxx>
Contact: <sip:1009 at 10.0.10.11:5060><sip:1009 at 10.0.10.11:5060>
Call-ID: 4def5539675b6f644b99bb300e8ec8d6 at 10.0.10.11:5060<mailto:4def5539675b6f644b99bb300e8ec8d6 at 10.0.10.11:5060>
CSeq: 102 INVITE
User-Agent: Asterisk PBX SVN-branch-1.8-r356107
Date: Wed, 22 Feb 2012 03:18:19 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 347
P-hint: outbound

v=0
o=root 1009117068 1009117068 IN IP4 10.0.10.10
s=Asterisk PBX SVN-branch-1.8-r356107
c=IN IP4 10.50.50.8.10.0.10.10
t=0 0
m=audio 13540 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
a=oldmediaip:10.0.10.11
a=nortpproxy:yes
--------------------------------------------------------------------------------------------------------------

Is this a bug, or is it likely I have something else screwed up?

Thank you in advance for your assistance - this list is an incredible resource!

-Ric





_______________________________________________

SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list

sr-users at lists.sip-router.org<mailto:sr-users at lists.sip-router.org>

http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



--

Daniel-Constantin Mierla -- http://www.asipto.com

http://linkedin.com/in/miconda -- http://twitter.com/miconda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120222/67a4e775/attachment-0001.htm>


More information about the sr-users mailing list