Wednesday 13 September 2023

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 secure connections have been enforced by Chrome and the browser world. This means the routers have to be accessed on https.  This then complicates things as you then need a valid ssl certificate.

Draytek have built in a LetsEncrypt client in their routers, so we use DynDDNS and LetsEncrypt in order to give the router a certificate.  To obscure things further we changed the ssl port away from 443.

All this worked fine until LetsEncrypt changed things. Ou certificates would not renew. It used to be that LetsEncrypt renewd on port 80, but to get things working again we had to change the secure  port back to 443. Suddenly we could renew the cert.

Keep that in mind. To use a Draytek with LetsEncrypt you now need ssl on port 443!


John Rogers

www.oneszeros.biz

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

Friday 6 August 2021

Mitel 5312, 5320, 5330 and 5340 BLF in SIP mode

 A few years ago I posted a how to guide to getting Mitel dual mode phones into SIP mode and registering them on your SIP server.  While my configuration on that particular job used the programable keys on the phone, there was no call for Busy Lamps.

Last week I was asked to use these phones and get the BLF working.  I scoured the Internet and having patched together a couple of resources managed to get them to work.

On these phones you have the <User> tag section to define your user and also the <pkDescription> section to define the keys. Just as your phone wont work for you without both the user and the key setup, so the busy lamps wont work without a modification in both of those sections.

In the <User> section you need to define the users you want to subscribe to BLF updates for. User the BLFGroup="" to do this. Fill the quotes with a comma separated list of extensions to monitor . Then in the <pkDescription> section you define a key as Fea="27" 


The below file is the MN_userID.cfg file in my TFTP server.  Note how I use the BLFGroup= to setup a subscription for 1050, then in the key section, key 27 (third up from bottom) is the BLF key for 1050

<Parameter Model="5312">

<user_list>

<User ID="1001" DispName="John-Rogers" Pwd="MyPassword" AuthName="1001" Realm="" RegSvr="sipserver.net" RegPort="5060" ProxyScheme="2" ProxySvr="sipserver.net" ProxyPort="5060" ProxyScheme="2" VMSvr="sipserver.net" VMPort="5060" VMScheme="2" OutSvr="" OutPort="5060" OutCtr="0" Ring="1" Line="0" EventSvr="" EventPort="5060" EventScheme="2" BLFGroup="1050">

</User>

</user_list>

<pkDescription>

<Key Line="25" Fea="6" Des="Line 1" Addr="" Mode="1" UserID="271581001"></Key>

<Key Line="26" Fea="7" Des="Line 2" Addr="" Mode="1" UserID="271581001"></Key>

<Key Line="27" Fea="27" Des="1050" Addr="1050" Mode="1" UserID="1050"></Key>

</pkDescription>

<vlan_id>0</vlan_id>

<host_name>SIP13</host_name>

</Parameter>

Have a play, it worked for me.

John Rogers

www.oneszeros.biz

Friday 2 April 2021

Killing stuck channels FreePBX Asterisk

 I keep finding stuck channels in asterisk / FreePBX conferences, that I then have to manually hangup.

Here is how you find the calls

core show channels

This will bring up a list if channels in use. Identify the one you need to hangup i.e.

PJSIP/itsptrunk-00000002

Then issue command

channel request hangup PJSIP/itsptrunk-00000002


The call will then drop and you have killed the call.


If you need any help with a telephony project you can reach me at www.oneszeros.biz

Asterisk & FreePBX Feature Codes

I have tended to find that documentation for Asterisk and FreePBX based phone systems can be rather spread about. For the generic phone user what codes should they use? Here is a helpful list.


Call Forward

*72 – Call Forward All Activate
*73 – Call Forward All Deactivate
*93 - Call Forward All Prompting Activate
*74 – Call Forward All Prompting Deactivate
*90 – Call Forward Busy Activate
*91 – Call Forward Busy Deactivate
*94 - Call Forward Busy Promping Activate
*92 – Call Forward Busy Prompting Deactivate

*52 – Call Forward No Answer/Unavailable Activate
*53 – Call Forward No Answer/Unavailable Deactivate
*740 – Call Forward Toggle


So how do you call forward to voicemail? This is one point that seems to escape all the guides. Calls can be sent direct to a users voicemail by putting a * in front of their extension number, so you can forward direct to voicemail by dialling *72 *ext. e.g. if my extension is 1002 I can dial *72 *1002 to do the forward.

Turning the prompting on and off turns on and off the voice responses that walk you through it and confirm your actions.

Call Waiting

*70 – Call Waiting – Activate
*71 – Call Waiting – Deactivate


*8 – Asterisk General Call Pickup (When you are part of a call group)
** – Directed Call Pickup (When you are part of a call group)
*2 – (When in a call) Asterisk Attended Transfer
## – (When in a call) Asterisk Blind Transfer
** – (When in a call) Asterisk Disconnect Code
*1 – (When in a call) Asterisk Toggle Call Recording


If you need any help please contact me via www.oneszeros.biz


Tuesday 3 March 2020

Mitel MSL Based Upgrade Corruption

Occasionally when upgrading items using the "Blades" Panel on a Mitel machine, you may get inability to proceed due to checksum errors or the like.

Follow the process below to delete the corrupt files and get back to a fresh set of upgrade files.


Environment
MSL
Mitel Standard Linux
MBG
Mitel Border Gateway
MiCollab
Cause
A cached package that forms part of the upgrade is corrupt.
Resolution
Access the package location via the secure shell and delete the files.

SSH onto the MSL server as user root using something like PuTTY and issue the following commands:

cd /var/cache/e-smith/blades/packages/
rm *.* -f


Go back to the MSL web interface and access the ServiceLink > Blades page
Select the "Update List" button to refresh the list of blades and cached downloads

You can now proceed to cache the download again before attempting to upgrade the server again.

John Rogers


Monday 13 February 2017

Mitel 5312 and 5324 in SIP mode

Mitel sell the 53xx range of phones as 'Dual Mode' meaning they can be switched to SIP mode. That's great, except for the lack of support and documentation available.
While there are user manuals for the 5320 upward, the last manual for the 5312 / 24 was published in 2007, and as for configuring the phone, that is largely undocumented.

Here is what I found got me working. If you are a dealer or have a Mitel 5000 (MiVoice Office) on the latest software (6.2) then that will help.

Two ways to start.

1. Upgrade on a PBX.   The Mitel 5000 has a tftp server built into it and will upgrade any phone attached to it.  Boot the phone into config mode and set the tftp server as the IP of the phone system. When the phone restarts it will receive the latest build for the phone.

2. Upgrade from the TFTP server.  You will need to get the SIP software from the Mitel website. This is an area protected for dealers with Mitel accounts, and there are 3 archives with different software in for the different phones.

Switch into SIP mode.

This has (?) to be manually done on the handset.  Boot the phone holding down the Superkey and then press * to configure the phone. In the 'Phone Mode' menu you can switch to SIP and another reboot gets the phone into SIP mode. In SIP mode a web interface is made available that is not there in Minet mode.

Once the phone boots it sits there asking for a user id. If you type a user ID in it will attempt to get a file from the TFTP server.  If you type in 1234, then when the phone reboots it will try to get a set of files.  The first will be called MN_GENERIC.cfg, the second includes the user id and is called MN_1234.cfg, The phone then tries to get one with its mac address included in the name MN_macaddress.cfg and lastly it tries and fails to get a US language file. (This is why i recommend an upgrade to latest version. Earlier versions gave up when they couldn't get the language file).

The phone can be given information about its account and tftp server in several ways. DHCP option 66 will probably do it. You can type it into the phone using the bootup menu, or you can browse to the phones web interface and define it there.  You can find the IP for the phone an the admin tools menu of the phone when it is booted up.

I got as far as getting my phone to tftp what looked like a good config from the tftp server, but still couldn't make a call. Any attempt to call resulted in a 'No Proxy Defined' message back on the display.  A google search turned up no answers.  So here is the answer you may be looking for.  When you define a user in the user list, you also have to have a matching user defined on one of the line keys. Check out the config below. Mitel have an example config and spreadsheet of values that can be used, but its not obvious.

MN_Generic.cfg  -  This will be requested by all Mitel 53xx phones (and others) and contains global information. It could be missed if such info will be included in the individual files.

SAMPLE MN_GENERIC.CFG FILE  (Supports multiple Phone Models)
<Parameter Model="5340">
   <dhcpenable>1</dhcpenable>
   <tftp_config>1</tftp_config>
   <pppoe_enable>0</pppoe_enable>
   <tftp_task_enable>1</tftp_task_enable>
   <tftp_upgrade>2</tftp_upgrade>
   <http_upgrade>0</http_upgrade>
   <outbound_state>0</outbound_state>
   <local_sip_port>5060</local_sip_port>
   <tos>0</tos>
   <e802_priority>6</e802_priority>
   <vlan_id>354</vlan_id>
   <sntp>pool.ntp.org</sntp>
   <time_zone>-5</time_zone>
   <auth_method>2</auth_method>
   <register_expire>7200</register_expire>
   <emerg_number></emerg_number>
   <emerg_ip>0.0.0.0</emerg_ip>
   <emerg_port>5060</emerg_port>
   <audio_codec>5</audio_codec>
   <audio_pkt_size>20</audio_pkt_size>
   <dtmf_type>0</dtmf_type>
   <dtmf_payload>101</dtmf_payload>
</Parameter>
<Parameter Model="5224">
   <dhcpenable>1</dhcpenable>
   <tftp_config>1</tftp_config>
   <pppoe_enable>0</pppoe_enable>
   <tftp_task_enable>1</tftp_task_enable>
   <tftp_upgrade>2</tftp_upgrade>
   <http_upgrade>0</http_upgrade>
   <outbound_state>0</outbound_state>
   <local_sip_port>5060</local_sip_port>
   <tos>0</tos>
   <e802_priority>6</e802_priority>
   <vlan_id>354</vlan_id>
   <sntp>pool.ntp.org</sntp>
   <time_zone>-5</time_zone>
   <auth_method>2</auth_method>
   <register_expire>7200</register_expire>
   <emerg_number></emerg_number>
   <emerg_ip>0.0.0.0</emerg_ip>
   <emerg_port>5060</emerg_port>
   <audio_codec>5</audio_codec>
   <audio_pkt_size>20</audio_pkt_size>
   <dtmf_type>0</dtmf_type>
   <dtmf_payload>101</dtmf_payload>
</Parameter>

MN_Useris.cfg
This was the one that caught me.   Notice the user list at the bottom of the file has a user ID that matches the user id under the definition of each key. This file would be stored as MN_1234.cfg


SAMPLE 5312 MN_<USER_ID>.CFG FILE
<Parameter Model="5312">
   <pkDescription>
      <Key Line="25" Fea="6" Des="Line 1" Addr="" Mode="1" UserID="1234"></Key>
      <Key Line="26" Fea="0" Des="" Addr="" Mode="1" UserID=""></Key>
      <Key Line="27" Fea="7" Des="Line 2" Addr="" Mode="1" UserID="1234"></Key>
      <Key Line="28" Fea="0" Des="" Addr="" Mode="1" UserID=""></Key>
      <Key Line="29" Fea="8" Des="Line 3" Addr="" Mode="1" UserID="1234"></Key>
      <Key Line="30" Fea="0" Des="" Addr="" Mode="1" UserID=""></Key>
      <Key Line="31" Fea="9" Des="Line 4" Addr="" Mode="1" UserID="1234"></Key>
       <Key Line="32" Fea="0" Des="" Addr="" Mode="1" UserID=""></Key>
      <Key Line="33" Fea="4" Des="Headset on/off" Addr="" Mode="1" UserID=""></Key>
   </pkDescription>
   <user_list>
      <User State="1" ID="1234" DispName="John Smith" Pwd="pass" AuthName="john_smith" Realm="" RegSvr="sip.mitel.com" RegPort="5060" RegScheme="2" ProxySvr="sip.mitel.com" ProxyPort="5060" ProxyScheme="2" VMSvr="" VMPort="5060" VMScheme="2" OutSvr="" OutPort="5060" OutCtr="0" Ring="1" Line="0" EventSvr="" EventPort="5060" EventScheme="2"></User>
   </user_list>
</Parameter>

If you do a search for the Mitel spreadsheet you will find plenty more options that can be inserted into these phones.

John Rogers

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...