[asterisk-dev] question about handle_request_subscribe in chan_sip.c V1.6.2

Stefan Schmidt sst at sil.at
Wed Sep 1 12:44:09 CDT 2010


hello,

i´ve found something i didnt understand in the handle_request_subscribe 
function.

After some parsing and checks on row 21622 
(http://www.asterisk.org/doxygen/asterisk1.6.2/chan__sip_8c-source.html#l21622) 
i would read this row like this:

if its not a MWI subscription and not a renew of an existing subscribe 
then check if there is allready an old stateid (which means an old 
callback to notify) then delete this old callback.
after this a new callback to notify p is set if the exten in context of 
p does a statechange and the return value is saved in p->stateid.

if i am right so far, then i dont understand why further down on row 
21683 the whole ao2 container is looped through to find old dialogs for 
this peer. if there is no callback for this dialogs, there wouldnt be a 
notify send to them, so they will just timeout after their expire time?

have i missed something or is this iterating through the dialog 
container just to remove old subscribe dialogs for this peer and this 
exten at context which will took more than 10 ms on every subscribe if 
there are more than 500 open sip dialogs.

best regards

steve smith



More information about the asterisk-dev mailing list