From b6b6ff95f348d4812f1b274141eb290cb849980e Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Wed, 13 Sep 2006 22:45:38 +0000 Subject: Fixed bug in event subscription: for event subscriptions established by non-SUBSCRIBE method (such as REFER), the method to refresh/unsubscribe subscription would still be SUBSCRIBE, not the initial method to establish subscription. There's no known ill effect of this bug (that I know of), but it's still important that this one has been fixed. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@712 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip-simple/evsub.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pjsip/src/pjsip-simple/evsub.c b/pjsip/src/pjsip-simple/evsub.c index a6f6b2ca..a69409de 100644 --- a/pjsip/src/pjsip-simple/evsub.c +++ b/pjsip/src/pjsip-simple/evsub.c @@ -590,7 +590,7 @@ static void on_timer( pj_timer_heap_t *timer_heap, pj_status_t status; PJ_LOG(5,(sub->obj_name, "Refreshing subscription.")); - status = pjsip_evsub_initiate(sub, &sub->method, + status = pjsip_evsub_initiate(sub, NULL, sub->expires->ivalue, &tdata); if (status == PJ_SUCCESS) @@ -632,7 +632,7 @@ static void on_timer( pj_timer_heap_t *timer_heap, "Timeout waiting for subsequent NOTIFY (we did " "send non-2xx response for previous NOTIFY). " "Unsubscribing..")); - status = pjsip_evsub_initiate( sub, &sub->method, 0, &tdata); + status = pjsip_evsub_initiate( sub, NULL, 0, &tdata); if (status == PJ_SUCCESS) pjsip_evsub_send_request(sub, tdata); } @@ -1363,15 +1363,15 @@ static pjsip_evsub *on_new_transaction( pjsip_transaction *tsx, */ if (tsx->role == PJSIP_ROLE_UAC && tsx->state == PJSIP_TSX_STATE_CALLING && - pjsip_method_cmp(&tsx->method, &sub->method) == 0) + (pjsip_method_cmp(&tsx->method, &sub->method) == 0 || + pjsip_method_cmp(&tsx->method, &pjsip_subscribe_method) == 0)) { if (sub->pending_sub && sub->pending_sub->state < PJSIP_TSX_STATE_COMPLETED) { PJ_LOG(4,(sub->obj_name, - "Cancelling pending %.*s request", - (int)sub->method.name.slen, sub->method.name.ptr)); + "Cancelling pending subscription request")); /* By convention, we use 490 (Request Updated) status code. * When transaction handler (below) see this status code, it @@ -1470,7 +1470,9 @@ static void on_tsx_state_uac( pjsip_evsub *sub, pjsip_transaction *tsx, pjsip_event *event ) { - if (pjsip_method_cmp(&tsx->method, &sub->method)==0) { + if (pjsip_method_cmp(&tsx->method, &sub->method)==0 || + pjsip_method_cmp(&tsx->method, &pjsip_subscribe_method)==0) + { /* Received response to outgoing request that establishes/refresh * subscription. @@ -1764,7 +1766,9 @@ static void on_tsx_state_uas( pjsip_evsub *sub, pjsip_transaction *tsx, pjsip_event *event) { - if (pjsip_method_cmp(&tsx->method, &sub->method) == 0) { + if (pjsip_method_cmp(&tsx->method, &sub->method) == 0 || + pjsip_method_cmp(&tsx->method, &pjsip_subscribe_method) == 0) + { /* * Incoming request (e.g. SUBSCRIBE or REFER) to refresh subsciption. -- cgit v1.2.3