Thursday, 10 February 2022

FreePBX paging timeout

 We had an issue this week with paging on FreePBX. The customer had a user who made a page to a group of handsets but did not hangup his extension properly. This meant that all the other extensions were locked busy for quite some time. 

The customer asked if we could set a maximum page length. We had a look and the GUI doesn't allow for it. That meant we would need to find a way to modify the config files.

Any config done in the GUI is written into etc/asterisk/extensions_additional.conf. Any config FreePBX writes into here can be overwritten in etc/asterisk/extensions_override_freepbx.conf.

I used WinSCP to get into the FreePBX file system and opened extensions _additional.conf. I dod a search for the page group number which was 2800. This took me to a context called [ext-paging] and below it [app-pagegroups]. I copied the two sections and pasted them into notepad so that I had got an original copy of the config.


Then I used WinSCP to open extensions_override_freepbx.conf and I pasted in the [app-pagegroups] section. It looked like this


[app-pagegroups]
include => app-pagegroups-custom
exten => 2800,1,Macro(user-callerid,)
exten => 2800,n,Set(_PAGEGROUP=2800)
exten => 2800,n(busy-check),GotoIf($[${TRYLOCK(apppagegroups2800)}]?:busy)
exten => 2800,n(devstate),Set(DEVICE_STATE(Custom:PAGE2800)=INUSE)
exten => 2800,n,Gosub(app-paging,ssetup,1())
exten => 2800,n,Set(PAGEMODE=PAGE)
exten => 2800,n,Set(PAGE_MEMBERS=1050-1499)
exten => 2800,n,Set(PAGE_CONF_OPTS=)
exten => 2800,n,Set(ANNOUNCEMENT=beep)
exten => 2800,n(agi),AGI(page.agi)
exten => 2800,n,Set(CONFBRIDGE(user,template)=page_user_duplex)
exten => 2800,n,Set(CONFBRIDGE(user,admin)=yes)
exten => 2800,n,Set(CONFBRIDGE(user,marked)=yes)
exten => 2800,n,Answer
exten => 2800,n(page),ConfBridge(${PAGE_CONF},,,admin_menu)
exten => 2800,n,Hangup
exten => 2800,n(busy),Set(PAGE${PAGEGROUP}BUSY=TRUE)
exten => 2800,n(play-busy),Busy(3)
exten => 2800,n(busy-hang),Goto(app-pagegroups,h,1)
exten => h,1,ExecIf($[${ISNULL(${PAGE${PAGEGROUP}BUSY})}]?Set(DEVICE_STATE(Custom:PAGE${PAGEGROUP})=NOT_INUSE))
;--== end of [app-pagegroups] ==--;

Then I just needed to add a timeout. About line 7 where all the Set statements start I added 

exten => 2800,n,Set(TIMEOUT(absolute)=30)

I then saved the file and issued a fwconsole reload to the terminal of FreePBX to get the config read in.

Now a page will cause the channel to be opened, but if it's not hung up then it will finish and hang up at 30 seconds.

The problem with this approach is if  I want to change the group I can't do it in the GUI anymore. I have noted that in the description of the page group, but if anyone can explain a better approach then I would be happy to hear it.

John Rogers
Ones and Zeros

LetsEncrypt failure on Draytek Routers

 We like to use Draytek Routers on our installs as they are easy to configure and tend to be reliable. As with all things these days https s...