[Home]

Summary:ASTERISK-13332: Unable to register SIP device with realtime in 1.6.x
Reporter:Max A Glucksmann (maxgo)Labels:
Date Opened:2009-01-09 15:58:54.000-0600Date Closed:2009-01-28 16:52:05.000-0600
Priority:BlockerRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Registration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20090128__bug14205__5.diff.txt
Description:Having the same network config, 7940, NAT, Asterisk v1.4, the phone registers OK.

After upgrading to 1.6.0.3 or 1.6.1-beta4, Asterisk doesn't reply to the REGISTER messages, although the received messages from the phone are displayed on the console, no replies are seen to be sent - not even replies denying the registration.


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

Registration messages received from the phone in 1.6.1-beta4:


<--- SIP read from UDP://71.x.x.x:5060 --->
REGISTER sip:216.x.x.x SIP/2.0
Via: SIP/2.0/UDP 71.x.x.x:5060;branch=z9hG4bK0a98814d
From: sip:1011001@216.x.x.x
To: sip:1011001@216.x.x.x
Call-ID: 000a8a5c-59480002-23a6c87c-2b9b65aa@71.x.x.x
CSeq: 101 REGISTER
User-Agent: CSCO/6
Contact: <sip:1011001@71.x.x.x:5060>
Content-Length: 0
Expires: 3600


As you can see, that's all is displayed in Asterisk's console; no replies are sent back to the phone.

Making the installation in the same server from 1.4 sources, the registration is successful:


<--- SIP read from 71.x.x.x:5060 --->
REGISTER sip:216.x.x.x SIP/2.0
Via: SIP/2.0/UDP 71.x.x.x:5060;branch=z9hG4bK61b94667
From: sip:1011001@216.x.x.x
To: sip:1011001@216.x.x.x
Call-ID: 000a8a5c-59480002-23a7ad78-45b48104@71.x.x.x
CSeq: 101 REGISTER
User-Agent: CSCO/6
Contact: <sip:1011001@71.x.x.x:5060>
Content-Length: 0
Expires: 3600


<------------->
--- (10 headers 0 lines) ---
Using latest REGISTER request as basis request
Sending to 71.x.x.x : 5060 (no NAT)


<--- Transmitting (NAT) to 71.x.x.x:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 71.x.x.x:5060;branch=z9hG4bK61b94667;received=71.x.x.x
From: sip:1011001@216.x.x.x
To: sip:1011001@216.x.x.x
Call-ID: 000a8a5c-59480002-23a7ad78-45b48104@71.x.x.x
CSeq: 101 REGISTER
User-Agent: ComtelPBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:1011001@216.x.x.x:5060>
Content-Length: 0


<------------>
[Jan  9 16:29:03] DEBUG[11354]: res_config_mysql.c:653 mysql_reconnect: MySQL RealTime: Everything is fine.


[Jan  9 16:29:03] DEBUG[11354]: res_config_mysql.c:356 update_mysql: MySQL RealTime: Update SQL: UPDATE sip_users SET ipaddr = '71.x.x.x', port = '5060', regseconds = '1231540143', username = '1011001', fullcontact = 'sip:1011001@71.x.x.x:5060' WHERE name = '1011001'


[Jan  9 16:29:03] DEBUG[11354]: res_config_mysql.c:370 update_mysql: MySQL RealTime: Updated 1 rows on table: sip_users


host5*CLI>


<--- Transmitting (NAT) to 71.x.x.x:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 71.x.x.x:5060;branch=z9hG4bK1b6b5dff;received=71.x.x.x
From: sip:1011001@216.x.x.x
To: sip:1011001@216.x.x.x;tag=as75122476
Call-ID: 000a8a5c-59480002-23a7ad78-45b48104@71.x.x.x
CSeq: 102 REGISTER
User-Agent: ComtelPBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Expires: 3600
Contact: <sip:1011001@71.x.x.x:5060>;expires=3600
Date: Fri, 09 Jan 2009 21:29:03 GMT
Content-Length: 0

Comments:By: Leif Madsen (lmadsen) 2009-01-10 09:06:33.000-0600

You're using sip realtime right?

Check out the file sip-friends.sql in contrib/scripts/ within your Asterisk source directory. I ran into a similar problem, and it had to do with the SQL schema I was using. I have recently updated it (you will need to check out the latest 1.6.0 branch, as it was changed after the 1.6.0.3 release).

Let me know if that fixes it. If it does, then I will be sure to update the UPGRADE-1.6.txt file before closing this out.

I have not checked to see if it mentions this or not, but I assume it doesn't :)

By: Max A Glucksmann (maxgo) 2009-01-10 15:00:19.000-0600

Yes, but I updated the sipfriends table with all the new fields, directly applied the sql script, and it didn't do it.

Then, I entered a friend in the flat file, disabled sippeers and sipusers in extconfig.conf and still only see the received messages, no outgoing messages to the phone...


Flat file entry:

[7940]
type=friend
username=7940
secret=1234
host=dynamic
context=publicdialplanobd
accountcode=comtelnetworks
nat=yes
callerid=<7940>
disallow=all
allow=ulaw
allow=g729



Received REGISTER message:

<--- SIP read from UDP://71.x.x.x:5060 --->
REGISTER sip:216.x.x.x SIP/2.0
Via: SIP/2.0/UDP 71.x.x.x:5060;branch=z9hG4bK3f89d43e
From: sip:7940@216.x.x.x
To: sip:7940@216.x.x.x
Call-ID: 000a8a5c-59480002-23a72b9d-55dbed30@71.x.x.x
CSeq: 172 REGISTER
User-Agent: CSCO/6
Contact: <sip:7940@71.x.x.x:5060>
Content-Length: 0
Expires: 3600

<------------->
--- (10 headers 0 lines) ---



Again, no response to the phone...

Can it be something regarding NAT, STUN that makes Asterisk ignore incoming messages from certain types of connections?

When registering from another box within the same public network it works alright. I don't have an IP Phone with a public address to test right now...

In 1.4.22 registrations work perfectly. I'm also trying phsultan's trunk version, where gtalk got to work fine to send and receive messages, but I find this problem also with registrations...

:S

By: Leif Madsen (lmadsen) 2009-01-12 11:27:14.000-0600

Here is what my MySQL is seeing upon registration and such. I think this is what is causing the negative impacts on the realtime engine. It seems like something is wrong in causing the fullcontact to be filled with the 'username', and the 'name' field to attempt to be matched on the 'fullcontact'.

In 1.4 it looks to be OK, and calls work. In trunk, calls due not work for me.


Asterisk trunk:

REGISTER
--------

UPDATE sipfriends SET ipaddr='192.168.128.129', port='11912', regseconds='1231765983', username='X-Lite release 1014k stamp 47051', fullcontact='X-Lite release 1014k stamp 47051' WHERE name='sip:105@192.168.128.129:11912;rinstance=581a52fa91ce3e64'

UN-REGISTER
----------

UPDATE sipfriends SET fullcontact='', ipaddr='', port='', regseconds='0', username='', regserver='' WHERE name=''

UPDATE sipfriends SET ipaddr='0.0.0.0', port='0', regseconds='1231765914', username='X-Lite release 1014k stamp 47051', fullcontact='' WHERE name=''


Asterisk 1.4:

REGISTER
--------

UPDATE sipfriends SET fullcontact='', ipaddr='', port='', regseconds='0', username='', regserver='' WHERE name='105'

UPDATE sipfriends SET ipaddr='192.168.128.129', port='65484', regseconds='1231766289', username='X-Lite release 1014k stamp 47051', fullcontact='sip:105@192.168.128.129:65484;rinstance=44b8b2727d4ff361' WHERE name='105'


UN-REGISTER
-----------

UPDATE sipfriends SET fullcontact='', ipaddr='', port='', regseconds='0', username='', regserver='' WHERE name='105'

UPDATE sipfriends SET ipaddr='0.0.0.0', port='0', regseconds='1231766197', username='X-Lite release 1014k stamp 47051', fullcontact='' WHERE name='105'

By: Leif Madsen (lmadsen) 2009-01-12 12:33:05.000-0600

Some more information that may or may not be handy:

mysql> select name,type,username,fromuser,secret,disallow,allow,host,ipaddr,fullcontact,regseconds,regserver from sipfriends;
+------+--------+----------------------------------+----------+---------+----------+---------------+---------+-----------------+------------------------------------------+------------+-----------+
| name | type   | username                         | fromuser | secret  | disallow | allow         | host    | ipaddr          | fullcontact                              | regseconds | regserver |
+------+--------+----------------------------------+----------+---------+----------+---------------+---------+-----------------+------------------------------------------+------------+-----------+
| 105  | friend | X-Lite release 1014k stamp 47051 | NULL     | welcome | all      | ulaw;alaw;gsm | dynamic | 0.0.0.0         |                                          | 1231766197 |           |
| 101  | friend | 101                              | NULL     | welcome | all      | ulaw;alaw;gsm | dynamic | 192.168.128.129 | sip:101@192.168.128.129:5060;rinstance=8 | 1231521175 |           |
| 100  | friend | 100                              | NULL     | welcome | all      | ulaw;alaw;gsm | dynamic | 192.168.128.129 | sip:100@192.168.128.129:5060;rinstance=b | 1231521175 |           |
+------+--------+----------------------------------+----------+---------+----------+---------------+---------+-----------------+------------------------------------------+------------+-----------+
3 rows in set (0.00 sec)





+------------------+--------------+------+-----+---------+-------+
| Field            | Type         | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+-------+
| name             | varchar(40)  | NO   | PRI |         |       |
| type             | varchar(10)  | NO   |     |         |       |
| username         | varchar(40)  | YES  |     | NULL    |       |
| fromuser         | varchar(40)  | YES  |     | NULL    |       |
| fromdomain       | varchar(40)  | YES  |     | NULL    |       |
| secret           | varchar(40)  | YES  |     | NULL    |       |
| md5secret        | varchar(40)  | YES  |     | NULL    |       |
| auth             | varchar(10)  | YES  |     | NULL    |       |
| mailbox          | varchar(20)  | YES  |     | NULL    |       |
| subscribemwi     | varchar(10)  | YES  |     | NULL    |       |
| vmexten          | varchar(20)  | YES  |     | NULL    |       |
| callerid         | varchar(40)  | YES  |     | NULL    |       |
| cid_number       | varchar(40)  | YES  |     | NULL    |       |
| callingpres      | varchar(20)  | YES  |     | NULL    |       |
| usereqphone      | varchar(10)  | YES  |     | NULL    |       |
| language         | varchar(10)  | YES  |     | NULL    |       |
| incominglimit    | varchar(10)  | YES  |     | NULL    |       |
| context          | varchar(40)  | NO   |     |         |       |
| subscribecontext | varchar(40)  | YES  |     | NULL    |       |
| amaflags         | varchar(20)  | YES  |     | NULL    |       |
| accountcode      | varchar(20)  | YES  |     | NULL    |       |
| musicclass       | varchar(20)  | YES  |     | NULL    |       |
| mohsuggest       | varchar(20)  | YES  |     | NULL    |       |
| allowtransfer    | varchar(20)  | YES  |     | NULL    |       |
| callgroup        | varchar(20)  | YES  |     | NULL    |       |
| pickupgroup      | varchar(20)  | YES  |     | NULL    |       |
| autoframing      | varchar(10)  | YES  |     | NULL    |       |
| disallow         | varchar(20)  | YES  |     | all     |       |
| allow            | varchar(20)  | YES  |     | NULL    |       |
| maxcallbitrate   | varchar(15)  | YES  |     | NULL    |       |
| host             | varchar(40)  | YES  | MUL | dynamic |       |
| outboundproxy    | varchar(40)  | YES  |     | NULL    |       |
| ipaddr           | varchar(20)  | NO   | MUL |         |       |
| defaultip        | varchar(20)  | YES  |     | NULL    |       |
| port             | int(6)       | NO   |     | 0       |       |
| fullcontact      | varchar(40)  | YES  |     | NULL    |       |
| insecure         | varchar(20)  | YES  |     | NULL    |       |
| qualify          | varchar(15)  | YES  |     | NULL    |       |
| regseconds       | int(11)      | NO   |     | 0       |       |
| regexten         | varchar(20)  | YES  |     | NULL    |       |
| regserver        | varchar(20)  | YES  |     | NULL    |       |
| rtptimeout       | varchar(15)  | YES  |     | NULL    |       |
| rtpholdtimeout   | varchar(15)  | YES  |     | NULL    |       |
| rtpkeepalive     | varchar(15)  | YES  |     | NULL    |       |
| setvar           | varchar(200) | YES  |     | NULL    |       |
| lastms           | char(11)     | YES  |     | NULL    |       |
+------------------+--------------+------+-----+---------+-------+

By: Leif Madsen (lmadsen) 2009-01-26 13:45:39.000-0600

Assigning this to myself because I want to follow up on this issue as I believe it is a wider issue with realtime as I was able to reproduce locally, but need to verify it is not some sort of configuration issue.

By: Digium Subversion (svnbot) 2009-01-28 16:47:34.000-0600

Repository: asterisk
Revision: 172131

U   trunk/res/res_config_odbc.c

------------------------------------------------------------------------
r172131 | tilghman | 2009-01-28 16:47:33 -0600 (Wed, 28 Jan 2009) | 7 lines

Fix how we skip fields (to avoid fields which don't exist) when doing an UPDATE.
(closes issue ASTERISK-13332)
Reported by: maxgo
Patches:
      20090128__bug14205__5.diff.txt uploaded by Corydon76 (license 14)
Tested by: blitzrage

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

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

By: Digium Subversion (svnbot) 2009-01-28 16:52:04.000-0600

Repository: asterisk
Revision: 172133

_U  branches/1.6.1/
U   branches/1.6.1/res/res_config_odbc.c

------------------------------------------------------------------------
r172133 | tilghman | 2009-01-28 16:52:04 -0600 (Wed, 28 Jan 2009) | 14 lines

Merged revisions 172131 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r172131 | tilghman | 2009-01-28 16:48:01 -0600 (Wed, 28 Jan 2009) | 7 lines
 
 Fix how we skip fields (to avoid fields which don't exist) when doing an UPDATE.
 (closes issue ASTERISK-13332)
  Reported by: maxgo
  Patches:
        20090128__bug14205__5.diff.txt uploaded by Corydon76 (license 14)
  Tested by: blitzrage
........

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

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