mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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
This commit is contained in:
committed by
George Joseph
parent
45df25a579
commit
fb7247c57c
@@ -1960,6 +1960,12 @@ static int chan_pjsip_digit_begin(struct ast_channel *chan, char digit)
|
||||
return -1;
|
||||
}
|
||||
|
||||
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:
|
||||
@@ -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;
|
||||
}
|
||||
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;
|
||||
|
||||
ast_rtp_instance_dtmf_end_with_duration(media->rtp, digit, duration);
|
||||
break;
|
||||
|
||||
case AST_SIP_DTMF_NONE:
|
||||
break;
|
||||
|
Reference in New Issue
Block a user