Subject: Office-wide paging with Asterisk and Cisco 7960 7940 phones
I spoke the other day about my preliminary tests with office-wide paging with Cisco phones
using the new SIP 6.1 image which supports auto-answer.
I've got a small and crude recipe for those of you who want to experiment and hopefully create some better and more complete examples than the one I've thrown together below.
Create a new line on each of the Cisco phones, and put the configuration into sip.conf as you normally would. I figure you have enough clue to create a new line in sip.conf and on your Cisco phones at this point. Go into settings -> Call Preferences -> Auto Answer (intercom) and then make the "new" line you've just created as auto-answer. (I wish there was a way to do this via the configuration file! Having to set this while sitting in front of the phone is silly and wasteful.)
Now that you have created a valid Asterisk-capable SIP line that auto-answers, here's how you get the paging features to work:
Here's what I have in extensions.conf:
[conference]
exten => 5555,1,AbsoluteTimeout(21)
exten => 5555,2,AGI(callall)
exten => 5555,3,MeetMe(5555,dq)
exten => 5555,4,Hangup
exten => t,1,Hangup
exten => T,1,Hangup
exten => h,1,Hangup
;
[add-to-conference]
exten => start,1,AbsoluteTimeout(20)
exten => start,2,MeetMe(5555,dmq)
exten => h,1,Hangup
exten => t,1,Hangup
exten => T,1,Hangup
Here are the contents of /var/lib/asterisk/agi-bin/callall
#!/bin/sh
cp /var/lib/asterisk/agi-bin/*conf /var/spool/asterisk/outgoing
Make sure to make the script executable.
And then for every extension I have as an auto-answer, I have a file like this
in /var/lib/asterisk/agi-bin:
Channel: SIP/2006
Context: add-to-conference
WaitTime: 2
Extension: start
Priority: 1
CallerID: Office Pager <5555>
So, I have three lines that are configured for automatic answering - SIP/2006, SIP/2007, SIP/2008. I have three files named 2006-conf, 2007-conf, 2008-conf in /var/lib/asterisk/agi-bin that get copied into the outgoing call spool directory every time I call extension 5555. These three lines are the auto-answer lines on each of the three phone devices I'm experimenting with.
Now, dial 5555 from any phone and you should have one-way paging. Voila! People who use the pager may have to get used to waiting 1-2 seconds before speaking to allow all the phones to catch up with the audio stream. All of the phones hang up after 20 seconds, regardless of if the person originating the page has stopped talking. Change the AbsoluteTimeout values to increase this interval.
If you want a really confusing loud mess, then change the "dmq" options to "dq" and you'll get an N-way conversation going with everyone who has a phone. Bad.
If you want a really interesting office surveillance tool, change the "dmq" to "dt" and you'll suddenly be listening to all of the extensions in the office, like some kind of mega-snoop tool. Useful for after-hours listening throughout the entire office.
Someone should improve my scripts with the following changes:
- AGI should automatically show the caller ID of the person originating the call instead of a generic pager address
- The AGI should take arguments of what extensions to call and then dynamically create the list of files that get copied out to the /var/spool/asterisk/outgoing directory
JT
Improved extension.conf (evolved with new Asterisk features):
extensions.conf without the need for a timeout:[conference]
exten => 5555,1,AGI(callall)
exten => 5555,2,MeetMe(5555,dtqp) ; press # to exit the conference
exten => 5555,3,MeetMeAdmin(5555,K) ; kick all users out
exten => 5555,4,Hangup
exten => h,1,Hangup
;
[add-to-conference]
exten => start,1,MeetMe(5555,dmqp)
exten => h,1,Hangup
Here is a much improved version of the paging function:
First setup a second extension for each phone that is +100 of the base extension (ie. base=200, intercom=300)Under the extensions.conf add each of your intercom extensions to the intercom context
extensions.conf
[intercom]
exten => *30,1,AGI(callall|5555|${CALLERIDNUM}|300|302) ; Change to match the range of extensions you want to page
exten => *30,2,Hangup
exten => h,1,Hangup
exten => 300,1,Macro(call-intercom,300)
exten => 301,1,Macro(call-intercom,301)
exten => 302,1,Macro(call-intercom,302)
; add your extensions here
[macro-call-intercom]
exten => s,1,AGI(callall|${CALLERIDNUM}|${CALLERIDNUM}|${ARG1}|${ARG1})
exten => s,2,Hangup
exten => h,1,Hangup
[add-to-intercom]
exten => start,1,Playback(beep)
exten => start,2,MeetMe(${iConf},${iConfParm})
exten => start,3,Macro(hangupcall)
exten => h,1,Hangup
Then in callall:
#!/bin/sh
# Parameters are: [conference number] [callers number] [start call number] [end call number]
asteriskdir=/var/spool/asterisk/outgoing/
outdir=/var/lib/asterisk/agi-bin/intercom/
conf=$2
startchan=$3
endchan=$4
if [[ "$2" == "" ]]; then
conf=5555
fi
if [[ "$3" == "" ]]; then
startchan=300
fi
if [[ "$4" == "" ]]; then
endchan=302
fi
intercom=$(($1+100)) # Change me if you need a bigger offset between the extensions
for (( channel=$startchan ; channel <= $endchan ; channel++ )) do
if [[ $1 != $channel && $intercom != $channel ]]; then
echo Channel: SIP/$channel > $outdir$channel-conf
echo Context: add-to-intercom >> $outdir$channel-conf
echo Extension: start >> $outdir$channel-conf
echo Priority: 1 >> $outdir$channel-conf
echo WaitTime: 2 >> $outdir$channel-conf
echo CallerID: Intercom \<$1\> >> $outdir$channel-conf
echo MaxRetries: 0 >> $outdir$channel-conf
echo SetVar: iConf=$conf >> $outdir$channel-conf
if [[ $startchan == $endchan ]]; then
echo SetVar: iConfParm=dqp >> $outdir$channel-conf
else
echo SetVar: iConfParm=dmqp >> $outdir$channel-conf
fi
fi
done
mv $outdir*conf $asteriskdir
if [[ $startchan == $endchan ]]; then
echo EXEC meetme $conf\|dqp
else
echo EXEC meetme $conf\|dtqp
fi
echo EXEC MeetMeAdmin $conf\|K
Change the default startchan and endchan to match your configuration.
You might also want to rename the conf-kick.gsm and replace it with the beep.gsm
This will allow you to call an intercom number, it will beep and you can talk, or dial *30 and page all the intercom phones, they will beep before you talk, and then beep again before hanging up. Also the caller can just hang up instead of hitting pound.
Page Changes
yes ,it can work
I test with our ipphone and ata .it do support auto-answer ,compatible with asterisk ,tribox .
yes ,it can work
I test with our ipphone and ata .it do support auto-answer ,compatible with asterisk ,tribox .
Re: Got it working ,BUT
Re: Cisco 7940-7960 auto-answer config
Re: Got it working ,BUT
auto answer should pickup within 2 seconds so its all good :)
Kicking
1. You had better use '#' to close the announcement, or you will leave all the auto-answer
phones in the conference. I tried to the "Kick-all" in the 'h' extension, but no go. I misunderstand
the 'h' extension. I'll go look it up.
2. When you do choose the '#' option to end the conference, the "You have been kicked from the conference"
message will be played to all your auto-answer phones. This is pretty ugly in this case, but you can cure it by
replacing the "conf-kicked.gsm' file with the contents of 'beep.gsm', or whatever suits your fancy. Or, you can
leave it alone and get a laugh from everyone in hearing range. Having some sound-off is nice, it lets everyone
know that the announcement is over.
syntax correction?
cp /var/lib/asterisk/agi-bin/*conf /var/spool/asterisk/outgoing
should be a
mv /var/lib/asterisk/agi-bin/*conf /var/spool/asterisk/outgoing
to make sure the file isn't read before its all the way moved
-adrian
I have the same problems
Got it working ,BUT
1. I couldn't get the AGI(callall) to work. I verifed that the callall file works (./callall will dialout to all the phones). But while the log says the AGI(callall) ran, I never saw the calls being made. Now if I replaced AGI(callall) with System(/var/lib/asterisk/agi-bin/callall then the calls are made
2. So now that I got it to work. A problem happens. I dial 5555. Callall fires off (now by using the Sytem cmd) and the phones answer and the meetme conf happens. When the meetme times out, the phone that placed the call starts ringing. I think the callall script is still trying to call the phone that started the Office page in the first place. Which sort of makes sense , since all my phones are in the callall. and when it fires up it will try to place the phone orginating the Office Page in the meetme conf (but it's already there). So when the meetme times out (20 sec) then the orginating phone is called again.