diff options
author | Torrey Searle <torrey@voxbone.com> | 2017-06-15 10:12:41 +0200 |
---|---|---|
committer | George Joseph <gjoseph@digium.com> | 2017-06-29 07:57:01 -0600 |
commit | fb7247c57c532f2d5e174ef12d6f82e576d65d10 (patch) | |
tree | 66e503620f1082490a757f34c84beb2ba4bf211a /channels | |
parent | 45df25a579edd5423c9d319758d109a74fe8ef33 (diff) |
res_pjsip: Add DTMF INFO Failback mode
The existing auto dtmf mode reverts to inband if 4733 fails to be
negotiated. This patch adds a new mode auto_info which will
switch to INFO instead of inband if 4733 is not available.
ASTERISK-27066 #close
Change-Id: Id185b11e84afd9191a2f269e8443019047765e91
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_pjsip.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index 7cab42873..0e4468cdc 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -1962,6 +1962,12 @@ static int chan_pjsip_digit_begin(struct ast_channel *chan, char digit) ast_rtp_instance_dtmf_begin(media->rtp, digit); break; + case AST_SIP_DTMF_AUTO_INFO: + if (!media || !media->rtp || (ast_rtp_instance_dtmf_mode_get(media->rtp) == AST_RTP_DTMF_MODE_NONE)) { + return -1; + } + ast_rtp_instance_dtmf_begin(media->rtp, digit); + break; case AST_SIP_DTMF_NONE: break; case AST_SIP_DTMF_INBAND: @@ -2063,6 +2069,20 @@ static int chan_pjsip_digit_end(struct ast_channel *ast, char digit, unsigned in media = channel->session->active_media_state->default_session[AST_MEDIA_TYPE_AUDIO]; switch (channel->session->endpoint->dtmf) { + case AST_SIP_DTMF_AUTO_INFO: + { + if (!media || !media->rtp) { + return -1; + } + if (ast_rtp_instance_dtmf_mode_get(media->rtp) != AST_RTP_DTMF_MODE_NONE) { + ast_debug(3, "Told to send end of digit on Auto-Info channel %s RFC4733 negotiated so using it.\n", ast_channel_name(ast)); + ast_rtp_instance_dtmf_end_with_duration(media->rtp, digit, duration); + break; + } + /* If RFC_4733 was not negotiated, fail through to the DTMF_INFO processing */ + ast_debug(3, "Told to send end of digit on Auto-Info channel %s RFC4733 NOT negotiated using INFO instead.\n", ast_channel_name(ast)); + } + case AST_SIP_DTMF_INFO: { struct info_dtmf_data *dtmf_data = info_dtmf_data_alloc(channel->session, digit, duration); @@ -2095,14 +2115,15 @@ static int chan_pjsip_digit_end(struct ast_channel *ast, char digit, unsigned in } ast_rtp_instance_dtmf_end_with_duration(media->rtp, digit, duration); - break; - case AST_SIP_DTMF_AUTO: - if (!media || !media->rtp || (ast_rtp_instance_dtmf_mode_get(media->rtp) == AST_RTP_DTMF_MODE_INBAND)) { - return -1; - } - - ast_rtp_instance_dtmf_end_with_duration(media->rtp, digit, duration); - break; + break; + case AST_SIP_DTMF_AUTO: + if (!media || !media->rtp || (ast_rtp_instance_dtmf_mode_get(media->rtp) == AST_RTP_DTMF_MODE_INBAND)) { + return -1; + } + + ast_rtp_instance_dtmf_end_with_duration(media->rtp, digit, duration); + break; + case AST_SIP_DTMF_NONE: break; |