#!/usr/bin/php -qc /var/lib/asterisk/agi-bin/useragi/php_agi.ini exec("PlayBack", "beep"); //$application="Playback"; //$argument="beep"; //$agi->exec($application, $argument); } function Get_Song() { GLOBAL $agi; $toggle = false; $trigger = 1;//set to 1 so goes through initially //Get number of songs present $family = 'jl2515'; $key = 'num_songs'; $return = $agi->database_get($family, $key); echo $return; $TOT_SONGS = $return['data']; //this holds the result ['result'] holds the result of the action $agi->say_number($TOT_SONGS); } /* //Ask for song number, exit only once a valid number is entered while($toggle == false) { $agi->saynumber($TOT_SONGS) $return = $agi->get_data("jl2515/w3/selectsong",2,3) $SONG_NUM = $return['result']; if($SONG_NUM <= $TOT_SONGS) $toggle = true; } while($trigger != 0) { //4 goes back, 6 goes forward, 0 quits $song_title="jl2515/s$SONG_NUM"; $return = $agi->stream_file($song_title, "460"); $trigger = $return['result']; if($trigger == 4+48) { Beep(); $SONG_NUM = $SONG_NUM -1; if($SONG_NUM < 1) SONG_NUM = $TOT_SONGS; } else if($trigger == 6+48) { Beep(); $SONG_NUM = $SONG_NUM + 1; if($SONG_NUM > $TOT_SONGS) SONG_NUM = 1; } else $trigger = 0; } } */ function MainLoop() { GLOBAL $agi; Get_Song(); Beep(); }//END MainLoop MainLoop(); ?>