A while back I found a guide to setting up delayed paging in FreePBX at http://www.freepbx.org/forum/freepbx/tips-and-tricks/delayed-paging-0. This worked well except that if two people dialed the call at the same time, they would record to the same file and interrupt each other when the page runs. The modifications below fix this problem. (I also added a caller ID field and a delay to stop the message from being cut off):

[from-internal-custom]
exten => 1001,1,Answer
exten => 1001,2,Wait(2)
exten => 1001,n,set(pageext="local/1002@ext-paging")
exten => 1001,n,set(pagetime=${EPOCH})
exten => 1001,n,flite(Press the pound key when finished)
exten => 1001,n,record(page-${pagetime}.ulaw)
exten => 1001,n,system(echo "Channel: ${pageext}" > /var/spool/asterisk/tmp/page-${pagetime}.call)
exten => 1001,n,system(echo -e "Callerid: \042Page\042 <1001>" >> /var/spool/asterisk/tmp/page-${pagetime}.call
exten => 1001,n,system(echo "WaitTime: 20" >> /var/spool/asterisk/tmp/page-${pagetime}.call)
exten => 1001,n,system(echo "Context: from-internal" >> /var/spool/asterisk/tmp/page-${pagetime}.call)
exten => 1001,n,system(echo "Extension: 1003" >> /var/spool/asterisk/tmp/page-${pagetime}.call)
exten => 1001,n,system(echo "Priority: 1" >> /var/spool/asterisk/tmp/page-${pagetime}.call)
exten => 1001,n,system(echo "Setvar: pagetime=${pagetime}" >> /var/spool/asterisk/tmp/page-${pagetime}.call)
exten => 1001,n,system(echo "MaxRetries: 2" >> /var/spool/asterisk/tmp/page-${pagetime}.call)
exten => 1001,n,system(echo "RetryTime: 15" >> /var/spool/asterisk/tmp/page-${pagetime}.call)
exten => 1001,n,system(chmod 777 /var/spool/asterisk/outgoing/page-${pagetime}.call)
exten => 1001,n,system(mv /var/spool/asterisk/tmp/page-${pagetime}.call /var/spool/asterisk/outgoing/)
exten => 1001,n,hangup()
 
exten => 1003,1,playback(beep)
exten => 1003,n,Wait(1)
exten => 1003,n,playback(page-${pagetime})
exten => 1003,n,Wait(2)
exten => 1003,n,system(rm /var/lib/asterisk/sounds/page-${pagetime}.ulaw)
exten => 1003,n,Hangup

There is still a less than one second window where there can be competition but this was not a problem for the application I’m using it for.


0 Comments

Leave a Reply