Changeset 5495 for pjproject


Ignore:
Timestamp:
Dec 7, 2016 3:33:35 AM (7 years ago)
Author:
ming
Message:

Fixed #1985: Escape '@' character in the Replaces parameter of REFER request

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r5493 r5495  
    28702870    pj_str_t str_dest; 
    28712871    int len; 
     2872    char call_id_dest_buf[PJSIP_MAX_URL_SIZE * 2]; 
     2873    int call_id_len; 
    28722874    pjsip_uri *uri; 
    28732875    pj_status_t status; 
     2876    const pjsip_parser_const_t *pconst; 
    28742877 
    28752878 
     
    29162919 
    29172920    str_dest.slen += len; 
    2918  
     2921         
     2922    /* This uses the the same scanner definition used for SIP parsing  
     2923     * to escape the call-id in the refer. 
     2924     * 
     2925     * A common pattern for call-ids is: name@domain. The '@' character,  
     2926     * when used in a URL parameter, throws off many SIP parsers.  
     2927     * URL escape it based off of the allowed characters for header values. 
     2928    */ 
     2929    pconst = pjsip_parser_const();       
     2930    call_id_len = pj_strncpy2_escape(call_id_dest_buf, &dest_dlg->call_id->id, 
     2931                                     PJ_ARRAY_SIZE(call_id_dest_buf), 
     2932                                     &pconst->pjsip_HDR_CHAR_SPEC); 
     2933    if (call_id_len < 0) { 
     2934        status = PJSIP_EURITOOLONG; 
     2935        goto on_error; 
     2936    } 
    29192937 
    29202938    /* Build the URI */ 
     
    29272945                           ((options&PJSUA_XFER_NO_REQUIRE_REPLACES) ? 
    29282946                            "" : "Require=replaces&"), 
    2929                            (int)dest_dlg->call_id->id.slen, 
    2930                            dest_dlg->call_id->id.ptr, 
     2947                           call_id_len, 
     2948                           call_id_dest_buf, 
    29312949                           (int)dest_dlg->remote.info->tag.slen, 
    29322950                           dest_dlg->remote.info->tag.ptr, 
Note: See TracChangeset for help on using the changeset viewer.