Asterisk tips findme
Created by: lschweiss,Last modification on Sun 02 of Dec, 2007 [22:11 UTC] by JustRumours
Find-me / Follow-me example
Thus far every example of doing this dials one number at a time in series. If you have more than a couple numbers in your find-me list, this can keep a caller waiting for a long time.
By using the local channel construct in the Dial cmd you can dial a virtually unlimited number of find-me numbers in parallel and use a macro to determine which one actually has a live person at the other end.
[default]
exten => _9999XXXXXXXXXX,1,Dial(IAX2/"identifier"/${EXTEN:4},40,M(screen))
exten => _9999XXXXXXXXXX,2,Hangup
[macro-screen]
exten => s,1,Wait(1)
exten => s,n,Background(press-1-to-be-connected-to-the-caller)
exten => s,n,Set(TIMEOUT(response=5))
exten => 1,1,NoOp(Caller accepted) ; Do not set MACRO_RESULT to anything to connect the caller
exten => i,1,Set(MACRO_RESULT=CONTINUE)
exten => t,1,Set(MACRO_RESULT=CONTINUE)
[findme]
exten => s,1,Playback(please-hold-while-we-connect-you)
exten => s,n,Dial(LOCAL/9999${findme1}&LOCAL/9999${findme2}&LOCAL/9999${findme3},40,m)
Notes:
- The 9999 is to distinguish the findme function from other ten digit extensions you may have in the default context
- The LOCAL channel construct always calls into the [default] context
- If you are dialing out on a channel that is connected immediately after dialing such as a POTS line, you will need to change your macro to loop the playing of the message otherwise the callee will never hear it.
Example:
Lets say you have 3 cell phones: (777)555-1111, (777)555-2222, (777)555-3333. You wish them to ring simultaneously when a call comes in. Put this somewhere in global section of extensions.conf:findme1=(777)555-1111
findme2=(777)555-2222
findme3=(777)555-3333
- Copy and paste above Macro screen and [findme] context as-si anywhere in extensions.conf.
- Copy these lines in [default] above to your existing default context of your extensions.conf. Make sure to replace "identifier" with your IAX provider (or SIP provider). You may also want to make sure that the audio file exists in /var/lib/asterisk/sounds. If not, pick some other file. This is the message you will hear on your cell phone when asterisks calls you. You will need to press '1' to accept the call.
Works great. I configured this to dial my cell-phone and office number at the same time.
A slightly different example:
The original example has some problems with the original on 1.2.13 Asterisk (possibly others). Timeouts variables didn't seem work within a Macro. Instead the WaitExten app is called to accomplish the same thing.Also, if the 'r' option isn't specified in the dial, it seems to pass a couple seconds of audio first
Additionally, if you just want the caller to hear ringing instead of a message, this example omits the "please wait" message to the caller
[default]
exten => _9999XXXXXXXXXX,1,Dial(IAX2/"identifier"/${EXTEN:4},40,rM(screen)) ; without r it seems to pass a second or two of audio first
exten => _9999XXXXXXXXXX,2,Hangup ; You can also substitute this with a Voicemail destination or other alternative destination
[macro-screen]
exten => s,1,Wait(1)
exten => s,n,Background(press-1-to-be-connected-to-the-caller) ; substitute a different playback file if you need to
exten => s,n,WaitExten(5) ; the value is the Wait time before we assume the call is not accepted
exten => 1,1,NoOp(Caller accepted) ; Do not set MACRO_RESULT to anything to connect the caller
exten => i,1,Set(MACRO_RESULT=CONTINUE)
exten => t,1,Set(MACRO_RESULT=CONTINUE)
[findme]
exten => s,1,NoOP(I'd rather the callers just hear ringing so they don't know they are calling something else)
exten => s,n,Dial(LOCAL/9999${findme1}&LOCAL/9999${findme2}&LOCAL/9999${findme3},40,m)
See also
- Asterisk cmd FollowMe: The built-in Asterisk 1.4 approach
- Asterisk Tips follow me: A hand-made solution not involving app_followme (dating back to 2004)
- Asterisk cmd Dial
Asterisk | Configuration | The Dialplan - extensions.conf | Dialplan Commands
This page has been viewed 26620 times since Tue 03 of Jan, 2006 [03:39 UTC]

Comments
333Re: real world example
This script requires interaction from the person receive the call to be connected. An external voice mail system will not provide that feedback and never be connected to the caller.
I use it to have my cell phone ring with my desk phone.
333real world example
exten => 1234,1,Dial(SIP/1234&IAX2/1234&IAX2/teliax/15555551212,25,)
This extension (1234) when dialed will ring SIP extension 1234, IAX2 extension 1234 and call 1-555-555-1212 out through teliax (at the same time), waiting for a maximum of 25 seconds for a channel to be picked up. Which ever channel is picked up first will have the call. This whole process is transparent to the caller and even the callee (no interaction required to pick up the call.) Hope this helps.
333Great concept, more info possible?
Thanks in advance!