Asterisk to PBX Paging Code HELP :)

New Code on my FLOW

Im USING THE LATEST FREEPBX but not sure where to put this and what file and how to call it ..... Heres the Flow


Mitel PBX users  Dials 1001 > LS-GS Trunk > (asterisk) Zaptel Inbound Trunk > inbound DID OF 1001 > BEEP > Recording Temp Page> Dial Ext 2001 > Outbound Route > FXS Ring Mitel PBX > Analog code 2001 paging Zone to Speaker)

exten => 1001,1,Answer
exten => 1001,2,Wait(1)
exten => 1001,n,set(pageext="zaptel/1001")
exten => 1001,1,playback(beep)
exten => 1001,2,Wait(1)
exten => 1001,n,record(asterisk-recording:ulaw)
exten => 1001,n,system(echo "Channel: ${pageext}" > /var/spool/asterisk/tmp/
exten => 1001,n,system(echo "WaitTime: 1" >> /var/spool/asterisk/tmp/
exten => 1001,n,system(echo "Context: from-internal" >> /var/spool/asterisk/tmp/
exten => 1001,n,system(echo "Extension: 2001" >> /var/spool/asterisk/tmp/
exten => 1001,n,system(echo "Priority: 1" >> /var/spool/asterisk/tmp/
exten => 1001,n,system(chmod 777 /var/spool/asterisk/outgoing/
exten => 1001,n,system(mv /var/spool/asterisk/tmp/ /var/spool/asterisk/outgoing/)
exten => 1001,n,hangup()

exten => 2001,1,dial(Zaptel/2001)
exten => 2001,n,Wait(2)
exten => 2001,1,dial(2001)  (After Connected to teh PBX Dial 2001)
exten => 2001,n,Wait(2)
exten => 2001,n,playback(asterisk-recording)
exten => 2001,n,Hangup

Shall i think of creating a huntgroup of 1001 and have 4 members in it and repeat this code 4 times IM not sure if i got the ZAPTEL context right or the Dialing
Who is Participating?
DrDamnitConnect With a Mentor Commented:
What you can do, is make a call, and put that call in a meetme conference. This can all be accomplished by AGI. So, once you setup all the calls and put them all in a conference room, you can then use another channel to connect to it and playback a message into the conference room, which will then broadcast out.

This has to be done in AGI as far as I know. If you're a PHP Programmer, check out phpagi.
1. What is the ultimate goal and what is your question? It looks like you're trying to call a TDM based paging system using zaptel?
2. Your exten 2001, has two  "1" priorities. This is problematic right off the bat. The second dial statement is missing the technology parameter, which is no good also.
ritztechAuthor Commented:
Im trying to get a user to dial certain paging codes across 7 sites Via IP and the Mitels are trunked via T1s and ill have a paging asterisk.

ultimate goal is to get a Page that doesnt page while the caller is paging and it sends it off to a location depending on the code user dials (IE create speed call buttons for Store 1 Etc)

IM just not sure exactly what File to put this in or more and how do i call it from the Freepbx gui.

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

ritztechAuthor Commented:
is there a way to like when i Call the extension some how initiate this script. Thanks
So... it's like asynchronus paging. I call, leave a message to be paged, then hang up. then, the asterisk box dials all the other PBX's and broadcasts the page. Right?
ritztechAuthor Commented:
Yep And depending on the Different Codes will go on different Dial outs ....
ritztechAuthor Commented:
If possilbe if you can assist on how do i get the right Dialout on the ZAPTEL FXS trunk
exten => 2001,1,dial(Zaptel/2001) is the only required dial statement. If you need a pause, then add 'w' until you get the correct amount,
and then it will continue on.

exten => 2001,1,dial(Zaptel/2001w123456)


exten => 2001,1,dial(Zaptel/2001wwwwwwwwwwwwwww123456789)

Your secondary dial statements "(After Connected to teh PBX Dial 2001)" are just flat wrong.
ritztechAuthor Commented:
So if i wanted to do this do i put this in  extensions.conf or custom-extensions,com

only reason within freepbx i created a huntgroup so theres enough flow to where paging can be used on max of 4 trunks...

and i somehow want to remove this
exten => 1001,n,system(chmod 777 /var/spool/asterisk/outgoing/
exten => 1001,n,system(mv /var/spool/asterisk/tmp/ /var/spool/asterisk/outgoing/)

to this

exten => 2001,n,playback(/var/spool/asterisk/tmp/

and just playback the tmp file
And every time someone calls that EXT again overwrite it.

hopefully im not confusing you..

So new FLOW i have

ritztechAuthor Commented:
Mitel PBX dials 1001 Freepbx takes it as

1001 > Huntgroup with 4 members


THIS IS 10011

exten => 10011,1,Answer
exten => 10011,2,Wait(1)
exten => 10011,n,set(pageext="g0/10011")
exten => 10011,1,playback(beep)
exten => 10011,2,Wait(1)
exten => 10011,n,record(asterisk-recording:ulaw)
exten => 10011,n,system(echo "Channel: ${pageext}" > /var/spool/asterisk/tmp/
exten => 10011,n,system(echo "WaitTime: 1" >> /var/spool/asterisk/tmp/
exten => 10011,n,system(echo "Context: from-internal" >> /var/spool/asterisk/tmp/
exten => 10011,n,system(echo "Extension: 20011" >> /var/spool/asterisk/tmp/
exten => 10011,n,system(echo "Priority: 1" >> /var/spool/asterisk/tmp/
exten => 10011,n,hangup()

this is where im confused DO I even ever hangup OR  Im not sure on how to call ext 20011
do i do like a exten => x,1,Goto

exten => 20011,1,dial(g0/2001ww123456)
exten => 20011,2,playback(beep)
exten => 20011,n,playback(/var/spool/asterisk/tmp/
exten => 20011,n,Hangup

i think i finally found WHERE to put this haha but im not sure if i mess with it. it might break my Freepbx

This is the extensions_additional.conf
include => ext-local-custom
This is not possible:

>and i somehow want to remove this
>exten => 1001,n,system(chmod 777 /var/spool/asterisk/outgoing/
>exten => 1001,n,system(mv /var/spool/asterisk/tmp/ /var/spool/asterisk/outgoing/)
>to this
>exten => 2001,n,playback(/var/spool/asterisk/tmp/

exten => 10011,n,hangup()


exten => 10011,n,Goto(20011,1)

I think that you may, ultimately, need to use AGI to control the call flow like you want. For what you're doing you need to execute entirely with the Dial() application and with playback.

As to where to put it, it is in one of the _custom.conf files. I can never remember which one.
ritztechAuthor Commented:
so trying to PLAYBACK to a file cant be done.

they only reason is what if i get like 2 pagges going at once is there a way to like only use 1 Trunk at once and like HOLD until that one trunk is good. and then initate the outgoing.

So allow anycall from ext 1001 to Play at once EVEN though i have 4 Zaptel Channels Ready.

Though AGI ill have to do quite a bit of reasearch on that....
ritztechAuthor Commented:
so something like this ( that i cant get to work haha)

exten => 1001,1,Answer
exten => 1001,2,Wait(2)
exten => 1001,n,flite(PRESS pound when done)
exten => 1001,3,playback(beep)
exten => 1001,n,record(asterisk-recording:ulaw)
exten => 1001,4,Wait(1)
exten => 1001,n,Goto(1002,1)

exten => 1002,1,Answer
exten => 1002,2,dial(dahdi/g0/8123)  (PAGE CODE ON PBX FOR THE ZONE)
exten => 10021,3,Wait(2)     (Wait for ANSWER)
exten => 1002,4,playback(beep)
exten => 1002,n,playback(asterisk-recording)  (PLAYING THE RECORDING OVER THE SPEAKERS)
exten => 1002,n,Wait(2)

ritztechAuthor Commented:
WAIIT am i not going the right method should i DO a broadcast cause its not MAKING a call its just calling the phone but broadcasting .. ????

thanks ....
ritztechAuthor Commented:
if you cant help is there some good places to get like Support for this kind of stuff being that my timeline for this project is reaching an end.
ritztechAuthor Commented:
not too much of php programmer i feel im like really close but i just dont know where to get to....

unless you have a agi example

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.