Changeset 3213 for pjproject/trunk
- Timestamp:
- Jun 20, 2010 8:58:26 AM (14 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r3212 r3213 1901 1901 1902 1902 /** 1903 * This macro specifies the default value for \a contact_rewrite_method 1904 * field in pjsua_acc_config. I specifies how Contact update will be 1905 * done with the registration, if \a allow_contact_rewrite is enabled in 1906 * the account config. 1907 * 1908 * If set to 1, the Contact update will be done by sending unregistration 1909 * to the currently registered Contact, while simultaneously sending new 1910 * registration (with different Call-ID) for the updated Contact. 1911 * 1912 * If set to 2, the Contact update will be done in a single, current 1913 * registration session, by removing the current binding (by setting its 1914 * Contact's expires parameter to zero) and adding a new Contact binding, 1915 * all done in a single request. 1916 * 1917 * Value 1 is the legacy behavior. 1918 * 1919 * Default value: 2 1920 */ 1921 #ifndef PJSUA_CONTACT_REWRITE_METHOD 1922 # define PJSUA_CONTACT_REWRITE_METHOD 2 1923 #endif 1924 1925 1926 /** 1903 1927 * This structure describes account configuration to be specified when 1904 1928 * adding a new account with #pjsua_acc_add(). Application MUST initialize … … 2107 2131 * configured. 2108 2132 * 2133 * See also contact_rewrite_method field. 2134 * 2109 2135 * Default: 1 (yes) 2110 2136 */ 2111 2137 pj_bool_t allow_contact_rewrite; 2138 2139 /** 2140 * Specify how Contact update will be done with the registration, if 2141 * \a allow_contact_rewrite is enabled. 2142 * 2143 * If set to 1, the Contact update will be done by sending unregistration 2144 * to the currently registered Contact, while simultaneously sending new 2145 * registration (with different Call-ID) for the updated Contact. 2146 * 2147 * If set to 2, the Contact update will be done in a single, current 2148 * registration session, by removing the current binding (by setting its 2149 * Contact's expires parameter to zero) and adding a new Contact binding, 2150 * all done in a single request. 2151 * 2152 * Value 1 is the legacy behavior. 2153 * 2154 * Default value: PJSUA_CONTACT_REWRITE_METHOD (2) 2155 */ 2156 int contact_rewrite_method; 2112 2157 2113 2158 /** -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r3190 r3213 1099 1099 1100 1100 PJ_LOG(3,(THIS_FILE, "IP address change detected for account %d " 1101 "(%.*s:%d --> %.*s:%d). Updating registration..", 1101 "(%.*s:%d --> %.*s:%d). Updating registration " 1102 "(using method %d)", 1102 1103 acc->index, 1103 1104 (int)uri->host.slen, … … 1106 1107 (int)via_addr->slen, 1107 1108 via_addr->ptr, 1108 rport)); 1109 1110 /* Unregister current contact */ 1111 pjsua_acc_set_registration(acc->index, PJ_FALSE); 1112 if (acc->regc != NULL) { 1113 pjsip_regc_destroy(acc->regc); 1114 acc->regc = NULL; 1115 acc->contact.slen = 0; 1116 } 1117 1118 /* Update account's Contact header */ 1109 rport, 1110 acc->cfg.contact_rewrite_method)); 1111 1112 pj_assert(acc->cfg.contact_rewrite_method == 1 || 1113 acc->cfg.contact_rewrite_method == 2); 1114 1115 if (acc->cfg.contact_rewrite_method == 1) { 1116 /* Unregister current contact */ 1117 pjsua_acc_set_registration(acc->index, PJ_FALSE); 1118 if (acc->regc != NULL) { 1119 pjsip_regc_destroy(acc->regc); 1120 acc->regc = NULL; 1121 acc->contact.slen = 0; 1122 } 1123 } 1124 1125 /* 1126 * Build new Contact header 1127 */ 1119 1128 { 1120 1129 char *tmp; … … 1152 1161 } 1153 1162 pj_strdup2_with_null(acc->pool, &acc->contact, tmp); 1154 } 1155 1156 /* Always update, by http://trac.pjsip.org/repos/ticket/864. */ 1157 pj_strdup_with_null(tp->pool, &tp->local_name.host, via_addr); 1158 tp->local_name.port = rport; 1163 1164 /* Always update, by http://trac.pjsip.org/repos/ticket/864. */ 1165 pj_strdup_with_null(tp->pool, &tp->local_name.host, via_addr); 1166 tp->local_name.port = rport; 1167 1168 } 1169 1170 if (acc->cfg.contact_rewrite_method == 2 && acc->regc != NULL) { 1171 pjsip_regc_update_contact(acc->regc, 1, &acc->contact); 1172 } 1159 1173 1160 1174 /* Perform new registration */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r3172 r3213 179 179 #endif 180 180 cfg->reg_retry_interval = PJSUA_REG_RETRY_INTERVAL; 181 cfg->contact_rewrite_method = PJSUA_CONTACT_REWRITE_METHOD; 181 182 } 182 183
Note: See TracChangeset
for help on using the changeset viewer.