Hi, When kamailio is listening on more than one interface is is sometimes necessary to use force_send_socket() to tell kamailio to use one socket or the other. This means it will put the correct values into Via and Record-Route headers. In the example below, I am choosing the socket based on if the request has come from a dispatcher list, but any other logic can be used.
#!substdef "!WAN_IP!x.x.x.x!g" #!substdef "!LAN_IP!y.y.y.y!g" route[RELAY]{ if (ds_is_from_list("CLUSTER_ID")) { xlog("L_INFO", "Using WAN_IP for sending\n"); force_send_socket("WAN_IP":5060); } else { xlog("L_INFO", "Using LAN_IP for sending\n"); force_send_socket("LAN_IP":5060); } t_relay(); }
Regards, Hugh
On 18/02/2013 18:28, Scott, Matt wrote:
I can get wan communication or lan communication working, but not both.
Setting this, allows wan communication, but then my lan tries to talk with my wan ip. Single Interface: listen=udp:<lan_ip>:5060 advertise <nat_wan_ip>:5060 I see my wan_ip in the via header, so I assume that's causing the issues for my lan. Using add_contact_alias for lan, with the advertise in my listen command, results in [nathelper.c:835]: no need to add alias param I've tried handle_ruri_alias();, but this doesn't seem to have an affect either.
Setting this, allows lan communication to work fine, but wan has issues. Single Interface: listen=udp:<lan_ip>:5060
Where is the happy median?
Was going to try path, but I read this is not the correct work-around.
Any clues or hints, are greatly appreciated.
U <carrier_wan_ip>:5060 -> <lan_ip>:5060 INVITE sip:+1<dialed_number>@<lan_ip>:5060 SIP/2.0..Via: SIP/2.0/UDP <carrier_wan_ip>:5060;branch=z9h G4bK04B0f1624ef34479ee3..From: <sip:+1<caller_id>@<carrier_wan_ip:5060;isup-oli=0>;tag=gK0413c49b..To : <sip:+1<dialed_number>@<lan_ip>:5060>..Call-ID: 184873373_18184370@<carrier_wan_ip..CSeq: 27475 IN VITE..Max-Forwards: 63..Allow: INVITE,ACK,CANCEL,BYE,PRACK,UPDATE..Accept: application/sdp, appl ication/isup, application/dtmf, application/dtmf-relay, multipart/mixed..Contact: <sip:+1720276 3205@<carrier_wan_ip:5060>..P-Asserted-Identity: <sip:+1<caller_id>@<carrier_wan_ip:5060>..Supported: 100 rel..Content-Length: 305..Content-Disposition: session; handling=required..Content-Type: applic ation/sdp....v=0..o=Sonus_UAC 25113 26131 IN IP4 <carrier_wan_ip..s=SIP Media Capabilities..c=IN IP4 4.55.10.130..t=0 0..m=audio 15746 RTP/AVP 0 8 18 101..a=rtpmap:0 PCMU/8000..a=rtpmap:8 PCMA/800 0..a=rtpmap:18 G729/8000..a=fmtp:18 annexb=no..a=rtpmap:101 telephone-event/8000..a=fmtp:101 0-1 5..a=sendrecv..a=maxptime:20..
U <lan_ip>:5060 -> <carrier_wan_ip>:5060 SIP/2.0 100 trying -- your call is important to us..Via: SIP/2.0/UDP <carrier_wan_ip:5060;branch=z9h G4bK04B0f1624ef34479ee3..From: <sip:+1<caller_id>@<carrier_wan_ip:5060;isup-oli=0>;tag=gK0413c49b..To : <sip:+1<dialed_number>@<lan_ip>:5060>..Call-ID: 184873373_18184370@<carrier_wan_ip..CSeq: 27475 IN VITE..Server: kamailio (3.3.2 (x86_64/linux))..Content-Length: 0....
U <lan_ip>:5060 -> <asterisk_ip>:5060 INVITE sip:+1<dialed_number>@<lan_ip>:5060 SIP/2.0..Via: SIP/2.0/UDP <wan_ip>:5060;branch= z9hG4bK5d66.7cb4b7a1.0..Via: SIP/2.0/UDP <carrier_wan_ip>:5060;branch=z9hG4bK04B0f1624ef34479ee3..Fro m: <sip:+1<caller_id>@<carrier_wan_ip:5060;isup-oli=0>;tag=gK0413c49b..To: <sip:+1<dialed_number>@192.168. 9.130:5060>..Call-ID: 184873373_18184370@<carrier_wan_ip>..CSeq: 27475 INVITE..Max-Forwards: 62..Allo w: INVITE,ACK,CANCEL,BYE,PRACK,UPDATE..Accept: application/sdp, application/isup, application/dt mf, application/dtmf-relay, multipart/mixed..Contact: <sip:+1<caller_id>@<carrier_wan_ip:5060>..P-As serted-Identity: <sip:+1<caller_id>@<carrier_wan_ip:5060>..Supported: 100rel..Content-Length: 305..C ontent-Disposition: session; handling=required..Content-Type: application/sdp....v=0..o=Sonus_UA C 25113 26131 IN IP4 <carrier_wan_ip..s=SIP Media Capabilities..c=IN IP4 4.55.10.130..t=0 0..m=audio 15746 RTP/AVP 0 8 18 101..a=rtpmap:0 PCMU/8000..a=rtpmap:8 PCMA/8000..a=rtpmap:18 G729/8000..a= fmtp:18 annexb=no..a=rtpmap:101 telephone-event/8000..a=fmtp:101 0-15..a=sendrecv..a=maxptime:20 ..
Asterisk box:
Retransmitting #4 (no NAT) to <wan_ip>:5060: SIP/2.0 200 OK Via: SIP/2.0/UDP <wan_ip>:5060;branch=z9hG4bK5d66.7cb4b7a1.0;received=192.168.9.130 Via: SIP/2.0/UDP <carrier_wan_ip>:5060;branch=z9hG4bK04B0f1624ef34479ee3 From: <sip:+1<caller_id>@<carrier_wan_ip>:5060;isup-oli=0>;tag=gK0413c49b To: <sip:+1<dialed_number>@<lan_ip>:5060>;tag=as1265f4d0 Call-ID: 184873373_18184370@<carrier_wan_ip> CSeq: 27475 INVITE Server: Asterisk PBX 1.6.2.14 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces Contact: <sip:+1<dialed_number>@<asterisk_ip>> Content-Type: application/sdp Content-Length: 239
Matt Scott
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users