summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua-lib/pjsua_call.c
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2011-10-03 08:22:48 +0000
committerLiong Sauw Ming <ming@teluu.com>2011-10-03 08:22:48 +0000
commitf3f2c4b1e8ec8416fce15fc5db9ea6c6059f307d (patch)
tree7d26081a3f71a384befdc68f71054f028f6f8ffa /pjsip/src/pjsua-lib/pjsua_call.c
parent1685526712e312b701db96c977604343c3550ba1 (diff)
Re #1266: Modified pjsua_media_channel_deinit() to resume deinit in the callback (instead of returning PJ_EBUSY) and make sure the right transport is used before calling dlg_respond()
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3780 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_call.c')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index fe9befd4..64aeac4d 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -357,6 +357,10 @@ on_make_call_med_tp_complete(pjsua_call_id call_id,
goto on_error;
}
+ /* pjsua_media_channel_deinit() has been called. */
+ if (call->async_call.med_ch_deinit)
+ goto on_error;
+
/* Create offer */
status = pjsua_media_channel_create_sdp(call->index, dlg->pool, NULL,
&offer, NULL);
@@ -708,7 +712,15 @@ on_incoming_call_med_tp_complete(pjsua_call_id call_id,
pjsua_perror(THIS_FILE, "Error initializing media channel", status);
goto on_return;
}
-
+
+ /* pjsua_media_channel_deinit() has been called. */
+ if (call->async_call.med_ch_deinit) {
+ pjsua_media_channel_deinit(call->index);
+ call->med_ch_cb = NULL;
+ PJSUA_UNLOCK();
+ return PJ_SUCCESS;
+ }
+
/* Get remote SDP offer (if any). */
if (call->inv->neg)
pjmedia_sdp_neg_get_neg_remote(call->inv->neg, &offer);
@@ -1057,6 +1069,16 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
goto on_return;
}
+ /* If account is locked to specific transport, then lock dialog
+ * to this transport too.
+ */
+ if (pjsua_var.acc[acc_id].cfg.transport_id != PJSUA_INVALID_ID) {
+ pjsip_tpselector tp_sel;
+
+ pjsua_init_tpselector(pjsua_var.acc[acc_id].cfg.transport_id, &tp_sel);
+ pjsip_dlg_set_transport(dlg, &tp_sel);
+ }
+
/* Create and attach pjsua_var data to the dialog: */
call->inv = inv;
dlg->mod_data[pjsua_var.mod.id] = call;
@@ -1128,16 +1150,6 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
update_remote_nat_type(call, remote_sdp);
}
- /* If account is locked to specific transport, then lock dialog
- * to this transport too.
- */
- if (pjsua_var.acc[acc_id].cfg.transport_id != PJSUA_INVALID_ID) {
- pjsip_tpselector tp_sel;
-
- pjsua_init_tpselector(pjsua_var.acc[acc_id].cfg.transport_id, &tp_sel);
- pjsip_dlg_set_transport(dlg, &tp_sel);
- }
-
/* Must answer with some response to initial INVITE. We'll do this before
* attaching the call to the invite session/dialog, so that the application
* will not get notification about this event (on another scenario, it is