Changeset 4173 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
- Timestamp:
- Jun 20, 2012 10:39:05 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r4172 r4173 625 625 acc->valid = PJ_FALSE; 626 626 acc->contact.slen = 0; 627 pj_bzero(&acc->via_addr, sizeof(acc->via_addr)); 628 acc->via_tp = NULL; 627 629 628 630 /* Remove from array */ … … 1091 1093 } 1092 1094 1095 /* Allow via rewrite */ 1096 if (acc->cfg.allow_via_rewrite != cfg->allow_via_rewrite) { 1097 if (acc->regc != NULL) { 1098 if (cfg->allow_via_rewrite) { 1099 pjsip_regc_set_via_sent_by(acc->regc, &acc->via_addr, 1100 acc->via_tp); 1101 } else 1102 pjsip_regc_set_via_sent_by(acc->regc, NULL, NULL); 1103 } 1104 if (acc->publish_sess != NULL) { 1105 if (cfg->allow_via_rewrite) { 1106 pjsip_publishc_set_via_sent_by(acc->publish_sess, 1107 &acc->via_addr, acc->via_tp); 1108 } else 1109 pjsip_publishc_set_via_sent_by(acc->publish_sess, NULL, NULL); 1110 } 1111 acc->cfg.allow_via_rewrite = cfg->allow_via_rewrite; 1112 } 1113 1093 1114 /* Normalize registration timeout and refresh delay */ 1094 1115 if (acc->cfg.reg_uri.slen ) { … … 1314 1335 1315 1336 tp = param->rdata->tp_info.transport; 1337 1338 /* If allow_via_rewrite is enabled, we save the Via "sent-by" address 1339 * from the response. 1340 */ 1341 if (acc->cfg.allow_via_rewrite && 1342 (acc->via_addr.host.slen == 0 || acc->via_tp != tp)) 1343 { 1344 via = param->rdata->msg_info.via; 1345 if (pj_strcmp(&acc->via_addr.host, &via->sent_by.host)) 1346 pj_strdup(acc->pool, &acc->via_addr.host, &via->sent_by.host); 1347 acc->via_addr.port = via->sent_by.port; 1348 acc->via_tp = tp; 1349 } 1316 1350 1317 1351 /* Only update if account is configured to auto-update */ … … 2177 2211 2178 2212 if (status == PJ_SUCCESS) { 2213 if (pjsua_var.acc[acc_id].cfg.allow_via_rewrite && 2214 pjsua_var.acc[acc_id].via_addr.host.slen > 0) 2215 { 2216 pjsip_regc_set_via_sent_by(pjsua_var.acc[acc_id].regc, 2217 &pjsua_var.acc[acc_id].via_addr, 2218 pjsua_var.acc[acc_id].via_tp); 2219 } 2220 2179 2221 //pjsua_process_msg_data(tdata, NULL); 2180 2222 status = pjsip_regc_send( pjsua_var.acc[acc_id].regc, tdata ); … … 2540 2582 pjsua_init_tpselector(acc->cfg.transport_id, &tp_sel); 2541 2583 pjsip_tx_data_set_transport(tdata, &tp_sel); 2584 } 2585 2586 /* If via_addr is set, use this address for the Via header. */ 2587 if (pjsua_var.acc[acc_id].cfg.allow_via_rewrite && 2588 pjsua_var.acc[acc_id].via_addr.host.slen > 0) 2589 { 2590 tdata->via_addr = pjsua_var.acc[acc_id].via_addr; 2591 tdata->via_tp = pjsua_var.acc[acc_id].via_tp; 2542 2592 } 2543 2593
Note: See TracChangeset
for help on using the changeset viewer.