Hello, I have a client that is based on a Ubuntu Server that has an online commerce business… he wants to have an automated call go out to the businesses that receive orders to confirm the orders they have taken. I have done a lot of web / database development, but never something like this.
Can someone point me in the right direction? Is Asterisk a good fit for this simple sort of automated call thing? Is there a certain Asterisk product/s I should be looking at?
Thanks!
Donovan
This is a simple task to achieve , Usually you do this automated call using Asterisk AMI. The easier way is use PHP. I can share some code if you need it
Hey ambiorixg12,
I’d sure be interested in seeing your code… PHP is a “second” language to me, so I should be able to follow it… and maybe port the functionality to the language the site is in. However, I’m guessing the PHP solution uses functions / libs that may be hard to product in the other language though.
I will check out Asterisk AMI to… thanks!
Donovan
You can query the db where the numbers are saved, and then pass that value through a variable to the code that make the call,
example:
select business_number from orders where order_status=‘pending’;
This is an old code , when I was just a newbie but it woks , more advanced examples can be found on the web
<?php
$extension='102'; //this could be the variable
$socket = fsockopen("192.168.15.200","5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n"); // default username and password for users
fputs($socket, "Secret: 123\r\n\r\n"); // for other Asterisk platforms plase get your username and
// password from /etc/asterisk/manager.con
$wrets=fgets($socket,128);
echo $wrets;
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: SIP/$trunk/$extension\r\n" );
fputs($socket, "Exten: 4443\r\n" );
fputs($socket, "Context: extensiones\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
sleep (1);
$wrets=fgets($socket,128);
?>
Thanks amb…
That looks like the socket connection to talk to the asterisk server… I can understand that part well enough, but I guess I am starting from scratch.
It appears I have to set up a machine to install asterisk. then get it config’d for my purposes?
Would you guys recommend this for newbs?:
digium.com/en/training/aster … s-training
Thanks!
Donovan
That is a very good training, But the only issue is that I dont see any topic doing reference the Asterisk manager interface (AMI). But any way Asterisk manager is pretty simple.