Entries tagged as asteriskRelated tags catalyst adam admin adsl audio baby brooke debian dns enum evolution family geek gnome google hardware house ipv6 laptop lca lca2009 lca2010 lca2011 lca2013 lca2014 lca2015 lca2019 lede linux linux.conf.au mythtv mythtv-status openstack oss perl recycle rpi software stereo voip ben cacert catalystcloud fai fedora_coreos lca2007Sunday, July 24. 2016
Allow forwarding from VoiceMail to ... Posted by Andrew Ruthven
in catalyst at
03:22
Comments (0) Trackbacks (0) Allow forwarding from VoiceMail to cellphonesSomething I've been wanting to do with our Asterisk PBX at Catalyst for a while is to allow having callers that hit VoiceMail to be forwarded the callee's cellphone if allowed. As part of an Asterisk migration we're currently carrying out I finally decided to investigate what is involved. One of the nice things about the VoiceMail application in Asterisk is that callers can hit 0 for the operator, or * for some other purpose. I decided to use * for this purpose. I'm going to assume a working knowledge of Asterisk dial plans, and I'm not going to try and explain how it works. Sorry. When a caller hits * the VoiceMail application exits and looks for a rule that matches a. Now, the simple approach looks like this within our macro for handling standard extensions: [macro-stdexten] ... exten => a,1,Goto(pstn,027xxx,1) ... (Where I have a context called pstn for placing calls out to the PSTN). This'll work, but anyone who hits * will be forwarded to my cellphone. Not what I want. Instead we need to get the dialled extension into a place where we can perform extension matching on it. So instead we'll have this (the extension is passed into macro-stdexten as the first variable - ARG1): [macro-stdexten] ... exten => a,1,Goto(vmfwd,${ARG1},1) ... Then we can create a new context called vmfwd with extension matching (my extension is 7231): [vmfwd] exten => 7231,1,Goto(pstn,027xxx,1) I actually have a bit more in there to do some logging and set the caller ID to something our SIP provider will accept, but you get the gist of it. All I need to do is to arrange for a rule per extension that is allowed to have their VoiceMail callers be forwarded to voicemail. Fortunately I have that part automated. The only catch is for extensions that aren't allowed to be forwarded to a cellphone. If someone calling their VoiceMail hits * their call will be hung up and I get nasty log messages about no rule for them. How do we handle them? Well, we send them back to VoiceMail. In the vmfwd context we add a rule like this: exten => _XXXX,1,VoiceMail(${EXTEN}@sip,${voicemail_option}) same => n,Hangup So any extension that isn't otherwise matched hits this rule. We use ${voicemail_option} so that we can use the same mode as was used previously. Easy! Naturally this approach won't work for other people trying to do this, but given I couldn't find write ups on how to do this, I thought it be might be useful to others. Here's my macro-stdexten and vmfwd in full: [macro-stdexten] exten => s,1,Progress() exten => s,n,Dial(${ARG2},20) exten => s,n,Goto(s-${DIALSTATUS},1) exten => s-NOANSWER,1,Answer exten => s-NOANSWER,n,Wait(1) exten => s-NOANSWER,n,Set(voicemail_option=u) exten => s-NOANSWER,n,Voicemail(${ARG1}@sip,u) exten => s-NOANSWER,n,Hangup exten => s-BUSY,1,Answer exten => s-BUSY,n,Wait(1) exten => s-BUSY,n,Set(voicemail_option=b) exten => s-BUSY,n,Voicemail(${ARG1}@sip,b) exten => s-BUSY,n,Hangup exten => _s-.,1,Goto(s-NOANSWER,1) exten => a,1,Goto(vmfwd,${ARG1},1) exten => o,1,Macro(operator) [vmfwd] exten => _XXXX,1,VoiceMail(${EXTEN}@sip,${voicemail_option}) same => n,Hangup #include extensions-vmfwd-auto.conf And I then build extensions-vmfwd-auto.conf from a script that is used to generate configuration files for defining accounts, other dial plan rule entries and phone provisioning files. With thanks to John Kiniston for the suggestion about the wildcard entry in vmfwd. |
Calendar
ArchivesCategoriesSyndicate This BlogBlog AdministrationShow tagged entriesPowered by |