@ -2169,20 +2169,23 @@ static int chan_pjsip_digit_begin(struct ast_channel *chan, char digit)
{
{
struct ast_sip_channel_pvt * channel = ast_channel_tech_pvt ( chan ) ;
struct ast_sip_channel_pvt * channel = ast_channel_tech_pvt ( chan ) ;
struct ast_sip_session_media * media ;
struct ast_sip_session_media * media ;
int res = 0 ;
media = channel - > session - > active_media_state - > default_session [ AST_MEDIA_TYPE_AUDIO ] ;
media = channel - > session - > active_media_state - > default_session [ AST_MEDIA_TYPE_AUDIO ] ;
switch ( channel - > session - > dtmf ) {
switch ( channel - > session - > dtmf ) {
case AST_SIP_DTMF_RFC_4733 :
case AST_SIP_DTMF_RFC_4733 :
if ( ! media | | ! media - > rtp ) {
if ( ! media | | ! media - > rtp ) {
return - 1 ;
return 0 ;
}
}
ast_rtp_instance_dtmf_begin ( media - > rtp , digit ) ;
ast_rtp_instance_dtmf_begin ( media - > rtp , digit ) ;
break ;
break ;
case AST_SIP_DTMF_AUTO :
case AST_SIP_DTMF_AUTO :
if ( ! media | | ! media - > rtp | | ( ast_rtp_instance_dtmf_mode_get ( media - > rtp ) = = AST_RTP_DTMF_MODE_INBAND ) ) {
if ( ! media | | ! media - > rtp ) {
return 0 ;
}
if ( ast_rtp_instance_dtmf_mode_get ( media - > rtp ) = = AST_RTP_DTMF_MODE_INBAND ) {
return - 1 ;
return - 1 ;
}
}
@ -2197,13 +2200,12 @@ static int chan_pjsip_digit_begin(struct ast_channel *chan, char digit)
case AST_SIP_DTMF_NONE :
case AST_SIP_DTMF_NONE :
break ;
break ;
case AST_SIP_DTMF_INBAND :
case AST_SIP_DTMF_INBAND :
res = - 1 ;
return - 1 ;
break ;
default :
default :
break ;
break ;
}
}
return res ;
return 0 ;
}
}
struct info_dtmf_data {
struct info_dtmf_data {
@ -2290,7 +2292,6 @@ static int chan_pjsip_digit_end(struct ast_channel *ast, char digit, unsigned in
{
{
struct ast_sip_channel_pvt * channel = ast_channel_tech_pvt ( ast ) ;
struct ast_sip_channel_pvt * channel = ast_channel_tech_pvt ( ast ) ;
struct ast_sip_session_media * media ;
struct ast_sip_session_media * media ;
int res = 0 ;
if ( ! channel | | ! channel - > session ) {
if ( ! channel | | ! channel - > session ) {
/* This happens when the channel is hungup while a DTMF digit is playing. See ASTERISK-28086 */
/* This happens when the channel is hungup while a DTMF digit is playing. See ASTERISK-28086 */
@ -2304,8 +2305,9 @@ static int chan_pjsip_digit_end(struct ast_channel *ast, char digit, unsigned in
case AST_SIP_DTMF_AUTO_INFO :
case AST_SIP_DTMF_AUTO_INFO :
{
{
if ( ! media | | ! media - > rtp ) {
if ( ! media | | ! media - > rtp ) {
return - 1 ;
return 0 ;
}
}
if ( ast_rtp_instance_dtmf_mode_get ( media - > rtp ) ! = AST_RTP_DTMF_MODE_NONE ) {
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_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 ) ;
ast_rtp_instance_dtmf_end_with_duration ( media - > rtp , digit , duration ) ;
@ -2343,28 +2345,29 @@ static int chan_pjsip_digit_end(struct ast_channel *ast, char digit, unsigned in
}
}
case AST_SIP_DTMF_RFC_4733 :
case AST_SIP_DTMF_RFC_4733 :
if ( ! media | | ! media - > rtp ) {
if ( ! media | | ! media - > rtp ) {
return - 1 ;
return 0 ;
}
}
ast_rtp_instance_dtmf_end_with_duration ( media - > rtp , digit , duration ) ;
ast_rtp_instance_dtmf_end_with_duration ( media - > rtp , digit , duration ) ;
break ;
break ;
case AST_SIP_DTMF_AUTO :
case AST_SIP_DTMF_AUTO :
if ( ! media | | ! media - > rtp | | ( ast_rtp_instance_dtmf_mode_get ( media - > rtp ) = = AST_RTP_DTMF_MODE_INBAND ) ) {
if ( ! media | | ! media - > rtp ) {
return 0 ;
}
if ( ast_rtp_instance_dtmf_mode_get ( media - > rtp ) = = AST_RTP_DTMF_MODE_INBAND ) {
return - 1 ;
return - 1 ;
}
}
ast_rtp_instance_dtmf_end_with_duration ( media - > rtp , digit , duration ) ;
ast_rtp_instance_dtmf_end_with_duration ( media - > rtp , digit , duration ) ;
break ;
break ;
case AST_SIP_DTMF_NONE :
case AST_SIP_DTMF_NONE :
break ;
break ;
case AST_SIP_DTMF_INBAND :
case AST_SIP_DTMF_INBAND :
res = - 1 ;
return - 1 ;
break ;
}
}
return res ;
return 0 ;
}
}
static void update_initial_connected_line ( struct ast_sip_session * session )
static void update_initial_connected_line ( struct ast_sip_session * session )