domingo, maio 18, 2014

DID based routing with Asterisk

DID based routing with Asterisk

GENERAL INFORMATION
In this guide we will configure inbound routing based on the DID (number) information returned by Callcentric. In order to do this you will need to do further editing to your current Asterisk configuration.

Below we will provide the necessary information to configure your Asterisk installation to route based on the called DID in your Callcentric account.

Understand that this guide presents the most basic configuration for configuring DID based routing and is meant as a learning tool to assist you in configuring your own complex routing.

The setup information below is based on Asterisk 1.4; although most other older and newer versions should be very similar.


Please note that Callcentric is not responsible for preventing unwanted physical or remote access your IP PBX. If your IP PBX is compromised then you will be responsible for any damage caused.
Please be sure to read this guide regarding securing your IP PBX solution.

RESOURCES
Main Project:
Asterisk - http://www.digium.com

Help and Support:
AussieVoIP sip_header information - sip_header
AussieVoIP context information - contexts
AussieVoIP extension information - extensions

CONFIGURATION
Prerequisites:
In order to use this guide you will need a properly configured Asterisk installation which can receive incoming calls from Callcentric. You may double check our Asterisk setup guide to make sure that your system can at least initially receive incoming calls.

Once you can receive incoming calls properly you may configure DID based routing by following the instructions below:
1Creating or editing the inbound context
Here we will configure the inbound context which will be used to handle the routing of inbound calls to your Asterisk installation. To create this context you can either use the command line or a text editor to edit the extensions.conf file.

Once you are able to access the extensions.conf file you can follow the steps below:

1. Enter the following context:
[incoming]
exten => s,1,Set(Var_TO=${SIP_HEADER(TO)})
exten => s,2,GotoIf($["${Var_TO}" = ""]?extension2,s,1:3)
exten => s,3,GotoIf($["${Var_TO}" = ""]?extension2,s,1:4)
exten => s,4,GotoIf($["${Var_TO}" = ""]?extension1,s,1:5)
exten => s,5,GotoIf($["${Var_TO}" = ""]?extension1,s,1:6)
exten => h,6,Macro(hangupcall)

Where and are the exact information returned by Callcentric's servers for your 1777 number and any DID on your account, respectively.

And where extension1 and extension2 are contexts which decide where to send the call. For example:
[extension1]
exten => s,1,Dial(SIP/100)

[extension2]
exten => s,1,Dial(SIP/200)


2. Save the file.
2Configure your inbound routing to route to your DID routing context
In your extensions.conf file use the following, from-callcentric can also be your own incoming context:

[from-callcentric]
exten => s,1,Goto(incoming,s,1) 

3Placing Test Calls
Once you are done save your changes and then test incoming calling to see that your Asterisk setup now routes inbound calling based on the number called.

To test inbound calls from Callcentric to your new DID based routing setup, follow the directions listed in this FAQ. You will also want to test calls directly to your DID from a PSTN phone if you have a DID on your account.

Nenhum comentário: