Summary:ASTERISK-11187: Register statement works differently using the plain text file or the Asterisk Realtime Architecture
Reporter:alexb (alexb)Labels:
Date Opened:2008-01-09 12:23:09.000-0600Date Closed:2008-01-15 11:44:10.000-0600
Versions:Frequency of
Description:In Asterisk 1.2.26 there is a different behaviour for the following syntax of register statement using the plain text file or the Asterisk Realtime Architecture:

register = **user**:**password**@sip_proxy

Please have a look at sip.conf:

allowoverlap = yes
realm = *****
bindport = 5060
bindaddr =
srvlookup = yes
tos = lowdelay
disallow = all
allow = alaw
trustrpid = no
dtmfmode = auto
externip = ***.***.***.***
localnet =
canreinvite = yes
rtcachefriends = yes
qualify = yes
register = **user**:**password**@sip_proxy


It looks like the example in sip.conf.sample (see below) and of course it works like a charm in Asterisk 1.2.26 as well as previous versions.

;register => 2345:password@sip_proxy/1234
;    Register 2345 at sip provider 'sip_proxy'.  Calls from this provider
;    connect to local extension 1234 in extensions.conf, default context,
;    unless you configure a [sip_proxy] section below, and configure a
;    context.
;    Tip 1: Avoid assigning hostname to a sip.conf section like [provider.com]
;    Tip 2: Use separate type=peer and type=user sections for SIP providers
;           (instead of type=friend) if you have calls in both directions

; For incoming calls only. Example: FWD (Free World Dialup)
; We match on IP address of the proxy for incoming calls
; since we can not match on username (caller id)

;type=peer                              ; we only want to call out, not be called
;username=yourusername                  ; Authentication user for outbound proxies
;fromuser=yourusername                  ; Many SIP providers require this!
;usereqphone=yes                        ; This provider requires ";user=phone" on URI
;call-limit=5                           ; permit only 5 simultaneous outgoing calls to this peer
;outboundproxy=proxy.provider.domain    ; send outbound signaling to this proxy, not directly to the peer
;port=80                                ; The port number we want to connect to on the remote side

Unfortunately, using ARA (see mappings below) of Asterisk 1.2.26, the register statement doesn't work anymore.

sip.conf => mysql,asterisk,ast_config
sipusers => mysql,asterisk,sip_buddies
sippeers => mysql,asterisk,sip_buddies

It is because the following query returns no rows:

[15:22] Alex: res_config_mysql.c:140 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM sip_buddies WHERE name = 'sip_proxy' AND host = 'dynamic'

Since we're trying to register to a remote server, host can't be dynamic! However no more queries are performed.

In Asterisk 1.2.25 the query was:
[15:21] Alex: res_config_mysql.c:140 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM sip_buddies WHERE name = 'sip_proxy'

This way Asterisk 1.2.26 can't register to the remote server and/or dial that peer.
Comments:By: snuffy (snuffy) 2008-01-10 02:20:02.000-0600

AlexB asterisk 1.2 is in security releases only, if you can reproduce this problem in 1.4 fine but otherwise i'm sorry this bug will not be fixed.

By: alexb (alexb) 2008-01-10 06:10:28.000-0600

snuffy I know Asterisk 1.2 is in security releases only, however I think that security fixes shouldn't break existing working code - just to put it simply, ARA doesn't work at all in Asterisk 1.2.26.

Anyway next week I'll try to reproduce this problem in 1.4 too and then let you know.

By: Jason Parker (jparker) 2008-01-15 11:44:09.000-0600

Please reopen if you can reproduce on the latest version of 1.4.