Forwarded Calls Going to Previous Extension’s Voicemail in Asterisk IP PBX

Issues with Forwarded Calls rolling over to Previous Extension’s Voicemail

NOTE:  The following information has been revised on 02-16-2012

Recently, I have run across an issue with Asterisk IP PBX.  The issue is not readily apparent but occurs when an extension is forwarded to another extension.  Also, it only happens when it rolls over to DIALSTATUS of NOANSWER but does not appear for BUSY statuses which was very odd.

When someone goes on vacation, they are instructed to forward their phone to another person for adequate coverage.  This method takes the burden off of the Asterisk Administrator and places it on the user lightening the workload.  However, this method of call forwarding can have issues.

The first issue is if that extension was part of a Hunt Group since their forwarding will break the Dialplan.  While baffling at first, this can be easily resolved by watching the CLI.

The second issue is that if the forwarded call does not get answered, the call reverts to the original extension’s voicemail.  I can see why this happens but lot of my clients think that if a call is forwarded for a reason, the voicemail that is played should be the one it is forwarded to.

Example:  Caller A calls User B but User B is on vacation and the phone automatically forwards the calls to User C.  If User C is busy, the Busy Voicemail of User C is played to Caller A.  However, if User C does not answer the call, the voicemail of User B is played.

I am not a big time programmer or Macro guru and I like to adhere to KISS policy so I wanted a simple way to modify this setting using the built in Variables in Asterisk.  All the ones I knew about had the caller information but did not have the callee information.  I modified the macros and stdexten contexts and it just would not work so I ended up commenting out the stdexten macros and programming it manually for the internal extensions.

Below is the code in internal-extensions with pattern matching.

exten => _5XXX,1,Answer
exten => _5XXX,n,Dial(SIP/${EXTEN},20,Tt)
exten => _5XXX,n,Voicemail(${EXTEN},u)
exten => _5XXX,n,HangUp

After numerous testing, it seems that DIALSTATUS of BUSY and NOANSWER are treated differently where BUSY is actually considered a bridged call and NOANSWER is not.  Therefore, I have to add the priority 1 as Answer to bridge the call and obtain the new ${EXTN} which is the extension the call was forwarded to.



About Express Interconnect: We are a Portland, Oregon based Small Business VoIP Phone Consultant specializing in implementing quality VoIP PBX system based on Asterisk IP PBX. We can be reached at 503-820-3513 or via email at: and can help with any questions you might have.

Due to Demand, we have finally branched out into Hosted VoIP Phone Service for Small Businesses.  Our Hosted VoIP Service provides full Asterisk IP PBX functionality in a simple Plug and Play system.

Also, please make sure to visit our on-line store at VoIP Phones Direct for all of your IP Phone needs. We carry Grandstream, Polycom, Snom, Aastra, and Yealink IP Phones with a 14 day money back guarantee and FREE UPS Ground Shipping.

Finally, please join the conversation on Facebook AND Twitter


Share and Enjoy

Tags: , , , , ,

Comments are closed.

WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera