summaryrefslogtreecommitdiff
path: root/channels/chan_pjsip.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2015-04-10 17:53:44 +0000
committerMatthew Jordan <mjordan@digium.com>2015-04-10 17:53:44 +0000
commit88b0fa77555b6216d751e156f7f0fdfe33fa9638 (patch)
treef75fd733bf050239a2f4b1bc15f86451fe79d0f4 /channels/chan_pjsip.c
parent16afee4651c034f5cab18b0ee0a1b925b9044fdf (diff)
res_pjsip: Add an 'auto' option for DTMF Mode
This patch adds support for automatically detecting the type of DTMF that a PJSIP endpoint supports. When the 'dtmf_mode' endpoint option is set to 'auto', the channel created for an endpoint will attempt to determine if RFC 4733 DTMF is supported. If so, it will use that DTMF type. If not, the DTMF type for the channel will be set to inband. Review: https://reviewboard.asterisk.org/r/4438 ASTERISK-24706 #close Reported by: yaron nahum patches: yaron_patch_3_Feb.diff submitted by yaron nahum (License 6676) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_pjsip.c')
-rw-r--r--channels/chan_pjsip.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index c9d09dbeb..207a7d90b 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -548,7 +548,7 @@ static struct ast_frame *chan_pjsip_cng_tone_detected(struct ast_sip_session *se
int exists;
/* If we only needed this DSP for fax detection purposes we can just drop it now */
- if (session->endpoint->dtmf == AST_SIP_DTMF_INBAND) {
+ if (session->endpoint->dtmf == AST_SIP_DTMF_INBAND || session->endpoint->dtmf == AST_SIP_DTMF_AUTO) {
ast_dsp_set_features(session->dsp, DSP_FEATURE_DIGIT_DETECT);
} else {
ast_dsp_free(session->dsp);
@@ -1473,6 +1473,14 @@ 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:
+ if (!media || !media->rtp || (ast_rtp_instance_dtmf_mode_get(media->rtp) == AST_RTP_DTMF_MODE_INBAND)) {
+ return -1;
+ }
+
+ ast_rtp_instance_dtmf_begin(media->rtp, digit);
+ break;
case AST_SIP_DTMF_NONE:
break;
case AST_SIP_DTMF_INBAND:
@@ -1576,6 +1584,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;
+
case AST_SIP_DTMF_NONE:
break;
case AST_SIP_DTMF_INBAND: