HOW TO: Set up a GSM Gateway on FreePBX

First of all I should mention that I have a Sun Comm SC-385 Dual Sim GSM Gateway, which uses the same firmware as the Portek MV-370. Therefore this post should satisfy this kit also.

Secondly, I have set up my gateway for outbound calls only. I have no intention yet to set this up for inbound calls.

Setting up the gateway:
The first challenge was to get my lan to recognise the gateway as its default IP was in the range of 192.168.33.xxx To do this I had to switch off the DHCP server element of the gateway, the only way I could see of doing this was to insert a sim and ‘dial up’ the gateway to send it the DHCP switch off code by DTMF. This is not simple as the gateway only allows you to do this within the first 20 seconds of it being reset, but the 20 seconds dont start until after the sim registers so timing is trial and error… anyway assuming you can get the timing right.

  1. Dial up the gateway
  2. The gateway will play back a dial tone.
  3. From your phone dial #111#

This should switch off DHCP and allow you to connect the gateway to your router.

The second challenge was to find the IP address of the gateway now that it is being set by your router. This is simple enough if you understand routers, just browse your routers ‘Client Table’ and look for the entry called “VOIP_TA1s” or similar. Now you have your IP you can browse to the gateways IP.

Default Admin User is 'voip’
Default Password is ‘1234’ (make sure you change this).

You should now be ready to set up the gateway.

In the “LAN to MOBILE” settings set up a outbound route on route 0 for sim card 1 and a route on route 25 for sim card 2 - both can be the same. You do this by using the input boxes at the bottom of the page:

  1. Position: 0 or 25 (dependant on your sim).

  2. URL: your Asterisk box IP address, (alternatively you can enter an * for all ip’s on your network (use this option if your voip phones will connect directly to the gateway)).

  3. Call Num: enter a “#” to send out the number dialed. (You can also delete ‘x’ digits by using dx or add ‘n’ numbers by using annn (eg #d1a0044 would change 01274 to 00441274)

  4. Click the Add button.

  5. Repeat this for your second Sim.

Next - confirm the SIP Ports each sim will use as you will need these to set up your asterisk trunks (below), you can do this by checking the ‘Forward Settings’. (No need to change these) - mine were SIM 1 Port 5060 and SIM 2 Port 5062.

SIP Settings only appear useful if you need to handle MOBILE to LAN calls. Here you simple allow the gateway to register as an extention (as you would a voip phone) - The point of difference to note is that your Asterisk server ip address goes in the ‘Proxy Server’ field.

MOBILE SETTINGS - ‘SETTINGS’ Page.
SIP From: Tel/User
CLID Presentation: Off - so that customers do not try to call the gateway back
LAN ANSWER MODE: Alerted - apparently makes Asterisk recognise the ringing earlier.
I did not need to change anything else here.

SAVE & REBOOT - for good luck!

Now onto your FreePBX set up.

Set up two new SIP Trunks (assume GSM1 - for SIM1 and GSM2 for SIM 2).
Set up you dial rules etc as you see fit, however your peer details need to be:

host=192.168.1.xxx (your gateway ip)
port=5060 (for GSM1) -(or 5062 for GSM2 or whatever it said in your Forward Settings)
type=friend
allow=ulaw&alaw
context=from-internal
insecure=very

Now set up your outbound rules to utilise these trunks as you see fit.

That is it. - From that point on all worked well for me.

I have added load balancing to my system, so that I can use one ‘Balanced/GSM’ outbound rule and use both SIMs equally, but that is another story best answered by this Thread. http://www.freepbx.org/forum/freepbx/tips-and-tricks/least-busy-trunk-hunting with this link being key… http://projects.colsolgrp.net/wiki/trunkbalance

I wish you luck.

Mark.