Sei sulla pagina 1di 6

Configurar telefonos Grandstream con Elastix con tftpboot

Reemplazamos el contenido de /tftpboot/GS_CFG_GEN/bin/encode.sh con:


#!/bin/bash

JAVA_HOME=/opt/openfire/jre
GAPSLITE_HOME=/tftpboot/GS_CFG_GEN

# Do NOT modify below this line


LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:$GAPSLITE_HOME/lib/`uname
-m`
export LD_LIBRARY_PATH

$JAVA_HOME/bin/java -classpath $GAPSLITE_HOME/lib/gapslite.jar:


$GAPSLITE_HOME/lib/bcprov-jdk14-124.jar:$GAPSLITE_HOME/config
com.grandstream.cmd.TextEncoder $*

Buscamos en /var/www/html/modules/endpoint_configuration/libs/paloSantoFileEndPoint.class.php :

exec("/tftpboot/GS_CFG_GEN/bin/encode.sh {$ArrayData['data']['filename']}
/tftpboot/gxp{$ArrayData['data']['filename']}.cfg
/tftpboot/cfg{$ArrayData['data']['filename']}.cfg",$arrConsole,
$flagStatus);
Y lo reemplazamos con:

exec("/tftpboot/GS_CFG_GEN/bin/encode.sh {$ArrayData['data']['filename']}
/tftpboot/gxp{$ArrayData['data']['filename']}.cfg
/tftpboot/cfg{$ArrayData['data']['filename']}",$arrConsole,$flagStatus);
Despus de estas modificaciones el mdulo podr crear y guardar los archivos que el telfono requiere
para que funcione en nuestra implementacin.
Lo primero que necesitaremos es descargar el firmware, paquete de lenguaje castellano y tonos de
timbre para el modelo de telfono GXP280/GXP2000 (el mismo firmware sirve para ambos telfonos):
cd /tftpboot
wget
http://www.grandstream.com/firmware/BT200_GXP/Release_BT200_GXP_1.2.5.3.z
ip
unzip Release_BT200_GXP_1.2.2.26.zip
wget http://www.grandstream.com/firmware/BT200_GXP/GXP_Language_Pack.zip
unzip GXP_Language_Pack.zip
unzip Spanish.zip
wget http://www.grandstream.com/firmware/BT200_GXP/RingTone.zip
unzip RingTone.zip
El modulo de provisionamiento no muestra en sus opciones el modelo GXP280, podemos agregarlo con
el siguiente procedimiento:
sqlite3 /var/www/db/endpoint.db
sqlite> insert into model values(50,'GXP280','GXP280',3);
sqlite> insert into model values(51,'BT200','BT200',3);
sqlite> .exit
Reemplazamos la plantilla que esta ubicada en
/var/www/html/modules/endpoint_configuration/libs/vendors/Grandstream.cfg.php :

<?php/*
PrincipalFileGrandstream nos retorna el contenido del archivo de
configuracion de los EndPoint
Grandstream, para ello es necesario enviarle el DisplayName,
id_device, secret, ipAdressServer
*/function PrincipalFileGrandstream($DisplayName, $id_device, $secret,
$ipAdressServer)
{
$content="
# Clave de administracion del dispositivo
# Recuerden cambiarla por una contrasea mas segura
P2 = verysecurepassword

# Nombre de la cuenta
P270 = $id_device

# Servidor SIP
P47 = $ipAdressServer

# Proxy SIP
P48 = $ipAdressServer

# SIP User ID
P35 = $id_device

# Authenticate ID
P36 = $id_device

# Authenticate password
P34 = $secret

# Nombre a mostrar en la pantalla del telefono


P3 = $DisplayName

# Soporte DHCP. 0 - si, 1 - no


P8 = 0

# Tonos utilizados en Ecuador


# Dial Tone
P343 = f1=425,f2=425;

# Busy Tone
P348 = f1=425,f2=425,c=33/33;

# Send DTMF. 8 - in audio, 1 - via RTP, 2 - via SIP INFO


# 11 - In Audio & RTP & SIP INFO, 9 - In Audio & RTP
# 10 - IN Audio & SIP INFO, 3 - RTP & SIP INFO
P73 = 1
# Ringtone 1
P105 = ring1.bin

# Display Language. 0 - English, 3 - Secondary Language, 2 - Chinese


P342 = 2

# language file postfix


P399 = Spanish

# NTP Server
P30 = $ipAdressServer

# Enable Call Features. 0 - no, 1 - yes


P191 = 0

# Account Ring Tone. 0 - system ring tone, 1 - custom ring tone 1, 2 -


custom ring tone 2
# 3 - custom ring tone 3.
P104 = 3

# Display CID instead of Name. 0 - no, 1 - yes


# GXP280 only
P1344 = 0

# SIP User ID is phone number. 0 - no, 1 - yes


P63 = 1

# SIP Registration. 0 - no, 1 - yes


P31 = 1

# Unregister On Reboot. 0 - no, 1 - yes


P81 = 1

# Register Expiration (in minutes. default 1 hour, max 45 days)


P1812 = 60

# Lock Keypad Update. 0 - no, 1 - yes


P88 = 1

# Firmware Upgrade. 0 - TFTP Upgrade, 1 - HTTP Upgrade.


P212 = 0

# Firmware Server Path


P192 = $ipAdressServer

# Config Server Path


P237 = $ipAdressServer

# Automatic Upgrade. 0 - No, 1 - Yes. Default is No.


P194 = 0

# Check for new firmware every () minutes, unit is in minute, minimnu 60


minutes, default is 7 days.
P193 = 10080

# Use firmware pre/postfix to determine if f/w is required


# 0 = Always Check for New Firmware
# 1 = Check New Firmware only when F/W pre/suffix changes
# 2 = Always Skip the Firmware Check
P238 = 1

#----------------------------------------
# XML Phonebook
#----------------------------------------
# Enable Phonebook XML Download
# 0 = No
# 1 = YES, HTTP
# 2 = YES, TFTP
P330 = 2

# Phonebook XML Server Path


P331 = $ipAdressServer

# Phonebook Download Interval


# This is an integer variable in hours.
# Valid value range is 0-720 (default 0), and greater values will default
to 720
P332 = 12

# Remove Manually-edited entries on Download


# 0 - No, 1 - Yes, other values ignored
P333 = 0";

return $content;
}

function templatesFileGrandstream($ipAdressServer)
{
$content= <<<TEMP# SIP Server
P47 = $ipAdressServer

# Outbound Proxy
P48 = $ipAdressServer

# SIP User ID
P35 = 8000

# Authenticate ID
P36 = 8000

# Authenticate password
P34 = 0000

# Display Name (John Doe)


P3 =

# DHCP support. 0 - yes, 1 - no


P8 = 1TEMP;
return $content;
}?>
Para habilitar la libreta de direcciones, se debe crear el siguiente archivo /tftpboot/gs_phonebook.php :

<?php
// File: gs_phonebook.php
// version: 1.0
// Date: 07-17-2006
// Author: Shane Steinbeck http://www.steinbeckconsulting.com
// Description: Realtime XML phonebook from MySQL database for
Grandstream GXP-2000 firmware 1.1.1.17
// Modified by Guillermo Salas <gsalas@mantareys.com> to use the FreePBX
database to show the name and
// extension number.
header("Content-type: text/xml");
$host = "localhost";$user = "root";$pass = "eLaStIx.2oo7";$database =
"asterisk";
$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to
host.");mysql_select_db($database, $linkID) or die("Could not find
database.");
$query = "SELECT user, description FROM devices ORDER BY description
ASC";
$resultID = mysql_query($query, $linkID) or die("Data not found.");

$xml_output = "<?xml version=\"1.0\"?>\n";


$xml_output .= "<AddressBook>\n";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= "\t<Contact>\n";
$xml_output .= "\t\t<LastName>" . $row['description'] . "</LastName>\n";
$xml_output .= "\t\t<FirstName></FirstName>\n";
$xml_output .= "\t\t\t<Phone>\n\t\t\t\t<phonenumber>" . $row['user'] .
"</phonenumber>\n";
$xml_output .= "\t\t\t\t<accountindex>0</accountindex>\n";

$xml_output .= "\t\t\t</Phone>\n";
$xml_output .= "\t</Contact>\n";
}

$xml_output .= "</AddressBook>";

/************************************************************************
***************

* Author: Mike
* Date: 10/03/2006
* This snipplet will save your xml file to the server for easier
updating of your phone.
* To facilitate automatic updates, add a cron job to run this file at
your desired interval (i.e. hourly).
*/

$filename = "/tftpboot/gs_phonebook.xml";
$fp = fopen($filename, 'wb');
fwrite($fp, $xml_output);
fclose($fp);

/************************************************************************
**************/

print($xml_output);
echo $xml_output;

?>

Creamos una tarea programada para mantener el archivo de direcciones actualizado:

vi /etc/cron.daily/gs_phonebook

/usr/bin/php /tftpboot/gs_phonebook.php

Potrebbero piacerti anche