@ -510,6 +510,9 @@ static void bridge_after_cb_failed(enum ast_bridge_after_cb_reason reason,
ast_bridge_after_cb_reason_string ( reason ) ) ;
ast_bridge_after_cb_reason_string ( reason ) ) ;
}
}
static int OK = 0 ;
static int FAIL = - 1 ;
static void * app_control_add_channel_to_bridge (
static void * app_control_add_channel_to_bridge (
struct stasis_app_control * control ,
struct stasis_app_control * control ,
struct ast_channel * chan , void * data )
struct ast_channel * chan , void * data )
@ -542,7 +545,7 @@ static void *app_control_add_channel_to_bridge(
bridge_after_cb_failed , control ) ;
bridge_after_cb_failed , control ) ;
if ( res ! = 0 ) {
if ( res ! = 0 ) {
ast_log ( LOG_ERROR , " Error setting after-bridge callback \n " ) ;
ast_log ( LOG_ERROR , " Error setting after-bridge callback \n " ) ;
return NUL L;
return & FAI L;
}
}
{
{
@ -569,22 +572,24 @@ static void *app_control_add_channel_to_bridge(
ast_log ( LOG_ERROR , " Error adding channel to bridge \n " ) ;
ast_log ( LOG_ERROR , " Error adding channel to bridge \n " ) ;
ast_channel_pbx_set ( chan , control - > pbx ) ;
ast_channel_pbx_set ( chan , control - > pbx ) ;
control - > pbx = NULL ;
control - > pbx = NULL ;
return NUL L;
return & FAI L;
}
}
ast_assert ( stasis_app_get_bridge ( control ) = = NULL ) ;
ast_assert ( stasis_app_get_bridge ( control ) = = NULL ) ;
control - > bridge = bridge ;
control - > bridge = bridge ;
}
}
return NULL ;
return & OK ;
}
}
void stasis_app_control_add_channel_to_bridge (
int stasis_app_control_add_channel_to_bridge (
struct stasis_app_control * control , struct ast_bridge * bridge )
struct stasis_app_control * control , struct ast_bridge * bridge )
{
{
int * res ;
ast_debug ( 3 , " %s: Sending channel add_to_bridge command \n " ,
ast_debug ( 3 , " %s: Sending channel add_to_bridge command \n " ,
stasis_app_control_get_channel_id ( control ) ) ;
stasis_app_control_get_channel_id ( control ) ) ;
stasis_app_send_command _async ( control ,
res = stasis_app_send_command ( control ,
app_control_add_channel_to_bridge , bridge ) ;
app_control_add_channel_to_bridge , bridge ) ;
return * res ;
}
}
static void * app_control_remove_channel_from_bridge (
static void * app_control_remove_channel_from_bridge (
@ -594,7 +599,7 @@ static void *app_control_remove_channel_from_bridge(
struct ast_bridge * bridge = data ;
struct ast_bridge * bridge = data ;
if ( ! control ) {
if ( ! control ) {
return NUL L;
return & FAI L;
}
}
/* We should only depart from our own bridge */
/* We should only depart from our own bridge */
@ -606,20 +611,22 @@ static void *app_control_remove_channel_from_bridge(
ast_log ( LOG_WARNING , " %s: Not in bridge %s; not removing \n " ,
ast_log ( LOG_WARNING , " %s: Not in bridge %s; not removing \n " ,
stasis_app_control_get_channel_id ( control ) ,
stasis_app_control_get_channel_id ( control ) ,
bridge - > uniqueid ) ;
bridge - > uniqueid ) ;
return NUL L;
return & FAI L;
}
}
ast_bridge_depart ( chan ) ;
ast_bridge_depart ( chan ) ;
return NULL ;
return & OK ;
}
}
void stasis_app_control_remove_channel_from_bridge (
int stasis_app_control_remove_channel_from_bridge (
struct stasis_app_control * control , struct ast_bridge * bridge )
struct stasis_app_control * control , struct ast_bridge * bridge )
{
{
int * res ;
ast_debug ( 3 , " %s: Sending channel remove_from_bridge command \n " ,
ast_debug ( 3 , " %s: Sending channel remove_from_bridge command \n " ,
stasis_app_control_get_channel_id ( control ) ) ;
stasis_app_control_get_channel_id ( control ) ) ;
stasis_app_send_command _async ( control ,
res = stasis_app_send_command ( control ,
app_control_remove_channel_from_bridge , bridge ) ;
app_control_remove_channel_from_bridge , bridge ) ;
return * res ;
}
}
const char * stasis_app_control_get_channel_id (
const char * stasis_app_control_get_channel_id (