#!/usr/bin/perl -w use strict; use Asterisk::AGI; my $agi = new Asterisk::AGI; my %in = $agi->ReadParse(); my $position = int(rand(5)) + 5; while(1) { $agi->stream_file('you-are-curr-call-num') < 0 && last; $agi->say_number($position) < 0 && last; $agi->stream_file('in-the-line') < 0 && last; $agi->stream_file('pls-stay-on-line') < 0 && last; $agi->exec('WaitMusicOnHold', '30') < 0 && last; $position += int(rand(5)); }