ConfBridge On Asterisk 11

Home » Asterisk Users » ConfBridge On Asterisk 11
Asterisk Users 1 Comment

I believe I am running an AGI (to put users in a conf) before the confbridge is built. So the users are not really get in the conf…

exten X,1,run agi to put users in conf exten X,n,ConfBridge()

How do I have in the dial plan ConfBridge() and someplace run an AGI that brings the users I want into that Conf.

I cannot delay in the AGI and wait for the conf because the conf is not built until I return from the AGI…

Any thoughts?

Thanks,

Jerry

One thought on - ConfBridge On Asterisk 11

  • Make your AGI script fork itself; have the child process detach, and the parent process exit. Then, the AGI call will return quickly to the dialplan;
    and meanwhile, the script can continue in the background at its own leisure.

    Example code (Perl) follows:

    #!/usr/bin/perl -w use strict;
    use Asterisk::AGI;

    my $child_pid;

    my $AGI = new Asterisk::AGI;
    my %params = $AGI->ReadParse();

    $SIG{CHLD} = “IGNORE”;

    if ($child_pid = fork) {
    # This is executed in the parent process
    exit;
    }
    elsif (defined $child_pid) {
    # This is executed in the child process
    close STDIN;
    close STDOUT;
    close STDERR;
    # Now we are detached

    #
    # This is where we do the funky stuff
    #

    exit;
    }
    else {
    # Oh, s#!t
    die “Could not fork: $!”;
    };
    # We should never, ever get here exit;