[Home]

Summary:ASTERISK-17535: [patch] [regression] Cisco phones do not register
Reporter:jmls (jmls)Labels:
Date Opened:2011-03-09 15:40:16.000-0600Date Closed:2011-05-20 10:47:48
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Channels/chan_sip/Registration
Versions:1.4.40 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) issue18951_set_proper_port_from_via.patch
( 1) sipdebug.txt
( 2) tmp.patch
Description:Prior to r304241, cisco phones worked fine. After this revision, cisco 79xx phones do not register with asterisk.

****** ADDITIONAL INFORMATION ******

Aastra 9133i and Xlite softphones work with both revisions.
Comments:By: jmls (jmls) 2011-03-09 15:40:52.000-0600

sip debug list added

By: jmls (jmls) 2011-03-09 15:41:37.000-0600

quotes from file on #asterisk-dev

(9:15:58 PM) file: ohhhhh yeah
(9:16:02 PM) file: that would break it
(9:16:33 PM) file: the port packets come from for Cisco phones is not actually where it wants you to send responses, any packets sent to the port are just discarded

By: jmls (jmls) 2011-04-04 13:30:18

living in hope that a fix is due soon ;)

By: jmls (jmls) 2011-04-15 15:42:35

is this going to get fixed in 1.4 ? Would be a big problem for me if not. I'm worried about the 2011-04-21 deadline ...

By: klaus3000 (klaus3000) 2011-04-22 01:41:51

The Cisco phone does not send REGISTER with credentials. All REGISTER requests are retransmissions of the first one. I guess the 401 response does not get back to your Cisco phone. Looks like a firewall problem.

Use tcpdump/Wireshark/ngrep to verify that the response leaves the Asterisk server and is routed correctly. Try also nat=no for this peer (maybe there is a firewall which really wants the response back to the port announced in the Via header)

By: jmls (jmls) 2011-04-22 01:47:15

there is no firewall, phones are on the same network as the server (same switch). If I change the version of asterisk back to a version before r304241, the phones start registering. Update to r304241 or above, and they stop registering.

By: Walter Doekes (wdoekes) 2011-04-22 01:47:49

klaus3000, nat is already no as far as I can tell:

<--- SIP read from 10.0.10.119:50408 --->
REGISTER sip:10.0.0.62 SIP/2.0
Via: SIP/2.0/UDP 10.0.10.119:5060;branch=z9hG4bK27784576

^-- no "rport", response should go to 5060


<--- Transmitting (no NAT) to 10.0.10.119:50408 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.0.10.119:5060;branch=z9hG4bK27784576;received=10.0.10.119

^-- response goes "with no NAT" to 50408 instead. and ineed, r304241 breaks it by overwriting *sa regardless of nat setting (or the other one, I don't remember off hand)

By: klaus3000 (klaus3000) 2011-04-22 02:37:11

I can not reproduce the bug: I tried with Asterisk 1.4.40.1 and nat=no and nat=never. As you see below, the response is sent to IP address in Via header.

U 2011/04/22 09:25:50.090084 11.222.33.113:5060 -> 22.222.22.165:4343
REGISTER sip:mydomain.com:4343 SIP/2.0
Via: SIP/2.0/UDP 11.222.33.113:5080;branch=z9hG4bKfcf2.86f5c6b.0
Via: SIP/2.0/UDP 10.10.0.51:54322;rport=54322;received=83.136.33.3;branch=z9hG4bK-d8754z-383feb5d36675e21-1---d8754z-
Max-Forwards: 69
Contact: <sip:klaus@10.10.0.51:54322;rinstance=4cbc77b66febb2c0;transport=udp>;expires=0
To: <sip:klaus@mydomain.com:4343>
From: <sip:klaus@mydomain.com:4343>;tag=fe2b2b17
Call-ID: NjgyMWU0NTBlNGNkOWFhYzg0NTJjNWM0NzZhNzMzZWU.
CSeq: 3 REGISTER
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: eyeBeam release 1102q stamp 51814
Content-Length: 0


#
U 2011/04/22 09:25:50.119143 22.222.22.165:4343 -> 11.222.33.113:5080
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 11.222.33.113:5080;branch=z9hG4bKfcf2.86f5c6b.0;received=11.222.33.113
Via: SIP/2.0/UDP 10.10.0.51:54322;rport=54322;received=83.136.33.3;branch=z9hG4bK-d8754z-383feb5d36675e21-1---d8754z-
From: <sip:klaus@mydomain.com:4343>;tag=fe2b2b17
To: <sip:klaus@mydomain.com:4343>;tag=as35a84f86
Call-ID: NjgyMWU0NTBlNGNkOWFhYzg0NTJjNWM0NzZhNzMzZWU.
CSeq: 3 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces
WWW-Authenticate: Digest algorithm=MD5, realm="mydomain.com", nonce="5a059e31"
Content-Length: 0

Are you sure that nat traversal is really deactivated? Please verify with "sip show peer *0204*" and check the line "Nat:".

By: Alec Davis (alecdavis) 2011-04-22 04:03:48

trunk Asterisk SVN-branch-1.8-r313860M and "User-Agent: Cisco-CP7940G/8.0" also get the same as jmls and wdoekes if the following isn't set.

in SIP001234567890.cnf (probably could have been in SIPDefault.cnf)<pre>
# NAT/Firewall Traversal
nat_enable: "1"
nat_address: ""
voip_control_port: "5060"
start_media_port: "16384"
end_media_port:  "32766"
nat_received_processing: "1"</pre>

without the above I get
tcpdump: of failed register
20:43:50.392816 IP 192.168.124.63.50367 > 192.168.5.40.5060: SIP, length: 557
20:43:50.393139 IP 192.168.5.40.5060 > 192.168.124.63.50367: SIP, length: 559
20:43:50.436852 IP 192.168.124.63 > 192.168.5.40: ICMP 192.168.124.63 udp port 50367 unreachable, length 36

with the above in the provisioning.
tcpdump of successful register
20:48:51.741057 IP 192.168.124.63.5060 > 192.168.5.40.5060: SIP, length: 520
20:48:51.741428 IP 192.168.5.40.5060 > 192.168.124.63.5060: SIP, length: 559
20:48:51.870860 IP 192.168.124.63.5060 > 192.168.5.40.5060: SIP, length: 674
20:48:51.871203 IP 192.168.5.40.5060 > 192.168.124.63.5060: SIP, length: 602

By: Alec Davis (alecdavis) 2011-04-22 04:33:52

http://www.cisco.com/en/US/docs/voice_ip_comm/cuipph/7960g_7940g/sip/8_0/english/administration/guide/sipaxd80.html

see 'nat_address', 'nat_enable' and the 'voip_control_port'
The description in the 'voip_control_port' is the clue.



By: klaus3000 (klaus3000) 2011-04-22 04:53:36

@alecdavis: so, SVN-branch-1.8-r313860M is buggy when using nat=no?

By: Walter Doekes (wdoekes) 2011-04-26 14:45:22

(1) I haven't tested the patch, apart from checking that it compiles.
(2) It touches 4 things:
(2a) ast_free already does NULL-checking, so I've been told
(2b) the port-setting from via should be done even if maddr is not set
(2c) it lacked the htons around the port
(2d) I found another stray ntohs that should be htons

If you can find the time, please test if this works.



By: Digium Subversion (svnbot) 2011-04-27 13:57:58

Repository: asterisk
Revision: 315891

U   branches/1.4/channels/chan_sip.c

------------------------------------------------------------------------
r315891 | mnicholson | 2011-04-27 13:57:57 -0500 (Wed, 27 Apr 2011) | 14 lines

Fix our compliance with RFC 3261 section 18.2.2.

This change optimizes the free_via() function and removes some redundant null
checking. It also fixes compliance with RFC 3261 section 18.2.2 by always using
the port specified in the Via header for routing responses (even when maddr is
not set). Also the htons() function is now used when setting the port.
Additional documentation comments have been added in various places to make the
logic in the code clearer.

(closes issue ASTERISK-17535)
Reported by: jmls
Patches:
     issue18951_set_proper_port_from_via.patch uploaded by wdoekes (license 717) (modified)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=315891

By: Digium Subversion (svnbot) 2011-04-27 14:03:08

Repository: asterisk
Revision: 315893

_U  branches/1.6.2/
U   branches/1.6.2/channels/chan_sip.c

------------------------------------------------------------------------
r315893 | mnicholson | 2011-04-27 14:03:07 -0500 (Wed, 27 Apr 2011) | 21 lines

Merged revisions 315891 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r315891 | mnicholson | 2011-04-27 13:57:56 -0500 (Wed, 27 Apr 2011) | 14 lines
 
 Fix our compliance with RFC 3261 section 18.2.2.
 
 This change optimizes the free_via() function and removes some redundant null
 checking. It also fixes compliance with RFC 3261 section 18.2.2 by always using
 the port specified in the Via header for routing responses (even when maddr is
 not set). Also the htons() function is now used when setting the port.
 Additional documentation comments have been added in various places to make the
 logic in the code clearer.
 
 (closes issue ASTERISK-17535)
 Reported by: jmls
 Patches:
       issue18951_set_proper_port_from_via.patch uploaded by wdoekes (license 717) (modified)
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=315893

By: Digium Subversion (svnbot) 2011-04-27 14:14:29

Repository: asterisk
Revision: 315894

_U  branches/1.8/
U   branches/1.8/channels/chan_sip.c
U   branches/1.8/channels/sip/reqresp_parser.c

------------------------------------------------------------------------
r315894 | mnicholson | 2011-04-27 14:14:29 -0500 (Wed, 27 Apr 2011) | 28 lines

Merged revisions 315893 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
 r315893 | mnicholson | 2011-04-27 14:03:05 -0500 (Wed, 27 Apr 2011) | 21 lines
 
 Merged revisions 315891 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r315891 | mnicholson | 2011-04-27 13:57:56 -0500 (Wed, 27 Apr 2011) | 14 lines
   
   Fix our compliance with RFC 3261 section 18.2.2.
   
   This change optimizes the free_via() function and removes some redundant null
   checking. It also fixes compliance with RFC 3261 section 18.2.2 by always using
   the port specified in the Via header for routing responses (even when maddr is
   not set). Also the htons() function is now used when setting the port.
   Additional documentation comments have been added in various places to make the
   logic in the code clearer.
   
   (closes issue ASTERISK-17535)
   Reported by: jmls
   Patches:
         issue18951_set_proper_port_from_via.patch uploaded by wdoekes (license 717) (modified)
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=315894

By: Digium Subversion (svnbot) 2011-04-27 14:15:51

Repository: asterisk
Revision: 315895

_U  trunk/
U   trunk/channels/chan_sip.c
U   trunk/channels/sip/reqresp_parser.c

------------------------------------------------------------------------
r315895 | mnicholson | 2011-04-27 14:15:50 -0500 (Wed, 27 Apr 2011) | 35 lines

Merged revisions 315894 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r315894 | mnicholson | 2011-04-27 14:14:27 -0500 (Wed, 27 Apr 2011) | 28 lines
 
 Merged revisions 315893 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ................
   r315893 | mnicholson | 2011-04-27 14:03:05 -0500 (Wed, 27 Apr 2011) | 21 lines
   
   Merged revisions 315891 via svnmerge from
   https://origsvn.digium.com/svn/asterisk/branches/1.4
   
   ........
     r315891 | mnicholson | 2011-04-27 13:57:56 -0500 (Wed, 27 Apr 2011) | 14 lines
     
     Fix our compliance with RFC 3261 section 18.2.2.
     
     This change optimizes the free_via() function and removes some redundant null
     checking. It also fixes compliance with RFC 3261 section 18.2.2 by always using
     the port specified in the Via header for routing responses (even when maddr is
     not set). Also the htons() function is now used when setting the port.
     Additional documentation comments have been added in various places to make the
     logic in the code clearer.
     
     (closes issue ASTERISK-17535)
     Reported by: jmls
     Patches:
           issue18951_set_proper_port_from_via.patch uploaded by wdoekes (license 717) (modified)
   ........
 ................
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=315895

By: Paul Belanger (pabelanger) 2011-05-12 16:21:15

Reopening as this commit breaks tests/udptl_v6.

By: Walter Doekes (wdoekes) 2011-05-13 01:31:07

22:27 < wdoekes2> pabelanger: try something like this http://wjd.nu/files/2011/05/tmp.txt?view

Untested.. and not so pretty, but it should work.

By: Digium Subversion (svnbot) 2011-05-13 08:41:48

Repository: asterisk
Revision: 318720

U   branches/1.8/channels/sip/reqresp_parser.c

------------------------------------------------------------------------
r318720 | mnicholson | 2011-05-12 18:35:51 -0500 (Thu, 12 May 2011) | 6 lines

Handle ipv6 addresses in the sent-by Via: field.

This change fixes a regression in via header parsing and ipv6 handling.

(closes issue ASTERISK-17535)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=318720

By: Digium Subversion (svnbot) 2011-05-13 08:42:44

Repository: asterisk
Revision: 318785

_U  trunk/
U   trunk/channels/sip/reqresp_parser.c

------------------------------------------------------------------------
r318785 | mnicholson | 2011-05-12 20:55:38 -0500 (Thu, 12 May 2011) | 13 lines

Merged revisions 318720 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r318720 | mnicholson | 2011-05-12 18:35:51 -0500 (Thu, 12 May 2011) | 4 lines
 
 Handle ipv6 addresses in the sent-by Via: field.
 
 This change fixes a regression in via header parsing and ipv6 handling.

 (closes issue ASTERISK-17535)
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=318785

By: Digium Subversion (svnbot) 2011-05-20 10:47:48

Repository: asterisk
Revision: 319996

U   tags/1.8.4.1/.version
U   tags/1.8.4.1/ChangeLog
D   tags/1.8.4.1/asterisk-1.8.4-summary.html
D   tags/1.8.4.1/asterisk-1.8.4-summary.txt
U   tags/1.8.4.1/channels/chan_sip.c
U   tags/1.8.4.1/channels/sip/reqresp_parser.c

------------------------------------------------------------------------
r319996 | lmadsen | 2011-05-20 10:47:47 -0500 (Fri, 20 May 2011) | 2 lines

Update .version, ChangeLog files. Remove old summary files.
Merge changes from issue ASTERISK-17535.
------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=319996

By: Chris Deel (boxwood) 2011-06-08 16:50:25.141-0500

I just had this issue occur two days ago, where my Cisco 7940 phones will not register (though x-lite still does).  I thought it was odd that there was no Contact line in the SIP reg.  Is this issue closed and in a current release, or does it need to be patched?  Running Asterisk 1.4.41 on centos 5.6 with freepbx 2.7.0.10

I should point out no changes were made, though when trying to update an extension, I received a fatal error message (white screen).

By: Sam Tilders (stilders) 2011-07-31 20:36:48.398-0500

Hi,

Apologies if this is the not the right place.

This issue appears to still be present in 1.8.5. At least in the asterisk18-1.8.5.0-1_centos5 rpm from the digium repository.

Not sure how to read the revision tags in the file or if they're relevant:
/usr/lib/asterisk/modules/chan_sip.so:
    $Revision: 325416 $
    $Revision: 281687 $
    $Revision: 310088 $
    $Revision: 324685 $
    $Revision: 317474 $
    $Revision: 268894 $

The replies to the handset all appeared to be sent to 5060, and not the port in the Via header.