summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua2
diff options
context:
space:
mode:
authorRiza Sulistyo <riza@teluu.com>2016-05-10 14:58:41 +0000
committerRiza Sulistyo <riza@teluu.com>2016-05-10 14:58:41 +0000
commitfcf865c4deb374fad719c5003f9a554f8ca40b82 (patch)
tree233dabc25dbd9c9d15ff9f377701b333a56d8c78 /pjsip/src/pjsua2
parente65297b91432118cfbc0b561b93846d7fa624253 (diff)
Fixed #1914: onCreateMediaTransport() callback might not be called on PJSUA2.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5288 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua2')
-rw-r--r--pjsip/src/pjsua2/endpoint.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/pjsip/src/pjsua2/endpoint.cpp b/pjsip/src/pjsua2/endpoint.cpp
index cf3a4039..d089b0c9 100644
--- a/pjsip/src/pjsua2/endpoint.cpp
+++ b/pjsip/src/pjsua2/endpoint.cpp
@@ -602,6 +602,15 @@ void Endpoint::on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
return;
}
+ pjsua_call *call = &pjsua_var.calls[call_id];
+ if (!call->incoming_data) {
+ /* This happens when the incoming call callback has been called from
+ * inside the on_create_media_transport() callback. So we simply
+ * return here to avoid calling the callback twice.
+ */
+ return;
+ }
+
/* call callback */
OnIncomingCallParam prm;
prm.callId = call_id;
@@ -609,6 +618,10 @@ void Endpoint::on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
acc->onIncomingCall(prm);
+ /* Free cloned rdata. */
+ pjsip_rx_data_free_cloned(call->incoming_data);
+ call->incoming_data = NULL;
+
/* disconnect if callback doesn't handle the call */
pjsua_call_info ci;
@@ -1225,7 +1238,22 @@ Endpoint::on_create_media_transport(pjsua_call_id call_id,
{
Call *call = Call::lookup(call_id);
if (!call) {
- return base_tp;
+ pjsua_call *in_call = &pjsua_var.calls[call_id];
+ if (in_call->incoming_data) {
+ /* This can happen when there is an incoming call but the
+ * on_incoming_call() callback hasn't been called. So we need to
+ * call the callback here.
+ */
+ on_incoming_call(in_call->acc_id, call_id, in_call->incoming_data);
+
+ /* New call should already be created by app. */
+ call = Call::lookup(call_id);
+ if (!call) {
+ return base_tp;
+ }
+ } else {
+ return base_tp;
+ }
}
OnCreateMediaTransportParam prm;