summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2012-03-28 09:05:34 +0000
committerBenny Prijono <bennylp@teluu.com>2012-03-28 09:05:34 +0000
commita14cb2f94e588ec153e09fcc9049dfb38be18358 (patch)
tree0266138578d4dab5f4c7cd1b96cea1c10f20578e
parent13f53625a0cb7a8f3e33557d650ada447f06f8fd (diff)
Misc (re #1446): prevent on_call_state() callback from being called before on_incoming_call() callback is called
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3990 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index 38ef3b9d..4a6f1173 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -1204,10 +1204,8 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
pjsip_dlg_set_transport(dlg, &tp_sel);
}
- /* Create and attach pjsua_var data to the dialog: */
+ /* Create and attach pjsua_var data to the dialog */
call->inv = inv;
- dlg->mod_data[pjsua_var.mod.id] = call;
- inv->mod_data[pjsua_var.mod.id] = call;
/* Store variables required for the callback after the async
* media transport creation is completed.
@@ -1282,7 +1280,7 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
* cause the disconnection callback to be called before on_incoming_call()
* callback is called, which is not right).
*/
- status = pjsip_inv_initial_answer(inv, rdata,
+ status = pjsip_inv_initial_answer(inv, rdata,
100, NULL, NULL, &response);
if (status != PJ_SUCCESS) {
if (response == NULL) {
@@ -1292,7 +1290,7 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
pjsip_inv_terminate(inv, 500, PJ_FALSE);
} else {
pjsip_inv_send_msg(inv, response);
- pjsip_inv_terminate(inv, response->msg->line.status.code,
+ pjsip_inv_terminate(inv, response->msg->line.status.code,
PJ_FALSE);
}
pjsua_media_channel_deinit(call->index);
@@ -1306,6 +1304,12 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
}
}
+ /* Only do this after sending 100/Trying (really! see the long comment
+ * above)
+ */
+ dlg->mod_data[pjsua_var.mod.id] = call;
+ inv->mod_data[pjsua_var.mod.id] = call;
+
++pjsua_var.call_cnt;
/* Check if this request should replace existing call */