summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua-lib/pjsua_call.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-06-20 10:03:46 +0000
committerBenny Prijono <bennylp@teluu.com>2007-06-20 10:03:46 +0000
commita73bec4fabd296d54db391af0a29a97c5a149e2a (patch)
tree053eb1a8c0deae0ae278883e4b6d592a262dd1c1 /pjsip/src/pjsua-lib/pjsua_call.c
parentff591488bfa7b642ae00ab48cff03129f6c71ae1 (diff)
More on ticket #399: a)send full offer on 200/OK response when re-INVITE does not have SDP, b) added on_create_offer() callback, c) handle some error cases
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1379 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_call.c')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index 247c3085..e362679d 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -50,6 +50,12 @@ static void pjsua_call_on_rx_offer(pjsip_inv_session *inv,
const pjmedia_sdp_session *offer);
/*
+ * Called to generate new offer.
+ */
+static void pjsua_call_on_create_offer(pjsip_inv_session *inv,
+ pjmedia_sdp_session **offer);
+
+/*
* This callback is called when transaction state has changed in INVITE
* session. We use this to trap:
* - incoming REFER request.
@@ -118,6 +124,7 @@ pj_status_t pjsua_call_subsys_init(const pjsua_config *cfg)
inv_cb.on_new_session = &pjsua_call_on_forked;
inv_cb.on_media_update = &pjsua_call_on_media_update;
inv_cb.on_rx_offer = &pjsua_call_on_rx_offer;
+ inv_cb.on_create_offer = &pjsua_call_on_create_offer;
inv_cb.on_tsx_state_changed = &pjsua_call_on_tsx_state_changed;
@@ -2295,6 +2302,52 @@ static void pjsua_call_on_rx_offer(pjsip_inv_session *inv,
/*
+ * Called to generate new offer.
+ */
+static void pjsua_call_on_create_offer(pjsip_inv_session *inv,
+ pjmedia_sdp_session **offer)
+{
+ pjsua_call *call;
+ pj_status_t status;
+
+ PJSUA_LOCK();
+
+ call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id];
+
+ /* See if we've put call on hold. */
+ if (call->media_st == PJSUA_CALL_MEDIA_LOCAL_HOLD) {
+ PJ_LOG(4,(THIS_FILE,
+ "Call %d: call is on-hold locally, creating inactive SDP ",
+ call->index));
+ status = create_inactive_sdp( call, offer );
+ } else {
+
+ PJ_LOG(4,(THIS_FILE, "Call %d: asked to send a new offer",
+ call->index));
+
+ /* Init media channel */
+ status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Error initializing media channel", status);
+ PJSUA_UNLOCK();
+ return;
+ }
+
+ status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, offer);
+ }
+
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Unable to create local SDP", status);
+ PJSUA_UNLOCK();
+ return;
+ }
+
+
+ PJSUA_UNLOCK();
+}
+
+
+/*
* Callback called by event framework when the xfer subscription state
* has changed.
*/