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 ++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'pjmedia') 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; -- cgit v1.2.3