Last active
September 21, 2017 08:51
-
-
Save ricventu/8e73f518bc50c8d7f995bf0ea3f68e91 to your computer and use it in GitHub Desktop.
Handling Asterisk Manager events from AGI script in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php -q | |
<?php | |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'phpagi.php'); | |
$AGI = new AGI(); | |
$ASM = $AGI->new_AsteriskManager(); | |
$ASM->connect(); | |
function meetme_join($event, $parameters) | |
{ | |
# code... | |
} | |
function meetme_leave($event, $parameters) | |
{ | |
# code... | |
} | |
$ASM->add_event_handler('MeetmeJoin', 'meetme_join'); | |
$ASM->add_event_handler('MeetmeLeave', 'meetme_leave'); | |
$ASM->Events('on'); | |
while(1) { | |
$ASM->wait_response(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment