Originate multiple calls


#1

Hi,
I’m using API command ‘Originate’ in order to invite people to a conference from a web page;
at the moment I’m only able to invite one person at once; and then I have to execute again the command Originate.
This is the php file:
invite.php

<?php if (isset($_POST["num"])) header( "Location: [x.x.x.x/invite.php?number=](http://x.x.x.x/invite.php?number=)".$_POST["num"]); $number=strtolower($_REQUEST['number']); $pos=strpos ($number,"local"); if ($number == null) : ?> Inserisci il numero <?php exit() ; endif ; if ($pos===false) : $errno=0 ; $errstr=0 ; $fp = fsockopen ("localhost", 5038, &$errno, &$errstr, 20); if (!$fp) { echo "$errstr ($errno)
\n"; } else { fputs ($fp, "Action: login\r\n"); fputs ($fp, "Username: phpagi\r\n"); fputs ($fp, "Secret: phpagi\r\n"); fputs ($fp, "Events: off\r\n\r\n"); sleep(1) ; fputs ($fp, "Action: Originate\r\n"); fputs ($fp, "Channel: $number\r\n"); fputs ($fp, "Context: invite\r\n"); fputs ($fp, "Extension: s\r\n"); fputs ($fp, "Priority: 1\r\n\r\n"); //fputs ($fp, "Callerid: Astra\r\n"); sleep(2) ; fclose ($fp); } echo "L'invito e'stato inoltrato al numero: $number." ; else : exit() ; endif ; in my extension.conf I have: [invite] exten => s,1,Wait() exten => s,2,Background(custom/partecipa) exten => 1,1,Goto(conf_room,8222,1) exten => h,1,Hangup() exten => i,1,Playback(invalid) exten => i,2,Goto(s,7) exten => s,1,GotoIf($[${DIALSTATUS} = ANSWER]?4) exten => s,2,Answer exten => s,3,Wait(1) exten => s,4,SetVar(LOOPED=1) exten => s,5,GotoIf($[${LOOPED} > 3]?hang,1) exten => s,6,SetVar(DIR-CONTEXT=general) exten => s,7,DigitTimeout(5) ; netlabUP exten => s,8,ResponseTimeout(7) exten => s,9,Background(custom/partecipa) exten => t,1,SetVar(LOOPED=$[${LOOPED} + 1]) exten => t,2,Goto(s,5) exten => h,1,Hangup() [conf_room] exten => _8XX,1,Macro(user-callerid) exten => _8XX,2,Answer exten => _8XX,3,Wait(1) exten => _8XX,4,GotoIf($[${CALLERIDNUM} = ${EXTEN:1}]?6:5) exten => _8XX,5,MeetMe(${EXTEN}|sM) exten => _8XX,6,MeetMe(${EXTEN}|asM) Thank you for helping me, C.

#2

A few things, one you may want to have a look at:

phpagi.sourceforge.net

as it may do some of the donkey work for you in regards to Asterisk Manager API.

As for the Originate command, it is possible to make this asynchronous (but you still need one originate per user you are going to include), just have a look here:

voip-info.org/wiki/view/Aste … +Originate


#3

I’ve already reed the wiki but it didn’t help me very much;
Now I look at the other link,
Thanks,
C.