Multiple times Originate With Asterisk and PHP

Hi Guys,

I am trying to make a script that invites users into a conference.
When for example a user calls extensions 1000, he will put into a conference channel and different users will be invited.

I do this at the moment with PHP and the Asterisk AMI.
When I invite one user with Originate it works perfect, but with multiple users like the example below, it doesn’t work.

    Action: Login
    Username: [my username]
    Secret: [my secret]

    Action: Originate
    Channel: SIP/1001
    Context: phones
    Exten: 2000 
    Priority: 1

    Action: Originate
    Channel: SIP/1002
    Context: phones
    Exten: 2000 
    Priority: 1

    Action: Logoff

At the console log, it shows that it is calling number 1001, but it skips number 1002.
Why is this? Is it not possible with the Asterisk Ami to invite multiple people into one conference? or am I missing something here?

My dial plan;

exten => 1000,1,Progress()
exten => 1000,2,Wait(1)
exten => 1000,3,Agi(/var/lib/asterisk/agi-bin/ami/make_invite.php)
exten => 1000,4,ConfBridge(1,default_bridge,admin_user)

exten => 2000,1,Progress()
exten => 2000,2,Wait(1)
exten => 2000,3,ConfBridge(1,default_bridge,default_user)

Thank you in advance.

Should work. Please provide the logs (from the full log file, not a sreen scrape of the console). Enable it if necssary.

Totally possible, I do it daily. With PHP it is a few line of codes

I found the issue.

Looks like if extension 1001 picks up the second extensions 1002 will be called.
Is there a way to call multiple people at the same time, without waiting for the pick up signal?


Make an array on php with the numbers to dial, and loop on that array and add Originate dialing code inside the loop

Found the issue.
To call multiple users with Originate we need to use this;

Async: true

That was the issue.
It’s now working.

Thank you as always :slight_smile:

1 Like

That it is correct

          fputs($socket, "Async: yes\r\n\r\n" );
          fputs($socket, "Action: Logoff\r\n\r\n");

Good point

1 Like