Setup MV-370 GSM Gateway with Asterisk
Created by: nicolas.bernaerts,Last modification on Fri 28 of Nov, 2008 [08:15 UTC] by mesfet
Page Contents
The GSM gateway MV-370 is manufactured by http://www.portech.com.tw/.
It's main interest in comparison with other gateways is that it is GSM to SIP (not FXS), so voice quality is very good.
Another point of interest is the price (MV-370 US$249,MV-372 US$445 on ebay).
With that gateway properly configured, you are able to receive calls from GSM to Asterisk (including DISA) and to give calls from Asterisk to GSM network.
Here the configuration for MV-370 device is discussed. Below, some interesting information about the routing features achieved by the MV-372 device, which manage 2 SIMs.
Usage
A typical usage of such a gateway is to be able to give a call with your normal mobile to any destination at voip cost :Your mobile <----gsm network----> MV-370 <--lan--> Asterisk <--internet--> VOIP provider <--whatever--> landline
To do such a call, you just call your MV-370 number (it has its own simcard), then you get an invitation tone, then you dial the number which is handled by Asterisk.
If you have some special deals with your mobile operator, like free special number, you can call your MV-370 for free.
You can then call all around the world from your mobile at voip cost :-)
MV-370 Configuration
The first thing to do with the MV-370 is to flash the latest firmware.Any firmware dated before 2006/09/26 is totally unstable, making the box very difficult to parameter and to work with.
Once you've configured everything in the box, one good advice is to unplug the power and to restart it.
By this way you sould have all the parameters taken into account.
To have the MV-370 to work with Asterisk, you need first to configure the box.
Here are some screen shots showing all the important parameters.
You have to note that in all the configuration process, the MV-370 is considered as extension '103' of the IPBX.
In Bold are the parameters depending on your installation
Here the '#' is important to avoid the two stage dialing when you give a call from Asterisk to GSM.
The mobile number you give in that page are the authorised mobile which can call GSM to Asterisk.
These mobile number must be defined as your GSM provider displays the number.
If you don't know how it is displayed, just give a call to the box and check the number given in the 'Incoming Mob' field of the 'Mobile Status' page.
Any number which is not in that list won't have acces to the LAN side, so to Asterisk.
If you want to allow any number, just set '*' in that field ... but beware of the bill ;-)
Once Asterisk configuration is made, you should get 'Registered' on the Realm1.
It is very important to use only ulaw or alaw as all DTMF is inband.
So if you want to be able to do some DISA when you call from GSM to Asterisk, it has to be one of these 2 codecs.
These settings seem to be ok, just adjust ...
Antenna position
Another important thing is to properly place the provided antenna.If your gsm reception is good, you should get around 18 or 19 as Signal Quality in the "Mobile Status" page.
With that level of signal quality, your audio quality will be very good.
On the other end, I've experienced that with a signal quality down to 11, audio becomes very jerky.
So, maximum signal quality = maximum audio quality.
Asterisk configuration
Once the MV-370 is set, you have to configure Asterisk.On that side, you have to setup files as follow :
sip.conf
; GSM VOIP Gateway MV-370
[103]
type=friend
username=103
fromuser=103
regexten=103 ; When they register, create extension 401
secret=xxxxxxx ; Asterisk extension password
context=gateway ; Incoming calls context
dtmfmode=inband ; Very important for DISA to work
call-limit=1 ; Limit to 1 call max
callerid=GSM Gateway <103>
host=dynamic
nat=no ; Gateway is not behind a NAT router
canreinvite=no ; Typically set to NO if behind NAT
insecure=very
qualify=yes
disallow=all
allow=ulaw ; prefered codec for DTMF detection
allow=alaw
extensions.conf
; ******* GSM Gateway incoming calls **********
[gateway]
exten => _103,1,Answer()
exten => 103,2,Set(TIMEOUT(digit)=3) ; give enough time to do second stage dialing
exten => 103,3,Set(TIMEOUT(response)=5)
exten => _103,4,DISA(no-password|outgoing) ; here 'outgoing' is the normal context to deal with the dial plan
[outgoing]
...
; example of LAN to GSM call
; call the MV-370 sim card mail box thru GSM
exten => _888,1,SetCallerID("xxxxxxxxxx")
exten => _888,2,Dial(SIP/${EXTEN}@103,60,r)
exten => _888,3,Hangup()
Here you can see that all my dialplan is defined in the [outgoing] section.
As a conclusion, MV-370 is a very nice toy to save lot of GSM bills, but it is a hell to setup as the documentation is really, really poor.
That's it ... hope it works for you :-)
Connection to TRIXBOX 2.0
-----------------------
Well - i have got it working after a while. The problem was that the MV-370 did forward calls from gsm to trixbox, but not the other way. I changed, in the lan to mobile section of the mv-370, the "#" to "#d0a0" to cut of the trailing "0" and the add it again. For me this works since all numbers start like this.. I added a trunk, configuration only in "peer Details" like this :
allow=ulaw&alaw
canreinvite=no
context=from-pstn
disallow=all
dtmfmode=inband
fromuser=61
host=dynamic
insecure=very
nat=no
qualify=yes
secret=61
type=friend
username=61
Firmware upgrade
Upgrading firmware could couse some problems. Portech technical help advises to use Internet Explorer on Windows to perform firmware upgrade.After upgrade you should go to Update > Default Settings and click a button to restore default settings. (This button might be not visible in Mozilla Firefox).
Users have reported that firmware image should be saved in an empty directory - otherwise update fails.
MV-372 configuration for route calls properly
MV-372 manage 2 SIMs, so it can manage up to 2 conversation. Often, it's interesting to put SIMs of different GSM providers to be able to route outgoing calls using (Application LCDial|Least Cost Routing).In the following example we configure MV-372 to have:
- SIM1 with number 3331234567, associated with SIP account 101
- SIM2 with number 3481234567, associated with SIP account 102
- Route -> Mobile To Lan Settings
- Insert record with Item 0, CID *, URL 3331234567
- Insert record with Item 10, CID *, URL 3481234567
- Route -> Lan To Mobile Settings
- Insert record with Item 0, CID *, Call Num #
- Insert record with Item 10, CID *, Call Num #
- Mobile -> Settings
- Just assure that each SIM has PIN request disabled
- SIP Settings -> Service Domain
- Select Mobile 1 then insert in Realm 1 the SIP information about SIP/101 account
- Select Mobile 2 then insert in Realm 1 the SIP information about SIP/102 account (remeber to select Active ON)
- SIP Settings -> SIP Responses
- Response on port busy: 503 Service Unavailable
- SIP Responses: check both items ON







Comments
333Re: Retreiving CallerID from Asterisk
1. First Trunk: User Context --> gsm1in
type=friend
secret=***yourpassword***
username=gsm1in
context=from-internal
permit=0.0.0.0/0.0.0.0
qualify=yes
host=dynamic
2. Second Trunk: User Context --> gsm2in
type=friend
secret=***yourpassword***
username=gsm2in
context=from-internal
permit=0.0.0.0/0.0.0.0
qualify=yes
host=dynamic
This settings replaces your old extensions what you deleted!
In the portech MV-372 Service Domains (Mobile1 and Mobile2) leave blank the Display name,
Username and Register name for Mobile 1 is gsm1in, for Mobile 2 is gms2in,
Proxy Server: your asterisk ip
Now you already have Caller ID in your VOIP phone for incomming calls. Enjoy!
Peter Furesz
333Re: Retreiving CallerID from Asterisk
I've a Portech MV-372 working with Trixbox, no problem with making and receiving calls.
the only thing is that when the gsm receives a call, it passes to asterisk not the Caller Id, but the extension registered on the portech.
Example: 2900 (reception extension), 2997 (portech extension), when we receive a call it rings on the right phone (2900) but it shows GSM1 (2997) instead of showing the real caller ID.
is it possible to retreive the real number that is calling the gsm? in the portech webmanagement, we're able to see the phone that is calling, but it isn't passed to the trixbox.
thanks i advanced.
333If you always recieve a busy tone from MV-370 , when dialing from asterisk
I use * in the url field of "Route-LAN to Mobile", to catch everything.
The docs for the MV-370 have been prepared by the CIA, obviously: Just to confuse the Russians <g> ....
333Echo on mobile when calling MV-370
My partner, connected to me via landline/asterisk/MV-370/Mobile , does not hear an echo.
Voice quality from my partner is good.
So it looks like, the echo is generated during transmission of voice from my mobile - MV-370 - asterisk.
Any ideas, what to do about it ?
333PIN usage in MV-370 does not work for me
Firmware:
Model Type: VoIP GSM:900/1800/1900MHz
Firmware Version: Fri Nov 2 16:54:11 2007.
Codec Version: Mon Jul 24 10:55:05 2006.
usage of PIN for the SIM does not work for me.
After removing PIN-activation, now MV-370 registeres successfully.
333Another request for DTMF help !
In SIP-settings-DTMF Setting
activate 2833
and in SIP.conf for asterisk: dtmfmode=rfc2833
Now the number dialed on the mobile during second-stage dialing is OK. No more duplication.
This is in contrast to one of the messages above. So it might be, with my newer version of the firmware, downloaded from www.portech.com.tw (see below) it might be different. The usage of rfc2833 for transmission of DTMF is better, anyway.
333Another request for DTMF help !
So in case of "12345" asterisk reecives "1223455" to dial.
Firmware:
Model Type: VoIP GSM:900/1800/1900MHz
Firmware Version: Fri Nov 2 16:54:11 2007.
Codec Version: Mon Jul 24 10:55:05 2006.
Any ideas, where to tweak ?
I tried Portech support already; unfotunately, it looks like they are in holidays ...
333If you always recieve a busy tone from MV-372 (2 port variation of 370) when dialing from asterisk
Try changing the url under route > lan to mobile settings > url.
If calling from via asterisk, the format that is needed is InboundAsteriskExtension@GsmGatewayAsteriskExtension
e.g. 6000@103 and then # in the call num field.
This will work if you have something like this in your asterisk dialplan (extensions.conf)
exten=103,1,Dial(SIP/+447789437873@103,60,r)
exten=103,3,Hangup()
I figured this out when looking at the mobile status page and seeing 6000@103 under "Incoming IP".
In the manual it states to use the asterisk IP address in the URL field. This simply
didn't work for me. Perhaps using the asterisk IP is a case when asterisk originates the call.
Alternativly you could use * in the url field, to catch everything.
333MV370 DTMF Detection
Someone, pls help me with this DTMF detection!!! Is there any tweaking need to be made in the settings or upgrade the firmware. The present version is v6.02b.
333Retreiving CallerID from Asterisk
MV-370 config
Mobile-To-LAN: * - 8220 (where 8220 is the exten called in my context gsm-in)
Mobile settings: SIP From: Tel/User (Standard)
extension.conf
[gsm-in]
exten => _X.,1,EAGI(fixcid_mv370.php,${SIP_HEADER(FROM)})
exten => _X.,n,Verbose(CallerID is $(CALLERID(NUM))
exten => _X.,n,Goto(default,5555,1)
fixcid_mv370.php
#!/usr/bin/php -f
<?PHP
###############################################################################
#### fixcid_mv370.php - AGI-BIN
#### Author: Filippo Grassilli
###############################################################################
$cidnum=$_SERVER[argv][1]; // Caller Number (CallerID)
// Fix CallerID for GSM Gateway Portech MV-370 - Pass SIP_HEADER(FROM)
if(ereg(" <sip:",$cidnum)) {
$cidnum=trim(ereg_replace("(\")|(<.*)","",$cidnum));
if($cidnum[0]=="+") {
if(ereg("^\+39",$cidnum)) $cidnum=substr($cidnum,3);
else $cidnum="00".substr($cidnum,1);
} elseif($cidnum=="N") {
$cidnum="";
}
echo "set variable CALLERID(NUM) \"$cidnum\"\n";
}