Changeset 995
- Timestamp:
- Feb 22, 2007 2:52:24 PM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/config.c
r983 r995 22 22 23 23 static const char *id = "config.c"; 24 const char *PJ_VERSION = "0.5.10.1 ";24 const char *PJ_VERSION = "0.5.10.1-trunk"; 25 25 26 26 PJ_DEF(void) pj_dump_config(void) -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r974 r995 2285 2285 2286 2286 } else { 2287 int st_code; 2288 char contact[120]; 2289 pj_str_t hname = { "Contact", 7 }; 2290 pj_str_t hvalue; 2291 pjsip_generic_string_hdr hcontact; 2292 pjsua_msg_data msg_data; 2293 2287 2294 if (!simple_input("Answer with code (100-699)", buf, sizeof(buf))) 2288 2295 continue; 2289 2296 2290 if (my_atoi(buf) < 100) 2297 st_code = my_atoi(buf); 2298 if (st_code < 100) 2291 2299 continue; 2300 2301 pjsua_msg_data_init(&msg_data); 2302 2303 if (st_code/100 == 3) { 2304 if (!simple_input("Enter URL to be put in Contact", 2305 contact, sizeof(contact))) 2306 continue; 2307 hvalue = pj_str(contact); 2308 pjsip_generic_string_hdr_init2(&hcontact, &hname, &hvalue); 2309 2310 pj_list_push_back(&msg_data.hdr_list, &hcontact); 2311 } 2292 2312 2293 2313 /* … … 2302 2322 } 2303 2323 2304 pjsua_call_answer(current_call, my_atoi(buf), NULL, NULL);2324 pjsua_call_answer(current_call, st_code, NULL, &msg_data); 2305 2325 } 2306 2326 -
pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
r979 r995 1151 1151 /* Add standard headers for certain types of response */ 1152 1152 static void dlg_beautify_response(pjsip_dialog *dlg, 1153 pj_bool_t add_headers, 1153 1154 int st_code, 1154 1155 pjsip_tx_data *tdata) … … 1165 1166 1166 1167 /* Contact, Allow, Supported header. */ 1167 if ( pjsip_method_creates_dialog(&cseq->method)) {1168 if (add_headers && pjsip_method_creates_dialog(&cseq->method)) { 1168 1169 /* Add Contact header for 1xx, 2xx, 3xx and 485 response. */ 1169 1170 if (st_class==2 || st_class==3 || (st_class==1 && st_code != 100) || 1170 1171 st_code==485) 1171 1172 { 1173 pj_str_t hcontact = { "Contact", 7 }; 1174 1172 1175 /* Add contact header only if one is not present. */ 1173 if (pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL) == 0) { 1176 if (pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL) == 0 && 1177 pjsip_msg_find_hdr_by_name(tdata->msg, &hcontact, NULL) == 0) 1178 { 1174 1179 hdr = pjsip_hdr_clone(tdata->pool, dlg->local.contact); 1175 1180 pjsip_msg_add_hdr(tdata->msg, hdr); … … 1242 1247 pjsip_dlg_inc_lock(dlg); 1243 1248 1244 dlg_beautify_response(dlg, st_code, tdata);1249 dlg_beautify_response(dlg, PJ_FALSE, st_code, tdata); 1245 1250 1246 1251 /* Unlock the dialog. */ … … 1260 1265 const pj_str_t *st_text) 1261 1266 { 1262 1267 pjsip_hdr *hdr; 1268 1263 1269 PJ_ASSERT_RETURN(dlg && tdata && tdata->msg, PJ_EINVAL); 1264 1270 PJ_ASSERT_RETURN(tdata->msg->type == PJSIP_RESPONSE_MSG, … … 1277 1283 } 1278 1284 1279 dlg_beautify_response(dlg, st_code, tdata); 1285 /* Remove existing Contact header (without this, when dialog sent 1286 * 180 and then 302, the Contact in 302 will not get updated). 1287 */ 1288 hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL); 1289 if (hdr) 1290 pj_list_erase(hdr); 1291 1292 /* Add tag etc. if necessary */ 1293 dlg_beautify_response(dlg, PJ_FALSE, st_code, tdata); 1280 1294 1281 1295 … … 1325 1339 /* Must acquire dialog first, to prevent deadlock */ 1326 1340 pjsip_dlg_inc_lock(dlg); 1341 1342 /* Last chance to add mandatory headers before the response is 1343 * sent. 1344 */ 1345 dlg_beautify_response(dlg, PJ_TRUE, tdata->msg->line.status.code, tdata); 1327 1346 1328 1347 /* If the dialog is locked to transport, make sure that transaction
Note: See TracChangeset
for help on using the changeset viewer.