[asterisk-users] "Follow me" with Asterisk that detects cellphone voicemail and similar announcements

ka at mayten.sch.bme.hu ka at mayten.sch.bme.hu
Thu Apr 28 10:08:46 CDT 2016

> Theoretically, I could use the dial function to call one number, then
> wait a few seconds and then dial another number. In practice, this
> won’t work because as soon as a call is answered by the mobile
> carrier’s voicemail the caller would be connected to that, no other
> numbers would be called.

I never understood why people have voicemails.  Switch off the voicemail 
feature, so it won't pick up the call.

My solution to this problem is rather manual.  I travel across countries 
as well, so here is what I have:

exten => dialme,n,Macro(get_mobile_target)
exten => dialme,n,Dial(SIP/${TARGET_PROVIDER}/${TARGET_NUMBER},35,t)

Now, as you can see, the above uses a macro to set some variables, so 
let's look at it:

Apart from many logging and other, non-relevant features, it calls an 

exten => s,n,Agi(get_mobile_target.agi)

What this AGI does, it looks up in an SQL table which provider and which 
destination number to call at any given time.  These can change 
dynamically as I travel around, hence it's in SQL.  How will values be 
updated in SQL?  By two ways.

1) I have a web frontend where I can logon and select from a dropdown 
menu, which simcard is my current cellphone number.  If I want, I can 
also select a provider from a dropdown list, as I have more and there 
are different deals with each.  So I won't be calling my US cellphone 
number from a provider that provides me good EU rates and only those.

Usually I use airport wifi or 3G/4G at the departing airport to select 
the cell number from the list.

2) I have DID number which I can call from whichever cellphone I'm 
currently using, where the call is handled by an AGI on the PBX.  If the 
callerID matches one from a pre-defined list (my known sim card 
numbers), it assumes that I'm checking in and the caller ID gets 
selected the same way as if I was making the selection from the web 
interface.  This call costs nothing as the call is never answered, the 
AGI hungs up the call.

I understand that both are rather manual and not exactly textbook 
follow-me but they are pretty simple and it works well for me.


More information about the asterisk-users mailing list