Paging: Difference between revisions
Paging moved to Call Without Pickup |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
# | The following procedure will allow you to page a group of phones to make an announcement. This will be a non interactive page and only allows the source to make an announcement and the target phones to listen. | ||
= Using an AGI script = | |||
This procedure will do a search for all registered phones and use <b>hints</b> to find the status of an extension. | |||
Copy the following contents into a file called page.agi and place it to the folder /var/lib/asterisk/agi-bin/ | |||
/var/lib/asterisk/agi-bin/page.agi | |||
<pre> | |||
#!/usr/bin/perl | |||
# | |||
# page.agi - Original file was allpage.agi by Rob Thomas 2005. | |||
# With parts of allcall.agi Original file by John Baker | |||
# Modified by Adam Boeglin to allow for paging sccp phones | |||
#Modified/Updated by Jeremy Betts 6/1/2006 for improved efficiency.. | |||
# We now use AGI to set the dialplan variable.. much smarter! | |||
# | |||
# | |||
# | |||
# This program is free software; you can redistribute it and/or | |||
# modify it under the terms of Version 2 of the GNU General | |||
# Public License as published by the Free Software Foundation | |||
# | |||
# This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | |||
# | |||
# page.agi will find all available sip & sccp phones | |||
# it then sets the dialplan variable PAGE_GROUP to allow | |||
# the phones to be paged with the Page cmd. | |||
# | |||
# This works with both my aastra, polycom, sipura/linksys and cisco sccp phones. | |||
# It should be easily modified for other sip phones | |||
# | |||
# Documentation: | |||
# Add something similar to your dialplan,arguments are extensions to | |||
# to be excluded from the page. Use just the extension numbers. | |||
# | |||
#exten => *61,1,Set(TIMEOUT(absolute) = 15) | |||
#exten => *61,n,AGI(page.agi|<arg>|<arg>) | |||
#exten => *61,n,SetCallerID("Page:${CALLERIDNAME}" <${CALLERIDNUM}>) | |||
#exten => *61,n,Set(_ALERT_INFO="Ring Answer") | |||
#exten => *61,n,SIPAddHeader(Call-Info: answer-after=0) | |||
#exten => *61,n,Page(${PAGE_GROUP}) | |||
#exten => *61,n,Hangup() | |||
# | |||
# | |||
# | |||
#use Asterisk::AGI; | |||
use Asterisk::AGI; | |||
$AGI = new Asterisk::AGI; | |||
# set our array of phones that we will NOT be paging | |||
@bypass = "@ARGV"; | |||
# Get our needed info for idle sip & sccp phones | |||
@sips = grep(/^\s+\d+\s.*/, `asterisk -rx "show hints"`); | |||
# Now check each 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 | |||
# Then set the dialplan variable thru AGI | |||
foreach $sipline (@sips) { | |||
my ($junk0, $exten, $junk1, $chan, $state, $junk2) = split(/ +/, $sipline,6); | |||
my ($type, $extension) = split(/\//,$chan,2); | |||
unless (($state ne "State:Idle") || (grep(/$exten/i, @bypass))) { | |||
if ($type eq "SCCP") { | |||
my $SCCP = $chan . "/aa=1wu/ringer=outside"; | |||
push(@mypage,$SCCP); | |||
} else { | |||
push(@mypage,"$chan"); | |||
} | |||
} | |||
} | |||
$page = join("&",@mypage); | |||
$AGI->set_variable("PAGE_GROUP", "$page"); | |||
exit; | |||
</pre> | |||
Change the page.agi file to be executable. | |||
<pre> | |||
chmod +x /var/lib/asterisk/agi-bin/page.agi | |||
</pre> | |||
Using the example in this page.agi file you need to create a dial plan so you can page the required phones. The script calls all the available phones so you if want to only page some and not all phones you will need to make sure you exclude the required extensions in priority 2. | |||
<pre> | |||
exten => *61,1,Set(TIMEOUT(absolute) = 15) | |||
exten => *61,n,AGI(page.agi|<arg>|<arg>) | |||
exten => *61,n,SetCallerID("Page:${CALLERIDNAME}" <${CALLERIDNUM}>) | |||
exten => *61,n,Set(ALERT_INFO="Ring Answer") | |||
exten => *61,n,SIPAddHeader(Call-Info:\; answer-after=0) | |||
exten => *61,n,Page(${PAGE_GROUP}) | |||
exten => *61,n,Hangup() | |||
</pre> | |||
== page.agi Requirments == | |||
For page.agi to function it requires perl to be installed. Usually this is part of the CentOS package and would normally be installed. Enter the following command to see if perl is installed. | |||
<pre> | |||
perl -v | |||
</pre> | |||
If perl is not install you can install it as follows. | |||
<pre> | |||
yum install perl.i386 | |||
</pre> | |||
= Alternative Method = | |||
An alternative method if you would just like to page a small number of phones either by creating a global variable or by entering the phones into the Page application would be to use the following dial plan. | |||
This example will page 3 extensions 201, 202 and 203. | |||
<pre> | |||
exten => *61,1,SetCallerID("Page:${CALLERIDNAME}" <${CALLERIDNUM}>) | |||
exten => *61,n,Set(ALERT_INFO="Ring Answer") | |||
exten => *61,n,SIPAddHeader(Call-Info:\;answer-after=0) | |||
exten => *61,n,Page(SIP/201&SIP/202&SIP/203) | |||
exten => *61,n,Hangup() | |||
</pre> | |||
Don't get this function confused with [[Call Without Pickup]] | |||
[[Category : Asterisk]] |
Latest revision as of 08:42, 13 May 2011
The following procedure will allow you to page a group of phones to make an announcement. This will be a non interactive page and only allows the source to make an announcement and the target phones to listen.
Using an AGI script
This procedure will do a search for all registered phones and use hints to find the status of an extension.
Copy the following contents into a file called page.agi and place it to the folder /var/lib/asterisk/agi-bin/
/var/lib/asterisk/agi-bin/page.agi
#!/usr/bin/perl # # page.agi - Original file was allpage.agi by Rob Thomas 2005. # With parts of allcall.agi Original file by John Baker # Modified by Adam Boeglin to allow for paging sccp phones #Modified/Updated by Jeremy Betts 6/1/2006 for improved efficiency.. # We now use AGI to set the dialplan variable.. much smarter! # # # # This program is free software; you can redistribute it and/or # modify it under the terms of Version 2 of the GNU General # Public License as published by the Free Software Foundation # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # page.agi will find all available sip & sccp phones # it then sets the dialplan variable PAGE_GROUP to allow # the phones to be paged with the Page cmd. # # This works with both my aastra, polycom, sipura/linksys and cisco sccp phones. # It should be easily modified for other sip phones # # Documentation: # Add something similar to your dialplan,arguments are extensions to # to be excluded from the page. Use just the extension numbers. # #exten => *61,1,Set(TIMEOUT(absolute) = 15) #exten => *61,n,AGI(page.agi|<arg>|<arg>) #exten => *61,n,SetCallerID("Page:${CALLERIDNAME}" <${CALLERIDNUM}>) #exten => *61,n,Set(_ALERT_INFO="Ring Answer") #exten => *61,n,SIPAddHeader(Call-Info: answer-after=0) #exten => *61,n,Page(${PAGE_GROUP}) #exten => *61,n,Hangup() # # # #use Asterisk::AGI; use Asterisk::AGI; $AGI = new Asterisk::AGI; # set our array of phones that we will NOT be paging @bypass = "@ARGV"; # Get our needed info for idle sip & sccp phones @sips = grep(/^\s+\d+\s.*/, `asterisk -rx "show hints"`); # Now check each 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 # Then set the dialplan variable thru AGI foreach $sipline (@sips) { my ($junk0, $exten, $junk1, $chan, $state, $junk2) = split(/ +/, $sipline,6); my ($type, $extension) = split(/\//,$chan,2); unless (($state ne "State:Idle") || (grep(/$exten/i, @bypass))) { if ($type eq "SCCP") { my $SCCP = $chan . "/aa=1wu/ringer=outside"; push(@mypage,$SCCP); } else { push(@mypage,"$chan"); } } } $page = join("&",@mypage); $AGI->set_variable("PAGE_GROUP", "$page"); exit;
Change the page.agi file to be executable.
chmod +x /var/lib/asterisk/agi-bin/page.agi
Using the example in this page.agi file you need to create a dial plan so you can page the required phones. The script calls all the available phones so you if want to only page some and not all phones you will need to make sure you exclude the required extensions in priority 2.
exten => *61,1,Set(TIMEOUT(absolute) = 15) exten => *61,n,AGI(page.agi|<arg>|<arg>) exten => *61,n,SetCallerID("Page:${CALLERIDNAME}" <${CALLERIDNUM}>) exten => *61,n,Set(ALERT_INFO="Ring Answer") exten => *61,n,SIPAddHeader(Call-Info:\; answer-after=0) exten => *61,n,Page(${PAGE_GROUP}) exten => *61,n,Hangup()
page.agi Requirments
For page.agi to function it requires perl to be installed. Usually this is part of the CentOS package and would normally be installed. Enter the following command to see if perl is installed.
perl -v
If perl is not install you can install it as follows.
yum install perl.i386
Alternative Method
An alternative method if you would just like to page a small number of phones either by creating a global variable or by entering the phones into the Page application would be to use the following dial plan.
This example will page 3 extensions 201, 202 and 203.
exten => *61,1,SetCallerID("Page:${CALLERIDNAME}" <${CALLERIDNUM}>) exten => *61,n,Set(ALERT_INFO="Ring Answer") exten => *61,n,SIPAddHeader(Call-Info:\;answer-after=0) exten => *61,n,Page(SIP/201&SIP/202&SIP/203) exten => *61,n,Hangup()
Don't get this function confused with Call Without Pickup