di Agostino Zanutto
Elastix & FXO (Grandstream GXW410X)
| VoIP & Telefonia |
Al fine di collegare un centralino telefonico alla rete pubblica o si usano delle schede dedicate che vengono montate direttamente all'interno del centralino o ci si avvale di un gateway di rete come il GWX4104 o il suo fratello "maggiore" GXW4108 di grandstream (i quali differiscono esclusivamente per il numero di linee gestibili 4 per primo e 8 per il secondo).
In questo post trattiamo la configurazione di questo oggetto con un centralino Elastix 1.6.
Acronimi:
con RTG o PSTN si indicano le linee telefoniche analogiche tradizionali, vengono chiamate RTG in italia (Rete Telefonica Generale) o in lingua inglese PSTN (Public Switched Telephone Network / Rete Telefonica Pubblica Commutata ).
con FXO: si indicano le porte che si usano per collegare le linee telefoniche ad un gateway, ed e` l'acronimo di Foreign eXchange Office, (linea di scambio/commutazione esterna).
Schema di collegamento

GXW4104/8
Va detto che l'oggetto ha la "classica" interfaccia minimale di Grandstream molto efficace che contiene tutte le informazioni necessarie in una logica top-down,
parte da un menù orizzontale con:
Status, Basic Settings, Advanced Settings, FXO Lines, FXO Line Test, Channels, Dial-plan, Profile 1, Profile 2, Profile 3.
Status: contiene delle informazioni sullo stato della periferica,
Basic Settings: fa riferimento all'interfaccia di rete settaggio della password e impostazioni IP per la periferica incluso timezone.
Advanced Settings: fa riferimento alla pagina di configurazione avanzata del gateway incluse procedure per l'update automatico del firmware e della configurazione via http. (per la quale vi rimando a un altro post per lo svolgimento di tale funzione da parte del centralino elastix)
FXO Lines: Questo pagina include diverse informazioni di natura "elettrica" per la nostra rete pubblica.
|
|||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||
FXO Line Test:
Pagina dedicata a impostare i numeri di linea e testare l'impedenza della linea in automatico. (inserire i vostri numeri di telefono)
Channels:
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Dial-plan: Utile solamente se utilizzate la modalità "stage 2" non trattata in questo post
Profile 1, Profile 2, Profile 3:
In queste sezioni, una per server SIP si possono specificare tutti i parametri per l'accesso al gateway da parte di un centralino.
Per alcune configurazioni particolari si possono associare delle linee a un centralino e altre a un altro/
| Activate Profile: | Yes No | ||
| Profile Name: | (Optional, name of your profile) | ||
| SIP Server: | (Server domain name or IP address) | ||
| Outbound Proxy: | (Domain name or IP address if in use ) | ||
| Use DNS SRV: | No Yes | ||
| User ID is phone number: | No Yes | ||
| SIP Registration: | Yes No | ||
| Unregister On Reboot: | Yes No | ||
| Register Expiration: | (in minutes. default 1 hour, max 45 days) | ||
| SIP Registration Failure Retry Wait Time: | (in seconds. Between 1-3600, default is 20) | ||
| SIP Transport: | UDP TCP | ||
| NAT Traversal (STUN): | No No, but send keep-alive Yes | ||
| Proxy-Require: | (content for SIP Proxy-Require header) | ||
| Early Dial: | No Yes (use "Yes" only if proxy supports 484 response) | ||
| Session Expiration: | (in seconds. default 180 seconds) | ||
| Min-SE: | (in seconds. default and minimum 90 seconds) | ||
| Caller Request Timer: | Yes No (Request for timer when making outbound calls) | ||
| Callee Request Timer: | Yes No (When caller supports timer but did not request one) | ||
| Force Timer: | Yes No (Use timer even when remote party does not support) | ||
| UAC Specify Refresher: | UAC UAS Omit (Recommended) | ||
| UAS Specify Refresher: | UAC UAS (When UAC did not specify refresher tag) | ||
| Force INVITE: | Yes No (Always refresh with INVITE instead of UPDATE) | ||
| Enable 100rel: | Yes No | ||
| Refer-To Uses Target Contact | No Yes | ||
| INVITE Ring-no-answer Timeout: | (in seconds. default 40 seconds) | ||
| Preferred Vocoder: (in listed order) |
|
||
| Special Feature: | |||
Elastix
Per il centralino elastix la connessione al Gateway si configurerà come una connessione a 4/8 trunks separati (o meno nel caso non utilizziate tutte le porte); uno per ogni porta FXO collegata.
Aggiunta Trunk (una per fxo) [Menù PBX => Trunks => Add SIP Trunk]
Dovrete impostare __DID_NUMBER__ con il numero della linea a cui andrete a collegarvi,
gxw1 andrà sostituito di volta in volta con gxw2, gxw3,gxw4 in modo da distinguere il contesto in uscita
Outbound Dial Prefix: diverrà 991 per la prima linea, 992 per la seconda... 993,994...
__GXW_410X_IP__ andrà sostituito con il numero di IP del vostro gateway
General Settings |
|
| Outbound Caller ID: | |
| Never Override CallerID: | |
| Maximum Channels: | |
| Disable Trunk: | Disable |
| Monitor Trunk Failures: | Enable |
Outgoing Dial Rules |
|
| Dial Rules: | |
| Dial Rules Wizards: | |
| Outbound Dial Prefix: | |
Outgoing Settings |
|
| Trunk Name: | |
| PEER Details: | |
Incoming Settings |
|
| USER Context: | |
| USER Details: | |
Registration |
|
| Register String: | |
Ultima nota: la scelta del codec g729 (le righe disallow=all e allow=g729) dipendono dal fatto che il codec sia installato e funzionante, in caso contrario utilizzate qualunque altro codec, supportato dal centralino e dai vostri apparecchi telefonici, tale scelta deve essere soppesata dopo aver considerato il vostro utilizzo del centralino e della rete a vostra disposizione e dipende in tutto e per tutto da essa.
Linee in ingresso / uscita & linee solo in ricezione [PBX => PBX Configuration => Outbound Routes]
Essendo questo Gateway in grado di di trattare ogni singola FXO a se come trunk potrete scegliere se fare in modo che una linea sia utilizzata per le chiamate in uscita semplicemente inserendola o meno tra le rotte in uscita, in caso contrario avremo a che fare con delle linee solo in ingresso.
Ringraziamenti
La configurazione di questo oggetto può risultare complessa per alcune ragioni, innanzi tutto abbiamo a che fare con un argomento che richiede un minimo di conoscenza del funzionamento elettrico della rete telefonica italiana, ma grazie all'ottimo post di Bruno Salzano (http://centralino-voip.brunosalzano.com) la cosa divene molto più agevole, visto che ci riporta tutti i settaggi in modo rapido e conciso.
Links
http://www.grandstream.com/support/gxw_series/gxw410x/gxw410x_support.html
http://www.grandstream.com/firmware.html#note17
http://www.voip-info.org/wiki/view/Grandstream+GXW-4104
http://centralino-voip.brunosalzano.com/configurazione-grandstream-gxw-4104
http://www.trixbox.org/forums/vendor-forums-non-certified/grandstream/setup-gxw-4104
<h2>Edit SIP Trunk</h2> <p><a href="/config.php?display=trunks&extdisplay=OUT_14&action=deltrunk"><span><img width="16" height="16" border="0" src="/images/core_delete.png" alt="" title="Delete Trunk gxw1"> Delete Trunk gxw1</span></a></p>
<a class="info" href="javascript:void(null)"> In use by 1 route<span>Route <b>003-gxw4104-1</b>: Sequence <b>1</b><br></span></a>
<form onsubmit="return trunkEdit_onsubmit('edittrunk');" method="post" action="config.php" name="trunkEdit">
<input type="hidden" value="trunks" name="display">
<input type="hidden" value="OUT_14" name="extdisplay">
<input type="hidden" value="" name="action">
<input type="hidden" value="sip" name="tech">
<table>
<tbody><tr>
<td colspan="2">
<h4>General Settings</h4>
</td>
</tr>
<tr>
<td>
<a class="info" href="javascript:void(null)">Outbound Caller ID<span><br>Caller ID for calls placed out on this trunk<br><br>Format: <b>"caller name" <#######></b>. You can also use the magic string 'hidden' to hide the CallerID sent out over Digital lines ONLY (E1/T1/J1/BRI/SIP/IAX)<br><br></span></a>:
</td><td>
<input type="text" tabindex="1" value="12345678" name="outcid" size="20">
</td>
</tr>
<tr>
<td>
<a class="info" href="javascript:void(null)">Never Override CallerID<span><br>Some VoIP providers will drop the call if you try to send an invalid CallerID (one you don't 'own.' Use this to never send a CallerID that you haven't explicitly specified in this trunk or in the outbound callerid field of an extension/user. You might notice this problem if you discover that Follow-Me or RingGroups with external numbers don't work properly. Checking this box has the effect of disabling 'foreign' callerids from going out this trunk. You must define an Outbound Caller ID on the this trunk when checking this.<br><br></span></a>:
</td><td>
<input type="checkbox" tabindex="2" name="keepcid">
</td>
</tr><tr>
<td>
<a class="info" href="javascript:void(null)">Maximum Channels<span>Controls the maximum number of outbound channels (simultaneous calls) that can be used on this trunk. To count inbound calls against this maximum, use the auto-generated context: from-trunk-sip-gxw1 as the inbound trunk's context. (see extensions_additional.conf) Leave blank to specify no maximum.</span></a>:
</td><td>
<input type="text" tabindex="3" value="" name="maxchans" size="3">
</td>
</tr>
<tr>
<td><a href="javascript:void(null)" class="info">Disable Trunk<span>Check this to disable this trunk in all routes where it is used.</span></a>:
</td>
<td>
<input type="checkbox" onclick="disable_verify(disabletrunk); return true;" id="disabletrunk" name="disabletrunk" tabindex="4"><small>Disable</small>
</td>
</tr>
<tr>
<td><a href="javascript:void(null)" class="info">Monitor Trunk Failures<span>If checked, supply the name of a custom AGI Script that will be called to report, log, email or otherwise take some action on trunk failures that are not caused by either NOANSWER or CANCEL.</span></a>:
</td>
<td>
<input type="text" value="" name="failtrunk" size="20" style="background: rgb(221, 221, 221) none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" disabled="">
<input type="checkbox" onclick="disable_field(failtrunk,failtrunk_enable); return true;" value="1" id="failtrunk_enable" name="failtrunk_enable" tabindex="5"><small>Enable</small>
</td>
</tr>
<tr>
<td colspan="2">
<h4>Outgoing Dial Rules</h4>
</td>
</tr>
<tr>
<td valign="top">
<a class="info" href="javascript:void(null)">Dial Rules<span>A Dial Rule controls how calls will be dialed on this trunk. It can be used to add or remove prefixes. Numbers that don't match any patterns defined here will be dialed as-is. Note that a pattern without a + or | (to add or remove a prefix) will not make any changes but will create a match. Only the first matched rule will be executed and the remaining rules will not be acted on.<br><br><b>Rules:</b><br>
<strong>X</strong> matches any digit from 0-9<br>
<strong>Z</strong> matches any digit from 1-9<br>
<strong>N</strong> matches any digit from 2-9<br>
<strong>[1237-9]</strong> matches any digit or letter in the brackets (in this example, 1,2,3,7,8,9)<br>
<strong>.</strong> wildcard, matches one or more characters (not allowed before a | or +)<br>
<strong>|</strong> removes a dialing prefix from the number (for example, 613|NXXXXXX would match when some dialed "6135551234" but would only pass "5551234" to the trunk) <strong>+</strong> adds a dialing prefix from the number (for example, 1613+NXXXXXX would match when some dialed "5551234" and would pass "16135551234" to the trunk)<br><br>
You can also use both + and |, for example: 01+0|1ZXXXXXXXXX would match "016065551234" and dial it as "0116065551234" Note that the order does not matter, eg. 0|01+1ZXXXXXXXXX does the same thing. </span></a>:
</td><td valign="top">
<textarea name="dialrules" rows="5" tabindex="6" cols="20" id="dialrules">!X</textarea><br>
<input type="submit" tabindex="7" value="Clean & Remove duplicates" style="font-size: 10px;">
</td>
</tr>
<tr>
<td>
<a class="info" href="javascript:void(null)">Dial Rules Wizards<span>
<strong>Always dial with prefix</strong> is useful for VoIP trunks, where if a number is dialed as "5551234", it can be converted to "16135551234".<br>
<strong>Remove prefix from local numbers</strong> is useful for ZAP trunks, where if a local number is dialed as "6135551234", it can be converted to "555-1234".<br>
<strong>Lookup numbers for local trunk</strong> This looks up your local number on www.localcallingguide.com (NA-only), and sets up so you can dial either 7 or 10 digits (regardless of what your PSTN is) on a local trunk (where you have to dial 1+area code for long distance, but only 5551234 (7-digit dialing) or 6135551234 (10-digit dialing) for local calls<br>
</span></a>:
</td><td valign="top"><select onchange="changeAutoPop(); " name="autopop" tabindex="8" id="autopop">
<option selected="" value="">(pick one)</option>
<option value="always">Always dial with prefix</option>
<option value="remove">Remove prefix from local numbers</option>
<option value="lookup7">Lookup numbers for local trunk (7-digit dialing)</option>
<option value="lookup10">Lookup numbers for local trunk (10-digit dialing)</option>
</select>
</td>
</tr>
<input type="hidden" name="npanxx" id="npanxx">
<script language="javascript">
function disable_field(field, field_enable) {
if (field_enable.checked) {
field.style.backgroundColor = '#FFF';
field.disabled = false;
}
else {
field.style.backgroundColor = '#DDD';
field.disabled = true;
}
}
function disable_verify(field) {
if (field.checked) {
var answer=confirm("Are you sure you want to disable this trunk in all routes it is used?");
if (!answer) {
field.checked = false;
}
} else {
alert("You have enabled this trunk in all routes it is used");
}
}
function populateLookup(digits) {
//var npanxx = prompt("What is your areacode + prefix (NPA-NXX)?", document.getElementById('areacode').value);
do {
var npanxx = prompt("What is your areacode + prefix (NPA-NXX)?\n\n(Note: this database contains North American numbers only, and is not guaranteed to be 100% accurate. You will still have the option of modifying results.)\n\nThis may take a few seconds.");
if (npanxx == null) return;
} while (!npanxx.match("^[2-9][0-9][0-9][-]?[2-9][0-9][0-9]$") && !alert("Invalid NPA-NXX. Must be of the format \'NXX-NXX\'"));
document.getElementById('npanxx').value = npanxx;
if (digits == 10) {
document.trunkEdit.action.value = "populatenpanxx10";
} else {
document.trunkEdit.action.value = "populatenpanxx7";
}
document.trunkEdit.submit();
}
function populateAlwaysAdd() {
do {
var localpattern = prompt("What is the local dialing pattern?\n\n(ie. NXXNXXXXXX for US/CAN 10-digit dialing, NXXXXXX for 7-digit)","NXXXXXX");
if (localpattern == null) return;
} while (!localpattern.match('^[0-9#*ZXN\.]+$') && !alert("Invalid pattern. Only 0-9, #, *, Z, N, X and . are allowed."));
do {
var localprefix = prompt("What prefix should be added to the dialing pattern?\n\n(ie. for US/CAN, 1+areacode, ie, \'1613\')?");
if (localprefix == null) return;
} while (!localprefix.match('^[0-9#*]+$') && !alert("Invalid prefix. Only dialable characters (0-9, #, and *) are allowed."));
dialrules = document.getElementById('dialrules');
if (dialrules.value[dialrules.value.length-1] != '\n') {
dialrules.value = dialrules.value + '\n';
}
dialrules.value = dialrules.value + localprefix + '+' + localpattern + '\n';
}
function populateRemove() {
do {
var localprefix = prompt("What prefix should be removed from the number?\n\n(ie. for US/CAN, 1+areacode, ie, \'1613\')");
if (localprefix == null) return;
} while (!localprefix.match('^[0-9#*ZXN\.]+$') && !alert("Invalid prefix. Only 0-9, #, *, Z, N, and X are allowed."));
do {
var localpattern = prompt("What is the dialing pattern for local numbers after "+localprefix+"? \n\n(ie. NXXNXXXXXX for US/CAN 10-digit dialing, NXXXXXX for 7-digit)","NXXXXXX");
if (localpattern == null) return;
} while (!localpattern.match('^[0-9#*ZXN\.]+$') && !alert("Invalid pattern. Only 0-9, #, *, Z, N, X and . are allowed."));
dialrules = document.getElementById('dialrules');
if (dialrules.value[dialrules.value.length-1] != '\n') {
dialrules.value = dialrules.value + '\n';
}
dialrules.value = dialrules.value + localprefix + '|' + localpattern + '\n';
}
function changeAutoPop() {
switch(document.getElementById('autopop').value) {
case "always":
populateAlwaysAdd();
break;
case "remove":
populateRemove();
break;
case "lookup7":
populateLookup(7);
break;
case "lookup10":
populateLookup(10);
break;
}
document.getElementById('autopop').value = '';
}
</script>
<tr>
<td>
<a class="info" href="javascript:void(null)">Outbound Dial Prefix<span>The outbound dialing prefix is used to prefix a dialing string to all outbound calls placed on this trunk. For example, if this trunk is behind another PBX or is a Centrex line, then you would put 9 here to access an outbound line. Another common use is to prefix calls with 'w' on a POTS line that need time to obtain dial tone to avoid eating digits.<br><br>Most users should leave this option blank.</span></a>:
</td><td>
<input type="text" tabindex="9" value="991" name="dialoutprefix" size="8">
</td>
</tr>
<tr>
<td colspan="2">
<h4>Outgoing Settings</h4>
</td>
</tr>
<tr>
<td>
<a class="info" href="javascript:void(null)">Trunk Name<span><br>Give this trunk a unique name. Example: myiaxtel<br><br></span></a>:
</td><td>
<input type="text" tabindex="10" value="gxw1" name="channelid" size="14">
</td>
</tr>
<tr>
<td colspan="2">
<a class="info" href="javascript:void(null)">PEER Details<span><br>Modify the default PEER connection parameters for your VoIP provider.<br><br>You may need to add to the default lines listed below, depending on your provider.<br><br>WARNING: Order is important as it will be retained. For example, if you use the "allow/deny" directives make sure deny comes first.<br><br></span></a>:
</td>
</tr>
<tr>
<td colspan="2">
<textarea tabindex="11" name="peerdetails" cols="40" rows="10">host=192.168.2.248
dtmfmode=rfc2833
insecure=port
type=peer
disallow=all
allow=g729
</textarea>
</td>
</tr>
<tr>
<td colspan="2">
<h4>Incoming Settings</h4>
</td>
</tr>
<tr>
<td>
<a class="info" href="javascript:void(null)">USER Context<span><br>This is most often the account name or number your provider expects.<br><br>This USER Context will be used to define the below user details.</span></a>:
</td><td>
<input type="text" tabindex="12" value="123456" name="usercontext" size="14">
</td>
</tr>
<tr>
<td colspan="2">
<a class="info" href="javascript:void(null)">USER Details<span><br>Modify the default USER connection parameters for your VoIP provider.<br><br>You may need to add to the default lines listed below, depending on your provider..<br><br>WARNING: Order is important as it will be retained. For example, if you use the "allow/deny" directives make sure deny
comes first.<br><br></span></a>:
</td>
</tr>
<tr>
<td colspan="2">
<textarea tabindex="13" name="userconfig" cols="40" rows="10">username=101
secret=wBgR1.2o
type=user
context=from-trunk
disallow=all
allow=g729
host=192.168.254.106
</textarea>
</td>
</tr>
<tr>
<td colspan="2">
<h4>Registration</h4>
</td>
</tr>
<tr>
<td colspan="2">
<a class="info" href="javascript:void(null)">Register String<span><br>Most VoIP providers require your system to REGISTER with theirs. Enter the registration line here.<br><br>example:<br><br>username: Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo. .<br><br>Many providers will require you to provide a DID number, ex: username: Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo. /didnumber in order for any DID matching to work.<br><br></span></a>:
</td>
</tr>
<tr>
<td colspan="2">
<input type="text" tabindex="14" value="" name="register" size="40">
</td>
</tr>
<tr>
<td colspan="2">
<h6><input type="submit" tabindex="15" value="Submit Changes" name="Submit"></h6>
</td>
</tr>
</tbody></table>
<script language="javascript">
<!--
var theForm = document.trunkEdit;
theForm.outcid.focus();
function trunkEdit_onsubmit(act) {
var msgInvalidOutboundCID = "Invalid Outbound Caller ID";
var msgInvalidMaxChans = "Invalid Maximum Channels";
var msgInvalidDialRules = "Invalid Dial Rules";
var msgInvalidOutboundDialPrefix = "Invalid Outbound Dial Prefix";
var msgInvalidTrunkName = "Invalid Trunk Name entered";
var msgInvalidChannelName = "Invalid Custom Dial String entered";
var msgInvalidTrunkAndUserSame = "Trunk Name and User Context cannot be set to the same value";
var msgConfirmBlankContext = "User Context was left blank and User Details will not be saved!";
var msgNeverOverrideCIDValue = "You must define an Outbound Caller ID when Choosing Never Override CallerID";
defaultEmptyOK = true;
if (theForm.keepcid.checked && isEmpty($.trim(theForm.outcid.value)))
return warnInvalid(theForm.outcid, msgNeverOverrideCIDValue);
if (!isCallerID(theForm.outcid.value))
return warnInvalid(theForm.outcid, msgInvalidOutboundCID);
if (!isInteger(theForm.maxchans.value))
return warnInvalid(theForm.maxchans, msgInvalidMaxChans);
if (!isDialrule(theForm.dialrules.value))
return warnInvalid(theForm.dialrules, msgInvalidDialRules);
if (!isDialIdentifierSpecial(theForm.dialoutprefix.value))
return warnInvalid(theForm.dialoutprefix, msgInvalidOutboundDialPrefix);
defaultEmptyOK = true;
if (isEmpty(theForm.channelid.value) || isWhitespace(theForm.channelid.value))
return warnInvalid(theForm.channelid, msgInvalidTrunkName);
if (theForm.channelid.value == theForm.usercontext.value)
return warnInvalid(theForm.usercontext, msgInvalidTrunkAndUserSame);
if ((isEmpty(theForm.usercontext.value) || isWhitespace(theForm.usercontext.value)) &&
(!isEmpty(theForm.userconfig.value) && !isWhitespace(theForm.userconfig.value)) &&
(theForm.userconfig.value != "secret=***password***\ntype=user\ncontext=from-trunk")) {
if (confirm(msgConfirmBlankContext) == false)
return false;
}
theForm.action.value = act;
return true;
}
function isDialIdentifierSpecial(s) { // special chars allowed in dial prefix (e.g. fwdOUT)
var i;
if (isEmpty(s))
if (isDialIdentifierSpecial.arguments.length == 1) return defaultEmptyOK;
else return (isDialIdentifierSpecial.arguments[1] == true);
for (i = 0; i < s.length; i++)
{
var c = s.charAt(i);
if ( !isDialDigitChar(c) && (c != "w") && (c != "W") && (c != "q") && (c != "Q") && (c != "+") ) return false;
}
return true;
}
//-->
</script>
</form>
</div>
Ultimo aggiornamento (Martedì 19 Aprile 2011 14:40)
