[Asterisk-Users] MeetMe Features
Leif Madsen
leif.madsen at gmail.com
Fri Dec 10 00:29:02 MST 2004
On Thu, 9 Dec 2004 10:59:56 +0100, Stojan Sljivic - Pamet
<stojan.sljivic at pamet.co.yu> wrote:
> - When someone joins the conference a message "<name> is now joining the
> conference." is played.
I decided to work on this today to see what happened. I used Peter's
logic to get me started.
This is by no means complete. Infact, its pretty dirty, but it works
and just wanted to post this to prove it can be done.
Now that I have the general idea of what is going on, I should be able
to just put this entire thing right into the Perl script and not need
any dialplan logic. But thats why Asterisk is great, theres a 1000
ways to accomplish your goal.
In order to use this, you must create a directory for the user
recordings. My example is for conference 5050 and the user pin is
1234.
mkdir -p /var/lib/asterisk/sounds/conf/5050
Then from the Asterisk CLI, create an entry in the AstDB.
*CLI> database put conference/room/5050 1234 ""
This will create the family/key entry with a value of nothing. The
first time the user logs in it will prompt them to say their name.
After the user presses pound (#), it will save the file to
/var/lib/asterisk/sounds/conf/5050/1234.wav. You will be able to
check to see if the user has created a wav file by doing a lookup in
the database.
*CLI> database show
If you need to re-record the prompt, just null out the value again.
If the user enters an incorrect conference/pin pair three times, then
the user is disconnected.
I'll be working on this again over the weekend to clean it up and make
it a bit more practical. Comments/suggestions/constructive criticism
welcome.
; extensions.conf snippet
;------------------------------------------------------------------------------
; MeetMe Announced Join
; (c)2004 Leif Madsen
; http://www.leifmadsen.com
;------------------------------------------------------------------------------
[conf-announced-join]
exten => s,1,SetVar(pincheck=0)
exten => s,2,Answer
exten => s,3,Read(confnum|conf-getconfno|4)
; get conf num
exten => s,4,Read(confpin|conf-getpin|4)
; get conf pin
exten => s,5,DBGet(userannouncement=conference/room/${confnum}/${confpin})
; if not available n+101
exten => s,6,GotoIf($["${userannouncement}" =
""]?recordprompt,1:joinconf,1) ; if blank, record an entry prompt
exten => s,106,SetVar(pincheck=$[${pincheck} + 1])
; invalid pin
exten => s,107,GotoIf($[${pincheck} = 3]?invalidpin,1)
; if three times wrong, goto invalidpin
exten => s,108,Playback(conf-invalidpin)
exten => s,109,Goto(s,3)
exten => recordprompt,1,SetVar(announcement=${confpin}.wav)
exten => recordprompt,2,DBPut(conference/room/${confnum}/${confpin}=${announcement})
exten => recordprompt,3,Playback(after-the-tone)
exten => recordprompt,4,Record(conf/${confnum}/${announcement}||6)
exten => recordprompt,5,Goto(joinconf,1)
exten => joinconf,1,AGI(conference-announce.pl)
exten => joinconf,2,MeetMe(${confnum}|q)
exten => invalidpin,1,Playback(invalid)
; 3 times wrong
exten => invalidpin,2,Hangup
exten => _505X,1,MeetMe(${EXTEN}|q)
; allow 5050 -> 5059
exten => _505X,2,Hangup
; Perl script
#!/usr/bin/perl
# Announced conference join script
# (c)2004 Leif Madsen
# http://www.leifmadsen.com
use warnings;
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse();
$pin= $AGI->get_variable('confpin');
$conf= $AGI->get_variable('confnum');
# callfile variables
my $CALLFILE = "/var/lib/asterisk/agi-bin/conf-announce.call"; # this
needs to be a temporary place before we move it to
/var/spool/asterisk/
my $CALL_CHANNEL = "Local/$conf\@conf-announced-join\/n";
my $CALL_RETRIES = 1;
my $CALL_RETRYTIME = 60;
my $CALL_WAITTIME = 30;
my $CALL_APP = "Playback";
my $CALL_APP_DATA = ("conf\/$conf\/$pin");
main::Callfile();
sub main::Callfile
{
open(OUTFILE, ">> $CALLFILE") or die $AGI->verbose("can't open
$CALLFILE for writing\n");
print OUTFILE "Channel: $CALL_CHANNEL\n";
print OUTFILE "MaxRetries: $CALL_RETRIES\n";
print OUTFILE "RetryTime: $CALL_RETRYTIME\n";
print OUTFILE "WaitTime: $CALL_WAITTIME\n";
print OUTFILE "Application: $CALL_APP\n";
print OUTFILE "Data: $CALL_APP_DATA\n";
`mv $CALLFILE /var/spool/asterisk/outgoing`;
close OUTFILE;
};
Leif Madsen.
http://www.leifmadsen.com
http://www.asteriskdocs.org
http://www.hacklocalhost.com
More information about the asterisk-users
mailing list