summaryrefslogtreecommitdiff
path: root/pjsip/src
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2015-10-02 02:08:17 +0000
committerNanang Izzuddin <nanang@teluu.com>2015-10-02 02:08:17 +0000
commit17276f318cc81d64c26aa766ae763b2773659dbf (patch)
treee74a7e1385128c4b35f0427c96a4844c848f654f /pjsip/src
parent6c8379528fa59c07748c7ff2a63cccdf358fe45e (diff)
Close #1892: Add pjsua/pjsua2 callback on_call_tx_offer()/Call::onCallTxOffer() to notify incoming re-INVITE without offer.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5185 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c8
-rw-r--r--pjsip/src/pjsua2/endpoint.cpp20
2 files changed, 27 insertions, 1 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index 0c8e872a..c1bea3b0 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -4181,8 +4181,14 @@ static void pjsua_call_on_create_offer(pjsip_inv_session *inv,
}
#endif
+ if (pjsua_var.ua_cfg.cb.on_call_tx_offer) {
+ cleanup_call_setting_flag(&call->opt);
+ (*pjsua_var.ua_cfg.cb.on_call_tx_offer)(call->index, NULL,
+ &call->opt);
+ }
+
/* We may need to re-initialize media before creating SDP */
- if (call->med_prov_cnt == 0) {
+ if (call->med_prov_cnt == 0 || pjsua_var.ua_cfg.cb.on_call_tx_offer) {
status = apply_call_setting(call, &call->opt, NULL);
if (status != PJ_SUCCESS)
goto on_return;
diff --git a/pjsip/src/pjsua2/endpoint.cpp b/pjsip/src/pjsua2/endpoint.cpp
index 96023af1..4fdc8dd6 100644
--- a/pjsip/src/pjsua2/endpoint.cpp
+++ b/pjsip/src/pjsua2/endpoint.cpp
@@ -1073,6 +1073,25 @@ void Endpoint::on_call_rx_offer(pjsua_call_id call_id,
*opt = prm.opt.toPj();
}
+void Endpoint::on_call_tx_offer(pjsua_call_id call_id,
+ void *reserved,
+ pjsua_call_setting *opt)
+{
+ PJ_UNUSED_ARG(reserved);
+
+ Call *call = Call::lookup(call_id);
+ if (!call) {
+ return;
+ }
+
+ OnCallTxOfferParam prm;
+ prm.opt.fromPj(*opt);
+
+ call->onCallTxOffer(prm);
+
+ *opt = prm.opt.toPj();
+}
+
pjsip_redirect_op Endpoint::on_call_redirected(pjsua_call_id call_id,
const pjsip_uri *target,
const pjsip_event *e)
@@ -1272,6 +1291,7 @@ void Endpoint::libInit(const EpConfig &prmEpConfig) throw(Error)
ua_cfg.cb.on_call_replace_request2 = &Endpoint::on_call_replace_request2;
ua_cfg.cb.on_call_replaced = &Endpoint::on_call_replaced;
ua_cfg.cb.on_call_rx_offer = &Endpoint::on_call_rx_offer;
+ ua_cfg.cb.on_call_tx_offer = &Endpoint::on_call_tx_offer;
ua_cfg.cb.on_call_redirected = &Endpoint::on_call_redirected;
ua_cfg.cb.on_call_media_transport_state =
&Endpoint::on_call_media_transport_state;