summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2012-05-17 08:14:05 +0000
committerNanang Izzuddin <nanang@teluu.com>2012-05-17 08:14:05 +0000
commit1cf598d9a2b29e9eb101455c1e3b3eddf6fbe20c (patch)
treeb7f287da0c873523f5ed8903c33c7f58ed32bdee
parent5e3c2cb55bda665a4d4f5d9210de39136b8cf360 (diff)
Close #1506: Added PJSUA callback for SDP creation.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4128 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h19
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c6
2 files changed, 25 insertions, 0 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index bba2d8bf..886617f8 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -662,6 +662,25 @@ typedef struct pjsua_callback
/**
+ * Notify application when a call has just created a local SDP (for
+ * initial or subsequent SDP offer/answer). Application can implement
+ * this callback to modify the SDP, before it is being sent and/or
+ * negotiated with remote SDP, for example to apply per account/call
+ * basis codecs priority or to add custom/proprietary SDP attributes.
+ *
+ * @param call_id The call index.
+ * @param sdp The SDP has just been created.
+ * @param pool The pool instance, application should use this pool
+ * to modify the SDP.
+ * @param rem_sdp The remote SDP, will be NULL if local is SDP offerer.
+ */
+ void (*on_call_sdp_created)(pjsua_call_id call_id,
+ pjmedia_sdp_session *sdp,
+ pj_pool_t *pool,
+ const pjmedia_sdp_session *rem_sdp);
+
+
+ /**
* Notify application when media session is created and before it is
* registered to the conference bridge. Application may return different
* media port if it has added media processing port to the stream. This
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index c8bcdd79..9e2c4c23 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -2025,6 +2025,12 @@ pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id,
call->rem_offerer = (rem_sdp != NULL);
+ /* Notify application */
+ if (pjsua_var.ua_cfg.cb.on_call_sdp_created) {
+ (*pjsua_var.ua_cfg.cb.on_call_sdp_created)(call_id, sdp,
+ pool, rem_sdp);
+ }
+
*p_sdp = sdp;
return PJ_SUCCESS;
}