From 2fe9c7e503a9599ed0361e10bb6ba1c4bf311e4c Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Tue, 26 Dec 2006 00:11:48 +0000 Subject: Added DTMF callback support all the way to PJSUA API (ticket #48) git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@863 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsua-lib/pjsua_call.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'pjsip/src/pjsua-lib/pjsua_call.c') diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c index 46abb1f7..b042e935 100644 --- a/pjsip/src/pjsua-lib/pjsua_call.c +++ b/pjsip/src/pjsua-lib/pjsua_call.c @@ -2049,6 +2049,22 @@ static void call_disconnect( pjsip_inv_session *inv, pjsip_inv_send_msg(inv, tdata); } +/* + * DTMF callback from the stream. + */ +static void dtmf_callback(pjmedia_stream *strm, void *user_data, + int digit) +{ + PJ_UNUSED_ARG(strm); + + if (pjsua_var.ua_cfg.cb.on_dtmf_digit) { + pjsua_call_id call_id; + + call_id = (pjsua_call_id)user_data; + pjsua_var.ua_cfg.cb.on_dtmf_digit(call_id, digit); + } +} + /* * Callback to be called when SDP offer/answer negotiation has just completed * in the session. This function will start/update media if negotiation @@ -2188,6 +2204,14 @@ static void pjsua_call_on_media_update(pjsip_inv_session *inv, return; } + /* If DTMF callback is installed by application, install our + * callback to the session. + */ + if (pjsua_var.ua_cfg.cb.on_dtmf_digit) { + pjmedia_session_set_dtmf_callback(call->session, 0, + &dtmf_callback, + (void*)(call->index)); + } /* Get the port interface of the first stream in the session. * We need the port interface to add to the conference bridge. -- cgit v1.2.3