From 25239448c6c5a31a484eafd5211af84f79d5db2e Mon Sep 17 00:00:00 2001 From: Riza Sulistyo Date: Tue, 11 Feb 2014 04:46:49 +0000 Subject: Re #1734: Add flash support for DTMF rfc 2833. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4739 74dad513-b988-da41-8d7b-12977e46ad98 --- pjmedia/include/pjmedia/stream.h | 5 ++++- pjmedia/src/pjmedia/endpoint.c | 2 +- pjmedia/src/pjmedia/stream.c | 11 ++++++++--- pjsip-apps/src/pjsua/pjsua_app_legacy.c | 2 +- pjsip/include/pjsua-lib/pjsua.h | 6 ++++-- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/pjmedia/include/pjmedia/stream.h b/pjmedia/include/pjmedia/stream.h index 88e5a882..a2e5f207 100644 --- a/pjmedia/include/pjmedia/stream.h +++ b/pjmedia/include/pjmedia/stream.h @@ -341,7 +341,10 @@ PJ_DECL(pj_status_t) pjmedia_stream_resume(pjmedia_stream *stream, * only valid for audio stream. * * @param stream The media stream. - * @param ascii_digit String containing digits to be sent to remote. + * @param ascii_digit String containing digits to be sent to remote as + * described on RFC 2833 section 3.10. Character 'R' is + * used to represent the event type 16 (flash) as stated + * in RFC 4730. * Currently the maximum number of digits are 32. * * @return PJ_SUCCESS on success. diff --git a/pjmedia/src/pjmedia/endpoint.c b/pjmedia/src/pjmedia/endpoint.c index 6abc680d..8a68072a 100644 --- a/pjmedia/src/pjmedia/endpoint.c +++ b/pjmedia/src/pjmedia/endpoint.c @@ -558,7 +558,7 @@ PJ_DEF(pj_status_t) pjmedia_endpt_create_audio_sdp(pjmedia_endpt *endpt, /* Add fmtp */ attr = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_attr); attr->name = pj_str("fmtp"); - attr->value = pj_str(PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR " 0-15"); + attr->value = pj_str(PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR " 0-16"); m->attr[m->attr_count++] = attr; } #endif diff --git a/pjmedia/src/pjmedia/stream.c b/pjmedia/src/pjmedia/stream.c index 7ecb6388..9abbbde5 100644 --- a/pjmedia/src/pjmedia/stream.c +++ b/pjmedia/src/pjmedia/stream.c @@ -230,10 +230,11 @@ struct pjmedia_stream /* RFC 2833 digit */ -static const char digitmap[16] = { '0', '1', '2', '3', +static const char digitmap[17] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '#', - 'A', 'B', 'C', 'D'}; + 'A', 'B', 'C', 'D', + 'R'}; /* Zero audio frame samples */ static pj_int16_t zero_frame[2 * 30 * 16000 / 1000]; @@ -1568,7 +1569,7 @@ static void handle_incoming_dtmf( pjmedia_stream *stream, } /* Ignore unknown event. */ - if (event->event > 15) { + if (event->event > 16) { PJ_LOG(5,(stream->port.info.name.ptr, "Ignored RTP pkt with bad DTMF event %d", event->event)); @@ -2754,6 +2755,10 @@ PJ_DEF(pj_status_t) pjmedia_stream_dial_dtmf( pjmedia_stream *stream, { pt = 11; } + else if (dig == 'r') + { + pt = 16; + } else { status = PJMEDIA_RTP_EINDTMF; diff --git a/pjsip-apps/src/pjsua/pjsua_app_legacy.c b/pjsip-apps/src/pjsua/pjsua_app_legacy.c index 6297833b..0e9333ef 100644 --- a/pjsip-apps/src/pjsua/pjsua_app_legacy.c +++ b/pjsip-apps/src/pjsua/pjsua_app_legacy.c @@ -1201,7 +1201,7 @@ static void ui_send_dtmf_2833() pj_status_t status; char buf[128]; - if (!simple_input("DTMF strings to send (0-9*#A-B)", buf, + if (!simple_input("DTMF strings to send (0-9*R#A-B)", buf, sizeof(buf))) { return; diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 4dc2187c..00699962 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -4693,10 +4693,12 @@ PJ_DECL(pj_status_t) pjsua_call_xfer_replaces(pjsua_call_id call_id, const pjsua_msg_data *msg_data); /** - * Send DTMF digits to remote using RFC 2833 payload formats. + * Send DTMF digits to remote using RFC 2833 payload formats. * * @param call_id Call identification. - * @param digits DTMF string digits to be sent. + * @param digits DTMF string digits to be sent as described on RFC 2833 + * section 3.10. Character 'R' is used to represent the + * event type 16 (flash) as stated in RFC 4730. * * @return PJ_SUCCESS on success, or the appropriate error code. */ -- cgit v1.2.3