How to configure 3CX with Topex Mobilink IP Gateway

EDIT: 3CX has its own guide since writing this one, find it here: http://www.3cx.com/blog/voip-howto/topex-gsm-gateway/ , as you can see they used some of my post :)
Here’s a how-to on configuring 3CX to use the Topex Mobilink GSM Gateway.
The Mobilink is an inexpensive and robust GSM/UMTS Gateway, but onfortunately there is almost no information regarding it’s setup . And as always with these devices, configurtion can be a pain. So i’ll provide you a step-by-step with screenshots.
This is the Mobilink, complete with Antenna with a long cord, so you can place it where needed.

First off, insert a simcard in the mobilink.
You can open the simtray by pressing the small yellow button with a pen.


Then connect it to your network, the default IP address is: https://192.168.173.1
Click on administration in the left pane, you’ll be prompted to log in.

Default username: admin
Default Password: 99admin11

When you login to the webpage, you’ll see that the WI is not too intuitive, but hey, the device costs less then a smartphone… What do you expect:)

If you have a pincode on the sim, you need to enter that in the Mobilink.
click mobile in the left pane –> settings –> more
here you can enter the pin.

Next we best change the network settings to fit your needs.
Click network in the left pane –> IP Settings –> correct them and save.

Now click the “commit” button on the left and let the device reboot.
You can now access the device on the entered IP address.

It’s best to see if there’s mobile connection now
Mobile –> status

Next you need to configure the incoming calls.
Go to Call controll –> Access IN –> enter your pbx IP here.

Now for Incoming mobile calls:
Call control –> Incoming Calls –> Edit –> More –> make sure mode is set to “trunk” and you are using “target” mode. Enter the local PBX extension where incoming calls should be connected to in the “target” field.
Leave all the rest default.

Now configure outgoing calls:
Call control –> Outgoing Calls –> Enable (that’s all for defaults)

Next you need to tell the Mobilink where your PBX is:
Call Controll –> Settings –> here you can enter the PBX IP

Now click Commit to save everything and reboot the device.
That’s it, the Mobilink is ready for action. Now for the PBX.

First off, we need to configure the Mobilink as PSTN Gateway, so NOT as trunk for outgoing.

In the 3cx management console go to pstn devices –> add gateway –> choose generic –> enter the name for the gateway –> Next

Enter the IP of the Mobilink and keep the rest as shown in the screen. –> Next

In the overview choose which inbound extensions will be called when there is an incoming call… but this doens’t matter, because the Mobilink invites the target you specify. –> Next

Now you have the outgoing PSTN device ready.

Create an outbound rule stating that phonecalls starting with the celular prefix of your country should be routed to the pstn gateway(mobilink)

Now we need to configure incoming calls from the Mobilink to the 3CX PBX.

Open the Voip providers tab in 3CX Managament console –> Add voip provider –> Generic Sip Trunk –> Next

Enter the IP of the Mobilink–> Next

In the next screen you’ll need to enter the external number (doesn’t matter what you enter here) and an auth. ID, doesn’t matter either. –> Next

Skip the incoming and outgoing rules and finish the config.

Now open the Voip provider(Mobilink) you just made by double clicking it and go to the “Source ID” tab. –> Check the thick that says “Source identification by DID”
–> click “Add Mask” –> enter * as mask –> Apply.

Ok, we’re done, you should be ready to make phonecalls in and out using the Mobilink GSM Gateway with 3cx. If not leave a message and I’ll see if I can help you.

How to configure OpenVPN on Yealink T38G

I finally got the vpn funcionality to work on the Yealink T38G and thought I’d write a decent post about it once. There are a few other tutorials out there, but none are complete imho.

This tutorial will show you how to setup an OpenVPN server on Ubuntu, and how to configure the Yealink to use VPN.

Please note:

  • I’m using a TUNNEL(routed) connection for the OpenVPN , so if you need a bridged one, DON’T follow this guide (for the OpenVPN setup that is)
  • This has been done with a Yealink T38 running FW 38.70.23.9 (although others should work as well)
  • The procedure to do this with a Yealink T26/T28 is the same, except for the location of the certificates; more on that later on.

So let’s start with the Ubuntu & OpenVPN setup.

1)Let’s make sure everything is up-to-date

  • apt-get update && apt-get upgrade

Update

2)Download the OpenVPN packages

  • apt-get install openvpn udev

installopenvpn

3)Copy everything to another location and make sure they don’t get overwritten by updates

  • cp -R /usr/share/doc/openvpn/examples/easy-rsa/ /etc/openvpn

4)Configure the vars file (it’s located in the easy-rsa/2.0/ folder you just moved) to include all the info to generate certficates, Edit the following lines to match you country etc…

  • export KEY_COUNTRY=”COUNTRY”
    export KEY_PROVINCE=”STATE”
    export KEY_CITY=”CITY”
    export KEY_ORG=”ORGANIZATION NAME”
    export KEY_EMAIL=”YOUR EMAIL”

Editfile

5)change directory to the etc/openvpn/easy-rsa/2.0 folder, and run the following:

  • . /etc/openvpn/easy-rsa/2.0/vars
    Note: in case you get an error about openssl.conf being the wrong version,issue the following: cp openssl.1.0.0.conf openssl.conf

sourcevars

  • source ./varsNow to clean up
  • . /etc/openvpn/easy-rsa/2.0/clean-all

clean

Now we must build the CA , so run:

  • . /etc/openvpn/easy-rsa/2.0/build-ca
    Note: it will ask several questions/settings but they should be good since it will use the vars file you created earlier. When done it will ask to build and write, so enter y

buildCA

6)Now we need to build the certificate and key for the server itself.

  • . /etc/openvpn/easy-rsa/2.0/build-key-server <yourchosenname>

buildcert

7) Now we need to generate the client certificate & key file.

  • . /etc/openvpn/easy-rsa/2.0/build-dh

9)So we have the required files, let’s put them somewhere safe for further configuration.
Make a directory somewhere. e.g mkdir /tmp/yealink, now go to the directory witht the client files (/easy-rsa/2.0/keys)

  • cp ca.crt <yourchosenname>.crt <yourchosenname>.key /tmp/yealink

cpcerts

10)Now we must move the files to a location where the OpenVPN service can find them. So in the /keys directory:

  • cp ca.crt ca.key dh1024.pem <yourchosenname>.crt <yourchosenname>.key /etc/openvpn

cpfiles

11) So now we have to modify the OpenVPN server config file to match our needs, there are lots of documents describing different setups/configs, so it should be a breeze for different setups from this.

  • cd /usr/share/doc/openvpn/examples/sample-config-files
  • gunzip -d server.conf.gz
  • mv server.conf /etc/openvpn/yourchosenname.conf

openvpn10  openvpn11openvpn12

12)Now edit the copied file using an editor,

  • nano /etc/openvpn/OPENVPN.conf  and uncomment the following lines
  • push “redirect-gateway def1″
    push “dhcp-option DNS 10.8.0.1″
    Note:You can edit more settings like port and protocol should you need it.

13)Now we need to setup the vpn server to forward traffic from the VPN client.

  • Edit the sysctl.cof file (/etc/sysctl.conf)
  • net.ipv4.ip_forward=1

fwd

14)Let’s punch a hole in IPTables to allow the traffic

  • iptables -A FORWARD -m state –state RELATED,ESTABLISHED -j ACCEPT
  • iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT

openvpn14 tmpiptables

That’s it for the server side, now let’s move on to the yealink :)

15) change directory to the folder where you stored a copy of the client files in step 9, here you need to create a config file (vpn.cnf) for the phone to use. To make your life easy I’ve created one and you can just copy/paste it. Note that you need to modify some settings like protocol/port etc… to match your config.

  • client
    ;dev tap
    dev tun
    ;dev-node MyTap
    ;proto tcp
    proto udp
    remote >YOURSERVERWANIP OR HOSTNAME< >YOURPORT<
    ;remote-random
    resolv-retry infinite
    nobind
    ;user nobody
    ;group nogroup
    .
    persist-key
    persist-tun
    ;http-proxy-retry # retry on connection failures
    ;http-proxy [proxy server] [proxy port #]
    ;mute-replay-warnings
    ca /phone/config/openvpn/keys/ca.crt
    cert /phone/config/openvpn/keys/client.crt
    key /phone/config/openvpn/keys/client.key
    ns-cert-type server
    ;cipher x
    comp-lzo
    verb 6
    ;mute 20

configfile

16)Now if you’re still with me you should have 4 files in your dir as seen below. if so, let’s continue if not review the previous steps. So now we need to make another dir in the folder where the files are called “keys” and then move all file there except the vpn.cnf

dircheck

  • mkdir /tmp/yealink/keys
    mv ca.crt <yourchosenname>.key <yourchosenname>.crt /tmp/yealink/keys

mvcheck

17)Almost there, now we must make a tarball for the yealink to use. Yealink expects a very strange folderstructure for the tarball with the topfolder being named “.” Now the way I found to do this is while in the directory issue the following:

  • tar -cf client.tar .
    Note: it will probably pass an error, but the tar will still be created as shown.

tarcheck

Now you need to move the tarball to somewhere you can access from the yealink phones webinterface.

18) Now log into the webinterface of your Yealink phone and navigate to the “Network” tab and then click “advanced” on the left.

openvpn20

19) You will see the VPN section, but don’t enable just yet. You should first upload your tar. To do so, click browse and then “Import” , when that’s done you can enable the VPN and the phone will reboot.

openvpn21

Now if all went well the phone reboots and connects to your VPN server and then you can configure the PBX settings, or if there were previously configured it should just work given. The phone will show a small “V” icon on the screen to show it’s connected to the VPN server.

Now as a side note: The config file for the Yealink uses a structure like : /phone/config… This is only for the T3x series, if you are trying to setup VPN for the 2x series you should use /yealink/config…
All other steps should remain the same.

If you still don’t get it going then drop me a line and i’ll try and help.

 

 

How to change extension length in 3CX

Here’s a short one on how to change the length of your extensions in 3CX after the initial install.
Please note that this is not recommended and should be tested and of course take a backup of your database first!.

To change the extension length go to “settings” –> Advanced –> choose the “custom parameter tab” and look for the value called :  “ENL” , change the value field to the desired length and you’re done!