[asterisk-users] Setting up ring group

Vazquez David vazquez at cross-solution.de
Fri Aug 1 10:28:09 CDT 2008


Tom Moore wrote:
> Hi guys,
> What's the best way to setup a ring group that contains 6 extensions so that
> when a call comes in there starts a 30 second timer and the first available
> device is rang instead of ringing all extensions at the same time?
> What I want it to do is cycle through the extensions and have the system
> ignore the ones that are busy and if there are not any free extensions in
> the ring group to have the system drop the caller to voicemail.
> If none of the extensions are present in the group I'd like to also drop to
> voicemail.
> Basically what I'm looking for is a multiple extensions version of the
> standard extension macro with multiple devices and the exten busy state
> ignored.
>
> Tom
>
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> AstriCon 2008 - September 22 - 25 Phoenix, Arizona
> Register Now: http://www.astricon.net
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>   
Hi I had the same problem. At the beginning I thought of implementing
agents and queues. But that's not what I wanted. I didn't go on and look
how to configure members (perhaps that would've been the better
solution), maybe because I'm always thinking on how to program something
and I'm not always aware that there are already solutions to many
problems out there.

Anyway, that's how it looks like in my extensions.conf


[wait-op]
; Ask if the channel is available, if it is
; go to the next step. If it isn't go to no-op
; and skip the delay.
exten = _XX,1,ChanIsAvail(SIP/${EXTEN})
exten = _XX,n,GotoIf($[ "${AVAILCHAN}"="" ]?no-op|s-na|1:3)
; Increment the delay by a value of five.
exten = _XX,n,Set(DB(cross/delay-${key})=$[${DB(cross/delay-${key})}+5])
exten = _XX,n,Wait(${DB(cross/delay-${key})})
exten = _XX,n,Dial(SIP/${EXTEN})

[no-op]
; Do nothing
exten = s,1,NoOp(Dummy)
exten = s-na,1,NoOp(Channel is not available)

[hotline-0]
; Define a custom name for the caller ID.
; This was an extra that I did
exten = s,1,Set(CALLERID(name)=hotline ${CALLERID(name)} ${CALLERID(num)})
; Set a key unique for each channel. So id doesn't matter how
; many calls we get, there will always exist just one key per channel
; This way we increase the delay only when we want to.
exten = s,n,Set(__key=${CHANNEL})
; Define the initial delay value on the database. That's even better than
; a global variable. One advantage, pointed out by a collegue of mine, is
; that when the process is over, you can delete the key from the DB.
exten = s,n,Set(DB(cross/delay-${key})=-5)
; Set all the devices as a single variable.
; Note that all of them use the "Local" context
exten = s,n,Set(dg0=Local/91 at wait-op)
exten = s,n,Set(dg0=${dg0}&Local/93 at wait-op)
exten = s,n,Set(dg0=${dg0}&Local/95 at wait-op)
exten = s,n,Set(dg0=${dg0}&Local/20 at wait-op)
exten = s,n,Set(dg0=${dg0}&Local/21 at wait-op)
exten = s,n,Set(dg0=${dg0}&Local/50 at wait-op)
exten = s,n,Set(dg0=${dg0}&Local/22 at wait-op)
exten = s,n,Dial(${dg0}|80)
; Manage the voicemail with a macro
exten = s,n,Macro(hotline-voicemail|${DIALSTATUS}|0)
; Delete the keys at hangup
exten = h,1,NoOp(DB_DELETE(cross/inc-${key})
exten = h,n,Hangup

[macro-hotline-voicemail]
; ${ARG1} Dialstatus
; ${ARG2} Whose voicemail?
exten = s,1,Set(CHANNEL(language)=de)
exten = s,n,Goto(s-${ARG1},1)
exten = s-BUSY,1,Voicemail(${ARG2},b)
exten = s-NOANSWER,1,Voicemail(${ARG2},u)
exten = s-CONGESTION,1,Voicemail(${ARG2},b)
exten = s-CHANUNAVAIL,1,Voicemail(${ARG2},u)

[default]
exten = 0,1,Goto(hotline-0|s|1)
...

I hope it works for you :)



More information about the asterisk-users mailing list