summaryrefslogtreecommitdiff
path: root/res/res_pjsip_pubsub.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2013-08-29 22:26:03 +0000
committerMark Michelson <mmichelson@digium.com>2013-08-29 22:26:03 +0000
commit8990924953be29d679de2b373e47d680e04ba85b (patch)
treea3245ce3ed3dfc0e82958f749d0f0cabddcae805 /res/res_pjsip_pubsub.c
parentde7ce39187f4cc22ded82a7b10cad1aa7654dfb0 (diff)
Fix when the subscription_terminated callback is called for subscription handlers.
The previous placement would result in the resubscribe() callback called instead of the subscription_terminated() callback being called when a subscription was ended via a SUBSCRIBE request. This would result in confusing PJSIP and having it throw an assertion. ........ Merged revisions 397955 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_pubsub.c')
-rw-r--r--res/res_pjsip_pubsub.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index ae31f5c95..ecc005996 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -962,15 +962,6 @@ static void pubsub_on_evsub_state(pjsip_evsub *evsub, pjsip_event *event)
return;
}
- if (event->type == PJSIP_EVENT_RX_MSG) {
- sub->handler->subscription_terminated(sub, event->body.rx_msg.rdata);
- }
-
- if (event->type == PJSIP_EVENT_TSX_STATE &&
- event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
- sub->handler->subscription_terminated(sub, event->body.tsx_state.src.rdata);
- }
-
if (sub->handler->subscription_shutdown) {
sub->handler->subscription_shutdown(sub);
}
@@ -1052,6 +1043,11 @@ static void pubsub_on_rx_refresh(pjsip_evsub *evsub, pjsip_rx_data *rdata,
return;
}
+ if (pjsip_evsub_get_state(sub->evsub) == PJSIP_EVSUB_STATE_TERMINATED) {
+ sub->handler->subscription_terminated(sub, rdata);
+ return;
+ }
+
sub->handler->resubscribe(sub, rdata, &response_data);
if (!response_data_changed(&response_data)) {