New extension for VoIP Asterisk Manager ( Request for comments )
| From: | Moises Silva | Date: | Sun, 31 Dec 2006 21:47:56 +0000 |
| Subject: | New extension for VoIP Asterisk Manager ( Request for comments ) | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-4424@lists.php.net to get a copy of this message | ||
Hi. I have written a small extension for PHP to be able to connect
with Asterisk Manager Interface. More information about Asterisk and
its manager interface can be found here:
http://www.digium.com/
http://www.asterisk.org/
http://www.voip-info.org/wiki/view/Asterisk+manager+API
This allow any PHP script easily send actions ( Like originate VoIP
calls and hangup current calls in the PBX ) and receive events ( like
new call, ringing call, peer register etc ) and act upon them using
callbacks.
Im using standar Linux TCP sockets, I guess work need still be done to
compile in other plataforms, but asterisk is mainly used on linux, so
I think is a good start.
The latest code can be found at:
svn://moy.ivsol.net/php-ami/trunk
A few documentation and example script is included.
I welcome ALL the feedback, good or bad.
A sample session would look like this:
$resource = ami_connect('asterisk.domain.com:5038', 'user', 'password');
ami_send_action($resource, 'Ping');
$response = ami_read($resource);
var_dump($response) /* usually the Pong response should be received here */;
The user can register callbacks to wait for events and responses to
actions. And start
waiting calling ami_loop() function. The function never returns unless
some callback return a value equal to AMI_EXIT_LOOP constant.
I also wanted to know what are the steps to include this in pecl repository.
Kind Regards.
--
"Su nombre es GNU/Linux, no solamente Linux, mas info en http://www.gnu.org"