[Users] UA not receiving BYE from SPA 3000

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Jul 14 13:43:14 CEST 2006


Hi Kenny,

sorry - there was a mistake in my script. It should be:

if (method=="BYE" || method=="CANCEL") {
    unforce_rtp_proxy();
    if (method=="CANCEL") {
        t_relay();
        exit;
    }
}

the exit; has to be called only if relay was done to allow BYE to pass 
through and to be processed by loose_route().

Regards,
Bogdan

Kenny Chua wrote:

> Hi Bogdan I tried what you told me to, however I still have the same 
> problem.  Seems like nothing is hanging up now. However if I used this 
> config before the loose route, things are slightly better, just that 
> the caller(softphne) hangs up first, then the calle(softphone) wont 
> hang up itself.
>
> if (method=="BYE" || method=="CANCEL") {
>         unforce_rtp_proxy();
>         t_relay();
>         exit;
>   } ;
>
> The bye is still not working right. Below is my config that I tried 
> using ur suggestion and ngrep:
>
> debug=3
> fork=yes
> log_stderror=no
>
> listen=68.xxx.xxx.xxx     
> alias=test.com
>
> port=5060
> children=16
>
> dns=no
> rev_dns=no
>
> fifo="/tmp/openser_fifo"
> fifo_db_url="mysql://openser:openserrw@localhost/openser"
>
> loadmodule "/usr/local/lib/openser/modules/mysql.so"
> loadmodule "/usr/local/lib/openser/modules/sl.so"
> loadmodule "/usr/local/lib/openser/modules/tm.so"
> loadmodule "/usr/local/lib/openser/modules/rr.so"
> loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
> loadmodule "/usr/local/lib/openser/modules/usrloc.so"
> loadmodule "/usr/local/lib/openser/modules/registrar.so"
> loadmodule "/usr/local/lib/openser/modules/auth.so"
> loadmodule "/usr/local/lib/openser/modules/auth_db.so"
> loadmodule "/usr/local/lib/openser/modules/uri.so"
> loadmodule "/usr/local/lib/openser/modules/uri_db.so"
> loadmodule "/usr/local/lib/openser/modules/domain.so"
> loadmodule "/usr/local/lib/openser/modules/nathelper.so"
> loadmodule "/usr/local/lib/openser/modules/avpops.so"
> loadmodule "/usr/local/lib/openser/modules/textops.so"
> loadmodule "/usr/local/lib/openser/modules/xlog.so"
> loadmodule "/usr/local/lib/openser/modules/permissions.so"
>
> modparam("auth_db|permissions|uri_db|usrloc", "db_url",
>     "mysql://openser:openserrw@localhost/openser")
> modparam("auth_db", "calculate_ha1", 1)
> modparam("auth_db", "password_column", "password")
>
> modparam("nathelper", "natping_interval", 30)
> modparam("nathelper", "ping_nated_only", 1)  
> modparam("nathelper", "rtpproxy_sock", "unix:/var/run/rtpproxy.sock")
>
> modparam("usrloc", "db_mode", 2)
>
> modparam("registrar", "nat_flag", 6)
>
> modparam("rr", "enable_full_lr", 1)
>
> modparam("tm", "fr_inv_timer", 27)
> modparam("tm", "fr_inv_timer_avp", "inv_timeout")
>
> modparam("permissions", "db_mode", 1)
> modparam("permissions", "trusted_table", "trusted")
>
>
> route {
>
>     # -----------------------------------------------------------------
>     # Sanity Check Section
>     # -----------------------------------------------------------------
>     if (!mf_process_maxfwd_header("10")) {
>         sl_send_reply("483", "Too Many Hops");
>         exit;
>     };
>
>     if (msg:len > max_len) {
>         sl_send_reply("513", "Message Overflow");
>         exit;
>     };
>
>     # -----------------------------------------------------------------
>     # Record Route Section
>     # -----------------------------------------------------------------
>     if (method!="REGISTER") {
>         record_route();
>     };
>
>     if (method=="BYE" || method=="CANCEL") {
>         unforce_rtp_proxy();
>         if(method=="CANCEL")
>             t_relay();
>         exit;
>     } ;
>
>     # -----------------------------------------------------------------
>     # Loose Route Section
>     # -----------------------------------------------------------------
>     if (loose_route()) {
>
>         if ((method=="INVITE" || method=="REFER") && !has_totag()) {
>             sl_send_reply("403", "Forbidden");
>             return;
>         };
>
>         if (method=="INVITE") {
>
>             if (!proxy_authorize("","subscriber")) {
>                 proxy_challenge("","0");
>                 return;
>             } else if (!check_from()) {
>                 sl_send_reply("403", "Use From=ID");
>                 return;
>             };
>             consume_credentials();
>
>             if (nat_uac_test("19")) {
>                 setflag(6);
>                 force_rport();
>                 fix_nated_contact();
>             };
>             force_rtp_proxy("l");
>         };
>
>         route(1);
>         return;
>     };
>
>     # -----------------------------------------------------------------
>     # Call Type Processing Section
>     # -----------------------------------------------------------------
>     if (!is_uri_host_local()) {
>         if (is_from_local() || allow_trusted()) {
>             route(4);
>             route(1);
>         } else {
>             sl_send_reply("403", "Forbidden");
>         };
>         return;
>     };
>            
>     if (method=="ACK") {
>         route(1);
>         return;
>     } else if (method=="CANCEL") {
>         route(1);
>         return;
>     } else if (method=="INVITE") {
>         route(3);
>         return;
>     } else  if (method=="REGISTER") {
>         route(2);
>         return;
>     };
>
>     lookup("aliases");
>     if (!is_uri_host_local()) {
>         route(4);
>         route(1);
>         return;
>     };
>
>     if (!lookup("location")) {
>         sl_send_reply("404", "User Not Found");
>         return;
>     };
>
>     route(1);
> }
>
> route[1] {
>
>     # -----------------------------------------------------------------
>     # Default Message Handler
>     # -----------------------------------------------------------------
>
>     t_on_reply("1");
>
>    
>     if (!t_relay()) {
>         if ((method=="INVITE" || method=="ACK") && isflagset(6)) {
>             unforce_rtp_proxy();
>         };
>         sl_reply_error();
>     };
> }
>
> route[2] {
>
>     # -----------------------------------------------------------------
>     # REGISTER Message Handler
>     # ----------------------------------------------------------------
>
>     if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {
>         setflag(6);
>         fix_nated_register();
>         force_rport();
>     };
>
>     sl_send_reply("100", "Trying");
>
>     if (!www_authorize("","subscriber")) {
>         www_challenge("","0");
>         exit;
>     };
>
>     if (!check_to()) {
>         sl_send_reply("401", "Unauthorized");
>         return;
>     };
>
>     consume_credentials();
>
>     if (!save("location")) {
>         sl_reply_error();
>     };
> }
>
> route[3] {
>
>     # -----------------------------------------------------------------
>     # INVITE Message Handler
>     # -----------------------------------------------------------------
>
>     if (!allow_trusted()) {
>    
>         if (!proxy_authorize("","subscriber")) {
>             proxy_challenge("","0");
>             return;
>         } else if (!check_from()) {
>             sl_send_reply("403", "Use From=ID");
>             return;
>         };
>     };
>
>     consume_credentials();
>
>     if (nat_uac_test("19")) {
>         setflag(6);
>     }
>    
>     lookup("aliases");
>     if (!is_uri_host_local()) {
>         route(4);
>         route(1);
>         return;
>     };
>
>     if (uri=~"^sip:[0-9]{3}@") {
>         lookup("aliases");
>         lookup("location");
>         route(4);
>         route(1);
>         return;
>     };   
>
>     if(!lookup("location")){
>         if (uri=~"^sip:[0-9]*@") {       
>             route(4);
>             route(5);
>             return;
>         };
>
>
>         sl_send_reply("404", "User Not Found");
>         return;
>     };
>
>     route(4);
>     route(1);
> }
>
> route[4] {
>
>     # -----------------------------------------------------------------
>     # NAT Traversal Section
>     # -----------------------------------------------------------------
>
>     if (isflagset(6)) {
>         force_rport();
>         fix_nated_contact();
>         force_rtp_proxy();
>     }
> }
>
> route[5] {
>
>     # -----------------------------------------------------------------
>     # PSTN Handler
>     # -----------------------------------------------------------------
>
>     rewritehostport("pstn.gateway:5060");
>
>     avp_write("i:45", "inv_timeout");
>
>     route(1);
> }
>
> onreply_route[1] {
>
>     if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {
>         if (!search("^Content-Length:[ ]*0")) {
>             force_rtp_proxy();
>         };
>     };
>
>     if (nat_uac_test("1")) {
>         fix_nated_contact();
>     };
> }
>
>
> [root at adsl-068-213-154-138 openser]# ngrep -qt port 5060
> interface: eth0 (68.xxx.xxx.xxx/255.255.255.248)
> filter: (ip) and ( port 5060 )
>
>
> U 2006/06/30 21:13:29.086503 70.xxx.xxx.xxx:5062 -> 68.xxx.xxx.xxx:5060
>   BYE sip:68.xxx.xxx.xxx SIP/2.0..Call-ID: 
> 7b304ac5-59d54-c0a814d0 at test.com..From: 
> CIO<sip:202 at test.com>;tag=2d8ac-e57529..To:
>    <sip:200 at test.com>;tag=4197719146..CSeq: 102 BYE..Via: SIP/2.0/UDP 
> 70.xxx.xxx.xxx:5062;rport..Contact: CIO<sip:202 at 70.xxx.xxx.xxx:5062>..Ma
>   x-Forwards: 70..Route: <sip:200 at 70.xxx.xxx.xxx:5060>..User-Agent: 
> BVA8051S (LDTK AR18D ) STUN 1 0 0..Supported: 
> timer..Proxy-Authorization: Digest userna
>   
> me="202",realm="test.com",uri="sip:68.xxx.xxx.xxx",response="b037fee90080d847fa4c837faba14862",nonce="44a5db70e33b5ec051569d1d7fbc2c6f328d
>   63f2"..Content-Length: 0....
>
> U 2006/06/30 21:13:29.602024 70.xxx.xxx.xxx:5062 -> 68.xxx.xxx.xxx:5060
>   BYE sip:68.xxx.xxx.xxx SIP/2.0..Call-ID: 
> 7b304ac5-59d54-c0a814d0 at test.com..From: 
> CIO<sip:202 at test.com>;tag=2d8ac-e57529..To:
>    <sip:200 at test.com>;tag=4197719146..CSeq: 102 BYE..Via: SIP/2.0/UDP 
> 70.xxx.xxx.xxx:5062;rport..Contact: CIO<sip:202 at 70.xxx.xxx.xxx:5062>..Ma
>   x-Forwards: 70..Route: <sip:200 at 70.xxx.xxx.xxx:5060>..User-Agent: 
> BVA8051S (LDTK AR18D ) STUN 1 0 0..Supported: 
> timer..Proxy-Authorization: Digest userna
>   
> me="202",realm="test.com",uri="sip:68.xxx.xxx.xxx",response="b037fee90080d847fa4c837faba14862",nonce="44a5db70e33b5ec051569d1d7fbc2c6f328d
>   63f2"..Content-Length: 0....
>
> U 2006/06/30 21:13:30.259448 70.xxx.xxx.xxx:1024 -> 68.xxx.xxx.xxx:5060
>   SIP/2.0 200 Ok..Via: SIP/2.0/UDP 
> 68.xxx.xxx.xxx;branch=z9hG4bKb10a.4676fc16.0..Via: SIP/2.0/UDP 
> 70.xxx.xxx.xxx:5062;rport=5062..From: CIO <sip:202 at test.com
>   >;tag=2d8ac-e57529..To: <sip:200 at test.com>;tag=4197719146..Contact: 
> <sip:200 at 70.xxx.xxx.xxx:5060>..Record-Route: <sip:68.21
>   3.154.138;ftag=2d8ac-e57529;lr=on>..Call-ID: 
> 7b304ac5-59d54-c0a814d0 at test.com..CSeq: 101 INVITE..Content-Type: 
> application/sdp..Server: X-
>   Lite release 1105x..Content-Length: 308....v=0..o=200 378856709 
> 378857471 IN IP4 70.xxx.xxx.xxx..s=X-Lite..c=IN IP4 
> 70.xxx.xxx.xxx..t=0 0..m=audio 8000 RT
>   P/AVP 0 8 3 98 97 101..a=rtpmap:0 pcmu/8000..a=rtpmap:8 
> pcma/8000..a=rtpmap:3 gsm/8000..a=rtpmap:98 iLBC/8000..a=rtpmap:97 
> speex/8000..a=rtpmap:101 tele
>   phone-event/8000..a=fmtp:101 0-15..a=sendrecv..
>
> U 2006/06/30 21:13:30.259708 68.xxx.xxx.xxx:5060 -> 70.xxx.xxx.xxx:5062
>   SIP/2.0 200 Ok..Via: SIP/2.0/UDP 
> 70.xxx.xxx.xxx:5062;rport=5062..From: CIO 
> <sip:202 at test.com>;tag=2d8ac-e57529..To: <sip:200 at test.com
>   >;tag=4197719146..Contact: 
> <sip:200 at 70.xxx.xxx.xxx:5060>..Record-Route: 
> <sip:68.xxx.xxx.xxx;ftag=2d8ac-e57529;lr=on>..Call-ID: 7b304ac5-59d54-c0a
>   814d0 at test.com..CSeq: 101 INVITE..Content-Type: 
> application/sdp..Server: X-Lite release 1105x..Content-Length: 
> 308....v=0..o=200 378856709
>    378857471 IN IP4 70.xxx.xxx.xxx..s=X-Lite..c=IN IP4 
> 70.xxx.xxx.xxx..t=0 0..m=audio 8000 RTP/AVP 0 8 3 98 97 
> 101..a=rtpmap:0 pcmu/8000..a=rtpmap:8 pcma/80
>   00..a=rtpmap:3 gsm/8000..a=rtpmap:98 iLBC/8000..a=rtpmap:97 
> speex/8000..a=rtpmap:101 telephone-event/8000..a=fmtp:101 
> 0-15..a=sendrecv..
>
> U 2006/06/30 21:13:30.399353 70.xxx.xxx.xxx:5062 -> 68.xxx.xxx.xxx:5060
>   ACK sip:68.xxx.xxx.xxx SIP/2.0..Call-ID: 
> 7b304ac5-59d54-c0a814d0 at test.com..From: 
> CIO<sip:202 at test.com>;tag=2d8ac-e57529..To:
>    <sip:200 at test.com>;tag=4197719146..CSeq: 101 ACK..Via: SIP/2.0/UDP 
> 70.xxx.xxx.xxx:5062;rport..Contact: CIO<sip:202 at 70.xxx.xxx.xxx:5062>..Ma
>   x-Forwards: 70..Route: <sip:200 at 70.xxx.xxx.xxx:5060>..User-Agent: 
> BVA8051S (LDTK AR18D ) STUN 1 0 0..Content-Length: 0....
>
> U 2006/06/30 21:13:30.399553 68.xxx.xxx.xxx:5060 -> 70.xxx.xxx.xxx:5060
>   ACK sip:200 at 70.xxx.xxx.xxx:5060 SIP/2.0..Record-Route: 
> <sip:68.xxx.xxx.xxx;ftag=2d8ac-e57529;lr=on>..Call-ID: 
> 7b304ac5-59d54-c0a814d0 at test.com
>   ..From: CIO<sip:202 at test.com>;tag=2d8ac-e57529..To: 
> <sip:200 at test.com>;tag=4197719146..CSeq: 101 ACK..Via: SIP/2.0/UDP 68
>   .213.154.138;branch=0..Via: SIP/2.0/UDP 
> 70.xxx.xxx.xxx:5062;rport=5062..Contact: 
> CIO<sip:202 at 70.xxx.xxx.xxx:5062>..Max-Forwards: 69..User-Agent: BVA8051S
>   (LDTK AR18D ) STUN 1 0 0..Content-Length: 0....
>
> U 2006/06/30 21:13:30.608084 70.xxx.xxx.xxx:5062 -> 68.xxx.xxx.xxx:5060
>   BYE sip:68.xxx.xxx.xxx SIP/2.0..Call-ID: 
> 7b304ac5-59d54-c0a814d0 at test.com..From: 
> CIO<sip:202 at test.com>;tag=2d8ac-e57529..To:
>    <sip:200 at test.com>;tag=4197719146..CSeq: 102 BYE..Via: SIP/2.0/UDP 
> 70.xxx.xxx.xxx:5062;rport..Contact: CIO<sip:202 at 70.xxx.xxx.xxx:5062>..Ma
>   x-Forwards: 70..Route: <sip:200 at 70.xxx.xxx.xxx:5060>..User-Agent: 
> BVA8051S (LDTK AR18D ) STUN 1 0 0..Supported: 
> timer..Proxy-Authorization: Digest userna
>   
> me="202",realm="test.com",uri="sip:68.xxx.xxx.xxx",response="b037fee90080d847fa4c837faba14862",nonce="44a5db70e33b5ec051569d1d7fbc2c6f328d
>   63f2"..Content-Length: 0....
>
> U 2006/06/30 21:13:32.324907 70.xxx.xxx.xxx:1024 -> 68.xxx.xxx.xxx:5060
>   BYE sip:202 at 70.xxx.xxx.xxx:5062 SIP/2.0..Via: SIP/2.0/UDP 
> 70.xxx.xxx.xxx:5060;rport;branch=z9hG4bK6DCE6FB5347E4C64B528E78857E75918..From: 
> <sip:200 at test.com
>   >;tag=4197719146..To: CIO 
> <sip:202 at test.com>;tag=2d8ac-e57529..Contact: 
> <sip:200 at 70.xxx.xxx.xxx:5060>..Route: <sip:68.xxx.xx
>   x.xxx;ftag=2d8ac-e57529;lr=on>..Call-ID: 
> 7b304ac5-59d54-c0a814d0 at test.com..CSeq: 27264 BYE..Max-Forwards: 
> 70..User-Agent: X-Lite release 1
>   105x..Content-Length: 0....
>
> U 2006/06/30 21:13:33.997886 70.xxx.xxx.xxx:1024 -> 68.xxx.xxx.xxx:5060
>   BYE sip:202 at 70.xxx.xxx.xxx:5062 SIP/2.0..Via: SIP/2.0/UDP 
> 70.xxx.xxx.xxx:5060;rport;branch=z9hG4bK6DCE6FB5347E4C64B528E78857E75918..From: 
> <sip:200 at test.com
>   >;tag=4197719146..To: CIO 
> <sip:202 at test.com>;tag=2d8ac-e57529..Contact: 
> <sip:200 at 70.xxx.xxx.xxx:5060>..Route: <sip:68.xxx.xx
>   x.xxx;ftag=2d8ac-e57529;lr=on>..Call-ID: 
> 7b304ac5-59d54-c0a814d0 at test.com..CSeq: 27264 BYE..Max-Forwards: 
> 70..User-Agent: X-Lite release 1
>   105x..Content-Length: 0....
>
>
>
>
>
>
>
> */Bogdan-Andrei Iancu <bogdan at voice-system.ro>/* wrote:
>
>     try something like:
>
>     if
>     (method=="BYE" || method=="CANCEL") {
>     unforce_rtp_proxy();
>     if (method=="CANCEL")
>     t_relay();
>     exit;
>     }
>
>     be doing this you let the BYE to reach the loose_route and be
>     properly
>     routed.
>
>     regards,
>     bogdan
>
>
>
> ------------------------------------------------------------------------
> Want to be your own boss? Learn how on Yahoo! Small Business. 
> <http://us.rd.yahoo.com/evt=41244/*http://smallbusiness.yahoo.com/r-index> 







More information about the Users mailing list