Packt Publishing Community, Experience, Distilled

Routing Rules in AsteriskNOW - The Calling Rules Tables

HomeBooksSupportFreeAuthorsAward
WELCOME ARTICLES IMPACKT NEWSLETTERS YOUR ACCOUNT ABOUT US

 
Article Network FAQ

Want to know more about Packt's Article Network? Interested in contributing your article ideas?

Please visit our FAQ for more information.


See More

SEARCH

Search our Site


Integrating Zimbra Collaboration Suite with Microsoft Outlook
This article by Marty Resnick and David Touitou, focuses on installing and configuring the Zimbra Connector for Outlook for using the Microsoft Outlook client as a front end to the Zimbra Collaboration Suite. We will also take a look at the most common applications within Outlook and how they integrate with Zimbra, including sharing folders and delegating access to other users.
See More
 
Routing Rules in AsteriskNOW - The Calling Rules Tables

Philosophy: A route of many roads leading from nowhere to nothing.
—Ambrose Bierce

While it appears that Ambrose Bierce has a little respect for Philosophy in general, he would surely refer to calling routing as—roads leading from a single point to multiple points, or something similar. The purpose of the "Calling Rules" is to define the methodology by which calls are routed from the PBX to the outbound world.

This article by Nir Simionovich deals with the routing rules in AsteriskNOW and the Calling Rules tables.

An interesting feature of a PBX is the ability to support multiple dial plans, meaning that you are able to create various dial-plan logics, associate different calling rules to each dial plan, and assign users to specific dial plan. Schematically speaking, the relation between the three can be illustrated as follows:


Essentially, from AsteriskNOW's point of view, any dial attempt that doesn't match a Calling Rule will be considered an internal call, and thus, AsteriskNOW will try to route the call to an internal AsteriskNOW resource—e.g. another extension or an AsteriskNOW feature code.

Most telephony engineers and carrier support engineers refer to "Calling Rules" as "Routing Rules". From this point onwards in the book "Calling Rules" will be referred to as "Routing Rules".

Managing Routing Rules with AsteriskNOW

At this point, after initially configuring your service providers and initial routing rules, your "Routing Rules" table should look as follows:


Edit one of these rules to get acquainted with the call rule dialog box. Click the Edit link of the all_outbound rule (rule 1). The following dialog box should appear on your screen:


Every call made from an IP phone connected to the PBX is processed by the routing rules. The processing is performed in the following order:

  • AsteriskNOW grabs the dialed number and tries to match it to the prefix defined in the Routing Rule. In this dialog, the prefix is 9.
  • It then verifies the number of digits suffixing the prefix. In this example, any number of digits that is 3 or more is considered a valid number to be assigned to this route.
  • Now, before actually routing the call to the designated service provider, AsteriskNOW can remove prefixes and/or prefix numbers to the dialed number. In this example it will only remove a single prefixing digit (9) and then pass the call to your service provider–Ports 1,2,3.

The above process happens for every call that is made by a phone connected to the PBX. If the process fails all the rules defined in the Routing Table, AsteriskNOW assumes that the call is supposed to be routed internally. If internal routing fails, the call will fail and a fast-busy tone will be heard from your IP phone.

Some IP phones also indicate the SIP error message that was received. If routing fails, the normal error that you may encounter would be error 404 – NOT FOUND.

Manually Editing Dial-Plan Logic

Additional information about Asterisk configuration files
While this book deals with AsteriskNOW—aimed to provide a simple, fast solution for managing the Asterisk Open Source PBX—it does so without getting into the inner workings of Asterisk's configuration files. Additional information about the configuration files, their format, usage, and various available options is available at the voip-info wiki, located at: http://www.voip-info.org/wiki/view/Asterisk+config+files.

Manually editing AsteriskNOW dial-plan files isn't recommended; however, in some extreme situations it can't be avoided (especially while creating special applications with AsteriskNOW). For this specific reason, AsteriskNOW includes a facility to edit the configuration files manually. Click the File Editor menu option; the following screen should appear:



This article has been extracted from: AsteriskNOW

AsteriskNOWA practical guide for deploying and managing an Asterisk-based telephony system using the AsteriskNOW Beta 6 software appliance
  • Install an Asterisk-based telephony system fast
  • Build an office PBX using AsteriskNOW
  • Learn the AsteriskGUI web management interface
  • Configure IP phones and connections
  • Configure and use the conferencing system
  • Write your own applications for Asterisk

For more information, please visit:
www.PacktPub.com/asterisknow/book

The extensions.conf file should interest you. Using the drop-down file selector, select the extensions.conf file for editing. The following screen should be observed:


Now, if you were to click one of the lightly-shaded areas (light green on your screen); a text editing box will open to enable you to edit the file.


You're probably wondering at this point—"where is routing logic located?" Scroll down the file and seek the section designated as numberplan-custom-1, which designates your DialPlan1 dial plan. If you were to create an additional dial plan using the GUI, its designation in the extensions.conf file would be numberplan-custom-2.

Examine the following section:


In the above section lines indicated by the exten directive, indicate a dial-plan activity. The exten directive is then followed by some form of well formatted number string, followed by a number indicating the sequence number of the directive, then followed by an Asterisk operational command—in our case, the Macro command.

Asterisk and AsteriskNOW include over 150 different applications; explanation of each and every application is beyond the scope of this book. Visit the Asterisk Wiki page at http://www.voip-info.org/wiki/index.php?page=Asterisk for more information about Asterisk and AsteriskNOW applications.

The way the dial plan analyzes dialed numbers is explained next. Consider one of the dialing rules:

exten=_9XXX!,1,Macro(trunkdial,${trunk_1}/${EXTEN:1})

The interesting portion of this line is the _9XXX!. The following is an extract from an Asterisk documentation:

; Extension names may be numbers, letters, or combinations
; thereof. If an extension name is prefixed by a ‘_'
; character, it is interpreted as a pattern rather than a
; literal. In patterns, some characters have special meanings:
;
; X - any digit from 0-9
; Z - any digit from 1-9
; N - any digit from 2-9
; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
; . - wildcard, matches anything remaining (e.g. _9011. matches
; anything starting with 9011 excluding 9011 itself)
; ! - wildcard, causes the matching process to complete as soon as
; it can unambiguously determine that no other matches are possible
;
; For example the extension _NXXXXXX would match normal 7 digit dialings,
; while _1NXXNXXXXXX would represent an area code plus phone number
; preceded by a one.
;
; Each step of an extension is ordered by priority, which must
; always start with 1 to be considered a valid extension. The priority
; "next" or "n" means the previous priority plus one, regardless of whether
; the previous priority was associated with the current extension or not.
; The priority "same" or "s" means the same as the previously specified
; priority, again regardless of whether the previous entry was for the
; same extension. Priorities may be immediately followed by a plus sign
; and another integer to add that amount (most useful with ‘s' or ‘n').
; Priorities may then also have an alias, or label, in
; parenthesis after their name which can be used in goto situations

As this text suggest, the underscore marking (_) indicates the start of a pattern matching rule. This is then followed by a form of expression indicating the pattern to match. In the example, the pattern match is _9XXX!, so, interpreting this according to the documentation:

  • _9: Indicates any number that is prefixed with the digit 9. This corresponds to the first routing rule.
  • XXX: Indicates 3 digits, ranging from 0 to 9. This corresponds to the second portion of the routing rule.
  • !: Indicates to match as soon as there is no other rule that may apply, thus closing the matching process.

For example, in accordance to the above points, the number 912345 will match the rule indicated above and will simply activate the Macro application. However, bearing in mind that the routing requires at least 3 digits to follow the prefix, the number 912 will not match our above routing rule.

At this point, the working of the Macro application is not explained; however, the empirical knowledge of its existence is enough.

Summary

In this article you learned what routing rules are and how they are processed within the AsteriskNOW operational model. Understanding the way routing rules work is imperative to configure your PBX for optimal usage of outbound connections.


This article has been extracted from: AsteriskNOW

AsteriskNOWA practical guide for deploying and managing an Asterisk-based telephony system using the AsteriskNOW Beta 6 software appliance
  • Install an Asterisk-based telephony system fast
  • Build an office PBX using AsteriskNOW
  • Learn the AsteriskGUI web management interface
  • Configure IP phones and connections
  • Configure and use the conferencing system
  • Write your own applications for Asterisk

For more information, please visit:
www.PacktPub.com/asterisknow/book



About the Author

Nir Simionovich has been involved with the open-source community in Israel since 1997. His involvement with the open-source community started back in 1997, when he was a student in the Technion, Israel's Technology Institute in Haifa. Nir quickly became involved in organizing open-source events and promoting usage of Linux and open‑source technologies in Israel.

In 1998, Nir started working for an IT consulting company (artNET experts Ltd.), where he introduced Linux-based solutions for enterprises and banks. By 2000, Nir had become a SAIR/GNU-certified Linux trainer and Administrator, slowly educating the future generations of Linux admins.

In 2001, Nir moved to the cellular content market, working for a mobile content delivery company (m-Wise Inc.—OTC.BB: MWIS.OB). During his commission atm-Wise, Nir successfully migrated a company that was built purely on Windows 2000 and ColdFusion to open-source technologies, such as Mandrake Linux (today Mandriva), Apache Tomcat, and Kannel (open-source SMS/WAP gateway).

By 2006, Nir had co-founded Atelis (Atelis PLC—AIM: ATEL). Atelis is a Digium distributor and integrator. During the course of 2006, Nir developed an Asterisk‑based international operator services platform for Bezeq International, which had replaced a Nortel DMS-300 switch. This platform is currently in use by Bezeq International in Israel, serving over 4000 customers a day.

In mid 2007, Nir left Atelis to become a freelance Asterisk promoter and consultant. Nir currently provides Asterisk consulting and development services to various companies, ranging from early-stage start-up companies, through VoIP service providers and VoIP equipment vendors. In his spare time, Nir is the founder of the Israeli Asterisk users group, the website maintainer of the group and an Asterisk developer, dealing mainly with the localization aspects of Asterisk to Israel.

Nir can be reached at nirs@greenfieldtech.net or through his website http://www.greenfieldtech.net.


Books from Packt

OpenVPN: Building and Integrating Virtual Private Networks
OpenVPN: Building and Integrating Virtual Private Networks

BlackBerry Enterprise Server for Microsoft® Exchange
BlackBerry Enterprise Server for Microsoft® Exchange

Building Telephony Systems With Asterisk
Building Telephony Systems With Asterisk

Linux Thin Client Networks Design and Deployment
Linux Thin Client Networks Design and Deployment

Qmail Quickstarter: Install, Set Up and Run your own Email Server
Qmail Quickstarter: Install, Set Up and Run your own Email Server

TrixBox Made Easy
TrixBox Made Easy

Configuring IPCop Firewalls: Closing Borders with Open Source
Configuring IPCop Firewalls: Closing Borders with Open Source

Zimbra: Implement, Administer and Manage
Zimbra: Implement, Administer and Manage







 
Article Network


Packt Article Network

Visit Packt's Article Network, for all the latest quality, relevant and free content.
See More



FEEDBACK
Name *:
Email *:
* optional
Do you have any comments?

SUGGEST A TITLE
What would you like Packt to publish?
 




© Packt Publishing Ltd 2008

RSS