login | register
Fri 10 of Oct, 2008 [22:56 UTC]

voip-info.org

Discuss [3] History

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 | Configuration | The Dialplan - extensions.conf | Dialplan Commands

This page has been viewed 21155 times since Tue 03 of Jan, 2006 [03:39 UTC]


Comments

Comments Filter
222

333Re: real world example

by lschweiss, Wednesday 17 of May, 2006 [19:48:12 UTC]
The point of this script is to connect the caller to the first real person to pick up. If for example one of the numbers in your list is a cell phone you may not want your caller to be dumped into the cell phone's voice mail which could happen immediately if the phone is out of service.

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.
222

333real world example

by gsupp, Thursday 30 of March, 2006 [13:38:28 UTC]
I was also confused by the example given. It turns out, "Find-me / Follow-me" is as simple as using the & symbol between channels in the dial string.

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.
222

333Great concept, more info possible?

by lazlow69, Wednesday 22 of March, 2006 [17:27:10 UTC]
I am still quite new to asterisk, but starting to get a good hold on it. I found this tip when searching for a way to have an inbound call simultaneously go to 3 cells and 3 sips, so that anyone who answers any of them will get the line. I would like it to be transparent to the inbound caller, as this tip seems to be. I am not sure I completely understand the logic in the example, though, so I was wondering if anyone has some real world examples of this implementation they'd be willing to share, or perhaps more information on how they implemented it , etc.

Thanks in advance!