Connect an AGI Script to a conference

Hello,

I would like a program (an AGI script) to listen to a conversation and play audio files. This would happen during a conference between 2 or more users (connected through SIP phones). I tried the following dialplan, but unfortunately Page places only outbound calls (ie it makes ext 111 ring but does not execute the instructions of the dialplan.

exten => _5XXX,1,Answer()
exten => _5XXX,n,Playback(welcome)
exten => _5XXX,n,Page(SIP/${EXTEN:1}&SIP/111)

exten => 111,1,Agi(agi://localhost/myApp.agi)

I ran through the documentation but could not find a way to bridge an AGI script into a conference.

Any idea ?

Thank you in advance,
Gilles Gerlinger

Try using the Originate application to put everyone into a MeetMe or ConfBridge individually.

Hi Malcolm,

Thank you very much for your answer. You suggested to use the Originate application. I think that this is what I did, but I may have missed something. Here is what I achieved so far.

Bob (exten 101) calls Alice (exten 102) and he needs the help of an assistant during his conversation with Alice.

I wrote the following dialplan so that instead of dialing Alice directly, Bob uses a prefix (digit 6 here) to explicitly indicate that he requires assistancy.

exten => _6XXX,1,Answer()
exten => _6XXX,n,Playback(some_annoucement_here)
exten => _6XXX,n,Agi(agi://localhost/myscript.agi)

In myscript, in JAVA here, I wrote the following:

public void service(AgiRequest request, AgiChannel channel) throws AgiException {

    String dest = request.getExtension().substring(1);
    Callback cb = new Callback(this);
    asteriskServer.originateToApplicationAsync("SIP/" + dest, "MeetMe", "600", 30000, cb);

    // Go to conf room (synchronous call!)
    channel.exec("MeetMe", "600");
    }

I understood that Bob who initiated the call, was the channel to this script and therefore if I use a streamFile method on that channel, I am able to play an audio file to Bob.
The originateToApplicationAsync puts Alice into the conference room 600.
Then Bob has to join the conf room too so that he can speak to Alice. This is what the channel.exec method does. However, this call is a synchronous call, which means that when Bob joins the conference room, the script is suspended and therefore unable to play an audio file to Bob and Alice.

What would work here is an asynchronous call to a context^extension^priority instead of a SIP number so that I can bridge real people into the conference but agi scripts as well.

But maybe I am not doing things the right way… Could you tell me what is the correct approach to this?

Kind regards,
Gilles Gerlinger

Hi,

Okay, for that application then, maybe MeetMe isn’t exactly what you need. Perhaps instead you would simply want to use the ChanSpy application? With that, you can whisper to Bob, or barge to both Bob & Alice. ?