VoIPowering Your Office with Asterisk: SOHO VoIP, Part 7 Akron OH

A modest amount of programming is all it takes to auotomate Asterisk's handling of out-of-business-hours calls—and more.

Local Companies

Vista Data Systems
330-864-5070 x1
150 North Miller Rd
Fairlawn, OH
Telepage Communication Systems Inc
(740) 452-0198
4255 Tucker Rd
Zanesville, OH
Advanced Business Communications
(740) 328-4037
65 Dayton Rd NE Ste A
Newark, OH
Warsaw Wireless
(513) 681-4888
2567 W North Bend Rd
Cincinnati, OH
Ameritech
(740) 286-5210
14541 Beaver Pike
Jackson, OH
Micro Network Service Group Inc
(740) 733-8232
1300 Main St
Smithfield, OH
Alcatel Network Systems
(440) 893-9086
539 E Washington St
Chagrin Falls, OH
Ridgeville Telephone Co
(419) 267-5185
S732 County Rd 20B
Ridgeville Corners, OH
Myers Kenneth G Construction Inc
(419) 639-2051
201 Smith St
Green Springs, OH
Microcom Telecommunication Services
(937) 294-4122
Dayton, OH

provided by: 
Originally published at Internet.com


In the previous installments in this series we learned how to connect legacy phone lines to an Asterisk server, how to record custom sound files and voicemail prompts, a couple of Linux soundcard troubleshooting tips, and how to set up a simple custom digital receptionist. Today we'll set up a more complex digital receptionist that answers incoming calls according to holiday and off-time schedules, and as a special bonus create a telemarketer tarpit that diverts unwanted calls into special contexts of their very own.

Call routing by time and date
The nice thing about computers is they are champions at doing boring, repetitive tasks, and Asterisk is no exception. You're probably familiar with PBX systems that require someone to manually turn on the after-hours or holiday greetings. Well now, in this here 21st century that's just silly. We're going to make the computer do the work.

Asterisk will perform this magic by checking the system time, and then using the GotoIfTime application to route incoming calls accordingly. Yes, I know you ace coders are scoffing at the quaint notion of using any form of goto. And it is true that your Asterisk extensions.conf file can turn to spaghetti in no time. But it's what we have to work with, so there you are.

This is the syntax for GotoIfTime:

GotoIfTime(times|days_of_week|days_of_month|months?label) Here is a sample [incoming] context that routes incoming calls to the [open-business-hours] context during business hours, then to the [office-closed] context after hours. Of course you need to create all these contexts; if you've forgotten how please refer to the previous installments in this series. [incoming] exten => s,1,GotoIfTime(09:00-17:59|mon-fri|*|*?open-business-hours) exten => s,2,Goto(office-closed) You should enter values for all of the time and date fields. An asterisk is a wildcard meaning "all." Ranges are separated by hyphens, and other values are comma-separated. * The times field uses the 24-hour format. The day starts at 0:00, midnight, and ends at 23:59, one minute before midnight * days_of_week are specified as mon, tue, wed, thu, fri, sat, sun * days_of_month are the numerical days, 1-31 * months are written with the first three letters of the name: jan, feb, mar, and so on The label field can contain any of the following: * A priority within the same extension * An extension and a priority within the same context * A context, extension, and priority This example modifies the [incoming] context to included an extension and priority: exten => s,1,GotoIfTime(09:00-17:59|mon-fri|*|*?open-business-hours,2,1) You can set up all the holidays. Don't be dull, give them custom contexts with creative greetings: exten => s,1,GotoIfTime(*|*|4|jul?happy-pyro) exten => s,n,GotoIfTime(*|*|4|sep?labor-day-don't-labor) exten => s,n,GotoIfTime(*|*|24,25|dec?cheerful-inoffensive-generic-greeting) exten => s,n,GotoIfTime(*|*|1|jan?new-year-new-resolutions) exten => s,n,GotoIfTime(09:00-17:59|mon-thur|*|*?open-business-hours) exten => s,n,GotoIfTime(09:00-12:59|fri|*|*?open-business-hours) exten => s,n,Goto(office-closed) Remember that Asterisk parses contexts in order, so watch your priorities. In this example the "open" and "closed" extensions need to come last, or the holiday extensions will never be used.

To keep your extensions.conf organized semi-sanely, you could put your GotoIfTime extensions in a separate context, and call them using include statements, like this: [incoming] include => gotoiftime [gotoiftime] exten => s,1,GotoIfTime(*|*|4|jul?happy-pyro) exten => s,n,GotoIfTime(*|*|4|sep?labor-day-doon't-labor) exten => s,n,GotoIfTime(*|*|24,25|dec?cheerful-inoffensive-generic-greeting) exten => s,n,GotoIfTime(*|*|1|jan?new-year-new-resolutions) exten => s,n,GotoIfTime(09:00-17:59|mon-thur|*|*?open-business-hours) exten => s,n,GotoIfTime(09:00-12:59|fri|*|*?open-business-hours) exten => s,n,Goto(office-closed) See Part 3 of this series for more information on using include statements.

Using un-numbered priorities, like in the [gotoiftime] context, can be a nice time- and hassle-saver. The downside is you can't goto to an un-numbered priority.

Telemarketer tarpit
Using Asterisk to foil telemarketers, ex-spouses, annoying bosses who call you in your off-hours, and other people you don't want to hear from is fun and easy. You need Caller ID service to make it work, then configure Asterisk to handle incoming calls based on Caller ID.

See Telemarketer Torture for a wonderful and comprehensive example of how to handle unwanted calls. Be sure to heed the many warnings about bad dialplan design and rudeness (yeah, right), and enjoy the opportunity to use goto until your eyeballs bleed.

Asterisk can also employ the same tools for good; for example, forwarding priority calls to your cellphone. Come back next week to learn how to do this, and also how to transfer calls, and how to do "meetme", or telephone conferencing the cheap and easy Asterisk way.

Resources
VoIPowering Your Office with Asterisk: SOHO VoIP; terminology explained
VoIPowering Your Office with Asterisk: SOHO VoIP part 2; connecting legacy PSTN lines to Asterisk, inbound calling
VoIPowering Your Office with Asterisk: SOHO VoIP, Part 3; setting up outbound calls safely
VoIPowering Your Office with Asterisk: SOHO VoIP, Part 4; set up voicemail
VoIPowering Your Office with Asterisk: SOHO VoIP, Part 5; digital receptionist, Asterisk GSM soundfile player
VoIPowering Your Office with Asterisk: SOHO VoIP, Part 6; recording custom prompts and greetings
VoIP-Info.org

Author: Carla Schroder

Read article at Internet.com site

Featured Local Company

Vista Data Systems

330-864-5070 x1
150 North Miller Rd
Fairlawn, OH