[svn-commits] trunk - r7514 in /trunk: ./ channels/chan_sip.c
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Fri Dec 16 21:45:26 CST 2005
Author: kpfleming
Date: Fri Dec 16 21:45:25 2005
New Revision: 7514
URL: http://svn.digium.com/view/asterisk?rev=7514&view=rev
Log:
Merged revisions 7513 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7513 | kpfleming | 2005-12-16 21:44:30 -0600 (Fri, 16 Dec 2005) | 2 lines
forcibly expire previous subscriptions from a peer when they resubscribe (keeps them from building up and waiting for expiration, and stops us sending unwanted NOTIFY messages to devices)
........
Modified:
trunk/ (props changed)
trunk/channels/chan_sip.c
Propchange: trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Dec 16 21:45:25 2005
@@ -1,1 +1,1 @@
-/branches/1.2:1-7489,7491-7496,7498-7511
+/branches/1.2:1-7489,7491-7496,7498-7513
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=7514&r1=7513&r2=7514&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Dec 16 21:45:25 2005
@@ -10799,12 +10799,40 @@
ast_set_flag(p, SIP_NEEDDESTROY);
return 0;
} else {
+ struct sip_pvt *p_old;
+
transmit_response(p, "200 OK", req);
transmit_state_notify(p, firststate, 1, 1); /* Send first notification */
append_history(p, "Subscribestatus", ast_extension_state2str(firststate));
+
+ /* remove any old subscription from this peer for the same exten/context,
+ as the peer has obviously forgotten about it and it's wasteful to wait
+ for it to expire and send NOTIFY messages to the peer only to have them
+ ignored (or generate errors)
+ */
+ ast_mutex_lock(&iflock);
+ for (p_old = iflist; p_old; p_old = p_old->next) {
+ if (p_old == p)
+ continue;
+ if (p_old->initreq.method != SIP_SUBSCRIBE)
+ continue;
+ if (p_old->subscribed == NONE)
+ continue;
+ ast_mutex_lock(&p_old->lock);
+ if (!strcmp(p_old->username, p->username)) {
+ if (!strcmp(p_old->exten, p->exten) &&
+ !strcmp(p_old->context, p->context)) {
+ ast_set_flag(p_old, SIP_NEEDDESTROY);
+ ast_mutex_unlock(&p_old->lock);
+ break;
+ }
+ }
+ ast_mutex_unlock(&p_old->lock);
+ }
+ ast_mutex_unlock(&iflock);
}
if (!p->expiry)
- ast_set_flag(p, SIP_NEEDDESTROY);
+ ast_set_flag(p, SIP_NEEDDESTROY);
}
return 1;
}
More information about the svn-commits
mailing list