Changeset 979 for pjproject/trunk


Ignore:
Timestamp:
Feb 19, 2007 4:55:42 PM (18 years ago)
Author:
bennylp
Message:

Fixed ticket #111: workaround for forking dialog

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip/sip_dialog.h

    r974 r979  
    125125    pjsip_dlg_party     remote;     /**< Remote party info.                 */ 
    126126    pjsip_role_e        role;       /**< Initial role.                      */ 
     127    pj_bool_t           uac_has_2xx;/**< UAC has received 2xx response?     */ 
    127128    pj_bool_t           secure;     /**< Use secure transport?              */ 
    128129    pjsip_cid_hdr      *call_id;    /**< Call-ID header.                    */ 
  • pjproject/trunk/pjsip/src/pjsip/sip_dialog.c

    r974 r979  
    15191519    /* When we receive response that establishes dialog, update To tag,  
    15201520     * route set and dialog target. 
    1521      */ 
    1522     if (dlg->state == PJSIP_DIALOG_STATE_NULL &&  
    1523         pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) && 
    1524         (res_code > 100 && res_code < 300) && 
    1525         rdata->msg_info.to->tag.slen) 
     1521     * 
     1522     * The second condition of the "if" is a workaround for forking. 
     1523     * Originally, the dialog takes the first To tag seen and set it as 
     1524     * the remote tag. If the tag in 2xx response is different than this 
     1525     * tag, ACK will be sent with wrong To tag and incoming request with 
     1526     * this tag will be rejected with 481. 
     1527     * 
     1528     * The workaround for this is to take the To tag received in the 
     1529     * 2xx response and set it as remote tag. 
     1530     */ 
     1531    if ((dlg->state == PJSIP_DIALOG_STATE_NULL &&  
     1532         pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) && 
     1533         (res_code > 100 && res_code < 300) && 
     1534         rdata->msg_info.to->tag.slen)  
     1535         || 
     1536        (dlg->role==PJSIP_ROLE_UAC && 
     1537         !dlg->uac_has_2xx && 
     1538         res_code/100 == 2 && 
     1539         pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) && 
     1540         pj_strcmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag))) 
    15261541    { 
    15271542        pjsip_hdr *hdr, *end_hdr; 
     
    15641579 
    15651580        dlg->state = PJSIP_DIALOG_STATE_ESTABLISHED; 
     1581 
     1582        /* Prevent dialog from being updated just in case more 2xx 
     1583         * gets through this dialog (it shouldn't happen). 
     1584         */ 
     1585        if (dlg->role==PJSIP_ROLE_UAC && !dlg->uac_has_2xx &&  
     1586            res_code/100==2)  
     1587        { 
     1588            dlg->uac_has_2xx = PJ_TRUE; 
     1589        } 
    15661590    } 
    15671591 
Note: See TracChangeset for help on using the changeset viewer.