diff options
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 19 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_media.c | 6 |
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; } |