Cut-Through Paging Question

Doctor and his partner carry numeric pagers and want an IVR menu: “to page dr A press 1, to page dr B press 2”. When caller presses 1 or 2 they are prompted to input their call-back number which is “paged” to correct pager. How might we accomplish the paging part of this?
Thanks in advance,
Tom Baur

What type of paging service are they using ?

Is it an old Arch or so paging servcice ?

Do they have a SMS gateway for the paging service ?

How many characters can the pager handle per page ?

There are a few ways to do it, please answer these questions and I may be able to help.


Thanks for the response. I hope this makes sense…
My customer is a doctor who uses a simple numeric beeper because cell service is spotty in the hospital. I want an IVR that allows callers to input ther call-back number which is displayed on the beeper.
The pager protocol is: dial the pager, input your number, press # to end.


To keep it simple.
How about making options 1 or 2 etc. point to a virtual extension that is forwarding the call to the pager number ?

Just an idea since you keep it simple for the customer to change things.

If not you would need to make a custom context for that feature.
Just gets a little more crazy since there is no handshake between the paging service and you may not get the information over properly.

I would still imagine the paging service as an email to send page gateway ?

they all do somehow.

Then you could forward the voicemail notification with the CID to the pager.

Let me know if this is helpful, if not I will look into giving you some thoughts about a script for it.


I have an AGI script that will do what you want.

You just need to find out what email GW the paging company has to accept an email that has the numeric information to be passed to your customers pager.

Further you have to make sure your local email server/sendmail is not rejected by the email server of the paging firm due to a FQDN issue, or better said the DNS has to match on the outside world.

I have tested this with AT&T to send a SMS to my cell and it works great.
I will post the details after you confirm your still looking for a solution.



i am still looking for a solution

I am not sure how techie you are, but this works great and has lots of potential.

It takes a little work to make it happen.

Let me know if you have problems with it.


  1. Install this script in /var/lib/asterisk/agi-bin
    1. Make it executable with:

      chmod +x pager2sms-0.2.agi

    2. Add an extension to extensions.conf that calls the script, like:

      exten => s,1,DeadAGI,pager2sms-0.2.agi|

      (You can get a list of email to SMS addresses from cellphone providers here)

    3. Change the hello-world sound file for a custom one.



Version 0.2

by Martin Masson ( martin (at domain) )

February 24th, 2007

Complete rewrite to take hangups into account


1. Install this script in /var/lib/asterisk/agi-bin

2. Make it executable with:

chmod +x pager2sms-0.2.agi

3. Add an extension to extensions.conf

that calls the script, like:

exten => s,1,DeadAGI,pager2sms-0.2.agi|

4. Change the hello-world sound file for a custom one.


This script is provided as-is without any garantee.

You are free to copy, modify, etc. with credit.


my $recipient = $ARGV[0];
my $sender = "[email protected]";
my $msglimit = 20;

use Asterisk::AGI;
my $AGI = new Asterisk::AGI;

my %input = $AGI->ReadParse();
my $callerid = $input{‘callerid’};

Ask for some digits that will be emailed to the recipient

Get up to the limit with a 10,000ms timeout

Change the hello-world sound file for your own

my $char = “BEGIN”;
while ($char ne “END” && length($pagermsg) < $msglimit ) {
$char = $AGI->get_data(“silence/1”, “10000”, “1”);
$AGI->verbose(“Key pressed: ‘$char’”,3);
$pagermsg .= $char;
if ($char eq “” || $char==-1) { $char = “END”; }

Send the email


Say good-bye


Hang up


sub sendmail() {

# If we enter nothing, don't send an email	
if ($pagermsg ne "") {
	# Convert the '*' to an '-'
	$pagermsg =~ s/\*/\-/g;

	# Send the mail
	open (MAIL, "|/usr/sbin/sendmail -t ");
		print MAIL "From: $sender\n";
		print MAIL "To: $recipient\n";
		print MAIL "Content-Type: text/plain\n";
		print MAIL "Subject: Message from $callerid\n\n";
		print MAIL "Numeric Message: $pagermsg";
	close (MAIL);
	$AGI->verbose("Sent email to $recipient with numeric message: $pagermsg",3);


sub endcall(){

$AGI->verbose("Call was hung up instead of timing out or using #",3);


What is the quick and easy way to do the above under freepbx (using the new freepbx distro)? I understand it isn’t a good idea to edit the files directly if at all possible.