[Asterisk-Users] Polycom Paging & Intercom - Please Wiki-Size
John Baker
johnb at listbrokers.com
Tue Mar 16 16:20:46 MST 2004
Carey -
OK, here it is (and please don't make fun of my poor perl programming
skills. My philosophy is if something works and it's stupid, then it
works)
First, make sure your Polycom phones are setup as in
http://www.voip-info.org/wiki-Polycom+auto-answer+config
Then, copy this perl script into /var/lib/asterisk/agi-bin/allcall.agi
#!/bin/sh
#!/usr/bin/perl
#
#
# allcall.agi will add all your Polycom sip phones to a meet me
# conference for use in office wide paging
#
# It takes arguments in the form of SIP/XXXX where XXXX is your
# sip extension. (can be any number of digits) The first argument
# is the originating caller and additional arguments are any other
# phone lines you wish to exclude
#
use File::Copy;
# A Few Variables to Set and Initialize
#
#
$outgoing = '/var/spool/asterisk/outgoing';
$temp = '/var/tmp';
$asterisk = '/usr/sbin/asterisk';
$audio_out = 'console/dsp';
@bypass = ();
@meetme_calls = ();
@sips = ();
# Parse out the Sip phones to exclude
#
# This truly shows my lack of understanding of perl
#
foreach $nocall (@ARGV) {
@bypass = split ( / /, $nocall );
}
# This is our originating caller. I need his
# callerid so that others will know who the paging
# pest is:
#
$callerid = $bypass[0];
$callerid =~ s-SIP/--g;
# Setup an array with all the sip phones
#
# I think I could use the Asterisk::AGI here
# and also the incominglimit in sip.conf to accomplish
# this, but I'm not that good.
@sips = `$asterisk -rx "sip show inuse"`;
chomp(@sips);
shift (@sips);
shift (@sips);
# Now check each sip phone to see if it's in use and also
# against our exclude list. If it passes both, it's
# added to our array of calls to make
foreach $sipline (@sips) {
$sipphone = 'SIP/' . substr( $sipline, 0, 4 );
$sipinuse = substr( $sipline, 16, 1 );
unless ( grep ( /$sipphone/i, @bypass ) ) {
push ( @meetme_calls, make_call("$sipphone") );
}
}
# The array is complete. The push line is uncommented
# if you want to add audio out to the intercom
#
#
# push ( @meetme_calls, make_call("$audio_out") );
# Now move each call file to the outgoing directory
#
# Here's some more perl ugly
#
foreach $call (@meetme_calls) {
move( "$temp" . '/' . "$call", "$outgoing" . '/' . "$call" );
}
exit 0;
sub make_call { # makes the call file and returns the name
$stripslash = $_[0];
$stripslash =~ s-/--g;
$tempcall = $temp . '/' . $stripslash . $$;
$callbase = $stripslash . $$;
open( call, ">>$tempcall" );
print call << "EOF";
Channel: $_[0]
MaxRetries: 1
Retry: 0
RetryTime: 60
Context: add-to-page
Extension: start
Priority: 1
SetVar: ALERT_INFO="Ring Answer"
CallerID: All-Call at $callerid
EOF
close(call);
return $callbase;
}
Next, in extensions.conf, add these two:
[macro-system-page]
exten => s,1,AbsoluteTimeout(11)
exten => s,2,NoOp,${ARG1}
exten => s,3,AGI,allcall.agi|SIP/${ARG1} ${EX-DESIGN} ${EX-SALES1}
; The first variable is the originating caller, the others are phones I
; wish to exclude from the system-wide paging. (Not everybody likes to
; be bothered, don't you know?) The form of the variable
; is SIP/EXT - For example, ${EX-DESIGN} = SIP/7013
exten => s,4,MeetMe(999,dq)
exten => s,5,Playback(beep)
exten => s,6,Hangup
exten => t,1,Hangup
exten => T,1,Hangup
[add-to-page]
exten => start,1,SetVar(ALERT_INFO="Ring Answer")
exten => start,2,AbsoluteTimeout(10)
exten => start,3,MeetMe(999,dmq)
exten => start,4,Hangup
exten => t,1,Hangup
exten => T,1,Hangup
And to invoke, I dial 999 from my sip phones (place the following line
wherever it best suits you:)
exten => 999,1,Macro(system-page,${CALLERIDNUM})
You have 10 seconds to make your announcement. It works well, but my
guys have to remember that it takes a second for the other phones to
answer and sync.
John Baker
On Tue, 2004-03-16 at 11:01, Carey Jung wrote:
> >
> >
> > Polycom 600 phones will do this. They're about $300, including the
> > power supply.
> >
> > I wrote a little how-to at
> > http://www.voip-info.org/wiki-Polycom+auto-answer+config
> >
> > I also wrote an all-call script for system wide paging which you're
> > welcome to, if you decide to use these phones.
> >
>
> I'd love a copy of your all-call script, if you would. I've got Polycom
> 500s.
>
> Thanks,
> Carey Jung
>
>
More information about the asterisk-users
mailing list