Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- <?
- #[@] Lucky's Queue Alert Script
- #[@]
- #[@] Plays a media file on your Asterisk server which can output to a speaker
- #[@] alerting you that you have XX amount of calls in the specified queue.
- #[@]
- #[@] Special thanks to Deck, Backie, and Cooter for the help making this
- //Define the login info
- $username = "admin"; //Admin username. Default is admin
- $password = "password"; //Your secret from manager.conf
- $server = "localhost"; //The server you are connecting to
- $fp = fsockopen($server, 5038, $errno, $errstr, 30);
- $out = "Action: Login\r\n";
- $out .= "UserName: $username\r\n";
- $out .= "Secret: $password\r\n\r\n";
- fwrite($fp, $out);
- $out = "Action: QueueStatus\r\n";
- $out .= "ActionID: 1\r\n\r\n"; //This is any number you wish to set it as
- $out .= "Action: Logoff\r\n\r\n";
- fwrite($fp,$out);
- $in = "";
- while (!feof($fp)) {
- $in .= fgets($fp);
- }nano
- fclose($fp);
- //Parses out the "Calls:" section
- $queue_exten = strstr($in, "Queue: 141"); //Specify the queue number
- $calls = strstr($queue_exten, "Calls: ");
- $callsnum = substr($calls, 7, 9); //This grabs the 2 digits represented by Calls: xx
- $callsnum = intval($callsnum);
- if ($callsnum >= 3) { //Specifies the number of calls to trigger the audio file
- system("mpg123 /path/to/test1.mp3"); //This will call mpg123 to play the file
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement