Changeset 1319 for pjproject


Ignore:
Timestamp:
May 30, 2007 4:26:40 AM (18 years ago)
Author:
bennylp
Message:

Fixed ticket #302: Behavior in cancelling INVITE session when no provisional response has been received (thanks Esbjörn Dominique)

Location:
pjproject/trunk/pjsip
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip-ua/sip_inv.h

    r1287 r1319  
    224224    pj_pool_t           *pool;                      /**< Dialog's pool.     */ 
    225225    pjsip_inv_state      state;                     /**< Invite sess state. */ 
    226     pj_bool_t            cancelling;                /**< CANCEL sent?       */ 
     226    pj_bool_t            cancelling;                /**< CANCEL requested   */ 
     227    pj_bool_t            pending_cancel;            /**< Wait to send CANCEL*/ 
    227228    pjsip_status_code    cause;                     /**< Disconnect cause.  */ 
    228229    pj_str_t             cause_text;                /**< Cause text.        */ 
  • pjproject/trunk/pjsip/include/pjsip/sip_transaction.h

    r1210 r1319  
    298298 
    299299/** 
     300 * Cease retransmission on the UAC transaction. The UAC transaction is 
     301 * still considered running, and it will complete when either final 
     302 * response is received or the transaction times out. 
     303 * 
     304 * This operation normally is used for INVITE transaction only, when 
     305 * the transaction is cancelled before any provisional response has been 
     306 * received. 
     307 */ 
     308PJ_DECL(pj_status_t) pjsip_tsx_stop_retransmit(pjsip_transaction *tsx); 
     309 
     310 
     311/** 
    300312 * Get the transaction instance in the incoming message. If the message 
    301313 * has a corresponding transaction, this function will return non NULL 
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c

    r1287 r1319  
    15131513            if (inv->invite_tsx->status_code < 100) { 
    15141514 
    1515                 pjsip_tsx_terminate(inv->invite_tsx, 487); 
     1515                pjsip_tsx_stop_retransmit(inv->invite_tsx); 
     1516                inv->cancelling = PJ_TRUE; 
     1517                inv->pending_cancel = PJ_TRUE; 
    15161518                *p_tdata = NULL; 
     1519                PJ_LOG(4, (inv->obj_name, "Stopping retransmission, " 
     1520                           "delaying CANCEL")); 
    15171521                return PJ_SUCCESS; 
    15181522            } 
     
    19261930 
    19271931        case PJSIP_TSX_STATE_PROCEEDING: 
     1932            if (inv->pending_cancel) { 
     1933                pjsip_tx_data *cancel; 
     1934 
     1935                inv->pending_cancel = PJ_FALSE; 
     1936 
     1937                status = pjsip_inv_end_session(inv, 487, NULL, &cancel); 
     1938                if (status == PJ_SUCCESS && cancel) 
     1939                    status = pjsip_inv_send_msg(inv, cancel); 
     1940            } 
     1941 
    19281942            if (dlg->remote.info->tag.slen) { 
    19291943 
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r1250 r1319  
    14201420    struct tsx_lock_data lck; 
    14211421 
     1422    PJ_ASSERT_RETURN(tsx != NULL, PJ_EINVAL); 
     1423 
    14221424    PJ_LOG(5,(tsx->obj_name, "Request to terminate transaction")); 
    14231425 
    1424     PJ_ASSERT_RETURN(tsx != NULL, PJ_EINVAL); 
    14251426    PJ_ASSERT_RETURN(code >= 200, PJ_EINVAL); 
    14261427 
     
    14311432    tsx_set_status_code(tsx, code, NULL); 
    14321433    tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, PJSIP_EVENT_USER, NULL); 
     1434    unlock_tsx(tsx, &lck); 
     1435 
     1436    return PJ_SUCCESS; 
     1437} 
     1438 
     1439 
     1440/* 
     1441 * Cease retransmission on the UAC transaction. The UAC transaction is 
     1442 * still considered running, and it will complete when either final 
     1443 * response is received or the transaction times out. 
     1444 */ 
     1445PJ_DEF(pj_status_t) pjsip_tsx_stop_retransmit(pjsip_transaction *tsx) 
     1446{ 
     1447    struct tsx_lock_data lck; 
     1448 
     1449    PJ_ASSERT_RETURN(tsx != NULL, PJ_EINVAL); 
     1450    PJ_ASSERT_RETURN(tsx->role == PJSIP_ROLE_UAC && 
     1451                     tsx->method.id == PJSIP_INVITE_METHOD, 
     1452                     PJ_EINVALIDOP); 
     1453 
     1454    PJ_LOG(5,(tsx->obj_name, "Request to stop retransmission")); 
     1455 
     1456    lock_tsx(tsx, &lck); 
     1457    /* Cancel retransmission timer. */ 
     1458    if (tsx->retransmit_timer.id != 0) { 
     1459        pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 
     1460        tsx->retransmit_timer.id = 0; 
     1461    } 
    14331462    unlock_tsx(tsx, &lck); 
    14341463 
Note: See TracChangeset for help on using the changeset viewer.