FAQ – Frequent Asterisk Questions – #2

Introduction

I’m a contributor at StackOverflow, answering questions concerning the Asterisk PBX system.  These types of questions, at their core, are part of my bread-and-butter work.  I’ve been working with Asterisk since 2004 and have personally deployed it successfully in 10 different countries under a wide variety of circumstances and use-cases.

However, there are a few things that are just “nice to have” in the tool-kit for a starting AST PBX admin.  So, I’m going to post a few of them on my blog.  It’s paying forward for a lot of the help I’ve gotten over the years.

Q: Can I “rimshot” a call to my mobile phone?

Yes. This is very straight forward.  We do it for some of our customers on our Cloudphones platform, in fact.  A common use-case is wanting calls from customers to go to your mobile phone, but wanting to keep your mobile phone private.

Another one would be having the call go to your office phone during regular hours, and to your mobile phone after hours without having to have the customer remember both numbers.  Just give them the office number and let your AST PBX do the heavy lifting.

Presuming your DID is 1-234-567-8900 and your moble is 1-987-654-3210:

exten => _12345678900,1,Verbose(2,Call for DID to Mobile)
 same => n, Dial(DAHDI/g1/19876543210,30,t)
 same => n, HangUp()

The dial option “t” allows:

“…the called user to transfer the call by hitting the blind xfer keys (features.conf)”

Further reading:

Q: How do I retain original Caller ID on Call Transfer In Asterisk?

When you transfer a call in Asterisk, the caller ID is often changed to that of the person initiating the transfer.  This can cause some confusion to the person recieving the transfer.  The solution is to capture the incoming CID information into a channel variable when the call first comes in:

exten => 5555,1, Verbose(2,New call to operator!)
 same => n, Set(__ORIG_CID=${CALLERID(all)})

Using “__” before the variable name means that the “ORIG_CID” will be inherited by all subsequent call events and channel actions.  So, you can set the CID just before you dial to be the contents of the channel variable.

Q:  How do I make Asterisk server automatically Answer a SIP call?

If you really want any call to the box, either from a VoIP phone or an ITSP to get handled the same way, try this:

[incoming]
 exten =>_X.,1,Answer()
 same => n,Playback(silence/2&some-fancy-auto-answer-message&silence/2&beep&beep&silence/2&beep&beep)
 same => n,Hangup()

… and make sure that in your SIP phone and SIP trunk definitions that you set:

context=incoming

That literally forces all calls into your context and then no matter what you dial, you always match the extension number.

More reading at:

Conclusion

So, that’s three common concepts that I deal with regularly.  I’ll put a few more up next week.  If there is anything you’d like to see in particular, let me know in the comments below!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.