@ -4549,6 +4549,29 @@ static void manager_bridge_event(int onoff, int type, struct ast_channel *c0, st
S_OR ( c1 - > cid . cid_num , " " ) ) ;
S_OR ( c1 - > cid . cid_num , " " ) ) ;
}
}
static void update_bridgepeer ( struct ast_channel * c0 , struct ast_channel * c1 )
{
const char * c0_name ;
const char * c1_name ;
ast_channel_lock ( c1 ) ;
c1_name = ast_strdupa ( c1 - > name ) ;
ast_channel_unlock ( c1 ) ;
ast_channel_lock ( c0 ) ;
if ( ! ast_strlen_zero ( pbx_builtin_getvar_helper ( c0 , " BRIDGEPEER " ) ) ) {
pbx_builtin_setvar_helper ( c0 , " BRIDGEPEER " , c1_name ) ;
}
c0_name = ast_strdupa ( c0 - > name ) ;
ast_channel_unlock ( c0 ) ;
ast_channel_lock ( c1 ) ;
if ( ! ast_strlen_zero ( pbx_builtin_getvar_helper ( c1 , " BRIDGEPEER " ) ) ) {
pbx_builtin_setvar_helper ( c1 , " BRIDGEPEER " , c0_name ) ;
}
ast_channel_unlock ( c1 ) ;
}
/*! \brief Bridge two channels together */
/*! \brief Bridge two channels together */
enum ast_bridge_result ast_channel_bridge ( struct ast_channel * c0 , struct ast_channel * c1 ,
enum ast_bridge_result ast_channel_bridge ( struct ast_channel * c0 , struct ast_channel * c1 ,
struct ast_bridge_config * config , struct ast_frame * * fo , struct ast_channel * * rc )
struct ast_bridge_config * config , struct ast_frame * * fo , struct ast_channel * * rc )
@ -4702,11 +4725,8 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
break ;
break ;
}
}
/* See if the BRIDGEPEER variable needs to be updated */
update_bridgepeer ( c0 , c1 ) ;
if ( ! ast_strlen_zero ( pbx_builtin_getvar_helper ( c0 , " BRIDGEPEER " ) ) )
pbx_builtin_setvar_helper ( c0 , " BRIDGEPEER " , c1 - > name ) ;
if ( ! ast_strlen_zero ( pbx_builtin_getvar_helper ( c1 , " BRIDGEPEER " ) ) )
pbx_builtin_setvar_helper ( c1 , " BRIDGEPEER " , c0 - > name ) ;
if ( c0 - > tech - > get_pvt_uniqueid )
if ( c0 - > tech - > get_pvt_uniqueid )
pbx_builtin_setvar_helper ( c1 , " BRIDGEPVTCALLID " , c0 - > tech - > get_pvt_uniqueid ( c0 ) ) ;
pbx_builtin_setvar_helper ( c1 , " BRIDGEPVTCALLID " , c0 - > tech - > get_pvt_uniqueid ( c0 ) ) ;
if ( c1 - > tech - > get_pvt_uniqueid )
if ( c1 - > tech - > get_pvt_uniqueid )
@ -4780,10 +4800,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
o1nativeformats = c1 - > nativeformats ;
o1nativeformats = c1 - > nativeformats ;
}
}
if ( ! ast_strlen_zero ( pbx_builtin_getvar_helper ( c0 , " BRIDGEPEER " ) ) )
update_bridgepeer ( c0 , c1 ) ;
pbx_builtin_setvar_helper ( c0 , " BRIDGEPEER " , c1 - > name ) ;
if ( ! ast_strlen_zero ( pbx_builtin_getvar_helper ( c1 , " BRIDGEPEER " ) ) )
pbx_builtin_setvar_helper ( c1 , " BRIDGEPEER " , c0 - > name ) ;
res = ast_generic_bridge ( c0 , c1 , config , fo , rc , config - > nexteventts ) ;
res = ast_generic_bridge ( c0 , c1 , config , fo , rc , config - > nexteventts ) ;
if ( res ! = AST_BRIDGE_RETRY ) {
if ( res ! = AST_BRIDGE_RETRY ) {