Changeset 4442


Ignore:
Timestamp:
Mar 19, 2013 7:39:25 AM (11 years ago)
Author:
nanang
Message:

Close #1645: Added run-time setting 'pjsip_cfg()->req_has_via_alias' and compile-time setting 'PJSIP_REQ_HAS_VIA_ALIAS', the default value is PJ_TRUE.

Location:
pjproject/trunk/pjsip
Files:
3 edited

Legend:

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

    r4441 r4442  
    121121        pj_bool_t follow_early_media_fork; 
    122122 
     123        /** 
     124         * Specify whether "alias" param should be added to the Via header 
     125         * in any outgoing request with connection oriented transport. 
     126         * 
     127         * Default is PJSIP_REQ_HAS_VIA_ALIAS. 
     128         */ 
     129        pj_bool_t req_has_via_alias; 
     130 
    123131    } endpt; 
    124132 
     
    317325 
    318326/** 
     327 * Specify whether "alias" param should be added to the Via header 
     328 * in any outgoing request with connection oriented transport. 
     329 * 
     330 * This option can also be controlled at run-time by the 
     331 * \a req_has_via_alias setting in pjsip_cfg_t. 
     332 * 
     333 * Default is PJ_TRUE. 
     334 */ 
     335#ifndef PJSIP_REQ_HAS_VIA_ALIAS 
     336#   define PJSIP_REQ_HAS_VIA_ALIAS                  PJ_TRUE 
     337#endif 
     338 
     339 
     340/** 
    319341 * Accept call replace in early state when invite is not initiated 
    320342 * by the user agent. RFC 3891 Section 3 disallows this, however, 
  • pjproject/trunk/pjsip/src/pjsip/sip_config.c

    r4441 r4442  
    3131       0, 
    3232       PJSIP_DONT_SWITCH_TO_TCP, 
    33        PJSIP_FOLLOW_EARLY_MEDIA_FORK 
     33       PJSIP_FOLLOW_EARLY_MEDIA_FORK, 
     34       PJSIP_REQ_HAS_VIA_ALIAS 
    3435    }, 
    3536 
  • pjproject/trunk/pjsip/src/pjsip/sip_util.c

    r4173 r4442  
    12011201        } 
    12021202        via->rport_param = pjsip_cfg()->endpt.disable_rport ? -1 : 0; 
     1203 
     1204        /* Add/remove "alias" param to/from Via header on connection  
     1205         * oriented/less transport, if configured. 
     1206         */ 
     1207        if (pjsip_cfg()->endpt.req_has_via_alias && 
     1208            tdata->msg->type == PJSIP_REQUEST_MSG) 
     1209        { 
     1210            const pj_str_t ALIAS_STR = {"alias", 5}; 
     1211            pjsip_param *alias_param; 
     1212            pj_bool_t is_datagram; 
     1213 
     1214            alias_param = pjsip_param_find(&via->other_param, &ALIAS_STR); 
     1215            is_datagram = (stateless_data->cur_transport->flag &  
     1216                           PJSIP_TRANSPORT_DATAGRAM); 
     1217            if (!is_datagram && !alias_param) { 
     1218                alias_param = PJ_POOL_ZALLOC_T(tdata->pool, pjsip_param); 
     1219                alias_param->name = ALIAS_STR; 
     1220                pj_list_push_back(&via->other_param, alias_param); 
     1221            } else if (is_datagram && alias_param) { 
     1222                pj_list_erase(alias_param); 
     1223            } 
     1224        } 
    12031225 
    12041226        pjsip_tx_data_invalidate_msg(tdata); 
Note: See TracChangeset for help on using the changeset viewer.