- Timestamp:
- Jan 25, 2018 7:00:42 AM (7 years ago)
- Location:
- pjproject/trunk/pjsip/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_util.c
r5636 r5733 1214 1214 } 1215 1215 1216 via->transport = pj_str(stateless_data->cur_transport->type_name); 1217 /* For Cancel request, do not update the Via address with 1218 * the new transport since it needs to match the original 1219 * request. 1216 /* For CANCEL request, do not update the Via header since it needs 1217 * to match the original request. 1220 1218 */ 1221 if (tdata->via_addr.host.slen > 0 && 1222 (!tdata->via_tp || 1223 tdata->via_tp == (void *)stateless_data->cur_transport || 1224 tdata->msg->line.req.method.id == PJSIP_CANCEL_METHOD)) 1225 { 1226 via->sent_by = tdata->via_addr; 1227 } else { 1228 via->sent_by = stateless_data->cur_transport->local_name; 1229 } 1230 via->rport_param = pjsip_cfg()->endpt.disable_rport ? -1 : 0; 1231 1232 /* Add/remove "alias" param to/from Via header on connection 1233 * oriented/less transport, if configured. 1234 */ 1235 if (pjsip_cfg()->endpt.req_has_via_alias && 1236 tdata->msg->type == PJSIP_REQUEST_MSG) 1237 { 1238 const pj_str_t ALIAS_STR = {"alias", 5}; 1239 pjsip_param *alias_param; 1240 pj_bool_t is_datagram; 1241 1242 alias_param = pjsip_param_find(&via->other_param, &ALIAS_STR); 1243 is_datagram = (stateless_data->cur_transport->flag & 1244 PJSIP_TRANSPORT_DATAGRAM); 1245 if (!is_datagram && !alias_param) { 1246 alias_param = PJ_POOL_ZALLOC_T(tdata->pool, pjsip_param); 1247 alias_param->name = ALIAS_STR; 1248 pj_list_push_back(&via->other_param, alias_param); 1249 } else if (is_datagram && alias_param) { 1250 pj_list_erase(alias_param); 1219 if (tdata->msg->line.req.method.id != PJSIP_CANCEL_METHOD) { 1220 via->transport = pj_str(stateless_data->cur_transport->type_name); 1221 1222 if (tdata->via_addr.host.slen > 0 && 1223 (!tdata->via_tp || 1224 tdata->via_tp == (void *)stateless_data->cur_transport)) 1225 { 1226 via->sent_by = tdata->via_addr; 1227 1228 /* Better also update tdata via_tp, e.g: CANCEL may need to 1229 * refer to original INVITE tdata. 1230 */ 1231 tdata->via_tp = stateless_data->cur_transport; 1232 } else { 1233 via->sent_by = stateless_data->cur_transport->local_name; 1234 1235 /* Better also update tdata via_tp & via_addr, e.g: CANCEL 1236 * may need to refer to original INVITE tdata. 1237 */ 1238 tdata->via_tp = stateless_data->cur_transport; 1239 tdata->via_addr = via->sent_by; 1240 } 1241 1242 via->rport_param = pjsip_cfg()->endpt.disable_rport ? -1 : 0; 1243 1244 /* Add/remove "alias" param to/from Via header on connection 1245 * oriented/less transport, if configured. 1246 */ 1247 if (pjsip_cfg()->endpt.req_has_via_alias && 1248 tdata->msg->type == PJSIP_REQUEST_MSG) 1249 { 1250 const pj_str_t ALIAS_STR = {"alias", 5}; 1251 pjsip_param *alias_param; 1252 pj_bool_t is_datagram; 1253 1254 alias_param = pjsip_param_find(&via->other_param, &ALIAS_STR); 1255 is_datagram = (stateless_data->cur_transport->flag & 1256 PJSIP_TRANSPORT_DATAGRAM); 1257 if (!is_datagram && !alias_param) { 1258 alias_param = PJ_POOL_ZALLOC_T(tdata->pool, pjsip_param); 1259 alias_param->name = ALIAS_STR; 1260 pj_list_push_back(&via->other_param, alias_param); 1261 } else if (is_datagram && alias_param) { 1262 pj_list_erase(alias_param); 1263 } 1251 1264 } 1252 1265 } -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r5720 r5733 3833 3833 continue; 3834 3834 3835 /* Reset Account's via transport and via address */ 3836 if (acc->via_tp == (void*)tp) { 3837 pj_bzero(&acc->via_addr, sizeof(acc->via_addr)); 3838 acc->via_tp = NULL; 3839 } 3840 3835 3841 /* Release transport immediately if regc is using it 3836 3842 * See https://trac.pjsip.org/repos/ticket/1481
Note: See TracChangeset
for help on using the changeset viewer.