function playTones($result) { global $device_states; $ip = $result['ip']; switch ($result['message']['type']) { case 'callmode_change': $device_states[$ip] = $result['message']['new_mode']; break; // GXP unfortunately sends callmode/voicemode/audio path changes AFTER // off-hook for handset. Handsfree and headset set mode FIRST. // Approach is to assume handset // GXP unfortunately sends callmode/voicemode/audio path changes AFTER // off-hook for handset. Handsfree and headset set mode FIRST. // Approach is to assume handset case 'off_hook': switch ($device_states[$ip]) { case 'CALLMODE_SPEAKERPHONE': $path = 'handsfree'; break; default: $path = 'handset'; break; } $g = new GrandstreamAudioControl($ip, 'admin', $path); $g->pulse(); break; } }
#!/usr/bin/php <?php // plays two double beeps - similar to Nokia 'new message' tone if (!($host = @$argv[1])) { die("Usage: beep host\n"); } require_once '../telnet/GrandstreamAudioControl.class.php'; $g = new GrandstreamAudioControl($host); $g->path('handsfree'); $g->play($f = 1500, $vol = 1, $len = 200, $path = null); usleep(20000); $g->play($f = 1500, $vol = 1, $len = 200, $path = null); usleep(700000); $g->play($f = 1500, $vol = 1, $len = 200, $path = null); usleep(20000); $g->play($f = 1500, $vol = 1, $len = 200, $path = null); sleep(1);
#!/usr/bin/php <?php if (!($host = @$argv[1])) { die("Usage: beep host\n"); } require_once '../telnet/GrandstreamAudioControl.class.php'; $g = new GrandstreamAudioControl($host); $g->path('handsfree'); print "Generating Pulses \n"; // $t=array(5, 180000, 100000); $g->pulse(); sleep(2); print "Generating volume sweep \n"; // $timings=array(3, 15000, 2, 5, 30); // $timings=array(3, 3000, 1, 5, 30); $g->sweep();