I’ve got a bit of a conumdrum. We have Parking Pro and can page our 7941 Cisco phones brilliantly(second paging number set on second sip line set to auto-answer) BUT I would also like to have a “discreet” page, where I ring the paging extension, record my valet message, then it ring each phone and they ring normally until answered manually and then the recording played. At the moment, if I page a normal ringing extension, it rings off after 2 rings. If I answer within the rings, obviously I hear the announcement, that how it works! I’d just like it to ring a few more times!!
Any help or tips on this? It is for safeguarding/lock down, either a all speaker open “Get out now!” announcement or a discreet all phones ringing with a message when answered,“we don’t want to alarm you or the person smashing in doors, but please leave quietly from the back door”, you get the idea.
One solution is to prepare a bunch of “call files”
touch each of them with a random time-stamp some time in the near future so all the phones don’t start ringing at the same time.
Thanks dicko, I am not sure how that would work, wouldn’t that involve pre-recorded messages? I am after some way, doesn’t have to use the paging module, maybe IVR, that asks to record a message and then sends that message to a ring group, and then plays it when they answer. System recordings and announcements would be a way, but you cant make a System recording “on-the-fly” that I can see. This has to be simple for an emergency, pick phone up, record message, get the heck out of dodge knowing you have just told everyone to do the same covertly. As I said for auto answer over the phone speakers, paging and intercom works brilliantly, but you wouldn’t always want a potential attacker to know where you are sending people, because he/she then know exactly where to go to find everyone too.
add appropriately to that link snippet’s context
exten => 11,1,record(custom/hello-world)
to record the file and at the end
exten => 10,n,System(/var/lib/asterisk/bin/yourscript)
where yourscript generates the call files.
paging will not work as by definition all phones paged will answer at once.
Ring groups neither as only the “first responder” will get the message.
Ok, making more sense now. So let me see if I have this right, I create an extension in custom extensions with a variation of that snippet from the book, change the 10 for the “pin code”, ie the “extension” the person rings, change Playback for Record so:
exten => 297,1,Answer()
exten => 297,n,Wait(1)
exten => 297,n,Record(hello-world)
exten => 297,n,Wait(1)
exten => 297,n,Hangup()
exten => 297,n,System(/var/lib/asterisk/bin/yourscript)
That script then creates a bunch of call-files, one for each extension needed to be called, I assume it can be any linux/bash script:
Then I need another extension with the playback snippet for the call files to process, say 298 as above.
What then sets the call files off?
Have I got this right, I am seeing some chicken and egg scenarios!
Thanks for this, really helpful.
Pretty well, you can record the file by just dialing 297, call files can be of the form:-
the calls are made when the date of the call file is less than or equal to now()
touch --date=“now + $(($RANDOM%20 + 2)) seconds” holyshit-513
will generate a date for that callfile between now() + 2 seconds and now() +22 seconds if you use bash, php etc. will be of course be different.
Amazing I will try this in the morning. I assume no changes if I am using Asterisk 11.7?
Little bash script and a couple of custom extensions and I should be away!
So dropping a file in outgoing runs it straight away if the time stamp is equal or less, or wait till it is, then run it? That’s even better, as the phones won’t all ring at the same time, will sound more officey.
I will report back, as I hate threads not finishing. This may help other people putting safeguarding into place(we are a college so it is a big thing at the moment)
never “drop” the file into outgoing directory, always mv ( or ln) it there , or asterisk might try and process it while it is being written.
the files must be rw for the asterisk user.
was just thinking that! create them in a tmp directory, touch them and mv them to outgoing, otherwise they would run before getting touched!! I will have to check the generated files for rw and owner/group, so maybe a chmod/chown before the mv too.
probably not necesssary for the script, it runs as asterisk. while testing it remember to “su asterisk -c yourscript” to do it the same way.
One last question…
If I create the script to generate a call file for every extension, say every extension from 500-580, and the call-file then corresponds to a non-existent extension(I am thinking not having to adjust it every time I add a new extension), will it silently fail as it will be unreachable and no harm done or am I going to cause problems with CPU/memory etc?
If your system can process 80 calls in 20 seconds, then no problem.
but how about
for i in $(rasterisk -x ‘sip show peers’|grep OK|cut -d ‘/’ -f1);do myscript $i ;done
Dual Xeon Dell 1950 server with 2GB of RAM… Problem with that is, I have to selectively do extensions for 4 different centres with 8 different types of extensions, 5xx and 15xx, 2xx and 12xx, 6xx and 16xx, 7xx and 17xx, etc but I suppose I could do the same grep but adjust to only add ones with certain starting numbers, as each “pin code/extension” will only deal with a certain extension prefix. Thanks again!!
grep the appropriate identifying key/values from :-
rasterisk -x 'database show AMPUSER'
perhaps cidname? or for RG 601
for i in $(rasterisk -x "dialplan show [email protected]"|grep DIALGRP|sed -e 's/^.*DIAL_OPTIONS\},\([0-9\-]*\).*/\1/' -e 's/-/ /g');do yourscript $i;done
for Page Group 700:-
rasterisk -x "dialplan show [email protected]"|grep PAGE_MEMBERS|sed -e 's/^.*PAGE_MEMBERS=\([0-9\-]*\).*$/\1/' -e 's/-/ /g'
Excellent, I got bored and set up everything from home, will try it on a few test extensions in the morning!
I went even easier with the grep:
rasterisk -x ‘sip show peers’|grep ‘’^’’|grep OK|cut -d ‘/’ -f1
Find all extensions beginning with 5 that have OK status, then each script per centre will change the 5 to whatever it needs to be, as they are set per centre.
rasterisk -x 'sip show peers'|egrep "^5[0-9]*.*OK.*"|cut -d '/' -f1
An update as promised, works just as it should, dare I say it better than the Paging Pro module, as you can add steps and more recordings etc. The random time is strange too, the phones start ringing when you least expect it(as expected!)
So thanks dicko, you are a star!