Actually, I am replacing the username of the uri with the alias that stored in the database. In my configuration file, it is using mediaproxy for NAT function (features-callfwd.5.0.cfg from getting started). I also add the following codes in the very first of the route routine for alias replacing purpose.
route { ... if (!has_totag() && method=="INVITE") { if (avp_db_load("$from/uri","s:alias")) { xlog("L_INFO","sip408: have alias - [$avp(s:alias)]\n"); uac_replace_from("anonymous","sip:$avp(s:alias)@$si"); } else { xlog("L_INFO","sip411: no alias\n"); }; }; ... }
When I make a call from a phone to the PSTN phone, the caller drops the ring when the callee rings. Callee hangs up and callee rings again few seconds after. You can find an error message "SIP/2.0 481 Call Leg/Transaction Does Not Exist" in line 180. I wonder if there is any thing wrong with the above code or my concept is wrong. Please help. Below is the sip message.
interface: any filter: (ip) and ( port 5060 ) # U 10.0.0.46:5060 -> 10.0.0.27:5060 INVITE sip:34163634@10.0.0.27 SIP/2.0. Via: SIP/2.0/UDP 10.0.0.46:5060;branch=z9hG4bKeKunMgjqbhggzOxi. Max-Forwards: 70. User-Agent: Koncept KE10XX v4.32.05 00-09-45-0a-fc-2d. From: "9000" sip:9000@10.0.0.27;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. Contact: sip:9000@10.0.0.46:5060. CSeq: 1 INVITE. Supported: 100rel, replaces. Content-Type: application/sdp. Content-Length: 286. . v=0. o=9000 58685689 12166570 IN IP4 10.0.0.46. s=SIP CALL. c=IN IP4 10.0.0.46. t=0 0. m=audio 6000 RTP/AVP 18 3 0 8 4 101. a=rtpmap:18 G729/8000. a=rtpmap:3 GSM/8000. a=rtpmap:0 PCMU/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:4 G723/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15.
# U 10.0.0.27:5060 -> 10.0.0.46:5060 SIP/2.0 100 trying -- your call is important to us. Via: SIP/2.0/UDP 10.0.0.46:5060;branch=z9hG4bKeKunMgjqbhggzOxi;rport=5060. From: "9000" sip:9000@10.0.0.27;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. CSeq: 1 INVITE. Server: OpenSer (1.0.0 (i386/linux)). Content-Length: 0. Warning: 392 10.0.0.27:5060 "Noisy feedback tells: pid=3353 req_src_ip=10.0.0.46 req_src_port=5060 in_uri=sip:34163634@10.0.0.27 out_uri=sip:934163634@10.30.0.248 via_cnt==1". .
# U 10.0.0.27:5060 -> 10.30.0.248:5060 INVITE sip:934163634@10.30.0.248 SIP/2.0. Record-Route: sip:34163634@10.0.0.27:5060;nat=yes;ftag=l7473818dCOs9ZMG;lr=on. Via: SIP/2.0/UDP 10.0.0.27;branch=z9hG4bK0d2f.18572a04.0. Via: SIP/2.0/UDP 10.0.0.46:5060;rport=5060;branch=z9hG4bKeKunMgjqbhggzOxi. Max-Forwards: 69. User-Agent: Koncept KE10XX v4.32.05 00-09-45-0a-fc-2d. From: "anonymous"sip:36418473@10.0.0.46;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. Contact: sip:9000@10.0.0.46:5060. CSeq: 1 INVITE. Supported: 100rel, replaces. Content-Type: application/sdp. Content-Length: 287. . v=0. o=9000 58685689 12166570 IN IP4 10.0.0.46. s=SIP CALL. c=IN IP4 10.0.0.27. t=0 0. m=audio 35540 RTP/AVP 18 3 0 8 4 101. a=rtpmap:18 G729/8000. a=rtpmap:3 GSM/8000. a=rtpmap:0 PCMU/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:4 G723/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15.
# U 10.30.0.248:5060 -> 10.0.0.27:5060 SIP/2.0 100 Trying. Via: SIP/2.0/UDP 10.0.0.27;branch=z9hG4bK0d2f.18572a04.0,SIP/2.0/UDP 10.0.0.46:5060;rport=5060;branch=z9hG4bKeKunMgjqbhggzOxi. From: "anonymous"sip:36418473@10.0.0.46;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27;tag=1EBAD768-B8F. Date: Wed, 04 Jan 2006 09:15:35 GMT. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 1 INVITE. Allow-Events: telephone-event. Content-Length: 0. .
# U 10.30.0.248:5060 -> 10.0.0.27:5060 SIP/2.0 183 Session Progress. Via: SIP/2.0/UDP 10.0.0.27;branch=z9hG4bK0d2f.18572a04.0,SIP/2.0/UDP 10.0.0.46:5060;rport=5060;branch=z9hG4bKeKunMgjqbhggzOxi. From: "anonymous"sip:36418473@10.0.0.46;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27;tag=1EBAD768-B8F. Date: Wed, 04 Jan 2006 09:15:35 GMT. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 1 INVITE. Require: 100rel. RSeq: 1250. Allow-Events: telephone-event. Contact: sip:934163634@10.30.0.248:5060. Record-Route: sip:34163634@10.0.0.27:5060;nat=yes;ftag=l7473818dCOs9ZMG;lr=on. Content-Type: application/sdp. Content-Disposition: session;handling=required. Content-Length: 177. . v=0. o=CiscoSystemsSIP-GW-UserAgent 584 9780 IN IP4 10.30.0.248. s=SIP Call. c=IN IP4 10.30.0.248. t=0 0. m=audio 17340 RTP/AVP 18. a=rtpmap:18 G729/8000. a=fmtp:18 annexb=yes.
# U 10.0.0.27:5060 -> 10.0.0.46:5060 SIP/2.0 183 Session Progress. Via: SIP/2.0/UDP 10.0.0.46:5060;rport=5060;branch=z9hG4bKeKunMgjqbhggzOxi. From: "9000" sip:9000@10.0.0.27;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27;tag=1EBAD768-B8F. Date: Wed, 04 Jan 2006 09:15:35 GMT. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 1 INVITE. Require: 100rel. RSeq: 1250. Allow-Events: telephone-event. Contact: sip:934163634@10.30.0.248:5060. Record-Route: sip:34163634@10.0.0.27:5060;nat=yes;ftag=l7473818dCOs9ZMG;lr=on. Content-Type: application/sdp. Content-Disposition: session;handling=required. Content-Length: 175. . v=0. o=CiscoSystemsSIP-GW-UserAgent 584 9780 IN IP4 10.30.0.248. s=SIP Call. c=IN IP4 10.0.0.27. t=0 0. m=audio 35540 RTP/AVP 18. a=rtpmap:18 G729/8000. a=fmtp:18 annexb=yes.
# U 10.0.0.46:5060 -> 10.0.0.27:5060 PRACK sip:934163634@10.30.0.248:5060 SIP/2.0. Via: SIP/2.0/UDP 10.0.0.46:5060;branch=z9hG4bK8UeWxCfGrMJSO66f. Route: sip:34163634@10.0.0.27:5060;nat=yes;ftag=l7473818dCOs9ZMG;lr=on. Max-Forwards: 70. User-Agent: Koncept KE10XX v4.32.05 00-09-45-0a-fc-2d. From: "9000" sip:9000@10.0.0.27;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27;tag=1EBAD768-B8F. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. Contact: sip:9000@10.0.0.46:5060. CSeq: 2 PRACK. RAck: 1250 1 INVITE. Content-Length: 0. .
# U 10.0.0.27:5060 -> 10.30.0.248:5060 PRACK sip:934163634@10.30.0.248:5060 SIP/2.0. Record-Route: sip:10.0.0.27;ftag=l7473818dCOs9ZMG;lr=on. Via: SIP/2.0/UDP 10.0.0.27;branch=z9hG4bKdc2f.dbee15d1.0. Via: SIP/2.0/UDP 10.0.0.46:5060;branch=z9hG4bK8UeWxCfGrMJSO66f. Max-Forwards: 69. User-Agent: Koncept KE10XX v4.32.05 00-09-45-0a-fc-2d. From: "9000" sip:9000@10.0.0.27;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27;tag=1EBAD768-B8F. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. Contact: sip:9000@10.0.0.46:5060. CSeq: 2 PRACK. RAck: 1250 1 INVITE. Content-Length: 0. .
#----------------------------------line 180 -------------------------- U 10.30.0.248:5060 -> 10.0.0.27:5060 SIP/2.0 481 Call Leg/Transaction Does Not Exist. Via: SIP/2.0/UDP 10.0.0.27;branch=z9hG4bKdc2f.dbee15d1.0,SIP/2.0/UDP 10.0.0.46:5060;branch=z9hG4bK8UeWxCfGrMJSO66f. From: "9000" sip:9000@10.0.0.27;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27;tag=1EBAD768-B8F. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. CSeq: 2 PRACK. Content-Length: 0. .
# U 10.0.0.27:5060 -> 10.0.0.46:5060 SIP/2.0 481 Call Leg/Transaction Does Not Exist. Via: SIP/2.0/UDP 10.0.0.46:5060;branch=z9hG4bK8UeWxCfGrMJSO66f. From: "9000" sip:9000@10.0.0.27;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27;tag=1EBAD768-B8F. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. CSeq: 2 PRACK. Content-Length: 0. .
# U 10.30.0.248:5060 -> 10.0.0.27:5060 SIP/2.0 183 Session Progress. Via: SIP/2.0/UDP 10.0.0.27;branch=z9hG4bK0d2f.18572a04.0,SIP/2.0/UDP 10.0.0.46:5060;rport=5060;branch=z9hG4bKeKunMgjqbhggzOxi. From: "anonymous"sip:36418473@10.0.0.46;tag=l7473818dCOs9ZMG. To: "34163634" sip:34163634@10.0.0.27;tag=1EBAD768-B8F. Date: Wed, 04 Jan 2006 09:15:35 GMT. Call-ID: wVhSdbheOYfdmQmf@10.0.0.46. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 1 INVITE. Require: 100rel. RSeq: 1250. Allow-Events: telephone-event. Contact: sip:934163634@10.30.0.248:5060. Record-Route: sip:34163634@10.0.0.27:5060;nat=yes;ftag=l7473818dCOs9ZMG;lr=on. Content-Type: application/sdp. Content-Disposition: session;handling=required. Content-Length: 177. . v=0. o=CiscoSystemsSIP-GW-UserAgent 584 9780 IN IP4 10.30.0.248. s=SIP Call. c=IN IP4 10.30.0.248. t=0 0. m=audio 17340 RTP/AVP 18. a=rtpmap:18 G729/8000. a=fmtp:18 annexb=yes.