Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c (revision 2649)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c (revision 2650)
@@ -3797,7 +3797,13 @@
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;
@@ -3812,7 +3818,16 @@
}
- 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;
Index: /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c (revision 2649)
+++ /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c (revision 2650)
@@ -3362,4 +3362,20 @@
/* Generic handling for UAC tsx completion */
handle_uac_tsx_response(inv, e);
+
+ } else if (tsx->role == PJSIP_ROLE_UAS &&
+ tsx->method.id == PJSIP_BYE_METHOD &&
+ tsx->status_code < 200 &&
+ e->body.tsx_state.type == PJSIP_EVENT_RX_MSG)
+ {
+ /* Received BYE before the 2xx/OK response to INVITE.
+ * Assume that the 2xx/OK response is lost and the BYE
+ * arrives earlier.
+ */
+ inv_respond_incoming_bye(inv, tsx, e->body.tsx_state.src.rdata, e);
+
+ /* Set timer just in case we will never get the final response
+ * for INVITE.
+ */
+ pjsip_tsx_set_timeout(inv->invite_tsx, 64*pjsip_cfg()->tsx.t1);
}
}
Index: /pjproject/trunk/tests/pjsua/scripts-sipp/prack_fork.xml
===================================================================
--- /pjproject/trunk/tests/pjsua/scripts-sipp/prack_fork.xml (revision 2649)
+++ /pjproject/trunk/tests/pjsua/scripts-sipp/prack_fork.xml (revision 2650)
@@ -94,5 +94,5 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To[$3]
+ Call-ID: [call_id]
+ Cseq: 1 BYE
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /pjproject/trunk/tests/pjsua/scripts-sipp/uas-forked-200.xml
===================================================================
--- /pjproject/trunk/tests/pjsua/scripts-sipp/uas-forked-200.xml (revision 2650)
+++ /pjproject/trunk/tests/pjsua/scripts-sipp/uas-forked-200.xml (revision 2650)
@@ -0,0 +1,143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Content-Type: application/sdp
+
+ v=0
+ o=- 3442013205 3442013205 IN IP4 192.168.0.13
+ s=pjsip
+ c=IN IP4 192.168.0.13
+ t=0 0
+ m=audio 4002 RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ ]]>
+
+
+
+
+
+ Content-Type: application/sdp
+
+ v=0
+ o=- 3442013205 3442013205 IN IP4 192.168.0.13
+ s=pjsip
+ c=IN IP4 192.168.0.13
+ t=0 0
+ m=audio 4002 RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+