Changeset 4455


Ignore:
Timestamp:
Apr 3, 2013 12:54:37 AM (6 years ago)
Author:
bennylp
Message:

Fixed #1651: incoming CANCEL request is not reported in any callbacks

File:
1 edited

Legend:

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

    r4441 r4455  
    624624    (*inv_state_handler[inv->state])(inv, e); 
    625625 
    626     /* Call on_tsx_state */ 
    627     if (mod_inv.cb.on_tsx_state_changed && inv->notify) 
     626    /* Call on_tsx_state. CANCEL request is a special case and has been 
     627     * reported earlier in inv_respond_incoming_cancel() 
     628     */ 
     629    if (mod_inv.cb.on_tsx_state_changed && inv->notify && 
     630        !(tsx->method.id==PJSIP_CANCEL_METHOD && 
     631          e->body.tsx_state.type==PJSIP_EVENT_RX_MSG)) 
     632    { 
    628633        (*mod_inv.cb.on_tsx_state_changed)(inv, tsx, e); 
     634    } 
    629635 
    630636    /* Clear invite transaction when tsx is confirmed. 
     
    28552861static void inv_respond_incoming_cancel(pjsip_inv_session *inv, 
    28562862                                        pjsip_transaction *cancel_tsx, 
    2857                                         pjsip_rx_data *rdata) 
     2863                                        pjsip_event *e) 
    28582864{ 
    28592865    pjsip_tx_data *tdata; 
    28602866    pjsip_transaction *invite_tsx; 
     2867    pjsip_rx_data *rdata; 
    28612868    pj_str_t key; 
    28622869    pj_status_t status; 
     2870 
     2871    pj_assert(e->body.tsx_state.type == PJSIP_EVENT_RX_MSG); 
     2872    rdata = e->body.tsx_state.src.rdata; 
     2873 
     2874    /* https://trac.pjsip.org/repos/ticket/1651 
     2875     * Special treatment for CANCEL. Since here we're responding to CANCEL 
     2876     * automatically (including 487 to INVITE), application will see the 
     2877     * 200/OK response to CANCEL first in the callback, and then 487 to 
     2878     * INVITE, before the CANCEL request itself. And worse, pjsua application 
     2879     * may not see the CANCEL request at all because by the time the CANCEL 
     2880     * request is reported, call has been disconnected and further events 
     2881     * from the INVITE session has been suppressed. 
     2882     */ 
     2883    if (mod_inv.cb.on_tsx_state_changed && inv->notify) 
     2884        (*mod_inv.cb.on_tsx_state_changed)(inv, cancel_tsx, e); 
    28632885 
    28642886    /* See if we have matching INVITE server transaction: */ 
     
    37553777         */ 
    37563778 
    3757         inv_respond_incoming_cancel(inv, tsx, e->body.tsx_state.src.rdata); 
     3779        inv_respond_incoming_cancel(inv, tsx, e); 
    37583780 
    37593781    } 
     
    38793901         */ 
    38803902 
    3881         inv_respond_incoming_cancel(inv, tsx, e->body.tsx_state.src.rdata); 
     3903        inv_respond_incoming_cancel(inv, tsx, e); 
    38823904 
    38833905    } else if (tsx->role == PJSIP_ROLE_UAS && 
Note: See TracChangeset for help on using the changeset viewer.