[asterisk-bugs] [JIRA] (ASTERISK-23542) Dynamic realtime SIP peers using callbackextension will not register after a 'sip reload' where sip.conf has changed

Michael L. Young (JIRA) noreply at issues.asterisk.org
Thu Aug 7 22:32:30 CDT 2014


    [ https://issues.asterisk.org/jira/browse/ASTERISK-23542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=221448#comment-221448 ] 

Michael L. Young commented on ASTERISK-23542:
---------------------------------------------

What I have found:

The registry object counter is being decremented incorrectly.  In a case where you have 3 peers (one is dynamic realtime with callbackextension and the other 2 are static register=> lines), the counter initially goes to 3 but then becomes 2 after the realtime peer is loaded into memory from the db.  At a reload, the counter is decremented as the registries are destroyed resulting in the counter becoming -1.  Then the config is loaded up, the counter is at 2 and then goes down to 1.  At the next reload, the registries are destroyed and the counter becomes -2.  Upon loading the register entries, it becomes 1 and then goes to 0.  With the next reload, the counter ends up being -3 when destroying the registries, goes up to 0 and therefore when the function to send sip registers is called, it sees the counter is at 0 and returns without registering any peer.

It would appear that when dynamic realtime is involved, the peer is built.  During the build, it sees there is a callback extension and adds a registry entry when sip_register is called.  When register_realtime_peers_with_callbackextens() is called, the peer is built, loaded into memory and sip_register is called again for the same peer because it has callbackextension set.  sip_register() finds a registry object entry already, and proceeds to throw away the reference.  The registry object counter is never incremented.  The "reg" object that was setup by calling ASTOBJ_INIT is un-referenced by calling registry_unref().  Inside of that function, the registry object counter is decremented, resulting in the problem with the counter.

The patch that I am going to attach fixes the issue.  It is simple and takes care of the counter.  But, I don't like to increment the counter when the registry entry is never linked into the list.  It doesn't seem the right thing to do.  I was attempting to focus on fixing the double call to sip_register for the same dynamic realtime peer with callbackextension but was hitting a mental block right now.  Feedback is welcomed.

> Dynamic realtime SIP peers using callbackextension will not register after a 'sip reload' where sip.conf has changed
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-23542
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23542
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_config_odbc, Resources/res_odbc, Resources/res_realtime
>    Affects Versions: SVN, 11.4.0, 11.8.1
>         Environment: Debian Wheezy 64 bits
>            Reporter: Jay Jideliov
>            Severity: Critical
>         Attachments: asterisk-23542-regobj-counter_11_v1.diff, full.txt
>
>
> Originally reported here: ASTERISK-22026
> But closed due to inactivity.
> I am now experiencing the same issue, and have attached a full log to this ticket.
> ______________________________________________________________________
> When i use peers in realtime with option callbackextension after "sip reload" the peer change to "unregister" and stay.
> If i restart asterisk or unload/load chan_sip works again
> {noformat}
> debian*CLI> sip show registry 
> Host                                    dnsmgr Username       Refresh State                Reg.Time                 
> xxxxxxxxxxxx:5060                        Y      xxxx              160 Registered           Sat, 06 Jul 2013 10:31:41
> 1 SIP registration.
> debian*CLI> sip reload
>  Reloading SIP
>   == Parsing '/etc/asterisk/sip.conf': Found
> debian*CLI> sip show registry
> Host                                    dnsmgr Username       Refresh State                Reg.Time                 
> xxxxxxxxxxxx:5060                        N      xxxxx              120 Unregistered                                  
> {noformat}                   
> Thanks



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list