summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-02-20 08:56:15 +0000
committerBenny Prijono <bennylp@teluu.com>2008-02-20 08:56:15 +0000
commit033950af51e08982e1e51e39b4dc172d8abf1d7a (patch)
tree3f8c643a0517822a3efe8adfe5ca3e366a51a64b /pjsip
parentbf9553a2b9f58387e62b4398f708649c6d0d0a78 (diff)
Ticket #489: New PJSUA callbacks to notify application when media stream is created and destroyed
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1806 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h38
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c12
2 files changed, 50 insertions, 0 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index ca93208e..1e857b51 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -602,6 +602,44 @@ typedef struct pjsua_callback
*/
void (*on_call_media_state)(pjsua_call_id call_id);
+
+ /**
+ * 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
+ * media port then will be added to the conference bridge instead.
+ *
+ * @param call_id Call identification.
+ * @param sess Media session for the call.
+ * @param stream_idx Stream index in the media session.
+ * @param p_port On input, it specifies the media port of the
+ * stream. Application may modify this pointer to
+ * point to different media port to be registered
+ * to the conference bridge.
+ *
+ * \par Python:
+ * Not applicable.
+ */
+ void (*on_stream_created)(pjsua_call_id call_id,
+ pjmedia_session *sess,
+ unsigned stream_idx,
+ pjmedia_port **p_port);
+
+ /**
+ * Notify application when media session has been unregistered from the
+ * conference bridge and about to be destroyed.
+ *
+ * @param call_id Call identification.
+ * @param sess Media session for the call.
+ * @param stream_idx Stream index in the media session.
+ *
+ * \par Python:
+ * Not applicable.
+ */
+ void (*on_stream_destroyed)(pjsua_call_id call_id,
+ pjmedia_session *sess,
+ unsigned stream_idx);
+
/**
* Notify application upon incoming DTMF digits.
*
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index 92c1cf60..4bd41f61 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -886,6 +886,10 @@ static void stop_media_session(pjsua_call_id call_id)
}
if (call->session) {
+ if (pjsua_var.ua_cfg.cb.on_stream_destroyed) {
+ pjsua_var.ua_cfg.cb.on_stream_destroyed(call_id, call->session, 0);
+ }
+
pjmedia_session_destroy(call->session);
call->session = NULL;
@@ -1057,6 +1061,14 @@ pj_status_t pjsua_media_channel_update(pjsua_call_id call_id,
*/
pjmedia_session_get_port(call->session, 0, &media_port);
+ /* Notify application about stream creation.
+ * Note: application may modify media_port to point to different
+ * media port
+ */
+ if (pjsua_var.ua_cfg.cb.on_stream_created) {
+ pjsua_var.ua_cfg.cb.on_stream_created(call_id, call->session,
+ 0, &media_port);
+ }
/*
* Add the call to conference bridge.