Ticket #798: UAC disconnect call when receiving BYE in early state (thanks Gang Liu for the suggestion)
- UAC now handles the BYE, and treat it as out-of-order disconnect request, meaning that it will disconnect the call
- it will also activate timer to terminate the INVITE transaction, in case final response never arrives
- added SIPp UAS scenario to test this
- also added forked 200/OK response SIPp scenario,
- and fixed the prack_fork.xml SIPp scenario
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2650 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c
index 2b163d8..dd81f9e 100644
--- a/pjsip-apps/src/pjsua/pjsua_app.c
+++ b/pjsip-apps/src/pjsua/pjsua_app.c
@@ -3796,9 +3796,15 @@
ui_input_url("Destination URI", buf, sizeof(buf), &result);
if (result.nb_result != NO_NB) {
- if (result.nb_result == -1 || result.nb_result == 0) {
+ if (result.nb_result == -1) {
puts("Sorry you can't do that!");
continue;
+ } else if (result.nb_result == 0) {
+ uri = NULL;
+ if (current_call == PJSUA_INVALID_ID) {
+ puts("No current call");
+ continue;
+ }
} else {
pjsua_buddy_info binfo;
pjsua_buddy_get_info(result.nb_result-1, &binfo);
@@ -3811,9 +3817,18 @@
uri = result.uri_result;
}
- tmp = pj_str(uri);
-
- send_request(text, &tmp);
+ if (uri) {
+ tmp = pj_str(uri);
+ send_request(text, &tmp);
+ } else {
+ /* If you send call control request using this method
+ * (such requests includes BYE, CANCEL, etc.), it will
+ * not go well with the call state, so don't do it
+ * unless it's for testing.
+ */
+ pj_str_t method = pj_str(text);
+ pjsua_call_send_request(current_call, &method, NULL);
+ }
break;
case 'e':