From d7bfd38fd9a244a92f74cb2c0cc8ae2bbc056e20 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 22 Feb 2007 14:46:55 +0000 Subject: Fixed ticket #131: dialog automatically insert Contact header when sending 3xx response (thanks Hozjan Vladimir for reporting) git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/pjproject-0.5-stable@994 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/pjsua/pjsua_app.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'pjsip-apps/src') diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c index 1417b81f..928ed1c1 100644 --- a/pjsip-apps/src/pjsua/pjsua_app.c +++ b/pjsip-apps/src/pjsua/pjsua_app.c @@ -2284,12 +2284,32 @@ void console_app_main(const pj_str_t *uri_to_call) continue; } else { + int st_code; + char contact[120]; + pj_str_t hname = { "Contact", 7 }; + pj_str_t hvalue; + pjsip_generic_string_hdr hcontact; + pjsua_msg_data msg_data; + if (!simple_input("Answer with code (100-699)", buf, sizeof(buf))) continue; - if (my_atoi(buf) < 100) + st_code = my_atoi(buf); + if (st_code < 100) continue; + pjsua_msg_data_init(&msg_data); + + if (st_code/100 == 3) { + if (!simple_input("Enter URL to be put in Contact", + contact, sizeof(contact))) + continue; + hvalue = pj_str(contact); + pjsip_generic_string_hdr_init2(&hcontact, &hname, &hvalue); + + pj_list_push_back(&msg_data.hdr_list, &hcontact); + } + /* * Must check again! * Call may have been disconnected while we're waiting for @@ -2301,7 +2321,7 @@ void console_app_main(const pj_str_t *uri_to_call) continue; } - pjsua_call_answer(current_call, my_atoi(buf), NULL, NULL); + pjsua_call_answer(current_call, st_code, NULL, &msg_data); } break; -- cgit v1.2.3