Meetme by AGI
the script below (meetme.agi) will prompt for a valid pin up to 3 times. If the pin matches one of the defined Admin pins, it will set the dialplan priority to 10 and exit, if User, sets to 20 and exits. Otherwise Hangs up.
In the case of admin, these MeetMe options are used:
a - Admin mode
A - Marked mode
c - Announce number of participants (optional of course)
s - Present Admin menu by pressing '*'
x - close conf when last marked user leaves.
In the case of user:
c s x are used as above, but we add:
w - wait until marked user enters. (Plays MoH until then)
The dialplan assumes you have a static pinless conference setup as conf #10.
extensions.conf:
exten => 5552323,1,Wait(1)
exten => 5552323,2,Answer()
exten => 5552323,3,AGI(meetme.agi)
exten => 5552323,4,NoOp(Invalid Pin)
exten => 5552323,5,Hangup()
exten => 5552323,10,NoOp(Admin Pin)
exten => 5552323,11,MeetMe(10,aAcsx)
exten => 5552323,12,Hangup()
exten => 5552323,20,NoOp(User Pin)
exten => 5552323,21,MeetMe(10,cswx)
exten => 5552323,22,Hangup()
The script of course requires the Asterisk::AGI module.
meetme.agi:
#!/usr/bin/perl
use Asterisk::AGI;
my $AGI = new Asterisk::AGI;
my $input = { %{$AGI->ReadParse()} };
#our $DEBUG = 1;
my @UserPins = ('11111','22222');
my @AdminPins = ('99999','88888');
my $mode = collectPin($AGI,5);
$AGI->verbose("collectPin got '$mode'") if $DEBUG;
if ($mode eq 'Admin') {
$AGI->set_priority(10);
} elsif ($mode eq 'User') {
$AGI->set_priority(20);
} else {
$AGI->stream_file("goodbye",'""');
$AGI->hangup;
}
exit;
sub collectPin {
my $AGI = shift;
my $maxdigits = shift;
my $tries = 0;
#Three tries to select an existing pin.
while ($tries < 3) {
$AGI->stream_file("please-try-again",'""') if $tries > 0;
$tries++;
my $pin = $AGI->get_data('enter-conf-pin-number', "10000", $maxdigits);
$AGI->verbose("Got PIN $pin.") if $DEBUG;
next unless $pin > 0;
if ( grep(/^$pin$/, @AdminPins) ) {
$AGI->stream_file("pin-number-accepted",'""');
return 'Admin';
} elsif ( grep(/^$pin$/, @UserPins) ) {
$AGI->stream_file("pin-number-accepted",'""');
return 'User';
} else {
$AGI->stream_file("conf-invalidpin",'""');
}
}
return undef;
}