School Environment - Bell scheduling system-Working Solution

I am wondering if anyone has done this? I have a Asterisk setup with around 90 polycom phones and want to do a bell system through the phones using something on th elines of the paging app.

I have the auto answer working on the phone and paging, but was wondering if there was an easy way to configure multiple schedules (8 to be exact) and then from a prompt select what schedule is active and then during certian times in the day page the phones (using a custom ringer on the polycoms as the bell ) and then hangup the channels.

I have a custom ringer on the phones that will play when a certian alert header is added. But need to figure out a way to schedule it :smile:

any help would be great, obviously this could be usefull for anyone in a school environment :smile: 8)

The only thing I can think of is to use a kind of batch file along with cron jobs to setup the scheduling and ringing of phones.

If you configured an IVR with the choice of the 8 different schedules and each choice ran a different script which would remove any relevant existing cron jobs (deactivate) and then add new ones (activate) for the new schedule.

The job would run a script which could feed into the asterisk system and page the phones at the right times.

You might look at the paging applications as it shows how to ring a phone through a script in asterisk.

voip-info.org/wiki/view/Cisc … wer+config
-see callall application

An idea…

Brad

Yeah thats what Im working on :smile:

hrmm

I have the paging stuff working just trying to work out the logistics for the cron stuff I think it should be possible though -

I have the paging portion working fine.

If any one else has worked on something like this it would be cool :smile:

[b]

Is there any way to make a call from a script without using a phone?[/b]

Can I create a shell script that executes a call?

Yes - the callall application is a shell script that you can run giving a few parameters and will call the different extensions.

The callall essentially passes the call information into a script that then gets chucked into a directory which asterisk automatically processes.

But that script and using the /var/spool/asterisk/outgoing/

requires an originating channel - how can I get around this, since everything will be handled within the dial plan?

I have tried this

test.call
Channel: SIP/2828
MaxRetries: 0
Context: classrooms
Extension: 4500
Priority: 1

and it calls channel SIP/2828 and then when I pick up it dial 4500.

I just want the sript to dial out on exten 4500 - is that possible?

use a local channel that goes to a noop and then a wait or something…

[local-exten]
exten => 100,1,Answer
exten => 100,n,Wait(60)
exten => 100,n,Hangup

then call Local/100@local-exten instead of SIP/2828

yes, duh :smile:

thanks for that…

Ok now I have to create the cron job that will creat the outgoing call files at specific times :smile:


Another question - how can I play a sound file when I use the Page() ?

If I dial an individual phone I can run a macro in the dial context to play sounds, but not for a page.


Ok here is what I have - I can create a outgoing call file with the following format to create the “bell”

Channel: Local/0000@clock CallerID: 1st Bell MaxRetries: 0 Context: classrooms Extension: 4500 Priority: 1

and then I have an extension that does this:


[clock]
exten => 0000,1,Answer
exten => 0000,n,Playback(beep)
exten => 0000,n,Wait(1)
exten => 0000,n,Playback(beep)
exten => 0000,n,Wait(1)
exten => 0000,n,Playback(beep)
exten => 0000,n,Wait(1)
exten => 0000,n,Playback(beep)
exten => 0000,n,Wait(1)
exten => 0000,n,Hangup


exten => 4500,1,SIPAddHeader(Alert-Info: Ring Answer) ; 4 digit extensions
exten => 4500,2,Page(SIP/1700&SIP/2828&local)

Ok so that works - but now I noticed that if someone is on the phone when I mv the file to the “outgoing” it causes a 2nd line to appear on that phone, and then when they hang up their first line - it dumps them into an empty conference for all of eternity :smile: This is no good cause I know people wont pay attention to their phones…

I guess I am going to have to use hints and create hints for every phone…

Any suggestions?

Ok im now using the page.agi :
voip-info.org/wiki/view/Scri … CCP+system

To find the phones that are in use and not page them.

Everything seems to be working allright, now I need to get the cron stuff in order and all is well :smile:

What do you all think the best way to do the cron stuff?
Create tmp.call files and then move them into the /outgoing/ when bells need to be ran?

or create files with creation times in the future for all the bells for that day?

-----------EDIT------------

Ok here is what I am doing -

I am executing a shell script from crontab at specific times IE

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

#Bell System - Schedule 1
25 12 * * 1-5 root /clock-temp/bell.sh
30 12 * * 1-5 root /clock-temp/bell.sh
55 12 * * 1-5 root /clock-temp/bell.sh
00 13 * * 1-5 root /clock-temp/bell.sh
30 13 * * 1-5 root /clock-temp/bell.sh
10 14 * * 1-5 root /clock-temp/bell.sh
15 14 * * 1-5 root /clock-temp/bell.sh
55 14 * * 1-5 root /clock-temp/bell.sh
00 15 * * 1-5 root /clock-temp/bell.sh

shell.sh:

#!/bin/sh

# this file will create the bell.call file used for Asterisk Outgoing Spool
rm -f /clock-temp/temp01.call
cat >> temp01.call << EOF
Channel: Local/0000@clock
CallerID: Bell
MaxRetries: 0
Context: classrooms
Extension: 4500
Priority: 1
EOF

Now I am at work on creating a dialplan menu that will allow you to change the schedule and thus re-program the crontab with the correct bell schedule.

Things are moving along 8)

Now I have the entire system working with 3 schedules to choose from my dialplan.

when typing in an extension you can change what schedule is being used and its just a simple AGI bash script that re-writes /etc/crontab and reloads the config.

Here is the AGI:

#!/bin/sh

# Schedule 1 - Regular Schedule
# this file will create the Crontab file used for Regular Schedule
rm -f /etc/crontab
cat >> /etc/crontab << EOF
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

#Bell System - Schedule 1 - Regular Schedule
00 08 * * 1-5 root /clock-temp/bell.sh
57 08 * * 1-5 root /clock-temp/bell.sh
02 09 * * 1-5 root /clock-temp/bell.sh
59 09 * * 1-5 root /clock-temp/bell.sh
04 10 * * 1-5 root /clock-temp/bell.sh
19 10 * * 1-5 root /clock-temp/bell.sh
24 10 * * 1-5 root /clock-temp/bell.sh
21 11 * * 1-5 root /clock-temp/bell.sh
26 11 * * 1-5 root /clock-temp/bell.sh
51 11 * * 1-5 root /clock-temp/bell.sh
56 11 * * 1-5 root /clock-temp/bell.sh
21 12 * * 1-5 root /clock-temp/bell.sh
26 12 * * 1-5 root /clock-temp/bell.sh
51 12 * * 1-5 root /clock-temp/bell.sh
56 12 * * 1-5 root /clock-temp/bell.sh
53 13 * * 1-5 root /clock-temp/bell.sh
58 13 * * 1-5 root /clock-temp/bell.sh
55 14 * * 1-5 root /clock-temp/bell.sh
EOF
/etc/init.d/crond reload

as you can see the schedules are complex (many different times) and I havnt figured out a good way to make it so you can easily modify the shcedule from the dialplan - but changing it in a flat file isnt too bad :smile:

It works, and gets the job done!
8)