I've opened the captured traffic with Wireshark and I've found out that Kamailio is actually forwarding the call with a double SDP header. ngrep was showing only a partial header. I think this happens because when forwarding the call I use rtpengine_offer() and not rtpengine_manage(). I've tried using rtpengine_manage() and I get only one SDP header but with the (wrong) private IP address. I've tried also rtpengine_delete() before rtpengine_offer() but there's always a double header. Ideas? Still digging..
Thanks! Session Description Protocol Session Description Protocol Version (v): 0 Owner/Creator, Session Id (o): Sonus_UAC 157372 901736 IN IP4 44.55.73.157 Session Name (s): SIP Media Capabilities Connection Information (c): IN IP4 172.30.0.156 Time Description, active time (t): 0 0 Media Description, name and address (m): audio 30154 RTP/AVP 0 18 101 Media Attribute (a): maxptime:20 Media Attribute (a): rtpmap:0 PCMU/8000 Media Attribute (a): rtpmap:18 G729/8000 Media Attribute (a): fmtp:18 annexb=no Media Attribute (a): rtpmap:101 telephone-event/8000 Media Attribute (a): fmtp:101 0-15 Media Attribute (a): sendrecv Media Attribute (a): rtcp:30155 Session Description Protocol Version (v): 0 Owner/Creator, Session Id (o): Sonus_UAC 157372 901736 IN IP4 44.55.73.157 Session Name (s): SIP Media Capabilities Connection Information (c): IN IP4 22.33.177.156 Time Description, active time (t): 0 0 Media Description, name and address (m): audio 30358 RTP/AVP 0 18 101 Media Attribute (a): maxptime:20 Media Attribute (a): rtpmap:0 PCMU/8000 Media Attribute (a): rtpmap:18 G729/8000 Media Attribute (a): fmtp:18 annexb=no Media Attribute (a): rtpmap:101 telephone-event/8000 Media Attribute (a): fmtp:101 0-15 Media Attribute (a): sendrecv Media Attribute (a): rtcp:30359 [Generated Call-ID: 241993330_65984054@44.55.73.157] On Wed, Oct 11, 2023 at 12:29 PM Leonardo Arena <rna...@gmail.com> wrote: > > Hi all, > > I have the following setup: > > Phone <-> private net using TCP transport <-> (172.30.0.156) Kamailio > v5.6.3 + RTPEngine v9.3.1 (22.33.177.156) <-> public net using UDP > transport <-> Asterisk (22.33.178.77) > > Phone is registered on Kamailio and forward calls on no answer or when > ext is unregistered, to Asterisk's custom IVR (nodejs app + CouchDB), > using failure_route() [1]. > > The problem is that when the none answer the phone and the call is > redirected to Asterisk, Kamailio announce its private IP address in > the SDP connection endpoint, hence there is no audio [2]. From > RTPEngine debug logs, it seems that RTPEngine replies with the correct > SDP connection endpoint IP [3]. See also RTPEngine interfaces > definition [4]. > > What am I missing? Why Kamailio is offering its private IP address in > the SDP connection, instead of its public address when forwarding the > call? If comment "route(SDP_MANAGE_IN)" in route[IN], Kamailio uses > the correct IP endpoint address in the SDP offer when forwarding the > call to Asterisk. But of course this breaks audio when someone answer > the phone. It seems that Kamailio is storing the initial SDP offer > settings and does not update it upon RTPEngine's request, even though > I have added "replace-session-connection" in route[SDP_OFFER_IVR]. > > Thanks for any help! > > leo > > > [1] > route[IN] { > if (!lookup('location')) { > t_on_reply("SDP_MANAGE"); > route(TOIVR); > } else { > xlog("L_INFO", "Route(IN) Req $mi $rm From <$fu> To <$tu> RURI > <$ru>\n"); > record_route(); > t_on_reply("SDP_MANAGE"); > route(SDP_MANAGE_IN); > t_on_failure("TOIVR"); > t_relay(); > exit; > } > } > > route[SDP_MANAGE] { > if (has_body("application/sdp")) { > rtpengine_manage(); > } > } > > route[SDP_MANAGE_IN] { > if (has_body("application/sdp")) { > rtpengine_manage("direction=public direction=private via-branch=1"); > } > } > > > ... > > > route[SDP_OFFER_IVR] { > if (has_body("application/sdp")) { > rtpengine_offer("direction=public direction=public > replace-session-connection via-branch=1"); > } > } > > failure_route[TOIVR] { > if (t_is_canceled()) { > exit; > } > append_branch(); > route(SDP_OFFER_IVR); > # using t_relay_to so that UDP is used with the correct IP address > if (!t_relay_to("xh.voip.net")) { > xlog("L_INFO", "No answer - Failure Route(TOIVR) Req $mi $rm > From <$fu> To <$tu> RURI <$ru> failed\n"); > t_reply("500", "Unable to route"); > } else { > xlog("L_INFO", "No answer - Failure Route(TOIVR) Req $mi $rm > From <$fu> To <$tu> RURI <$ru>\n"); > } > } > > > [2] > U 2023/10/11 09:05:43.797393 22.33.177.156:5060 -> 22.33.176.8:5060 #3 > SIP/2.0 180 Ringing. > Via: SIP/2.0/UDP > 22.33.176.8;branch=z9hG4bK2cb2.e559c4a326678f69ae9b4656be7bc36c.0. > Via: SIP/2.0/UDP > 22.33.176.20;branch=z9hG4bK2cb2.2920561c845ee5279051359f40cb7c0f.0. > Via: SIP/2.0/UDP 44.55.73.157:5060;branch=z9hG4bK0cBdccef20c0d8bfefb. > Record-Route: <sip:172.30.0.156;transport=TCP;r2=on;lr=on;ftag=gK0c1bb12e>. > Record-Route: <sip:22.33.177.156;r2=on;lr=on;ftag=gK0c1bb12e>. > Record-Route: <sip:22.33.176.8;lr=on;ftag=gK0c1bb12e;did=7ffe.26c8>. > Record-Route: <sip:22.33.176.20;lr=on;ftag=gK0c1bb12e>. > From: "Unavailable" <sip:013335553222@44.55.73.157>;tag=gK0c1bb12e. > To: <sip:8555000033@22.33.176.20>;tag=660096088. > Call-ID: 474758100_116775912@44.55.73.157. > CSeq: 704680 INVITE. > Contact: <sip:+18555000033@172.30.96.2:11815;transport=TCP>. > Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, > REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE. > User-Agent: Yealink SIP-T31P 124.86.0.40. > Allow-Events: talk,hold,conference,refer,check-sync. > Content-Length: 0. > . > > > U 2023/10/11 09:06:03.751585 22.33.177.156:5060 -> 22.33.178.77:5060 #4 > INVITE sip:+18555000033@172.30.96.2:11815;transport=TCP SIP/2.0. > Record-Route: <sip:22.33.177.156;lr=on;ftag=gK0c1bb12e>. > Record-Route: <sip:22.33.176.8;lr=on;ftag=gK0c1bb12e;did=7ffe.26c8>. > Record-Route: <sip:22.33.176.20;lr=on;ftag=gK0c1bb12e>. > Via: SIP/2.0/UDP > 22.33.177.156;branch=z9hG4bK2cb2.afb825e30e294872c72c5e21ef26f3f3.1. > Via: SIP/2.0/UDP > 22.33.176.8;branch=z9hG4bK2cb2.e559c4a326678f69ae9b4656be7bc36c.0. > Via: SIP/2.0/UDP > 22.33.176.20;branch=z9hG4bK2cb2.2920561c845ee5279051359f40cb7c0f.0. > Via: SIP/2.0/UDP 44.55.73.157:5060;branch=z9hG4bK0cBdccef20c0d8bfefb. > f: "Unavailable" <sip:013335553222@44.55.73.157>;tag=gK0c1bb12e. > t: <sip:8555000033@22.33.176.20>. > i: 474758100_116775912@44.55.73.157. > CSeq: 704680 INVITE. > Max-Forwards: 32. > Allow: > INVITE,ACK,CANCEL,BYE,REGISTER,REFER,INFO,SUBSCRIBE,NOTIFY,PRACK,UPDATE,OPTIONS,MESSAGE,PUBLISH. > Accept: application/sdp, application/isup, application/dtmf, > application/dtmf-relay, multipart/mixed. > m: "Unavailable" <sip:013335553222@44.55.73.157:5060>. > Remote-Party-ID: "Unavailable" > <sip:013335553222@44.55.73.157:5060>;privacy=off. > k: timer,100rel,precondition. > Session-Expires: 1800. > Min-SE: 90. > l: 604. > Content-Disposition: session; handling=required. > c: application/sdp. > . > v=0. > o=Sonus_UAC 525653 764118 IN IP4 44.55.73.157. > s=SIP Media Capabilities. > c=IN IP4 172.30.0.156. > t=0 0. > m=audio 30030 RTP/AVP 0 18 101. > a=maxptime:20. > a=rtpmap:0 PCMU/8000. > a=rtpmap:18 G729/8000. > a=fmtp:18 annexb=n > > > > > [3] > Oct 11 09:06:03 voipsipr7 daemon.info rtpengine[35061]: INFO: > [474758100_116775912@44.55.73.157]: [control] Received command 'offer' > from 127.0.0.1:39942 > Oct 11 09:06:03 voipsipr7 daemon.debug rtpengine[35061]: DEBUG: > [474758100_116775912@44.55.73.157]: [control] Dump for 'offer' from > 127.0.0.1:39942: { "supports": [ "load limit" ], "sdp": "v=0^M > o=Sonus_UAC 5 > 25653 764118 IN IP4 44.55.73.157^M s=SIP Media Capabilities^M c=IN IP4 > 44.55.78.60^M t=0 0^M m=audio 61610 RTP/AVP 0 18 101^M a=rtpmap:0 > PCMU/8000^M a=rtpmap:18 G729/8000^M a=fmtp:18 annexb=no^M a=rtpmap:101 > telephone-event/8000^M a=fmtp:101 0-15^M a=sendrecv^M a=maxptime:20^M > ", "direction": [ "public", "public" ], "replace": [ > "session-connection" ], "call-id": "474758100_116775912@44.55.73.157 > ... > Oct 11 09:06:03 voipsipr7 daemon.debug rtpengine[35061]: DEBUG: > [474758100_116775912@44.55.73.157]: ... ", "via-branch": > "z9hG4bK2cb2.e559c4a326678f69ae9b4656be7bc36c.0", "received-from": [ > "IP4", "22.33.176 > .8" ], "from-tag": "gK0c1bb12e", "command": "offer" } > > > ... > > > Oct 11 09:06:03 voipsipr7 daemon.info rtpengine[35061]: INFO: > [474758100_116775912@44.55.73.157]: [control] Replying to 'offer' from > 127.0.0.1:39942 (elapsed time 0.000638 sec) > Oct 11 09:06:03 voipsipr7 daemon.debug rtpengine[35061]: DEBUG: > [474758100_116775912@44.55.73.157]: [control] Response dump for > 'offer' to 127.0.0.1:39942: { "sdp": "v=0^M o=Sonus_UAC 525653 764118 > IN IP4 207 > .223.73.157^M s=SIP Media Capabilities^M c=IN IP4 22.33.177.156^M t=0 > 0^M m=audio 30068 RTP/AVP 0 18 101^M a=maxptime:20^M a=rtpmap:0 > PCMU/8000^M a=rtpmap:18 G729/8000^M a=fmtp:18 annexb=no^M a=rtpmap:101 > teleph > one-event/8000^M a=fmtp:101 0-15^M a=sendrecv^M a=rtcp:30069^M ", > "result": "ok" } > Oct 11 09:06:03 voipsipr7 daemon.info /usr/sbin/kamailio[35261]: INFO: > <script>: No answer - Failure Route(TOIVR) Req 4 INVITE From > <sip:013335553222@44.55.73.157> To <sip:8555000033@22.33.176.20> RURI > <sip: > +18555000033@172.30.96.2:11815;transport=TCP> > Oct 11 09:06:03 voipsipr7 daemon.info rtpengine[35061]: INFO: > [474758100_116775912@44.55.73.157]: [control] Received command > 'answer' from 127.0.0.1:53245 > Oct 11 09:06:03 voipsipr7 daemon.debug rtpengine[35061]: DEBUG: > [474758100_116775912@44.55.73.157]: [control] Dump for 'answer' from > 127.0.0.1:53245: { "supports": [ "load limit" ], "sdp": "v=0^M o=- > 525653 7 > 64120 IN IP4 22.33.178.77^M s=Asterisk^M c=IN IP4 22.33.178.77^M t=0 > 0^M m=audio 11264 RTP/AVP 0 101^M a=rtpmap:0 PCMU/8000^M a=rtpmap:101 > telephone-event/8000^M a=fmtp:101 0-16^M a=ptime:20^M a=maxptime:150^M > a=sendrecv^M m=audio 0 RTP/AVP 0 18 101^M ", "call-id": > "474758100_116775912@44.55.73.157", "received-from": [ "IP4", > "22.33.178.77" ], "from-tag": "gK0c1bb12e", "to-tag": > "a21c53b6-ca33-43b ... > Oct 11 09:06:03 voipsipr7 daemon.debug rtpengine[35061]: DEBUG: > [474758100_116775912@44.55.73.157]: ... 4-a585-af9b568a5ecb", > "command": "answer" } > > > ... > > > Oct 11 09:06:03 voipsipr7 daemon.info rtpengine[35061]: INFO: > [474758100_116775912@44.55.73.157]: [control] Replying to 'answer' > from 127.0.0.1:53245 (elapsed time 0.000915 sec) > Oct 11 09:06:03 voipsipr7 daemon.debug rtpengine[35061]: DEBUG: > [474758100_116775912@44.55.73.157]: [control] Response dump for > 'answer' to 127.0.0.1:53245: { "sdp": "v=0^M o=- 525653 764120 IN IP4 > 22.33.178 > .77^M s=Asterisk^M c=IN IP4 22.33.177.156^M t=0 0^M m=audio 30056 > RTP/AVP 0 101^M a=maxptime:150^M a=rtpmap:0 PCMU/8000^M a=rtpmap:101 > telephone-event/8000^M a=fmtp:101 0-16^M a=sendrecv^M a=rtcp:30057^M > a=ptime > :20^M m=audio 0 RTP/AVP 0 18 101^M ", "result": "ok" } > Oct 11 09:06:03 voipsipr7 daemon.debug rtpengine[35061]: DEBUG: > [474758100_116775912@44.55.73.157]: [core] Forward to sink endpoint: > 22.33.178.77:11264 (RTP seq 0 TS 0) > > > [4] > Interface definition in RTPEngine: > interface = > public/22.33.177.156;public/22:33:201:105::156;private/172.30.0.156 __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: