[asterisk-users] followme app

John A. Sullivan III jsullivan at opensourcedevel.com
Tue Aug 25 11:21:21 CDT 2009


On Tue, 2009-08-25 at 16:28 +0200, harry R wrote:
> Hi 
> 
> Someone may give me an example of followme() application using in a
> dialplan (including what to configure in followme.conf) ?
> I use asterisk 1.6.1 so if your example can match to that release it's
> will be wonderfull.
<snip>
We are using followme on 1.6.1 with the slight complication that we are
a multi-tenant environment.  Since we have clients with the same
extension numbers living in different contexts, we cannot directly map
extensions to followme definitions.  Here's how we handled it.

In followme.conf (actually in included files - one per client), we have
definitions using a globally unique identifier per user, e.g.,

[1234561] ; John Sullivan
context=zx400
number=>12345678901,30
number=>12345678902,36

The call to followme is initiated as part of our basic call handling
macro:

[macro-common]
; ARG1 = extension to dial
; ARG2 = extension for voice mail
; ARG3 = context for voice mail
; ARG4 = extension for followme (optional)
; ARG5 = Timeout is seconds until voice mail / followme (optional - defaults to 24)
exten => s,1,Set(TM=${IF(${ISNULL(${ARG5})}?24:${ARG5})})
exten => s,n,Dial(${ARG1},${TM})
exten => s,n,Wait(0.5)
exten => s,n,Goto(s-${DIALSTATUS},1)

exten => s-NOANSWER,1,GotoIf($[${ISNULL(${ARG4})}]?vm)
exten => s-NOANSWER,n,background(custom/ImSorry)
exten => s-NOANSWER,n,background(custom/Silence-0.25)
exten => s-NOANSWER,n,background(custom/No1AtXten)
exten => s-NOANSWER,n,background(custom/Silence-0.5)
exten => s-NOANSWER,n,background(custom/Press${ARG2})
;exten => s-NOANSWER,n,background(custom/Silence-0.25)
exten => s-NOANSWER,n,background(custom/4VoiceMail)
exten => s-NOANSWER,n,background(custom/Silence-0.5)
exten => s-NOANSWER,n,background(custom/Press${ARG4})
exten => s-NOANSWER,n,background(custom/Silence-0.25)
exten => s-NOANSWER,n,background(custom/TryToFindPerson)
exten => s-NOANSWER,n,WaitExten(5)
exten => s-NOANSWER,n(vm),Voicemail(${MACRO_EXTEN}@${ARG3},u)

exten => s-BUSY,1,Voicemail(${MACRO_EXTEN}@${ARG3},b)

exten => _s-.,1,Goto(s-NOANSWER,1)

where they press some key for voice mail and another key to have the
system "try to find" the person, i.e., followme.  This key choice is
then handled in the originating context:

exten => 2,1,GotoIf(${ISNULL(${FM})}?i,1)
exten => 2,n,FollowMe(${FM},san)
exten => 2,n,Goto(1,1)

where we first check to make sure it was a hand-off from the macro and
not a misdialed, invalid extension.

FM is a variable set to track the globally unique followme identifier.
Here is a sample user's extension definition showing how we set the
identifier:

; John Sullivan
exten => xxx,1,Set(__VM=312) ; VoiceMail ID
exten => xxx,n,Set(__FM=100001) ; Followme ID
exten => xxx,n,Macro(common,SIP/jasiii,1,zx400,2)
exten => 8xxx,1,VoiceMail(xxx at zx400)
exten => 7xxx,1,VoiceMailMain(xxx at zx400)
exten => 7xxx,n,Hangup()

I realize that's a somewhat complicated example and, as we are very new
to asterisk, any critiques and improvements are welcome.  In summary:

     1. We defined a followme for a user with a unique ID - in many
        cases this can be the extension
     2. Our busy / not-available routine offers an option for followme,
        traps this number as an extension just like an automated
        attendant
     3. Checks to make sure that extension was not an accident, e.g., if
        the number pressed for followme is "2", we don't want people
        landing in followme because they dialed 2 from the main
        auto-attendant if they happen to be in the same context
     4. Call followme by passing it the unique ID and any options

Hope this helps. Again, bear in mind that we are new to this so if
someone suggests a better way, they are probably right :-) - John
-- 
John A. Sullivan III
Open Source Development Corporation
+1 207-985-7880
jsullivan at opensourcedevel.com

http://www.spiritualoutreach.com
Making Christianity intelligible to secular society




More information about the asterisk-users mailing list