Changeset 2750


Ignore:
Timestamp:
Jun 4, 2009 10:16:47 PM (10 years ago)
Author:
bennylp
Message:

Ticket #860:

  • will send SUBSCRIBE to refresh REFER subscription (not REFER!), only when required (such as when call transfer is running for longer than REFER subscription expiration, hence need to be refreshed)
  • replaced hardcoded REFER subscription duration (600s) with a macro, PJSIP_XFER_EXPIRES.
  • when NOTIFY with "200 OK" sipfrag body is received and subscription state is not terminated, send SUBSCRIBE with Expires=0 to terminate the REFER subscription
  • for transferee, terminate the subscription in CONNECTING state and not in CONFIRMED state. Terminating the subscription in CONFIRMED state causes redundant NOTIFYs with "200 OK" sipfrag body to be sent, one with active subscription and another with terminated state.
Location:
pjproject/trunk/pjsip/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_xfer.c

    r2394 r2750  
    2929#include <pj/string.h> 
    3030 
     31/* Subscription expiration */ 
     32#ifndef PJSIP_XFER_EXPIRES 
     33#   define PJSIP_XFER_EXPIRES       600 
     34#endif 
     35 
    3136 
    3237/* 
     
    155160        return status; 
    156161 
    157     status = pjsip_evsub_register_pkg( &mod_xfer, &STR_REFER, 300, 1, &accept); 
     162    status = pjsip_evsub_register_pkg(&mod_xfer, &STR_REFER,  
     163                                      PJSIP_XFER_EXPIRES, 1, &accept); 
    158164    if (status != PJ_SUCCESS) 
    159165        return status; 
     
    587593        pjsip_tx_data *tdata; 
    588594 
    589         status = pjsip_xfer_initiate(sub, NULL, &tdata); 
     595        status = pjsip_evsub_initiate(sub, NULL, PJSIP_XFER_EXPIRES, &tdata); 
    590596        if (status == PJ_SUCCESS) 
    591597            pjsip_xfer_send_request(sub, tdata); 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r2724 r2750  
    29022902        case PJSIP_INV_STATE_CONNECTING: 
    29032903            st_code = e->body.tsx_state.tsx->status_code; 
    2904             ev_state = PJSIP_EVSUB_STATE_ACTIVE; 
     2904            if (call->inv->state == PJSIP_INV_STATE_CONNECTING) 
     2905                ev_state = PJSIP_EVSUB_STATE_TERMINATED; 
     2906            else 
     2907                ev_state = PJSIP_EVSUB_STATE_ACTIVE; 
    29052908            break; 
    29062909 
     2910#if 0 
     2911/* We don't need this, as we've terminated the subscription in 
     2912 * CONNECTING state. 
     2913 */ 
    29072914        case PJSIP_INV_STATE_CONFIRMED: 
    29082915            /* When state is confirmed, send the final 200/OK and terminate 
     
    29122919            ev_state = PJSIP_EVSUB_STATE_TERMINATED; 
    29132920            break; 
     2921#endif 
    29142922 
    29152923        case PJSIP_INV_STATE_DISCONNECTED: 
     
    34563464        if (!cont) { 
    34573465            pjsip_evsub_set_mod_data(sub, pjsua_var.mod.id, NULL); 
     3466        } 
     3467 
     3468        /* If the call transfer has completed but the subscription is 
     3469         * not terminated, terminate it now. 
     3470         */ 
     3471        if (status_line.code/100 == 2 && !is_last) { 
     3472            pjsip_tx_data *tdata; 
     3473 
     3474            status = pjsip_evsub_initiate(sub, &pjsip_subscribe_method,  
     3475                                          0, &tdata); 
     3476            if (status == PJ_SUCCESS) 
     3477                status = pjsip_evsub_send_request(sub, tdata); 
    34583478        } 
    34593479    } 
     
    37353755    } 
    37363756 
     3757    if (call->inv == NULL) { 
     3758        /* Shouldn't happen. It happens only when we don't terminate the 
     3759         * server subscription caused by REFER after the call has been 
     3760         * transfered (and this call has been disconnected), and we 
     3761         * receive another REFER for this call. 
     3762         */ 
     3763        PJSUA_UNLOCK(); 
     3764        return; 
     3765    } 
     3766 
    37373767    /* Notify application callback first */ 
    37383768    if (pjsua_var.ua_cfg.cb.on_call_tsx_state) { 
Note: See TracChangeset for help on using the changeset viewer.