@ -4359,10 +4359,13 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
if ( bridge_end . tv_sec ) {
if ( bridge_end . tv_sec ) {
to = ast_tvdiff_ms ( bridge_end , ast_tvnow ( ) ) ;
to = ast_tvdiff_ms ( bridge_end , ast_tvnow ( ) ) ;
if ( to < = 0 ) {
if ( to < = 0 ) {
if ( config - > timelimit )
if ( config - > timelimit ) {
res = AST_BRIDGE_RETRY ;
res = AST_BRIDGE_RETRY ;
else
/* generic bridge ending to play warning */
ast_set_flag ( config , AST_FEATURE_WARNING_ACTIVE ) ;
} else {
res = AST_BRIDGE_COMPLETE ;
res = AST_BRIDGE_COMPLETE ;
}
break ;
break ;
}
}
} else
} else
@ -4441,6 +4444,7 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
ast_debug ( 1 , " Got DTMF %s on channel (%s) \n " ,
ast_debug ( 1 , " Got DTMF %s on channel (%s) \n " ,
f - > frametype = = AST_FRAME_DTMF_END ? " end " : " begin " ,
f - > frametype = = AST_FRAME_DTMF_END ? " end " : " begin " ,
who - > name ) ;
who - > name ) ;
break ;
break ;
}
}
/* Write immediately frames, not passed through jb */
/* Write immediately frames, not passed through jb */
@ -4512,7 +4516,6 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
int o0nativeformats ;
int o0nativeformats ;
int o1nativeformats ;
int o1nativeformats ;
long time_left_ms = 0 ;
long time_left_ms = 0 ;
struct timeval nexteventts = { 0 , } ;
char caller_warning = 0 ;
char caller_warning = 0 ;
char callee_warning = 0 ;
char callee_warning = 0 ;
@ -4559,11 +4562,11 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
o1nativeformats = c1 - > nativeformats ;
o1nativeformats = c1 - > nativeformats ;
if ( config - > feature_timer ) {
if ( config - > feature_timer ) {
nexteventts = ast_tvadd ( config - > start_time , ast_samp2tv ( config - > feature_timer , 1000 ) ) ;
config- > nexteventts = ast_tvadd ( config - > start_time , ast_samp2tv ( config - > feature_timer , 1000 ) ) ;
} else if ( config - > timelimit ) {
} else if ( config - > timelimit & & firstpass ) {
nexteventts = ast_tvadd ( config - > start_time , ast_samp2tv ( config - > timelimit , 1000 ) ) ;
config- > nexteventts = ast_tvadd ( config - > start_time , ast_samp2tv ( config - > timelimit , 1000 ) ) ;
if ( caller_warning | | callee_warning )
if ( caller_warning | | callee_warning )
nexteventts = ast_tvsub ( nexteventts , ast_samp2tv ( config - > play_warning , 1000 ) ) ;
config- > nexteventts = ast_tvsub ( config - > nexteventts , ast_samp2tv ( config - > play_warning , 1000 ) ) ;
}
}
if ( ! c0 - > tech - > send_digit_begin )
if ( ! c0 - > tech - > send_digit_begin )
@ -4582,9 +4585,9 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
to = - 1 ;
to = - 1 ;
if ( ! ast_tvzero ( nexteventts) ) {
if ( ! ast_tvzero ( config- > nexteventts) ) {
now = ast_tvnow ( ) ;
now = ast_tvnow ( ) ;
to = ast_tvdiff_ms ( nexteventts, now ) ;
to = ast_tvdiff_ms ( config- > nexteventts, now ) ;
if ( to < = 0 ) {
if ( to < = 0 ) {
if ( ! config - > timelimit ) {
if ( ! config - > timelimit ) {
res = AST_BRIDGE_COMPLETE ;
res = AST_BRIDGE_COMPLETE ;
@ -4612,7 +4615,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
}
}
if ( ! to ) {
if ( ! to ) {
if ( time_left_ms > = 5000 & & config - > warning_sound & & config - > play_warning ) {
if ( time_left_ms > = 5000 & & config - > warning_sound & & config - > play_warning & & ast_test_flag ( config , AST_FEATURE_WARNING_ACTIVE ) ) {
int t = ( time_left_ms + 500 ) / 1000 ; /* round to nearest second */
int t = ( time_left_ms + 500 ) / 1000 ; /* round to nearest second */
if ( caller_warning )
if ( caller_warning )
bridge_playfile ( c0 , c1 , config - > warning_sound , t ) ;
bridge_playfile ( c0 , c1 , config - > warning_sound , t ) ;
@ -4620,10 +4623,11 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
bridge_playfile ( c1 , c0 , config - > warning_sound , t ) ;
bridge_playfile ( c1 , c0 , config - > warning_sound , t ) ;
}
}
if ( config - > warning_freq & & ( time_left_ms > ( config - > warning_freq + 5000 ) ) )
if ( config - > warning_freq & & ( time_left_ms > ( config - > warning_freq + 5000 ) ) )
nexteventts = ast_tvadd ( nexteventts , ast_samp2tv ( config - > warning_freq , 1000 ) ) ;
config- > nexteventts = ast_tvadd ( config - > nexteventts , ast_samp2tv ( config - > warning_freq , 1000 ) ) ;
else
else
nexteventts = ast_tvadd ( config - > start_time , ast_samp2tv ( config - > timelimit , 1000 ) ) ;
config- > nexteventts = ast_tvadd ( config - > start_time , ast_samp2tv ( config - > timelimit , 1000 ) ) ;
}
}
ast_clear_flag ( config , AST_FEATURE_WARNING_ACTIVE ) ;
}
}
if ( c0 - > _softhangup = = AST_SOFTHANGUP_UNBRIDGE | | c1 - > _softhangup = = AST_SOFTHANGUP_UNBRIDGE ) {
if ( c0 - > _softhangup = = AST_SOFTHANGUP_UNBRIDGE | | c1 - > _softhangup = = AST_SOFTHANGUP_UNBRIDGE ) {
@ -4726,10 +4730,14 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
if ( ! ast_strlen_zero ( pbx_builtin_getvar_helper ( c1 , " BRIDGEPEER " ) ) )
if ( ! ast_strlen_zero ( pbx_builtin_getvar_helper ( c1 , " BRIDGEPEER " ) ) )
pbx_builtin_setvar_helper ( c1 , " BRIDGEPEER " , c0 - > name ) ;
pbx_builtin_setvar_helper ( c1 , " BRIDGEPEER " , c0 - > name ) ;
res = ast_generic_bridge ( c0 , c1 , config , fo , rc , nexteventts ) ;
res = ast_generic_bridge ( c0 , c1 , config , fo , rc , config - > nexteventts ) ;
if ( res ! = AST_BRIDGE_RETRY )
if ( res ! = AST_BRIDGE_RETRY ) {
break ;
} else if ( config - > feature_timer ) {
/* feature timer expired but has not been updated, sending to ast_bridge_call to do so */
break ;
break ;
}
}
}
ast_clear_flag ( c0 , AST_FLAG_END_DTMF_ONLY ) ;
ast_clear_flag ( c0 , AST_FLAG_END_DTMF_ONLY ) ;
ast_clear_flag ( c1 , AST_FLAG_END_DTMF_ONLY ) ;
ast_clear_flag ( c1 , AST_FLAG_END_DTMF_ONLY ) ;