Custom Destinations
Elastix 2.2.0

HOWTO: Create Custom Extensions & Destinations

One of the quirky things about Elasitx revolves around the simple fact that they do not give you access to the full feature set of the FreePBX interface. It took me forever to figure out that custom extensions and destinations had to be built using the unembedded FreePBX module.

It was fairly easy to figure out that custom extensions and destinations would be defined within the extensions_custom.conf file in the /etc/asterisk directory. So let us deal with that first. In my case, I want to create a custom extension that will ask a user to make a menu selection. I want to my music on hold selection to be from the ‘Holiday’ selections if we are in December each year, otherwise, play the ‘default’ music on hold. Option 1 on our menu will be to enter an order number. If they choose to do this, the system will go out and run an AGI script. Option 2 will be to speak with a customer support agent. Option 3 will be to hangup the call. I want to make this extension part of the [from-internal-custom] context and the extension number will be 900. Editing your extensions_custom.conf you can do the following:

Under the [from-internal-custom] context we will need to add a line to include our new custom extension. In this case I will name the custom extension my-custom-agi.
include => my-custom-agi

Now somewhere lower in the file I will create my custom extension. I have numbered each line so that we can refer back to it in the description below.
01 [my-custom-agi]
02 exten => 900,1,Answer
03 exten => 900,n,SetMusicOnHold(default)
04 exten => 900,n,GotoIfTime(*,*,*,dec?moh25:skipped)
05 exten => 900,n(moh25),SetMusicOnHold(Holiday)
06 exten => 900,n(skipped),Wait(1)
07 exten => 900,n,Set(TIMEOUT(digit)=7)
08 exten => 900,n,Set(TIMEOUT(response)=10)
09 exten => 900,n,Read(CHOICE,custom/intro&custom/option-1&custom/option-2,1,,1)
10 exten => 900,n,GotoIf($[${CHOICE} = 1]?getpo)
11 exten => 900,n,GotoIf($[${CHOICE} = 2]?toivr:continue)
12 exten => 900,n(getpo),Playback(custom/orderno)
13 exten => 900,n,Read(ORDERNO,beep,0)
14 exten => 900,n,AGI(myapplication.php,${ORDERNO})
15 exten => 900,n,Wait(1)
16 exten => 900,n(another),Read(CHOICE,custom/another,1,,1)
17 exten => 900,n,GotoIf($[${CHOICE} = 1]?getpo)
18 exten => 900,n,GotoIf($[${CHOICE} = 2]?toivr)
19 exten => 900,n,GotoIf($[${CHOICE} = 3]?hangup:continue)
20 exten => 900,n(toivr),NoOp(Requested Customer Service Agent)
21 exten => 900,n,GotoIfTime(*,*,1,jan?closed)
22 exten => 900,n,GotoIfTime(*,*,8,apr?closed)
23 exten => 900,n,GotoIfTime(*,mon,25-31,may?closed)
24 exten => 900,n,GotoIfTime(*,*,4,jul?closed)
25 exten => 900,n,GotoIfTime(*,mon,1-7,sep?closed)
26 exten => 900,n,GotoIfTime(*,thu,22-28,nov?closed)
27 exten => 900,n,GotoIfTime(*,fri,22-28,nov?closed)
28 exten => 900,n,GotoIfTime(*.*,24-26,dec?closed)
29 exten => 900,n,GotoIfTime(20:00-08:59,mon-fri,*,*?closed)
30 exten => 900,n,GotoIfTime(09:00-17:00,mon-fri,*,*?ext-queues,500,1)
31 exten => 900,n,GotoIfTime(17:01-20:00,mon-fri,*,*?ext-queues,501,1)
32 exten => 900,n(closed),NoOp(Offices are closed)
33 exten => 900,n,Playback(custom/closed)
34 exten => 900,n,Goto(ext-local,vmu901,1)
35 exten => 900,n(continue),NoOp(Invalid User Request)
36 exten => 900,n,Playback(custom/invalid-choice)
37 exten => 900,n,Goto(another)
38 exten => 900,n(hangup),Playback(goodbye)
39 exten => 900,n,Hangup

Now that the context is defined, I have to associate this extension with FreePBX. Since the Elastix folks did not want to give us access to the lower level aspects of the PBX, we have to open the unembedded version of FreePBX from our Elastix interface. Once there, select the TOOLS menu and click on CUSTOM DESTINATIONS.

Once here you have four fields, but only three to complete. For your Custom Destination you need to enter your new custom context as follows: my-custom-agi,900,1 For the second field enter the name of your custom destination. Since you are calling an AGI above called myapplication.php, I might just call the custom destination My Application. The notes field is simply a place to keep more descriptive information on your custom destination.

Now, when you go back into your Elastix PBX editor (the embedded version), you will be able to select your new custom destination as a valid drop down for any routes.

Share


Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

comments-bottom

Featured Photos

Asterisk PBX P... Posted by author icon Cary H. Oct 18th, 2011 | no responses
Asterisk PBX P... Posted by author icon Cary H. Oct 16th, 2011 | no responses
Asterisk PBX P... Posted by author icon Cary H. Aug 14th, 2011 | no responses

Random Photos

Asterisk PBX P... Posted by author icon Cary H. Oct 18th, 2011 | no responses
Asterisk PBX P... Posted by author icon Cary H. Aug 14th, 2011 | no responses
Asterisk PBX P... Posted by author icon Cary H. Oct 16th, 2011 | no responses

Top Rated

TurfOutlet.com Posted by author icon Cary H.