I have then created a test.call file:
hannel: PJSIP/1000
MaxRetries: 2
RetryTime: 10
WaitTime: 3
Context: call-file-test
Extension: 10
And in the PBX gui, I have created a custom extension 10
In the cli I run:
mv /test.call /var/asterisk/spool/outgoing/
This initiates a call on extension 2000 (physically connected device) and plays the âhello-worldâ recording.
Is there a way for me to
A) dial this number from a phone so that it rings a group of people and plays the hello-world recording.
B) stops the group of people from hanging up until the message is played then hangs up (or, continues to ring and play until the whole message is played)
I bought the paging pro module following an earlier ticket solution, but it does not quite give me everything I need.
I know of no way to block a SIP device from terminating an active session before the other side finishes. If such a thing is even possible it would have to be a phone feature, and the call would have to have some way of triggering the feature with a custom header. Sounds like you want an overhead paging system, perhaps used in conjunction with paging to the phones.
Sorry, not sure if I am misunderstoodâŚso take out the requirement to not allow hang upâŚ
The rest is not possible in your opinion? (push out an announcement using custom contexts?)
Add the following in extension_custom.conf
exten => 12345,1,Goto(pa-system,s,1)
[pa-system] exten => s,1,Answer
exten => 1,n,System(cp test.call /var/spool/asterisk/outgoing/)
exten => 0,1, Hangup()
Then, when I dial 12345 from any phone, I expected it to copy my call file (below) into outgoing to be processed
Channel: PJSIP/1000
MaxRetries: 2
RetryTime: 10
WaitTime: 3
Context: call-file-test
Extension: 10
Why? I am curious because we setup a set of static calls files and set a cron job that copies from the folder to /outgoing, at specified times. These are reminder calls (calls user to remind them of a function), but they seem to be working. Do you think this approach is flawed?
Okay, can you think of a solution where I can generate the .call files when an extension is dialled so that it pushes a message out to a number of people?
Maybe copy to one folder, then move the copied file?
You can cp files that are dated in the future, if not asterisk will likely grab only some of the file that are dated (mtime or atime) before the instant of time they start appearing in âoutgoingâ (the words used by the developers. Asterisk aggressively consumes them)
Easy way, in your staging folder , create one file for each extension âtouchâ them each with a random time between one second in the future and a reasonable period in that future, this eases the load on the system. Then cp them all into outgoing.
If youâre writing dialplan, there is no need to use call files unless you are attempting to schedule calls for the future. With dialplan you can just use the Originate dialplan application.
lorne14-pro*CLI> core show application Originate
-= Info about application 'Originate' =-
[Synopsis]
Originate a call.
[Description]
This application originates an outbound call and connects it to a specified
extension or application. This application will block until the outgoing call
fails or gets answered. At that point, this application will exit with the
status variable set and dialplan processing will continue.
This application sets the following channel variable before exiting:
${ORIGINATE_STATUS}: This indicates the result of the call origination.
FAILED
SUCCESS
BUSY
CONGESTION
HANGUP
RINGING
UNKNOWN: In practice, you should never see this value. Please report it to
the issue tracker if you ever see it.
[Syntax]
Originate(tech_data,type,arg1[,arg2[,arg3[,timeout]]])
Should read âThen âmvâ themâŚâ. Using âcpâ copies the contents of the new file into the outgoing directory, and you can get âfalse startsâ where the file is not complete when the call file is consumed. The recommended procedure is to build the file in a directory on the same file system and âmvâ it into the outgoing directory. This doesnât actually copy the text of the file, it merely changes the directory entry so that âextantâ file appears fully formed in the outgoing directory and you are ensured to get all of the contents of the file.
No, it doesnât work like that because we have previously âtouchedâ them some time safely in the near future, no false starts not interim renaming, just as i said âcpâ them and they will still be there the next time you need them (retouched of course) Spacing them out also as twenty cals hitting the system at the same time is probably quite a shock to a small system, if the message is 20 seconds long and you are happy with 5 calls then space them out at "touch callfile.n -d â+ 4*indexâ
The call files (with retries) will have a much higher delivery success rate than any other solution
Something like:-
j=1;for i in 1111 2222 3333 4444 5555 6666;do echo -n " contents of callfile \nwhere $i is replaced\nas necessary\n$j\n\n"> callfile.$i;touch callfile.$i -d "+$j sec ";j=$((j + 4));done;chown asterisk:asterisk callfile*;cp callfile* /var/spool/asterisk/outgoing
If i get you right. you want to create a custom extension and sent it to extension_custom.conf.
Create your custom extension go to (advance>Custom Context) add âLocal/s@call-file-testâ
You do not copy the files because copy doesnât write the entire file at once just like if you were to write directly to the file in the directory. which is a no-no.
The only way you can copy files into the outgoing spool without it being triggered immediately is to change the permissions of the file so Asterisk canât execute it until the permissions are changed.
Even if it takes the kernel 30 minutes to copy a file but that file was dated 31 minutes in the future when the copy was started, asterisk wont do anything until that 31 minutes have passed. its just how Asterisk works.
Which is another way of stating wgat i did already in this thread
You can cp files that are dated in the future, if not asterisk will likely grab only some of the file that are dated (mtime or atime) before the instant of time they start appearing in âoutgoingâ (the words used by the developers. Asterisk aggressively consumes them)