Delay when spooling out ~50 call files

I’ve set up my first Asterisk. One function of the system is to play a sound in about 50 rooms, where each room has a sip-telephone.

So I wrote a python-script which creates for each room a call file with the following content:

Channel: SIP/1337
Application: Playback
Data: my-sound
Priority: 1

This works fine, except that the sound is not played simultaneously in all rooms (only in 3-5 rooms).
I thought the reason for the delay is that the system needs some time for each room to create the call file, move it to the spool-directory and to let asterisk read the file. So my next try was:

Channel: SIP/1337&SIP/1338&SIP/1339&SIP/1340
Application: Playback
Data: my-sound
Priority: 1

to trigger all the calls with one call-file. But with this call-file only one room answers the call.

Isn’t there a solution to start the calls (nearly) simultaneously?

Thansk in advance,

The & notation is processed by the Dial application, not the low level set up a call code.

You could use a local channel for the A side, but, even then, I think 50 would exceed the maximum line length.

Why aren’t using Page application?

1 Like

The page application sounds good. But how do I implement page into the call-file?

Why do you want a call file? Try in the asterik cli: core show application Page
And see what it does.

The problem I see is that I have to start the call programmatically and the rooms which should be called vary.

As I understand the page application I have to define it in the extensions.conf, which would mean that I have to change the extensions.conf and reload the configuration every time…

Hmmm I’m not following what you need. Even if the rooms vary you can create it in the dialplan once for all and invoke it later. But let’s assume you need it dynamically, set a variable and trigger the call to a local channel like David said before

I use call files with the Page application but I do it through a local channel.

exten =>  s,1,NoOP()
 same =>    n,NoCDR()
 same =>    n,SIPAddHeader(Alert-Info: RingAnswer)
 same =>    n,SipAddHeader(Call-Info: <uri>\;answer-after=0)
 same =>    n,Set(CALLERID(NAME)=${Origin})
 same =>    n,Set(CALLERID(NUM)=PAGE)
 same =>    n,Page(${Device},A(${File})is),10)
 same =>    n,Hangup()

My call file looks like

Channel: LOCAL/GO6@waitexten
WaitTime: 20
Context: pageconnect
Extension: s
Priority: 1
SetVar: Origin=7106
SetVar: Device=SIP/7901
SetVar: File=pagequeue/1495067241

1 Like

It could be, that in a first call only rooms 1 and 2 are called, then all rooms are called and in another call only rooms 27-31 and 42 are called. The rooms which should be called are selected by an user in an web interface.
So creating the dealplan once means to define many possibilities. Also it’s possible that the standard-user adds another room. And the standard-user has no access to the extensions.conf.

My point is clarified by @johnkiniston 's answer. You are talking about rooms but Page application has no concept of that, it creates bridges dynamically. See the code posted by @johnkiniston you can page any device with that code you only need to modify the variable in your call files.

And please keep in mind that your first request was totally different than your actual goal thus means that the first answer will never met your expectations. If I recall @david551 in another post talked about making smart questions and show the real goal to avoid unwanted answers.

I think I wrote a bit incomprehensible: with “room” I haven’t mean’t conference rooms but rooms in a building where every room stands for 1 telephone.

I read @johnkiniston’s code so, that I have to define local channels in the extensions.conf. So if I’d like to call SIP/1337 and SIP/1338 there must be a local channel with these two numbers?

Maybe there is a better way to do what I’m doing than to use a local channel, the local channel I use is actually just there to allow the call file to have two legs.

the GO6@waitexten extension just answers the call and does a Wait for the length of the extension (so my GO6 extension is a 6 second wait)

It seems you want to make automated calls on demands controlled by a web GUI, I wont suggest call file, to acomplish this task instead I suggest use a more sophistcated method. The Asterisk AMI originate action and Local channels, using AMI you can make your web app Interact with Asterisk and is PHP it is extremely more easier using PHP MYSQL & Asterisk AMI Originate action

Asterisk AMI sounds good. I’ve never had heard of it before…

You meen I should send the following command for each room?

Action: Originate
ActionID: 1
Channel: SIP/1337
Application: Playback
Data: my-sound

(Sending the command with Channel: SIP/1337&SIP/1338/… isn’t working. So the question is, if AMI is fast enough to hear no delay…)

If you want multiple endpoints to answer and play the same file you still need to use the Page application.

With application Playback only the first phone that answers will play the sound.

This is true no matter how you start the call, Dialplan, call file, or AMI.

I think the first part that he needs is to understand how Originate works. Because you already gave him the solution, he only needs to tweak it a little.

I habe some questions to your solution.
Can you explain the line   same => n,Page(${Device},A(${File})is),10)   ? All information I have is that Page() has the numbers to call and the options d, q and r as input…

Do I have to define sth. to get the “LOCAL/GO6@waitexten”-Context in the Call-File to work? Am I correct in assuming that the variables “Origin” and “Device” are the phone which will be the speaker?

The file contains a list with all phones, which should be placed in the conference, right? How is the content formated and where is the file stored?

Edit: My extensions.conf with your [pageconnect]:

include => durchsage
include => internal

exten => _XXXX,1,Dial(SIP/${EXTEN})

exten => 1234,1,Ringing()
 same => n,TrySystem(/path/to/
 same => n,HangUp()

exten =>  s,1,NoOP()
 same =>    n,NoCDR()
 same =>    n,SIPAddHeader(Alert-Info: RingAnswer)
 same =>    n,SipAddHeader(Call-Info: <uri>\;answer-after=0)
 same =>    n,Set(CALLERID(NAME)=${Origin})
 same =>    n,Set(CALLERID(NUM)=PAGE)
 same =>    n,Page(${Device},A(${File})is),10)
 same =>    n,Hangup() creates the call-file like you wrote.

Now, when I call 1234 no phone is ringing and the log shows:

  == Using SIP RTP CoS mark 5
    -- Executing [1234@phones:1] Ringing("SIP/9999-00000004", "") in new stack
    -- Executing [1234@phones:2] TrySystem("SIP/9999-00000004", "/path/to/") in new stack
    -- Executing [1234@phones:3] Hangup("SIP/9999-00000004", "") in new stack
  == Spawn extension (phones, 1234, 3) exited non-zero on 'SIP/9999-00000004'

Origin in my example is what phone is sending the page so the people being paged know who paged them.

Device is what device(s) to play the page on, You can specify multiple devices together by concatenating them like SIP/7901&SIP/7902&SIP/7803

File is what soundfile to play back to the devices I’m paging to. I pre-record the audio stream and then play it back with the A option to Page()

The Page() application has a number of options See the wiki for a list of what Page will accept

Ok, I understand. But what is “LOCAL/GO6@waitexten” doing?
My Asterisk says:

– Attempting call on LOCAL/GO6@waitexten for s@pageconnect:1 (Retry 1)
[Aug 22 19:35:35] NOTICE[30188][C-00000007]: chan_local.c:968 local_call: No such extension/context GO6@waitexten while calling Local channel
[Aug 22 19:35:35] NOTICE[30188][C-00000007]: channel.c:5694 __ast_request_and_dial: Unable to call channel LOCAL/GO6@waitexten
[Aug 22 19:35:35] NOTICE[30188]: pbx_spool.c:389 attempt_thread: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[Aug 22 19:35:35] NOTICE[30188]: pbx_spool.c:392 attempt_thread: Queued call to LOCAL/GO6@waitexten expired without completion after 0 attempts

exten => GO6,1,NoOP()
same => n,Answer()
same => n,Wait(6)
same => n,Hangup()