[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r323515 - in /team/irroot/dist...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jun 15 04:21:06 CDT 2011
Author: irroot
Date: Wed Jun 15 04:21:00 2011
New Revision: 323515
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=323515
Log:
Fix MWI ASTERISK-18002 ASTERISK-17866
Modified:
team/irroot/distrotech-customers-1.8/channels/chan_sip.c
team/irroot/distrotech-customers-1.8/main/event.c
Modified: team/irroot/distrotech-customers-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/channels/chan_sip.c?view=diff&rev=323515&r1=323514&r2=323515
==============================================================================
--- team/irroot/distrotech-customers-1.8/channels/chan_sip.c (original)
+++ team/irroot/distrotech-customers-1.8/channels/chan_sip.c Wed Jun 15 04:21:00 2011
@@ -4886,6 +4886,7 @@
unref_peer(p, "Wrong type of realtime SIP endpoint");
return NULL;
}
+ sip_send_mwi_to_peer(p, NULL, 0);
break;
case FINDALLDEVICES:
break;
@@ -14376,6 +14377,7 @@
}
if (!res) {
ast_devstate_changed(AST_DEVICE_UNKNOWN, "SIP/%s", peer->name);
+ sip_send_mwi_to_peer(peer, NULL, 0);
}
if (res < 0) {
switch (res) {
@@ -23961,7 +23963,7 @@
}
p->subscribed = MWI_NOTIFICATION;
- if (ast_test_flag(&authpeer->flags[1], SIP_PAGE2_SUBSCRIBEMWIONLY)) {
+ if (!ast_test_flag(&authpeer->flags[1], SIP_PAGE2_SUBSCRIBEMWIONLY)) {
add_peer_mwi_subs(authpeer);
}
if (authpeer->mwipvt && authpeer->mwipvt != p) { /* Destroy old PVT if this is a new one */
@@ -24811,6 +24813,7 @@
/* Send MWI */
ast_set_flag(&p->flags[0], SIP_OUTGOING);
+ peer->lastmsgssent = ((newmsgs > 0x7fff ? 0x7fff0000 : (newmsgs << 16)) | (oldmsgs > 0xffff ? 0xffff : oldmsgs));
/* the following will decrement the refcount on p as it finishes */
transmit_notify_with_mwi(p, newmsgs, oldmsgs, peer->vmexten);
dialog_unref(p, "unref dialog ptr p just before it goes out of scope at the end of sip_send_mwi_to_peer.");
Modified: team/irroot/distrotech-customers-1.8/main/event.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/main/event.c?view=diff&rev=323515&r1=323514&r2=323515
==============================================================================
--- team/irroot/distrotech-customers-1.8/main/event.c (original)
+++ team/irroot/distrotech-customers-1.8/main/event.c Wed Jun 15 04:21:00 2011
@@ -444,12 +444,14 @@
};
const enum ast_event_type event_types[] = { type, AST_EVENT_ALL };
int i;
+ int want_specific_event;/* TRUE if looking for subscribers wanting specific parameters. */
if (type >= AST_EVENT_TOTAL) {
ast_log(LOG_ERROR, "%u is an invalid type!\n", type);
return res;
}
+ want_specific_event = 0;
va_start(ap, type);
for (ie_type = va_arg(ap, enum ast_event_ie_type);
ie_type != AST_EVENT_IE_END;
@@ -492,6 +494,7 @@
}
if (insert) {
+ want_specific_event = 1;
AST_LIST_INSERT_TAIL(&check_ie_vals.ie_vals, ie_value, entry);
} else {
ast_log(LOG_WARNING, "Unsupported PLTYPE(%d)\n", ie_value->ie_pltype);
@@ -501,17 +504,22 @@
for (i = 0; i < ARRAY_LEN(event_types); i++) {
AST_RWDLLIST_RDLOCK(&ast_event_subs[event_types[i]]);
- AST_RWDLLIST_TRAVERSE(&ast_event_subs[event_types[i]], sub, entry) {
- AST_LIST_TRAVERSE(&sub->ie_vals, ie_val, entry) {
- if (!match_sub_ie_val_to_event(ie_val, &check_ie_vals)) {
- /* The current subscription ie did not match an event ie. */
+ if (want_specific_event) {
+ AST_RWDLLIST_TRAVERSE(&ast_event_subs[event_types[i]], sub, entry) {
+ AST_LIST_TRAVERSE(&sub->ie_vals, ie_val, entry) {
+ if (!match_sub_ie_val_to_event(ie_val, &check_ie_vals)) {
+ /* The current subscription ie did not match an event ie. */
+ break;
+ }
+ }
+ if (!ie_val) {
+ /* Everything matched. A subscriber is looking for this event. */
break;
}
}
- if (!ie_val) {
- /* Everything matched. A subscriber is looking for this event. */
- break;
- }
+ } else {
+ /* Just looking to see if there are ANY subscribers to the event type. */
+ sub = AST_RWLIST_FIRST(&ast_event_subs[event_types[i]]);
}
AST_RWDLLIST_UNLOCK(&ast_event_subs[event_types[i]]);
if (sub) {
More information about the asterisk-commits
mailing list