diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-12-26 00:11:48 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-12-26 00:11:48 +0000 |
commit | 2fe9c7e503a9599ed0361e10bb6ba1c4bf311e4c (patch) | |
tree | 2c9692b2e847917e2ad7e6a364829943b1623ed0 /pjsip/src | |
parent | 2c57eaea78b397d120cfe359ff5d8026dae17f60 (diff) |
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
Diffstat (limited to 'pjsip/src')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_call.c | 24 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_media.c | 2 |
2 files changed, 25 insertions, 1 deletions
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 @@ -2050,6 +2050,22 @@ static void call_disconnect( pjsip_inv_session *inv, } /* + * 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 * has succeeded. @@ -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. diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index 3c92c0ea..87d7d6df 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -442,7 +442,7 @@ pj_status_t pjsua_media_subsys_destroy(void) } /* Close media transports */ - for (i=0; i<(int)pjsua_var.ua_cfg.max_calls; ++i) { + for (i=0; i<pjsua_var.ua_cfg.max_calls; ++i) { if (pjsua_var.calls[i].med_tp) { (*pjsua_var.calls[i].med_tp->op->destroy)(pjsua_var.calls[i].med_tp); pjsua_var.calls[i].med_tp = NULL; |