Changeset 4586 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
- Timestamp:
- Sep 4, 2013 10:07:45 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r4580 r4586 1495 1495 /* Update NAT address from the REGISTER response */ 1496 1496 static pj_bool_t acc_check_nat_addr(pjsua_acc *acc, 1497 int contact_rewrite_method, 1497 1498 struct pjsip_regc_cbparam *param) 1498 1499 { … … 1679 1680 via_addr->ptr, 1680 1681 rport, 1681 acc->cfg.contact_rewrite_method)); 1682 1683 pj_assert(acc->cfg.contact_rewrite_method == 1 || 1684 acc->cfg.contact_rewrite_method == 2); 1685 1686 if (acc->cfg.contact_rewrite_method == 1) { 1682 contact_rewrite_method)); 1683 1684 pj_assert(contact_rewrite_method == PJSUA_CONTACT_REWRITE_UNREGISTER || 1685 contact_rewrite_method == PJSUA_CONTACT_REWRITE_NO_UNREG || 1686 contact_rewrite_method == PJSUA_CONTACT_REWRITE_ALWAYS_UPDATE); 1687 1688 if (contact_rewrite_method == PJSUA_CONTACT_REWRITE_UNREGISTER) { 1687 1689 /* Unregister current contact */ 1688 1690 pjsua_acc_set_registration(acc->index, PJ_FALSE); … … 1762 1764 } 1763 1765 1764 if (acc->cfg.contact_rewrite_method == 2 && acc->regc != NULL) { 1766 if (contact_rewrite_method == PJSUA_CONTACT_REWRITE_NO_UNREG && 1767 acc->regc != NULL) 1768 { 1765 1769 pjsip_regc_update_contact(acc->regc, 1, &acc->reg_contact); 1766 1770 } 1767 1771 1768 1772 /* Perform new registration */ 1769 pjsua_acc_set_registration(acc->index, PJ_TRUE); 1773 if (contact_rewrite_method < PJSUA_CONTACT_REWRITE_ALWAYS_UPDATE) { 1774 pjsua_acc_set_registration(acc->index, PJ_TRUE); 1775 } 1770 1776 1771 1777 pj_pool_release(pool); … … 2059 2065 } 2060 2066 2067 static void regc_tsx_cb(struct pjsip_regc_tsx_cb_param *param) 2068 { 2069 pjsua_acc *acc = (pjsua_acc*) param->cbparam.token; 2070 2071 PJSUA_LOCK(); 2072 2073 if (param->cbparam.regc != acc->regc) { 2074 PJSUA_UNLOCK(); 2075 return; 2076 } 2077 2078 pj_log_push_indent(); 2079 2080 if ((acc->cfg.contact_rewrite_method & 2081 PJSUA_CONTACT_REWRITE_ALWAYS_UPDATE) == 2082 PJSUA_CONTACT_REWRITE_ALWAYS_UPDATE && 2083 param->cbparam.code >= 400 && 2084 param->cbparam.rdata) 2085 { 2086 if (acc_check_nat_addr(acc, PJSUA_CONTACT_REWRITE_ALWAYS_UPDATE, 2087 ¶m->cbparam)) 2088 { 2089 param->contact_cnt = 1; 2090 param->contact[0] = acc->reg_contact; 2091 } 2092 } 2093 2094 PJSUA_UNLOCK(); 2095 pj_log_pop_indent(); 2096 } 2097 2061 2098 /* 2062 2099 * This callback is called by pjsip_regc when outgoing register … … 2127 2164 2128 2165 /* Check NAT bound address */ 2129 if (acc_check_nat_addr(acc, param)) { 2166 if (acc_check_nat_addr(acc, (acc->cfg.contact_rewrite_method & 3), 2167 param)) 2168 { 2130 2169 PJSUA_UNLOCK(); 2131 2170 pj_log_pop_indent(); … … 2271 2310 return status; 2272 2311 } 2312 2313 pjsip_regc_set_reg_tsx_cb(acc->regc, regc_tsx_cb); 2273 2314 2274 2315 /* If account is locked to specific transport, then set transport to
Note: See TracChangeset
for help on using the changeset viewer.