--------------------------------------------- (Inserted after the action_redirect function) --------------------------------------------- [...] static char mandescr_bridge[] = "Description: Bridge 2 channels together\n" "Variables: (Names marked with * are required)\n" " *Channel1: First channel\n" " *Channel2: Second channel\n" "Return 0 on success."; static int action_bridge(struct mansession *s, struct message *m) { /* New command by "Carl de Billy" */ char *name1 = astman_get_header(m, "Channel1"); char *name2 = astman_get_header(m, "Channel2"); struct ast_channel *chan1 = NULL, *chan2 = NULL; struct ast_bridge_config config; struct ast_frame *f; struct ast_channel *who; int res; /* Validate params */ if(!name1 || ast_strlen_zero(name1)){ astman_send_error(s, m, "Channel1 not specified"); return -1; } if(!name2 || ast_strlen_zero(name2)){ astman_send_error(s, m, "Channel2 not specified"); return -1; } /* Get channels */ chan1 = ast_get_channel_by_name_locked(name1); chan2 = ast_get_channel_by_name_locked(name2); res = ast_channel_make_compatible(chan1, chan2); if(res < 0){ astman_send_error(s, m, "Impossible to make channels compatible"); return -2; } ast_deactivate_generator(chan1); ast_deactivate_generator(chan2); config.timelimit=0; config.play_warning=0; config.warning_freq=0; config.end_sound=NULL; config.start_sound=NULL; /* Do the job */ res = ast_channel_bridge(chan1, chan2, &config, &f, &who); /* Clean-up */ if (chan1) ast_mutex_unlock(&chan1->lock); if (chan2) ast_mutex_unlock(&chan2->lock); return res; } [...] ------------------------------------- (Register added for "Bridge" command) ------------------------------------- [...] int init_manager(void) { struct ast_config *cfg; char *val; int oldportno = portno; static struct sockaddr_in ba; int x = 1; if (!registered) { /* Register default actions */ ast_manager_register2("Ping", 0, action_ping, "Ping", mandescr_ping); ast_manager_register2("Events", 0, action_events, "Contol Event Flow", mandescr_events); ast_manager_register2("Logoff", 0, action_logoff, "Logoff Manager", mandescr_logoff); ast_manager_register2("Hangup", EVENT_FLAG_CALL, action_hangup, "Hangup Channel", mandescr_hangup); ast_manager_register( "Status", EVENT_FLAG_CALL, action_status, "Status" ); ast_manager_register2( "Setvar", EVENT_FLAG_CALL, action_setvar, "Set Channel Variable", mandescr_setvar ); ast_manager_register2( "Getvar", EVENT_FLAG_CALL, action_getvar, "Gets a Channel Variable", mandescr_getvar ); ast_manager_register( "Redirect", EVENT_FLAG_CALL, action_redirect, "Redirect" ); ast_manager_register2("Originate", EVENT_FLAG_CALL, action_originate, "Originate Call", mandescr_originate ); ast_manager_register2( "Command", EVENT_FLAG_COMMAND, action_command, "Execute Command", mandescr_command ); ast_manager_register2( "ExtensionState", EVENT_FLAG_CALL, action_extensionstate, "Check Extension Status", mandescr_extensionstate ); ast_manager_register2( "AbsoluteTimeout", EVENT_FLAG_CALL, action_timeout, "Set Absolute Timeout", mandescr_timeout ); ast_manager_register2( "MailboxStatus", EVENT_FLAG_CALL, action_mailboxstatus, "Check Mailbox", mandescr_mailboxstatus ); ast_manager_register2( "MailboxCount", EVENT_FLAG_CALL, action_mailboxcount, "Check Mailbox Message Count", mandescr_mailboxcount ); ast_manager_register2("ListCommands", 0, action_listcommands, "List available manager commands", mandescr_listcommands); ast_manager_register2( "Bridge", EVENT_FLAG_CALL, action_bridge, "Bridge 2 channels", mandescr_bridge ); ast_cli_register(&show_mancmd_cli); ast_cli_register(&show_mancmds_cli); ast_cli_register(&show_manconn_cli); ast_extension_state_add(NULL, NULL, manager_state_cb, NULL); registered = 1; } [...]