Saturday, January 20, 2007

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;
}

Sunday, January 14, 2007

Mediaproxy with Accounting setup

There is a new MediaProxy release available.

To upgrade go to http://mediaproxy.ag-projects.com or download the software directly from: http://mediaproxy.ag-projects.com/mediaproxy-1.8.0.tar.gz


Changes from version 1.7.2 to 1.8.0
-----------------------------------

Added support for radius accounting. The accounting type can be specified in the configuration file. To support radius accounting the pyrad module must be installed (available at http://www.wiggy.net/code/pyrad/). The old boolead switch dbaccounting in the [Accounting] section of mediaproxy.ini was replaced by accounting which is a string
specifying the accounting type to be used: none, radius or database.

For those using CDRTool, release 5.0 is available, which works with the new Radius accounting of MediaProxy 1.8.0. To upgrade go to http://cdrtool.ag-projects.com/ or download the software directly from: http://download.dns-hosting.info/CDRTool/cdrtool_5.0.tar.gz

Thanks
Anand Kumar