Summary:ASTERISK-09330: SIP SUBSCRIBE in LAN environment does not work because dialog is destroyed too quickly
Reporter:Dmitry Andrianov (dimas)Labels:
Date Opened:2007-04-26 19:25:01Date Closed:2007-04-27 08:44:02
Versions:Frequency of
Environment:Attachments:( 0) siplog.txt
Description:Using XLite 3.0 as softphone, Asterisk installed locally (ping is usually within 1ms).
I was debugging completely another issue when found that SUBSCRIBE dialog fails multiple times because Asterisk every time schedules SIP dialog destruction 128 ms after receiving initial SUBSCRIBE. When Asterisk replies with 401 Unauthorized, XLite replies with another SUBSCRIBE with all auth data but it is too late - dialog is already killed. So after receipt of second SUBSCRIBE Asterisk creates new dialog, responds with 401 again and process repeats.
At the same time REGISTER dialog works just fine because it uses different timeouts.


Attached log file of softphone authentication process (core set debug 10, core set verbose 10, sip set debug)

Note multiple

 Scheduling destruction of SIP dialog 'NmNkMWU5YmVhZTdmYzZlNzVkOTYwOThjYzlkMjk2MGM.' in 128 ms (Method: SUBSCRIBE)

immediately followed by

 Really destroying SIP dialog 'NmNkMWU5YmVhZTdmYzZlNzVkOTYwOThjYzlkMjk2MGM.' Method: SUBSCRIBE

From the code it looks like that timeout is somehow based on RTT and when I connect to the same box from remote location with 53 ms ping, SUBSCRIBE dialog destruction is scheduled to 5312 ms and everything works fine.
I'm not sure what is wrong exactly but to me, 128 ms is just too short timeout for authentication which theoretically can involve complex calculations...
Comments:By: Olle Johansson (oej) 2007-04-27 03:05:33

This is solved by changing the "t1min" setting in the sip.conf configuration file. Raise it to 200 ms and you will get 64*200 ms timeouts.

By: Olle Johansson (oej) 2007-04-27 03:05:49

Configuration issue.

By: Dmitry Andrianov (dimas) 2007-04-27 04:11:03

I'm sorry if I'm wrong reopening the issue but I really think it is a bug. It is great one can easily workaround changing just single config option but I honestly do not understand how average person who just installed Asterisk will get an idea he needs doing that.

Note that REGISTER dialog in the same situation works just fine! Why can't the same timeout scheme be used for SUBSCRIBE so everything work just out of the box for most of people.

Sorry again but to me advanced options are for advanced people. Simple cases must work out of the box :)

By: Olle Johansson (oej) 2007-04-27 08:43:52

This is not a forum for discussion. It's been covered in many places and I are looking into fine-tuning the documentation on this.