Disconnect every 5 to 10 minutes

Comment on asterisk settings HKBN 2b
tillama
Joined: Thu 15 of Dec, 2005

Re: Disconnect every 5 to 10 minutes

Posted:Thu 11 of Jan, 2007 (10:24 UTC)
Thanks Alex. You have done a nice work reviewing RFC2976 and comparing version 1.4/1.2.
It seems that we have come up with a temporary solution to this problem, although it is a "childproof" one.

It would be nice if you can submit a patch to Digium/Asterisk if they agree with your interpretation of RFC2976.
Hopefully this problem is completely solved in future version of 1.4.....
netonfire
Joined: Mon 01 of Jan, 2007

Re: Disconnect every 5 to 10 minutes

Posted:Thu 04 of Jan, 2007 (13:54 UTC)
Hi CK Lioe, I looked into the chan_sip source code. Asterisk sending the "403 unauthorised" response was infact due to some incorrerctly written code, The part of the code should not be executed at all because the INFO message didn't have the X-CLIENTCODE header. This has beeb fixed in the new asterisk version 1.4 by checking the return value of the get_header().


Anyway, back to the disconnect problem. I checked RFC2976, and it seems to indicate that if the request INFO has no message body, then the response should be 200 OK. I have raised this to the Digium/Asterisk bug report, let's see how they would intepret the RFC.


For my fix, I added some simple code to check the CONTENT-LENGTH in function handle_request_info(), the code were inserted after all the IF..ELSE statements and before last three line of code


 /* Nothing in the header is interesting, now check if content-length is 0 */ 
        if (!strcasecmp(get_header(req, "Content-Length"), "0")) { 
                transmit_response(p, "200 OK", req); 
                return; 
       } /* else ... there issomething in the message body, do something with it if you need to */ 


Also if the verison is below 1.4, need to replace  the following line

} else if ((c = get_header(req, "X-ClientCode"))) {

with 

} else if (!ast_strlen_zero(c = get_header(req, "X-ClientCode"))) {


This seem to fixed the problem. The last call I made lasted more than 30 minutes, and I can see 4 INFO requests in the trace and all were responded with 200 OK.

The fix is very similar to the one posted on th digium, but it is more generic and less Nortel specific.

tillama
Joined: Thu 15 of Dec, 2005

Re: Disconnect every 5 to 10 minutes

Posted:Wed 03 of Jan, 2007 (01:20 UTC)
Hi, Alex, You have the same problem as I do. For the problem of 5-10 minutes diconnection, the code workaround works for me. (http://bugs.digium.com/file_download.php?file_id=11655&type=bug)

However, you need to find the appropriate lines to insert in the file chan_sip.c, and the locations are different for each version. Search for the section of code which handles INFO method, and insert it before otherwise sending "403 unauthorised". Then recompile.

This method of patch is quite troublesome, if you know how to write a better patch, please release it. Thanks
netonfire
Joined: Mon 01 of Jan, 2007

Re: Disconnect every 5 to 10 minutes

Posted:Mon 01 of Jan, 2007 (23:13 UTC)
All my calls disconnect after 5-10 minutes. I am using trixbox (Asterisk version 1.2.12.1), using 203.80.89.135 (s21.hkbntel.net) as my proxy and re-registry every 120 sec, and my codec is alaw.

In the packet traces, I can see that HKBN sent the INFO packet, and asterisk responded with a 403 unauthorised and the call was disconnected.

It is very annoying, i will try the code workaround to see if that works.


tillama
Joined: Thu 15 of Dec, 2005

Re: Disconnect every 5 to 10 minutes

Posted:Wed 27 of Dec, 2006 (08:36 UTC)
Hi, Chandave, I am using 203.80.89.139 (s22.hkbntel.net), re-registering every 120 s (by default). Codec = G729
Disconnection does not happen to every call, say 4 in 5 calls...... However, it is o.k. now after modifying chan_sip.c and recompile.

This problem is not urgent, as I have already a temp. fix. But raise this out to see if other user have the same problem or a better solution.
chandave
Joined: Sun 05 of Jun, 2005

Re: Disconnect every 5 to 10 minutes

Posted:Wed 27 of Dec, 2006 (03:15 UTC)
Sending the SIP INFO must be dependant on which SIP proxy you are using or how often you are re-REGISTERING with HKBN. I don't receive any of these packets. I just tested with an outgoing call running for over 17 minutes (outbound to a HK PSTN number).

I'm currently using 203.80.89.135 (s21.hkbntel.net) as my SIP Proxy and am re-REGISTERing every 120 seconds. Additionally, I'm using G.711a codec.

What are you settings CK Lioe?

See ya...

d.c.
tillama
Joined: Thu 15 of Dec, 2005

Disconnect every 5 to 10 minutes

Posted:Wed 27 of Dec, 2006 (00:41 UTC)
Hi,

When using HKBN 2b with asterisk, I have the problem of disconnection every 5 to 10 minutes.
After debugging the SIP message, it is found that HKBN's Nortel server send method INFO every few minutes, but asterisk gives "403 Unauthorized" instead of "200 OK" to it. This causes disconnection.

I have modify chan_sip.c according to one suggestion (see http://bugs.digium.com/view.php?id=5747). The disconnection problem disappears.

The modification is not obvious, as there is no patch available yet.
Does anyone have the same problem? If you have a solution or a patch to this issue, please provide.