[asterisk-users] PhpAgi call generation

Lee Jenkins lee at datatrakpos.com
Tue Jun 19 12:23:21 CDT 2007


Nitesh Divecha wrote:
> Is there any info on how to create .call files with some examples? And 
> where to place this file? And how to initiate it..?
> 
> Thanks man...
> 
> Cheers,
> Nitesh
> 
> 
> 
> Christopher Robinson wrote:
>> That should be pretty easy to do with a .call file.  The context that 
>> you drop your called party off to will play the sounds and do the 
>> transfer.  So really you need to concentrate on creating that context, 
>> the .call files are very easy to generate.
>>
>>
>> Nitesh Divecha wrote:
>>> Finally, this is what I was looking for... to generate a call.
>>>
>>> I have been working on my Time Clock application, where an employee will 
>>> call into the system using his cellphone to clock in and clock out his 
>>> hours. And it works perfect...
>>>
>>> Now I was looking for an option where or if an employee is late to clock 
>>> in, the system has to generate a call and call the supervisor and inform 
>>> him that XYZ employee is late and give an option to supervisor "Would 
>>> you like to call XYZ employee, Press 1" and the system will call the XYZ 
>>> employee and connect with the supervisor...
>>>
>>> Is it something feasible to do using the .call files? Or I am way too 
>>> off...
>>>
>>> Cheers,
>>> Nitesh
>>>
>>>
>>> Christopher Robinson wrote:
>>>   
>>>> I've done this many times, also used the .call files.  If you don't need 
>>>> your application to initiate the call the .call files are the better way 
>>>> to go, otherwise it's a bit too much file management overhead.
>>>>
>>>> Here's some working code on our end.  In this case the Channel is 
>>>> actually a context which makes the actual call, but I've used it both ways.
>>>>
>>>> <?php
>>>>   require('PHPAGI/phpagi-asmanager.php');
>>>>
>>>>   $callid = 'Somebody';
>>>>
>>>>   $asm = new AGI_AsteriskManager();
>>>>   if($asm->connect())
>>>>   {
>>>>     $call = $asm->send_request('Originate',
>>>>             array('Channel'=>"LOCAL/17165555555 at voicepulse",
>>>>                   'Context'=>'called_party_context',
>>>>                   'Exten'=>'899',
>>>>                   'Timeout' => '1000',
>>>>                   'Async'=>'1',
>>>>                   'MaxRetries' => '5',
>>>>                   'RetryTime' => '5',
>>>>                   'Priority'=>1,
>>>>                   'Callerid'=>$callid));
>>>>     $asm->disconnect();
>>>>   }
>>>> ?>
>>>>
>>>>
>>>> nik600 wrote:
>>>>   
>>>>     
>>>>> hi
>>>>>
>>>>> i'd like to write a simply application in php with phpAgi that:
>>>>>
>>>>> - connect to Asterisk
>>>>> - call an external number using a Zap channel
>>>>> - play a message
>>>>>
>>>>> here is some code:
>>>>>
>>>>> <?php
>>>>>
>>>>> $asm = new AGI_AsteriskManager();
>>>>>
>>>>> if ($asm->connect()) {
>>>>>
>>>>> $asm->Originate("Zap/g1/1","number","default","1");
>>>>>
>>>>> /*
>>>>> play message...
>>>>> */
>>>>> } else {
>>>>>         die("error\n");
>>>>> }
>>>>>
>>>>> ?>
>>>>>
>>>>> But it doesn't work.
>>>>> Is it possible to create a program like this?
>>>>> thanks

Sorry, I can't help you with PHP.  All my stuff is in pascal.  But here 
is a link to call origination info:
http://www.voip-info.org/tiki-index.php?page=Asterisk+auto-dial+out

I did something a bit like what you're doing, but it was a script to 
call into the system and generate a "broadcast" type message to a 
different party.  Again, a bit different, but the elements are all the 
same; call control, origination, database access, etc. Its in pascal, 
but the syntax is very easy to understand and may give you an idea of 
how program flow might be.

http://www.leebo.dreamhosters.com/apscripts/msgcast/


-- 

Warm Regards,

Lee






More information about the asterisk-users mailing list