Ringing a group of phones from two or more lines

Hi,

This is probably an easy one for you asterisk gurus but here goes.

Ive got an asterisk pbx with a digium 3 port fxo (pstn) card and three pstn lines going into it. I then have 4 SIP phones connected too.

Basically the problem I am getting is a reliable way to make all the phones ring when a call comes in on one of lines. I setup the way of doing this with the calls coming in and ringing all the extensions in one go as shown in my extensions.conf below:

[macro-normal]
exten => s,1,Dial(${ARG2}|20,tTr)
exten => s,2,Voicemail(u${ARG1})

[default]
;Outgoing calls, if all are busy, caller will get engaged tone.
exten => _X.,1,Dial(Zap/g1/${EXTEN})


;Internal Calls
exten => 100,1,Macro(normal|100|SIP/100)
exten => 101,1,Macro(normal|101|SIP/101)
exten => 102,1,Macro(normal|102|SIP/102)
exten => 103,1,Macro(normal|103|SIP/103)


;Voicemail
exten => 500,1,Wait(3)
exten => 500,2,VoiceMailMain(s1)

[incoming]
;Incoming calls, will ring all extensions, if no answer after 20 seconds will go to global voicemail.
exten => s,1,Answer()
exten => s,2,Dial(SIP/100&SIP/101&SIP/102&SIP/103,20,tTr)
exten => s,3,Playback(im-sorry)
exten => s,4,Playback(nbdy-avail-to-take-call)
exten => s,5,Voicemail(u100)
exten => s,6,HangUp()

The crux of the problem is when a call has just come in and all the sip phones are ringing, then another call comes in (while all the sip phones are ringing) this call goes straight to answer phone, which isnt what I want to happen.

What I need it to do is to wait for the currently ringing call to be answered and then make all the other available phones ring.

Is there anyway to do this? Someone mentioned queues for this sort of thing ?

Thanks for any help you might have.

Personally, I would recommend to go with queues as the best option in handling concurrent incoming calls. That is actually the main purpose of queues; to handle this sort of feature you need in this case.

Maybe this would work

voip-info.org/wiki/view/Asterisk+tips+campon

THanks, thats what I was suspecting.

Does anyone have simple queue example dialplan that does this sort of thing? I’ve looked through stuff on internet and in a couple of books but if someone has a simple working one that would be grand.

Cheers.

for queues?

easy:

exten => s,1,Answer() exten => s,2,Queue(QUEUENAME,,,,300) exten => s,3,Playback(im-sorry) exten => s,4,Playback(nbdy-avail-to-take-call) exten => s,5,Voicemail(u100) exten => s,6,HangUp()

that rings the queue QUEUENAME for 5 minutes before dumping to voicemail.

you can either statically add the devices you want to be called in queues.conf, like so:

member => SIP/123 member => SIP/124

or use AddQueueMember to dynamically add a device to a queue:

[code]
exten => *50,1,AddQueueMember(QUEUENAME|SIP/${CALLERIDNUM})
exten => *50,2,Playback(agent-loginok)
exten => *50,3,Hangup

exten => *51,1,RemoveQueueMember(QUEUENAME|SIP/${CALLERIDNUM})
exten => *51,2,Playback(agent-logoutok)
exten => *51,3,Hangup[/code]

there is probably an easier way to do the AddQueueMember line, but it works for us. hope this helps.

In your incoming context, comment out the “answer” line. The system will answer the zap channel when one of the sip phones answers the call.

there is a bug in app_queue that was causing calls into the queue to drop after 31 seconds (we don’t have this exact config, it was slightly different) - adding the answer command fixed the problem for us, which is why i included it. i’ve never had an issue using the answer command.

Sorry whoiswes, I should have been more clear. was suggesting that tself remove his answer line as a quick test.

Thanks guys.

i’m going to try removing the answer() from the extensions.conf to see if that helps.

Also on the queues , I assume the users will not need to login to this queue on their phones?

Does this look right?

extensions.conf
---------------------
[macro-normal]
exten => s,1,Dial(${ARG2}|20,tTr)
exten => s,2,Voicemail(u${ARG1})

[default]
;Outgoing calls, if all are busy, caller will get engaged tone.
exten => _X.,1,Dial(Zap/g1/${EXTEN})

;Internal Calls
exten => 100,1,Macro(normal|100|SIP/100)
exten => 101,1,Macro(normal|101|SIP/101)
exten => 102,1,Macro(normal|102|SIP/102)
exten => 103,1,Macro(normal|103|SIP/103)

;Voicemail
exten => 500,1,Wait(3)
exten => 500,2,VoiceMailMain(s1)

[incoming]
;Incoming calls.
exten => s,1,Answer()
exten => s,2,Queue(IncomingQueue,,,,30)
exten => s,3,Playback(im-sorry)
exten => s,4,Playback(nbdy-avail-to-take-call)
exten => s,5,Voicemail(u100)
exten => s,6,HangUp()

And then for the queues config.

queues.conf
---------------------------
[general]
persistenmembers = yes

[IncomingQueue]
strategy = ringall

member => SIP/100
member => SIP/101
member => SIP/102
member => SIP/103

Does that look right?

Cheers

looks good to me - your queue will ring everyone for 30 seconds…

you MIGHT need to add timeout=30 to your queues.conf - that means that each member will be run for 30 seconds before the app goes to the next person in line (which is everyone, since you are using ringall). i can’t remember what the default is, so if you have any issues with the agent phones not ringing long enough, try adding the timeout setting.

Okay cool i’ll try giving it a go. Probably won’t be for a few days as the system is live now and working and I need to get some decent amount of downtime on it.

Another small point ive noticed, if after 30 seconds it times out and rings all the sip phones again, when will it ever get out of the loop and go to the global voicemail box? or won’t it? will the user just keep going round and round?

Cheers.

Hi,

think i’ve got it all sorted now, heres my configuration and it seems to work fine:

extensions.conf

[macro-normal] 
exten => s,1,Dial(${ARG2}|20,tTr) 
exten => s,2,Voicemail(u${ARG1}) 

[default] 
;Outgoing calls, if all are busy, caller will get engaged tone. 
exten => _X.,1,Dial(Zap/g1/${EXTEN}) 

;Internal Calls 
exten => 100,1,Macro(normal|100|SIP/100) 
exten => 101,1,Macro(normal|101|SIP/101) 
exten => 102,1,Macro(normal|102|SIP/102) 
exten => 103,1,Macro(normal|103|SIP/103) 

;Voicemail 
exten => 500,1,Wait(3) 
exten => 500,2,VoiceMailMain(s1) 

[incoming]
;Incoming calls, will ring all extensions, if no answer after 20 seconds will go to global voicemail.
;exten => s,1,Answer()
;exten => s,1,Dial(SIP/100&SIP/101&SIP/102&SIP/103&SIP/104,20,tTr)
exten => s,1,Queue(IncomingQueue,tTr,,,20)
exten => s,2,Playback(im-sorry)
exten => s,3,Playback(nbdy-avail-to-take-call)
exten => s,4,Voicemail(u100)
exten => s,5,HangUp()

queues.conf

[general]
persistentmembers = yes

[IncomingQueue]
strategy = ringall

timeout = 20

member => SIP/100
member => SIP/101
member => SIP/102
member => SIP/103
member => SIP/104

Thanks for you help guys.

Hi,

doesnt look like it is working properly now it is chopping the first 2 seconds or so of the call off.

So when someone picks up the phone and say “hello” the person at the other end doesnt hear “hello” anyone got any ideas about what is causing this? Its not the phones as it does it when it goes to voicemail too. Using the config as above.

is it a problem when picking the call out of the queue?

Thanks.

no, everything looks good…what types of phones are you using?

They are polycom soundpoint IP301’s the problem only emerged when i added the queue, if i put the answer() in a the begining of the dialplan the problem goes away.

Is there any way of adding a delay to the queue when it is picked up, other than using “memberdelay” which doesnt appear to work.

Cheers

It appears to be caused by a problem with the answer() function, without this asterisk answers the call before the media(line) is ready, and so chops the beginging of the call off.

Here is a bug.
bugs.digium.com/bug_view_page.php?bug_id=0002563

I’ve tried adding the memberdelay to the queues.conf file, but it is ignored, this seems to be a rather large bug with the queues configuration.

Anyone had the same problem?