Custom APP pickup asterisk 11

Aquí tenemos otra entrada, que ha sido un marrón con todas las de la ley.

Asterisk es un producto que me encanta, pero a medida que crece en volumen, su comportamiento es “errático”…. es decir, a medida que crece en extensiones / usuarios o intentas hacer algo “multitenant”, te vas llevando sorpresa tras sorpresa, pero durante el camino a migrar a otra solución, tienes que ir parcheando y salir del paso como puedas.

También he de decir que, me desagrada muchísimo los paneles tipo freepbx / elastix y derivados, ya que limitan muchísimo sus funcionalidades.

Estos días, me pasó que tenía que habilitar en una empresa, más de 64 grupos de pickup a “ciegas” y corregir que el default del “features” se comporta de manera errática; intentas capturar una extensión de tu grupo y, en función de las alineaciones estelares, posición de la luna o si pasa algún cometa cerca, acabas capturando algo que no toca y, “capturas” también el cabreo del cliente.

En esta pbx, tengo dividida las extensiones de la siguiente manera:

Compras:
200
201
202
203
204
205
..
220

Facturación:
230
231
232
233
234
235
236
..
250

Contabilidad:
260
261
262
263

Formación:
270
271
272
273

y así un número ‘N’ de departamentos.

me hice una BBDD con ello, tipo

tabla: extensionesempresa
id | extension | departamento
-----------------------------
1 200 compras
2 201 compras
3 202 compras
4 203 compras
5 204 compras
..
40 320 administracion
41 321 administracion
..
..
N

Luego en el func_odbc, la consulta

[uverdepartamento]
dsn=asterisk
readsql=select departamento from extensionesempresa where extension='${ARG1}'

[ucontarextensiones]
dsn=asterisk
readsql=select count(extension),extension from extensionesempresa where departamento='${ARG1}'


Y ahora el código de app_pickup custom

[app_pickup]
exten => _*8,1,NoOP(.... custom pickup ..........)
exten => _*8,n,Set(empresa=${ODBC_uverdepartamento(${CALLERID(num)})})
exten => _*8,n,NoOP(... la empresa es ${empresa} ...........)
exten => _*8,n,Set(HASH(uno)=${ODBC_ucontarextensiones(${empresa})})
exten => _*8,n,NoOP( ${HASH(uno)} )
exten => _*8,n,Set(variable=${HASH(uno)})
exten => _*8,n,Set(exteninicial=${CUT(variable,\,,1)})
exten => _*8,n,Set(numextensions=${CUT(variable,\,,2)})
exten => _*8,n,NoOP(.... ${exteninicial} ${numextensiones} ...... )
exten => _*8,n,NoOP(.... bucle while ..............................)
exten => _*8,n,Set(contador=1)
exten => _*8,n,Set(extenIni=${exteninicial})
exten => _*8,n,While($[${contador} < ${numextensions}]) exten => _*8,n,NoOP(extenIni: ${extenIni} contador: ${contador} ...)
exten => _*8,n,GotoIf($["${DEVICE_STATE(SIP/${extenIni})}"="RINGING"]?pickup)
exten => _*8,n,Set(extenIni=$[${extenIni} + 1])
exten => _*8,n,Set(contador=$[${contador} + 1])
exten => _*8,n,EndWhile
exten => _*8,n(pickup),NoOP(.... hacemos el pickup a ${extenIni}........)
exten => _*8,n(pickup),Set(PICKUPMARK=${extenIni})
exten => _*8,n(pickup),Set(GLOBAL(PICKUPMARK)=${extenIni})
exten => _*8,n(pickup),PickupChan(SIP/${extenIni})
exten => _*8,n,Hangup

En la primera parte, sacamos el departamento:

exten => _*8,1,NoOP(.... custom pickup ..........)
exten => _*8,n,Set(empresa=${ODBC_uverdepartamento(${CALLERID(num)})})
exten => _*8,n,NoOP(... la empresa es ${empresa} ...........)

Luego sacamos la extensión inicial y contamos las extensiones que tiene el departamento:

exten => _*8,n,Set(HASH(uno)=${ODBC_ucontarextensiones(${empresa})})
exten => _*8,n,NoOP( ${HASH(uno)} )
exten => _*8,n,Set(variable=${HASH(uno)})
exten => _*8,n,Set(exteninicial=${CUT(variable,\,,1)})
exten => _*8,n,Set(numextensions=${CUT(variable,\,,2)})

Con el While hacemos el bucle y miramos si la extensión está en “RINGINNG” mediante la función “devstate”… si es así, usamos la función PickupChan.

Y ya la tenemos funcionando 😉

VoIP jazztel ftth y asterisk pjsip

En esta ocasión, registraremos nuestro servicio de VoIP de fibra Jazztel en nuestro asterisk.

Requisitos:

1º) Capturar el proceso de register del router de jazztel contra sus SBC. Para ello, mediante un hub colocado entre el router y la ONT, colocaremos nuestro pc capturando el paquete deseado.

En las capturas, deberás ver un paquete tal que:


Via: SIP/2.0/UDP x.x.x.x:5060;branch=asdfgsdfgsdfgsdfgsd
To:
From: ;tag=d2derwerqwer19-f45ffrr
Call-ID: xxxxxxxxxxx-xxxxxxxxx@x.x.x.x
CSeq: 46360 REGISTER
Contact:
Authorization: Digest username="misuperusuario007@ims.jazztel.net",realm="ims.jazztel.net",nonce="elsuperNonce",uri="sip:ims.jazztel.net",response="idRespuestaasfasdfasdfwererer",algorithm=MD5,cnonce="sdferelcenoncd",qop=auth,nc=00000001
Expires: 3600
Max-Forwards: 70
Supported: 100rel
User-Agent: ZXHN H218N/V2.0.0_JAZZT7
Content-Length: 0

En vez de las ‘x’, saldrán tus valores xDDD; no preguntes

2º) HTTPBrute, que nos servirá para sacar el password con el paquete SIP.

Pantallazo

Rellena cada casilla con lo que toca…. es bastante clarito todo. Le das a crack y calculate y te esperas unas horas (en mi caso)

3º) Asterisk 12 o 13 con pjSip. Yo en mi caso tengo una 12 con poca ram y cpu.

La versión 12 o 13 tiene su razón bastante obvia…… Para poder hacer una llamada, tienes que tener activada la opción 100rel…. en el chan_sip de asterisk, esta opción no está, pero en pjsip si, así que ya sabéis.

El user-agent, debe ser igual al que os proponga el router.

4º) Configuración del pjsip.conf

[global]
user_agent=ZXHN H298N/V1.1.4_JAZZT15

[endpoint]
100rel=yes --> Importante definir el endpoint con el 100rel=yes
sdp_session=ZXHN H298N/V1.1.4_JAZZT15

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.0.0/16 --> tu red local
local_net=127.0.0.1/32

[Jazztel]
type=registration
transport=transport-udp
outbound_auth=Jazztel
server_uri=sip:212.106.212.22:5060
client_uri=sip:+349xxxxxxxx@ims.jazztel.net --> tu número de teléfono con el +34
retry_interval=60
expiration=3600
support_path=yes

[Jazztel]
type=auth
auth_type=userpass
password=PasswordQueHayasCalculado
username=tuUsuari0DeJazttel@ims.jazztel.net
realm=ims.jazztel.net

[Jazztel]
type=aor
contact=sip:ip.del.sbc.jazztel:5060

[Jazztel]
type=endpoint
transport=transport-udp
context=Tu_Contexto_De_Llamadas_Entrantes
disallow=all
allow=alaw
allow=ulaw
allow=gsm
allow=g729
outbound_auth=Jazztel
aors=Jazztel
from_user=+349xxxxxxxx --> tu número de teléfono de jazztel
from_domain=ims.jazztel.net
aors=Jazztel
direct_media=no

[Jazztel]
type=identify
endpoint=Jazztel
match=ip.del.sbc.de.jazztel

Y a partir de aquí…. enjoy your VoIP FTTH Service 😉

VoIP movistar fibra y asterisk

Esta vez, configuraremos la voip de movistar en nuestro asterisk.

Movistar, con la fibra, nos ofrece un servicio VoIP vía la ONT….. si nos conformamos con usarlo tal cual, pues perfecto, pero si tenemos en la oficina o en casa un asterisk, la mejor manera de aprovecharlo, es configurar la voIP en nuestra PBX sin necesidad de usar conversores.

Partimos que tenemos la vlan 3 configurada en nuestro router y obtenemos la IP por DHCP (una 10.x.x.x)

usuario : NúmeroDeTeléfono
password: NúmeroDeTeléfono
proxy : 10.31.255.134
puerto : 5070

los datos del proxy, si googleamos un poco se pueden obtener, pero la configuración no…..

Primero de todo, necesitamos la cadena del register para el sip.conf


register => 9xxxxxxxx@telefonica.net:9xxxxxxxx@10.31.255.134:5070/9xxxxxxxx

Y ahora la definición del peer:

[VOMISTAR]
type =peer
fromuser=9XXXXXXXX
secret =9XXXXXXXX
fromdomain=telefonica.net
host =telefonica.net
callerid = "" <9XXXXXXXX>
outboundproxy=10.31.255.134:5070
port =5070
nat =force_rport,comedia
insecure=port,invite
dtmfmode=auto
disallow=all
allow =ulaw
allow =alaw
context =llamadas_entrantes

Una vez hecho ésto y con el correspondiente reload……. al hacer un sip show registry:


processpbx*CLI> sip show registry
Host dnsmgr Username Refresh State Reg.Time
10.31.255.134:5070 N 9xxxxxxxx@te 55 Registered Wed, 24 Jun 2015 23:09:28
1 SIP registrations.

A partir de aquí, ya es cosa nuestra con el diaplan !!!! enjoy your fiber 🙂

Añadir a inicio Flash Operator Panel, en debian

Una pequeña entrada, que me sirve para recordar cómo añadir al inicio de mi Debian, que autoarranque el Flash Operator Panel, aunque esto se aplique a cualquier cosa que queramos.

Primero, dentro del directorio /etc/init.d creamos el siguiente fichero, suponiendo que lo hayamos instalado en /etc/op_panel


root@pbx:/etc/init.d# nano operator_panel

Y le añadimos:

/etc/op_panel/op_server.pl -d

Nota: -d es para lanzarlo como daemon

Y ahora le damos los permisos de ejecución y lo añadimos:

root@pbx:/etc/init.d# chmod a+x operator_panel
root@pbx:/etc/init.d# update-rc.d operator_panel defaults

Y con ésto, ya lo tenemos todo. 😉

Cisco 7912 asterisk 1.x

Otra entrada que es un apunte.

Recientemente, ha caído en mis manos un cisco 7912 para jugar y, venía con firmware SCCP. En mi asterisk, sólo uso SIP, ya que todo el sistema lo tengo con ese protocolo… hasta las llamadas y el DDI.

Empezamos por pasar el teléfono de SCCP a SIP.

Para ello, bajamos el siguiente archivo: 7912.tar

Lo descomprimes en el tftp server y tenemos estos ficheros:

Parte1Sip

Creamos el fichero gkmac_address_telf.txt con el siguiente contenido:

#txt
# -----------------------------------------------------------------------------
# This file "gkdefault.txt" is provided as a convenience for upgrading the
# Cisco 7912G IP Phone with minimal effort.
#
# If changes are made to this file, you must run
#
# cfgfmt -tsip_ptag.dat gkdefault.txt gkdefault.cfg
#
# again to create a new profile and place it in the TFTP directory.
#
# If you plan to upgrade just one phone, you can copy gkdefault.cfg to
# gk, where is the MAC address of the target phone, such
# as gk001122334455.
#
# The phone will try to download gk first, then gkdefault.cfg
# if corresponding gk is not found on the TFTP server.
# -----------------------------------------------------------------------------

upgradecode:3,0x601,0x0400,0x0100,0.0.0.0,69,0x060111a,CP7912080000SIP060111A.sbin

# Set the GUI/Web config password to 1234; the password must NOT be 0
# (disabled) if configuring via the phone's web interface is desired.

UIPassword:1234

Guardamos cambios, reiniciamos el teléfono y esperamos a que se instale el firmware sip.

Una vez hecho ésto, volvemos a generar el fichero con los datos para registrarlo en nuestro asterisk…… los datos:

ip asterisk: 192.168.1.1
user:100
pass:100

Tendremos el fichero tal que:

#txt
# -----------------------------------------------------------------------------
# Example Profile for Cisco 7905G/7912G IP Phones (SIP)
# -----------------------------------------------------------------------------
#
# IMPORTANT: File must begin with "#txt" (without the quotes) for the
# formating tool (cfgfmt.exe) to treat it as a text file.
#
# NOTE: 1. A hash (#) at the beginning of the line is a comment. The
# formatting tool ignores any line beginning with the token.
#
# 2. All parameter/value pairs are OPTIONAL; however, they may be
# needed nevertheless for the phone to function properly
# if no prior value had been programmed.
#
# 3. Parameter values can be one of the following:
#
# a. Alphanumeric string
# Ex: SIP-4-Ever$#, 1234, #012-34la$!-
#
# b. Numeric digit string
# Ex: 593, 960135, 19690489
#
# c. Array of comma-separated short integer
# Ex: {395,65534,20,32768,105} (without brackets)
#
# d. IP address
# Ex: 192.168.2.170, 64.15.243.3
#
# e. Extended IP address -- IP address with Port
# Ex: 192.168.2.170.9001, 174.10.232.53.10364
#
# f. Boolean
# Ex: 0 or 1
#
# g. Bitmap value -- unsigned hex integer (32-bit)
# Ex: 0x00060400, 0x125f0431
#
# h. Integer (32-bit)
# Ex: 2147483647, 56, 65342
#
# ============================= UI Parameters =================================
# -----------------------------------------------------------------------------
# Parameter: UIPassword
#
# Type: Alphanumeric string (9 characters max)
#
# Description: Control access to the web page and some protected phone menus.
# If set to non-zero, then every access to the web page will
# require the value of UIPassword being entered.
#
# Default: 0 = Web interface is restricted to viewing of device
# information and network configuration and statistics.
# Parameter changes are not allowed via the web interface.

UIPassword:cisco

# ========================== Logo Upgrade Parameter ===========================
# -----------------------------------------------------------------------------
# Parameter: upgradelogo
#
# Description: Special parameter to provide information on how to upgrade the
# logo on the main LCD screen
#
# Syntax: upgradelogo:,,
#
# Options: image_id
# - A unique number that is logically associated with the logo
# file and must be incremented for each new logo upgrade;
# the factory logo is assigned '1'. Upgrading the firmware
# resets this value to '1'.
#
# tftp_ip_addr
# - TFTP server IP address where logo_filename is located
#
# logo_filename
# - Name of logo file
#
# Example: upgradelogo:4,192.168.3.105,logo.dat
#
# NOTE: The default values listed below will not trigger any upgrade.

#upgradelogo:0,0,none

# ===================== Network Configuration Parameters ======================
# -----------------------------------------------------------------------------
# Parameter: Dhcp
#
# Type: Boolean
#
# Options: 1 = Use DHCP to obtain IP, route, netmask, DNS, NTP, TFTP, etc.
# 0 = Don't use DHCP, instead use hard coded parameter values for
# IP, route, netmask, DNS, NTP, TFTP, etc.

dhcp:1

# ======================= SIP Configuration Parameters ========================
# -----------------------------------------------------------------------------
# Parameter: Proxy
#
# Type: Alphanumeric string (31 characters max)
#
# Description: IP address or domain name of SIP proxy server

Proxy:192.168.1.1

# -----------------------------------------------------------------------------
# Parameter: UID
#
# Type: Alphanumeric string (31 characters max)
#
# Description: User ID (i.e. phone number) for the line

UID:100

# -----------------------------------------------------------------------------
# Parameter: PWD
#
# Type: Alphanumeric string (31 characters max)
#
# Description: Password used for authentication

PWD:100

# -----------------------------------------------------------------------------
# Parameter: LoginID
#
# Type: Alphanumeric string (51 characters max)
#
# Description: User ID used for authentication, if different from UID.

LoginID:100

# -----------------------------------------------------------------------------
# Parameter: UseLoginID
#
# Type: Boolean
#
# Description: Indicate user ID to use for authentication
#
# Options: 0 = Use UID as user ID for authentication
# 1 = Use LoginID as user ID for authentication

UseLoginID:0

# -----------------------------------------------------------------------------
# Parameter: SIPPort
#
# Type: Integer (1 - 65535)
#
# Description: Port to listen for incoming SIP requests.
# The same port is used for sending outgoing SIP requests.

SIPPort:5060

# -----------------------------------------------------------------------------
# Parameter: SIPRegInterval
#
# Type: Integer (1 - 86400 seconds)
#
# Description: Interval between registration renewal

SIPRegInterval:3600

# -----------------------------------------------------------------------------
# Parameter: SIPRegOn
#
# Type: Boolean
#
# Description: Enable or disable SIP registration
#
# Options: 0 = Disable registration
# 1 = Enable registration

SIPRegOn:1

# -----------------------------------------------------------------------------
# Parameter: MAXRedirect
#
# Type: Integer (0 - 10)
#
# Description: Maximum number of times to try redirection
#
# Note: If set to greater than 10, default is 10 times.

MaxRedirect:5

# -----------------------------------------------------------------------------
# Parameter: OutBoundProxy
#
# Type: IP address or alphanumeric string (31 characters max)
#
# Description: Outbound proxy server that processes all outbound SIP requests.
# It can be an IP address with or without a port parameter such
# as 123.123.110.45, 123.123.110.45.5060, or 123.123.110.45:5061,
# or URL such as sip.cisco.com, sip.komodo.cisco.com:5061. For
# IP address, a '.' or ':' can be used to delimit a port
# parameter. For URL, a ':' must be used to delimit the port
# parameter.
#
# Note: If this parameter is configured, all SIP requests will be
# sent to this outbound proxy and then forwarded to the
# destination specified in the Request-URI of the SIP message.
# An outbound proxy may or may not be the same SIP proxy server.

OutBoundProxy:0

# -----------------------------------------------------------------------------
# Parameter: RxCodec
#
# Type: Integer (1 - 3)
#
# Description: Preferred receiving audio codec
#
# Options: 1 -- g711a
# 2 -- g711u
# 3 -- g729a

RxCodec:1

# -----------------------------------------------------------------------------
# Parameter: TxCodec
#
# Type: Integer (1 - 3)
#
# Description: Preferred transmitting audio codec
#
# Options: 1 -- g711a
# 2 -- g711u
# 3 -- g729a

TxCodec:3

# -----------------------------------------------------------------------------
# Parameter: MsgRetryLimits
#
# Type: Bitmap
#
# Description: Specify number of times SIP requests and final responses to
# INVITE request are retransmitted to the current SIP user agent.
#
# Options: Bit Values
# ----- --------------------------------------------------------
# 0-3 Number of times to retransmit SIP requests, except
# those listed below, and final response to INVITE
# Range: 0-15
# Default: 0 = NOTIFY retransmitted 6 times
# PRACK restransmitted 5 times
# Response to INVITE retransmitted 7 times
#
# 4-7 Number of times to retransmit REGISTER request
# Range: 0-15 Default: 0 (= 10 times)
#
# 8-11 Number of times to retransmit INVITE request
# Range: 0-15 Default: 0 (= 2 times)
#
# 12-15 Number of times to retransmit BYE request
# Range: 0-15 Default: 0 (= 4 times)
#
# 16-19 Number of times to retransmit CANCEL request
# Range: 0-15 Default: 0 (= 4 times)
#
# 20-23 Number of times to retransmit REFER request
# Range: 0-15 Default: 0 (= 5 times)
#
# 24-31 RESERVED

MsgRetryLimits:0x00000000

# ====================== Audio Configuration Parameters =======================
# -----------------------------------------------------------------------------
# Parameter: AudioMode
#
# Type: bitmap value
#
# Description: Used for controlling or fine-tuning certain audio features
#
# Options: Bit Values
# ----- --------------------------------------------------------
# 0 Silence Suppression
# 0 = Disable silence suppression
# *1 = Enable silence suppression
#
# 1-3 RESERVED. Must be set to 0.
#
# 4-5 DTMF Transmission Method
# 0 = Always inband
# *1 = Negotiated via SDP
# 2 = Always out-of-band
#
# 6-31 RESERVED. Must be set to 0.
#
# Defaults are marked with *.

AudioMode:0x00000011

# ------------------------------------------------------------------------
# Parameter: NumTxFrames
#
# Type: Integer (1 - 6)
#
# Description: Transmit frames per packet.
#
# Note: G.711 and G.729 frame sizes are 10 ms per frame.
#
# Cisco recommends that you use only the default value 2.

NumTxFrames:2

# ------------------------------------------------------------------------
# Parameter: ConnectMode
#
# Type: bitmap value
#
# Description: Connection mode of the protocol used
#
# Options: Bit Values
# ----- --------------------------------------------------------
# 0 Send INVITE requests (due to call forwarding, call
# transfer, etc.) to the URL specified in the
# corresponding header value, i.e. 302's Contact,
# Refer-To, etc.
#
# *0 = Disable. INVITE is sent via local proxy.
# 1 = Enable. INVITE is sent via specified URL.
#
# 1-3 RESERVED. Must be set to 0.
#
# 4 Include +sip.instance=... in REGISTER's Contact:
# 0 = Disable
# *1 = Enable
#
# 5-15 RESERVED. Must be set to 0.
#
# 16 Registration Removal Prior To Re-Registration
# *0 = Disable
# 1 = On power up, "Contact: *" is used to remove all
# registrations. On subsequent registration cycles,
# "Contact: ;expires=0" is used.
#
# 17 RESERVED. Must be set to 0.
#
# 18 SIP Proxy Type
# *0 = Standard or no SIP proxy
# 1 = Cisco Call Manager
#
# 19 IP Ringback and Early Media
# *0 = Do not send ringback tone to the caller
# 1 = Send ring back tone to the caller
#
# 20 Include "action=proxy" in REGISTER request
# *0 = Disable
# 1 = Enable
#
# 21 Include "action=redirect" in REGISTER request
# *0 = Disable
# 1 = Enable
#
# 22 Process "received=" tag in VIA header to automatically
# detect if phone is behind a NAT and use specified WAN IP
# *0 = Disable
# 1 = Enable
#
# 23 RESERVED. Must be set to 0.
#
# 24 Include RTP statistics in BYE and 200 response to BYE
# *0 = Disable
# 1 = Enable
#
# 25-31 RESERVED. Must be set to 0.
#
# Defaults are marked with *.
#
# Note: Setting both bits 20 & 21 is forbidden; setting both to 0
# causes the phone to not include the "action" parameter in
# the REGISTER request and leaves it up to the proxy server
# to decide what action to take.

ConnectMode:0x00000010

# -----------------------------------------------------------------------------
# Parameter: TimeZone
#
# Type: Integer (0 - 24)
#
# Description: Timezone offset from GMT for time-stamping incoming calls with
# the local time (for caller-id display, etc.)
#
# Use the following table to select the correct TimeZone value.
#
# 0 = GMT 9 = GMT + 9 18 = GMT - 7
# 1 = GMT + 1 10 = GMT + 10 19 = GMT - 6
# 2 = GMT + 2 11 = GMT + 11 20 = GMT - 5
# 3 = GMT + 3 12 = GMT + 12 21 = GMT - 4
# 4 = GMT + 4 13 = GMT - 12 22 = GMT - 3
# 5 = GMT + 5 14 = GMT - 11 23 = GMT - 2
# 6 = GMT + 6 15 = GMT - 10 24 = GMT - 1
# 7 = GMT + 7 16 = GMT - 9
# 8 = GMT + 8 17 = GMT - 8
#
# Type: Integer ( -720 thru -60, 60 thru 780)
#
# Description: Timezone offset (in minutes) from GMT used for cities/countries
# that fall on 30 and 45 minutes zones.
#
# Use the following table to select the correct TimeZone value.
#
# 210 = GMT + 3:30 Tehran
# 270 = GMT + 4:30 Kabul
# 330 = GMT + 5:30 Calcutta, Chennai, Mumbai, New Delhi
# 345 = GMT + 5:45 Kathmandu
# 390 = GMT + 6:30 Rangoon
# 570 = GMT + 9:30 Darwin, Adelaide
# -210 = GMT - 3:30 Newfoundland
#
# Formula for calculating TimeZone in Minutes:
# (#hr * 60min/hr) + #min = total #min
#
# Sample calculation for Darwin (GMT + 9:30):
# (9hr * 60min/hr) + 30min = 570min

TimeZone:1

# -----------------------------------------------------------------------------
# Parameter: NTPIP
#
# Type: IP address
#
# Description: NTP IP address. This is an OPTIONAL parameter; however, if
# this parameter value is not configured and the DHCP server
# does not provide the value, then the time and caller ID time
# information will be incorrect.

NTPIP:192.168.1.1

# -----------------------------------------------------------------------------
# Parameter: AltNTPIP
#
# Type: IP address
#
# Description: Alternate NTP IP address (if redundancy is desired)

AltNTPIP:130.206.3.166

# -----------------------------------------------------------------------------
# Parameter: UseTftp
#
# Type: Boolean
#
# Description: Indicate whether TFTP server is used for provisioning
#
# Options: 1 = Use TFTP for provisioning
# 0 = TFTP is not used for provisioning

UseTftp:1

# -----------------------------------------------------------------------------
# Parameter: TftpURL
#
# Type: Alphanumeric string (31 characters max)
#
# Description: IP address or URL of TFTP server to use.
# This value is required if the DHCP server will not provide
# the TFTP address. You can optionally include the path prefix
# to the Tftp file to download. Example: If the TFTP server IP
# address is 192.168.2.170 or wwww.cisco.com, and the path to
# download the Cisco phone profile is in /IP_phones, then you
# can specify the URL as 192.168.2.170/IP_phones or
# www.cisco.com/IP_phones.

TftpURL:192.168.1.1

# -----------------------------------------------------------------------------
# Parameter: CfgInterval
#
# Type: Integer (60 - 4294967295 seconds)
#
# Description: Interval (in seconds) between each configuration update.
# When TFTP is used for provisioning, at every such interval
# expiration, the box will perform a TFTP get of its
# configuration file at the earliest possible time -- when the
# box is idle). CfgInterval can be set to some random value to
# achieve random contact interval from individual phone to the
# TFTP server.
#
# Note: If set to less than 60, default is 60 seconds.

CfgInterval:3600

# -----------------------------------------------------------------------------
# Parameter: EncryptKey
#
# Type: Hexadecimal string (8 Hex digits max)
#
# Description: Key to use to decrypt the configuration profile
#
# Options: *0 = Configuration profile is not encrypted
#
# non-zero = Configuration profile is encrypted with this key,
# and the phone will decrypt the profile with this
# key.
#
# Default is marked with *.
#
# Note: The cfgfmt.exe program will automatically encrypt the binary
# file when this parameter value is non-zero.

EncryptKey:0

# -----------------------------------------------------------------------------
# Parameter: EncryptKeyEx
#
# Value Type: Hexadecimal string (64 Hex digits max)
#
# Description: Stronger encryption key to use to decrypt the configuration
# profile. When this parameter is set to a non-zero value, the
# phone will request a profile with the name .x,
# where
#
# = "ld" for Cisco 7905 IP phone
# "gk" for Cisco 7912 IP phone
# = MAC address of the Cisco IP phone
# x = extension indicating profile w/strong encryption
#
# If this parameter is set to 0, the phone will operate as if it
# only possessed the EncryptKey parameter, i.e. it will request
# its profile as without the "x" extension.
#
# Syntax: [/MAC]
#
# RC4_Key = Hexadecimal string from 1 to 64 hex digits
#
# MAC = (Optional) MAC address of the Cisco IP phone
# If this is specified, only the phone with the
# specified MAC address will be able to decrypt
# the profile.
#
# Options: *0 = EncryptKey parameter value is used.
# The phone will request file and
# decrypt it using the EncryptKey parameter value.
#
# non_zero = Configuration profile is encrypted with this
# stronger key, and the phone will request and
# decrypt the profile with this key.
#
# Default is marked with *.
#
# Note: If this parameter is specified, the cfgfmt.exe (version 2.1a
# or later) program will create two profiles. The
# .x profile will be encrypted with EncryptKeyEx
# while profile will be encrypted with
# EncryptKey.

#EncryptKeyEx:0

# -----------------------------------------------------------------------------
# Parameter: NPrintf
#
# Type: Extended IP value
#
# Syntax: .
#
# Description: For diagnostic use. Use this parameter to specify the IP
# address and port number where the phone will send its
# debug output information.
#
# The program "prserv.exe", which is included in every software
# upgrade package, is need to capture the debug information.
# For example, to send message to the host at 192.168.2.170 and
# port number 9001, you would run "prserv 9001" on a PC and
# specify "192.168.2.170.9001" as the value of this parameter.

NPrintf:0

# -----------------------------------------------------------------------------
# Parameter: TraceFlags
#
# Type: Bitmap value
#
# Description: For diagnostic use. Use this parameter to turn ON specific
# trace features.
#
# Options: Bit Values
# ----- --------------------------------------------------------
# 0 SIP Messages Log
# *0 = Disable
# 1 = Enable
#
# 1-7 RESERVED. Must be set to 0.
#
# 8 RTP Statistics Log
# *0 = Disable
# 1 = Enable
#
# RTP statistics log is in the following format:
#
# Recv[channel number]:
#
#
#
#
#
#
# Tx[channel number]:
#
#
#
# 9-31 RESERVED. Must be set to 0.

TraceFlags:0x00000000

# -----------------------------------------------------------------------------
# Parameter: IPDialPlan
#
# Type: Integer (0 - 2)
#
# Description: Allow for detection of IP-like destination address in dial
# plan.
#
# Options: 0 = Disable IP dialing detection.
#
# 1 = If two '.' is seen, then the phone assumes that an
# IP address is being entered.
#
# 2 = If three '.' is seen, then the phone assumes that an
# IP address is being entered.

IPDialPlan:1

# -----------------------------------------------------------------------------
# Parameter: DialPlan
#
# Type: Alphanumeric string (199 characters max)
#
# Description: Dial plan rules.
#
# Note: No syntax check is performed by the actual implementation.
# It is the responsibility of the provisioner to make sure that
# the dial_plan is syntatically valid.
#
# Programmable strings of dial plan that allow one to specify:
# o special rule -- I{timeout} to control default inter-digit
# timeout - specifying this rule also has the side effect
# of preventing non-matching dial string from being sent out.
# o optional send character to use (e.g. '#' or '*')
# o how many digits before auto send
# o send after timeout at any specified number of digits
# (time out can be changed as digits are entered).
# in the following:
# o . means match any digits
# o - means more digits can be entered, this (if needed) must
# appear at the end of the individual rule
# (i.e. e.g. 1408t5- is legal, but 1408t5-3...
# is illegal).
# o ># means terminating key to send is #, and termination
# can be applied only after matching hits ># (So >*
# means terminating char is *, i.e. terminating key
# must follow >)
# o rules applied in the order of listed (whichever matched
# completely first will cause trigger the send).
# o tn means timeout is n seconds (note: n is 0-9 and
# a-z -- which ranges 0 to 26).
# o more than one rules are separated by |.
# o rn means repeat last pattern n times (note: 1. ># or tn are
# modifier, they are not pattern; 2. n is 0-9 and a-z --
# which ranges 0 to 26). Use the repeat modifier to specify
# more rules in less space.
#
# You can also use the modifier 'S' to sieze the rule matching
# (i.e. if a rule matches and the modifier 'S' is seen, all other
# rules after that matching rule will not be used for matching).
#
# Examples 1: The set of dial plan rules:
#
# ".t7>#......t4-|911|1t7>#..........t1-|0t4>#.t7-"
#
# or equivalently
#
# ".t7>#r6t4-|911|1t7>#.r9t1-|0t4>#.t7-"
#
# consists of the following rules:
#
# .t7>#......t2- -- at least one digit need to be
# entered, after that, time out is 7 seconds
# before send, and terminating char # can also
# be applied after the first digit is entered,
# and after 7 digits are entered, time out
# change to 2 seconds. * means further digits
# can be entered as long as not terminated by
# timeout or #.
#
# 911 -- send out immediately
#
# 1t7>#..........t1- -- at least one digit need to be
# entered, after that, time out is 7 seconds
# before send, and terminating char # can also
# be applied after the first digit is entered,
# and after 10 digits are entered, time out
# change to 1 second. * means further digits can be
# entered as long as not terminated by timeout
# or #.
#
# 0t4>#.t7- -- after entering 0, if no other digit is
# entered, it will timeout and send in 4 seconds,
# otherwise, time out change to 7 seconds after
# another key is entered. again # is terminating
# digit.
# Examples 2: The set of dial plan rules:
#
# "911|1>#.r9t3.t5-|0t411t9-"
#
# if 911 entered, it will be sent out immediately.
# if 14088713344 is entred, after 3 seconds, it will
# be sent out but if another digit is entered (say
# 140887133445, the timeout chaned to 5 seconds).
# if 0 is entered, after 4 seconds, it will be send out.
# if 011 is entered, the time out changed to 9 seconds.

DialPlan:112|1>#t8.r9t2-|0>#t811.rat4-|^1t4>#.-

# -----------------------------------------------------------------------------
# Parameter: RingOnOffTime
#
# Type: Array of three short integers
#
# Description: Control phone ring characteristic.
#
# Note: Values specified below are recommended for the U.S.

RingOnOffTime:2,4,25

# -----------------------------------------------------------------------------
# Parameters: DialTone
# DialTone2
# BusyTone
# ReorderTone
# RingBackTone
# CallWaitTone
#
# Type: Array of short integers
#
# Description: Playback tones
#
# Format: For DialTone, DialTone2, BusyTone, RingBackTone, CallWaitTone
#
# NumOfTone,Freq[0],Level[0],Freq[1],Level[1],NumOfCadence,
# OnTime[0],OffTime[0],OnTime[1],OffTime[1],TotalToneTime
#
# For ReorderTone
#
# SequentialTone,NumOfTone,Freq[0],Level[0],Freq[1],Level[1],
# Freq[2],Level[2],NumOfCadence,OnTime[0],OffTime[0],
# OnTime[1],OffTime[1],OnTime[2],OffTime[2],NumOfRepeat,
# TotalToneTime
#
# Options: - NumOfTone:
# Number of frequency components (1 or 2)
# For Reorder Tone, value range is 1 to 3.
# - Freq[x] (Hz):
# Transformed frequency (-32768 to 32767)
# - Level[x] (dBm):
# Transformed amplitude (-32768 - 32767)
# - NumOfCadence:
# Number of cadence pairs (0 - 2).
# For Reorder Tone, value range is 0 to 3.
# To specify a steady tone, set value to 0.
# - OnTime[x] (s):
# Length of time tone is ON (0 - 65535)
# - OffTime[x] (s):
# Length of time tone is OFF (0 - 65535)
# - SequentialTone:
# Juxtoposed tones or sequential tones
# 0 = Juxtoposed tone, 1 = Sequential tone
# - NumOfRepeat:
# Number of times (OnTime[x], OffTime[x]) cadence pair is
# repeated before proceeding to the (OnTime[x], OffTime[x]).
# - TotalToneTime:
# The total length of time the tone is played. If set to 0,
# tone will play continously until other call events stop
# the tone. For DialTone, BusyTone, ReorderTone, and
# RingBackTone, the unit is in number of 10 ms. For other
# tones, the unit is the number of samples.
#
# Note: 1. If NumOfCadence is set to 0, OnTime[x] and OffTime[x] must
# be set to 0.
# 2. Values specified below are recommended for the U.S.

DialTone:2,31538,814,30831,2032,0,0,0,0,0,0
DialTone2:2,30743,1384,29864,1252,0,0,0,0,0,0
BusyTone:2,30467,1104,28959,1404,1,4000,4000,0,0,0
ReorderTone:0,2,30467,1104,28959,1404,0,0,1,2000,2000,0,0,0,0,0,0
RingBackTone:2,30831,2032,30467,1104,1,16000,32000,0,0,0
CallWaitTone:1,30831,2412,0,0,1,2400,2400,0,0,4800

# -----------------------------------------------------------------------------
# Parameter: MediaPort
#
# Type: Integer (1 - 65535)
#
# Description: Base port to receive RTP media

MediaPort:16384

# -----------------------------------------------------------------------------
# Parameter: TOS
#
# Type: Bitmap value
#
# Description: ToS (Type of Service) bits. This bitmap value specifies the
# precedence and delay of Audio and Signaling IP packets.
#
# Options: Bit Values
# ----- --------------------------------------------------------
# 0-7 ToS Value For Audio Data Packets
# Range: 0-255 Default: 184 (0xb8)
#
# 8-15 ToS Value For Signaling Data Packets
# Range: 0-255 Default: 96 (0x60)
#
# 16-31 RESERVED

TOS:0x000060b8

# -----------------------------------------------------------------------------
# Parameter: SigTimer
#
# Type: Bitmap value
#
# Description: Timeout values to start/stop the following signalling events
#
# Options: Bit Values
# ----- --------------------------------------------------------
# 0-7 CALL WAITING PERIOD
# Period between each burst of call waiting tone
#
# Range: 0 - 255
# Factor: 0.1 second
# Note: 0 defaults to 100 (or 10 sec)
# Default: 100 (0x64 = 10 sec)
#
# 8-13 RESERVED. Must be set to 0.
#
# 14-19 RING TIMEOUT
# Timeout in ringing the phone after which the incoming
# call is rejected
#
# Range: 0 - 63
# Factor: 10 seconds
# Note: 0 means ring never times out
# Default: 6 (60 sec)
#
# 20-25 NO ANSWER TIMEOUT
# Time to declare no answer and initiate call forwarding
# on no answer
#
# Range: 0 - 63
# Factor: 1 second
# Default: 20 (0x14 = 20 sec)
#
# 26-27 RESERVED. Must be set to 0.
#
# 28-29 FIRST KEY REPEAT INTERVAL
# The minimum time required initially for the Volume or
# Navigation key to be pressed before the highlight bar
# begins to move automatically.
#
# Range: 0 to 3
# Default: 0 (1 second)
#
# 0 = 1 sec 1 = Disable Key Repeat
# 2 = 2 sec 3 = 3 sec
#
# 30-31 SUBSEQUENT KEY REPEAT INTERVAL
# The minimum time required subsequently for Volume or
# Navigation key to be pressed to keep the highlight bar
# moving automatically.
#
# Range: 0 to 3
# Default: 0 (0.25 second)
#
# 0 = 0.25 sec 1 = 0.5 sec
# 2 = 0.75 sec 3 = 1 sec

SigTimer:0x01418064

# -----------------------------------------------------------------------------
# Parameter: OpFlags
#
# Type: Bitmap value
#
# Description: Turn ON/OFF various operational features
#
# Options: Bit Values
# ----- --------------------------------------------------------
# 0 TFTP CONFIGURATION FILE NAME
# *0 = Do not use internally generated TFTP configuration
# file name
# 1 = Always use the internally generated TFTP
# configuration file name
#
# 1 NETWORK PROBING ON POWER UP
# 0 = Probe the static network router on power up
# *1 = Do not perform static network router probing at
# power up
#
# 2 RESERVED. Must be set to 0.
#
# 3 DHCP OPTION 150
# *0 = Ask for DHCP option 150 in DHCP DISCOVERY message
# 1 = Do not ask for DHCP option 150 in DHCP DISCOVERY
# message (some DHCP server will not respond if
# option 150 is requested)
#
# 4 NETWORK OPERATION
# *0 = Assume normal operation without VLAN
# 1 = Assume operation under VLAN (the VLAN ID is
# specified in VLANSetting, see VLANSetting parameter)
# Multicast is disabled
#
# 5 VLAN ENCAPSULATION
# *0 = Use VLAN IP encapsulation
# 1 = Do not use VLAN IP encapsulation, i.e. force
# turning OFF VLAN IP encapsulation
#
# 6 Cisco Discovery Protocol (CDP)
# *0 = Use CDP discovery
# 1 = Do not perform CDP discovery. Multicast is disabled
#
# 7 WEB CONFIGURATION ACCESS
# *0 = Allow web configuration
# 1 = Do not allow web configuration
#
# 8 TFTP REFRESH ACCESS
# *0 = Allow force profile update via http://ip/refresh
# 1 = Do not allow http://ip/refresh
#
# 9 REMOTE RESET ACCESS
# *0 = Allow reset of the phone via http://ip/reset
# 1 = Do not allow reset of the phone via http://ip/reset
#
# 10-14 RESERVED. Must be set to 0.
#
# 15 UDP CHECKSUM GENERATION
# *0 = Generate UDP checksum in outgoing UDP packets
# 1 = Do not generate UDP checksum in outgoing UDP packets
#
# 16-31 RESERVED. Must be set to 0.

OpFlags:0x00000002

# -----------------------------------------------------------------------------
# Parameter: VLANSetting
#
# Type: Bitmap value
#
# Description: Control various VLAN settings
#
# Options: Bit Values
# ----- --------------------------------------------------------
# 0-2 Specify 802.1Q priority for Signalling IP packets
# 3-5 Specify 802.1Q priority for Audio Voice IP packets
# 6-17 RESERVED. Must be set to 0.
# 18-29 Specify 802.1Q VLAN ID
# 30-31 RESERVED. Must be set to 0.

VLANSetting:0x0000002b

# -----------------------------------------------------------------------------
# Parameter: NatServer
#
# Type: Alphanumeric string (47 characters max)
#
# Description: IP address or domain name of a server to which a dummy,
# single-byte UDP packet is sent to maintain a NAT during
# a session.
#
# Syntax: [:port]
# If port number is not specified, 5060 is assumed.

NatServer:0

# -----------------------------------------------------------------------------
# Parameter: NatTimer
#
# Type: Bitmap value
#
# Description: This parameter provides control over the transmission interval
# and destination server of Keep Alive packets.
#
# Options: Bit Values
# ----- --------------------------------------------------------
# 0-11 SIP/RTP Keep Alive (KA) period in seconds (0-2047)
# Specify the interval in which a dummy packet is sent
# out through the specified SIP and RTP ports to keep
# the port bindings on the NAT/firewall open
#
# 12-17 RESERVED. Must be set to 0.
#
# 18 SIP KA destination:
# 0 = NatServer
# 1 = ProxyServer
#
# 19 RESERVED. Must be set to 0.
#
# 20 Enable KA for SIPPort (send to either NatServer or
# Proxy)
#
# 21 Enable KA for MediaPort (send to NatServer)
#
# 22 Enable KA for MediaPort + 4 (send to NatServer)
#
# 23-31 RESERVED. Must be set to 0.
#
# Note: 1. If NatServer is not specified (0) or invalid, then the
# only available option is to enable SIP KA to Proxy Server.
#
# 2. If KA period is 0, all KA are disabled; but still can
# do NATIP mapping.

NatTimer:0

# ============================ Caller Preferences =============================

# -----------------------------------------------------------------------------
# Parameter: CallForwardNumber
#
# Type: Numeric digit string (31 digits max)
#
# Description: Phone number to forward all calls
#
# Note: Set value to zero (0) to disable this feature.

CallForwardNumber:0

# -----------------------------------------------------------------------------
# Parameter: VoiceMailNumber
#
# Type: Numeric digit string (31 digits max)
#
# Description: Phone number to access voice mail
#
# Note: Set value to zero (0) to disable this feature.

VoiceMailNumber:1234

# -----------------------------------------------------------------------------
# Parameter: CallFwdBusyNumber
#
# Type: Numeric digit string (31 digits max)
#
# Description: Phone number to forward busy calls
#
# Note: Set value to zero (0) to disable this feature.

CallFwdBusyNumber:0

# -----------------------------------------------------------------------------
# Parameter: DisplayName
#
# Type: Alphanumeric string (31 characters max)
#
# Description: Display Name used in outgoing Caller ID
#
# Note: Set value to zero (0) to disable this feature.

DisplayName:100

# -----------------------------------------------------------------------------
# Parameter: ShortName
#
# Type: Alphanumeric string (31 characters max)
#
# Description: Name to be displayed on phone's LCD screen.
#
# Note: Set value to zero (0) to disable this feature and display
# the value in "DisplayName", if any, on the LCD screen.

ShortName:100

# -----------------------------------------------------------------------------
# Parameters: TimeFormat
# DateFormat
#
# Type: Alphanumeric string (15 characters max)
#
# Description: Strings to controls the Time and Date format as appear
# on the top line of the LCD display.
#
# Special characters are:
#
# h = 12 hour format
# H = 24 hour format
# i = Minute
# I = Minute
# a = AM
# A = AM
# p = PM
# P = PM
# m = Month in number (1 - 12)
# M = Month in abbreviation (Jan - Dec)
# d = Day in number (1 - 31)
# D = Day in number (1 - 31)
# y = Year in 2 digits (00 - 99)
# Y = Year in 4 digits (0000 - 9999)
# : = Colon blinks every second
# 0 = Time or date is not displayed
#
# All other characters are shown as is.
#
# Examples: TimeFormat Sample Display
# ---------- --------------
# h:ia 2:00p or 11:00a
# H:i 14:00
# 0 Time is not displayed
#
# DateFormat Sample Display
# ---------- --------------
# m-d-y 04-20-05
# M d, Y Apr 20, 2005
# M. D, y Apr. 20, 05
# Y/m/d 2005/04/20
# Y M. D 2005 Apr. 20
# 0 Date is not displayed

TimeFormat:h:ia
DateFormat:m-d-y

# -----------------------------------------------------------------------------
# Parameter: DoNotDisturb
#
# Type: Boolean
#
# Description: Enable or disable "Do Not Disturb"
#
# Options: 0 = Deactivate "Do Not Disturb" feature
# 1 = Activate "Do Not Disturb" feature

DoNotDisturb:0

# -----------------------------------------------------------------------------
# Parameter: BlockCallerId
#
# Type: Boolean
#
# Description: Enable or disable blocking of outgoing Caller ID
#
# Options: 0 = Do not block outgoing Caller ID
# 1 = Block outgoing Caller ID

BlockCallerId:0

# -----------------------------------------------------------------------------
# Parameter: CallWaiting
#
# Type: Boolean
#
# Description: Enable or disable call waiting for every call
#
# Options: 0 = Disable call waiting for every call
# 1 = Enable call waiting for every call

CallWaiting:1

# -----------------------------------------------------------------------------
# Parameter: AttendedTransfer
#
# Type: Boolean
#
# Description: Enable or disable attended call transfer
#
# Note: If attended call transfer is disabled, the "Trnsfer"
# softkey will not be shown on the LCD screen.
#
# Options: 0 = Disable attended call transfer
# 1 = Enable attended call transfer

AttendedTransfer:1

# -----------------------------------------------------------------------------
# Parameter: BlindTransfer
#
# Type: Boolean
#
# Description: Enable or disable blind transfer
#
# Note: If blind transfer is disabled, the "BlndXfr" softkey
# will not be shown on the LCD screen.
#
# Options: 0 = Disable blind transfer
# 1 = Enable blind transfer

BlindTransfer:1

# -----------------------------------------------------------------------------
# Parameter: Conference
#
# Type: Boolean
#
# Description: Enable or disable 3-way conference
#
# Note: If 3-way conference is activated, "Confrn" softkey
# will not be shown on the LCD screen.
#
# Options: 0 = Deactivate 3-way conference
# 1 = Enable 3-way conference

Conference:1

# -----------------------------------------------------------------------------
# Parameter: BlockAnonymous
#
# Type: Boolean
#
# Description: Enable or disable blocking of anonymous incoming calls
#
# Note: If enabled, anonymous incoming calls will be rejected.
#
# Options: 0 = Deactivate blocking of anonymous incoming call
# 1 = Activate blocking of anonymous incoming call

BlockAnonymous:0

# -----------------------------------------------------------------------------
# Parameter: ForwardToVMDelay
#
# Type: Integer (1 - 4294967295 seconds)
#
# Description: Number of seconds before forwarding a call to the
# VoiceMailNumber, if configured.
#
# Note: This setting has no effect if VoiceMailNumber is not
# provisioned OR the value is 0 or greater than the ring timeout
# value (see SigTimer bits 14-19).

ForwardToVMDelay:20

# -----------------------------------------------------------------------------
# Parameters: CallPrefGuiShow
# CallPrefGuiSet
#
# Type: Bitmap value
#
# Description: CallPrefGuiShow provides the ability to control whether a
# call preference option is displayed on the LCD screen.
#
# CallPrefGuiSet provides the ability to control whether a
# call preference option can be set by an end user if it is
# displayed on the LCD screen.
#
# Options: Bit Values
# ----- --------------------------------------------------------
# 0 Do Not Disturb (DND)
#
# 1 Call Waiting
#
# 2 Block Caller ID
#
# 3 Call Forward All
#
# 4 RESERVED
#
# 5 RESERVED
#
# 6 Display Name
#
# 7 Time Format
#
# 8 Date Format
#
# 9 Voice Mail
#
# 10 Call Transfer
#
# 11 Blind Transfer
#
# 12 Conference
#
# 13 Short Name
#
# 14-23 RESERVED
#
# 24 Block Anonymous Calls
#
# 25 RESERVED
#
# 26 Forward to Voice Mail Delay
#
# 27 Call Forward On Busy
#
# 28 Show Registration Status Icon
# (If set in CallPrefGuiShow, registration status icon
# will be displayed on LCD screen. This bit has no
# effect in CallPrefGuiSet.)
#
# 29-31 RESERVED

CallPrefGuiShow:0xffffffff
CallPrefGuiSet:0xffffffff

Guardamos el fichero en el tftp y ahora toca compilar el fichero para que el teléfono lo pueda leer.

Para ello, con la utilidad que tenemos el los archivos cfgfmt.linux o la de windows, convertiremos el fichero, mediante la línea de comandos:


#cfgfmt.linux fichero_origen.txt fichero_destino

Asignamos permisos y listo.

Instalar asterisk 1.8 debian 6

Otro apunte.

Para instalar asterisk 1.8 en debian 6.0, con soporte ODBC para el cdr en MySQL, seguiremos los siguientes pasos.

Partimos de una debian 6.0 recién instalada.

Instalamos MySQL

# apt-get install mysql-server mysql-client

Y más requisitos:

# apt-get install subversion libncurses5-dev libssl-dev libxml2-dev vim-nox gawk wget apache2
# aptitude install build-essential linux-headers-`uname -r`
# apt-get install -qy bison flex libncurses5-dev zlib1g-dev libssl-dev libnewt-dev libiksemel-dev
# apt-get install -qy make linux-headers-`uname -r` gcc g++ libstdc++6 mysql-client libmysqlclient-dev mysql-server mc ssh apache2
# apt-get install linux-headers-`uname -r` bison openssl libssl-dev libeditline0 libeditline-dev libedit-dev
# apt-get install gcc make g++ php5-cli mysql-common libmysqlclient15-dev libnewt-dev

Y el func_odbc:

# apt-get install unixodbc-dev libmyodbc unixodbc

Ahora descargaremos la última cert. de asterisk 1.8:

root@pbx:/etc/apt# cd /usr/src/
root@pbx:/usr/src/asterisk# mkdir asterisk
root@pbx:/usr/src/asterisk# wget -c http://downloads.asterisk.org/pub/telephony/certified-asterisk/certified-asterisk-1.8.15-current.tar.gz
root@pbx:/usr/src/asterisk# tar -zxvf certified-asterisk-1.8.15-current.tar.gz

Y vamos a compilar:

# ./configure
# make menuselect

*** nota, para que funcione bien el musicOnHold **


1) Run "make menuselect"
2) Select "Add-ons"
3) Make sure "format_mp3" is selected: [*]format_mp3
4) Use the "Menu Select" command 'x' to Save and Quit
5) Run "contrib/scripts/get_mp3_source.sh" <-- IMPORTANT or you won't have MP3 source to compile and your build will fail! 6) Run "make install"

Seleccionamos los módulos que queremos instalar y personalizamos.... y a compilar:


# make
# make install
# make config
# make samples

Y ahora los sonidos en castellano, cortesía de voipnovatos:


# wget -c http://www.voipnovatos.es/voces/voipnovatos-core-sounds-es-alaw-1.4.tar.gz
# wget -c http://www.voipnovatos.es/voces/voipnovatos-core-sounds-es-g729-1.4.tar.gz
# wget -c http://www.voipnovatos.es/voces/voipnovatos-core-sounds-es-gsm-1.4.tar.gz
# wget -c http://www.voipnovatos.es/voces/voipnovatos-core-sounds-es-ulaw-1.4.tar.gz
# wget -c http://www.voipnovatos.es/voces/voipnovatos-extra-sounds-es-alaw-1.4.tar.gz
# wget -c http://www.voipnovatos.es/voces/voipnovatos-extra-sounds-es-ulaw-1.4.tar.gz
# wget -c http://www.voipnovatos.es/voces/voipnovatos-extra-sounds-es-g729-1.4.tar.gz
# wget -c http://www.voipnovatos.es/voces/voipnovatos-extra-sounds-es-gsm-1.4.tar.gz

Hacemos el tar -zxvf de todos los ficheros y copiamos en /var/lib/asterisk/sounds y listo.

Arrancamos el servicio:


# /etc/init.d/asterisk start

Simular extension mobility con asterisk

Esta entrada es otro apunte.

Hace poco, uno de los clientes donde tengo un asterisk, tienen varios empleados que hacen teletrabajo y, querían llevarse la extensión a casa….. sabemos de sobras que asterisk no soporta parallel forking y, había que buscar la manera de hacerlo mediante dialPlan.

El tema consiste en:

1º) El usuario tiene un softphone configurado en su pc y se conecta por VPN
2º) El Usuario, tiene su extensón, por ejemplo 240 y en casa quiere tener la misma.
3º) El usuario, cuando está en casa querrá que el cliente vea que está en la oficina 😉

De esta manera, la operadora de la centralita, tan sólo tiene que preocuparse de pasarle la llamada a su extensión habitual, al igual que sus compañeros.

Sabiendo de antemano que no podemos tener 2 extensiones iguales registradas, vamos a hacer “el apaño” con el dialPlan; en este caso, a las extensiones remotas les añadiremos un 3 delante.

Show me the code 😉

En el sip.conf, definimos las extensiones:

[240](extension)
username=240
callerid=”INFORMATICA” <240>
secret=xxxxxx
mailbox=200

[3240](extension)
username=3240
callerid=”INFORMATICA” <240>
secret=xxxxxx
mailbox=200

Tenemos la 240 que es la del teléfono y la 3240 que es la remota.

Ahora, una función para habilitar el extension Mobility falso ;-). Editamos el extensions.conf y con la 342 habilitamos y con el 343 deshabilitamos:

exten => 342,1,NoOP(…: desvio extensiones remotas activado :…)
exten => 342,n,Playback(call-fwd-unconditional&enabled)
exten => 342,n,Set(DB(${CALLERID(num)}/remoto)=1)
exten => 342,n,Hangup
exten => 343,1,NoOP(…: desvio extensiones remotas desactivado :…)
exten => 343,n,Playback(call-fwd-unconditional&disabled)
exten => 343,n,Set(DB(${CALLERID(num)}/remoto)=0)
exten => 343,n,Hangup

Guardamos en la ASTDB una clave / valor tal que: 240 / 1 o 240/0 (1 habilitado y 0 deshabilitado)

Y ahora la magia del dialplan, en el extensions.conf:

exten => _2XX,1,NoOp(Llamada entre extensiones)
exten => _2XX,n,NoOP(comprobamos que tiene el desvio a extension de casa)
exten => _2XX,n,Set(remoto_activo=0) // inicializamos variable y la ponemos a 0
exten => _2XX,n,Set(remoto_activo=${DB(${EXTEN}/remoto)}) // preguntamos y seteamos variable
exten => _2XX,n,NoOP(${remoto_activo}) // lo printamos en pantalla para debug
exten => _2XX,n,GotoIf($[“${remoto_activo}” = “1”]?desvio) // si activo, pasamos a (desvio)
exten => _2XX,n,NoOP(llamando de la ${CALLERID(num)} a la:${EXTEN})
exten => _2XX,n,Dial(SIP/${EXTEN},60,tTwWm) // llamamos normal
exten => _2XX,n(desvio),Dial(SIP/3${EXTEN},60,tTwWm) // añadimos el 3 delante
exten => _2XX,n,Hangup()

Guardamos, hacemos un reload y listo.

Sé que no es una manera elegante, pero vemos que con un poquito de BBDD y programación de dialPlan, la posibilidades son casi infinitas.

Enjoy your mobility 😉

Añadiendo seguridad con IPTABLES

Otra entrada que es un apunte.

Estos días, por cuestiones técnicas y de un proyecto donde estoy colaborando, he tenido que unir mi debian / asterisk a un grupo, mediante el software vpn TINC.

La instalación del tinc es sencilla y funciona muy bien, pero mi máquina es completamente accesible desde el otro extremo de la red. No es que no me fie, pero no suelo dejar mis equipos expuestos al exterior; manias personales.

Bien, tras analizar los puertos que debo dejar abiertos, me hice una lista:

– permitir tráfico SIP/UDP (5060 udp) – abierto
– permitir tráfico RTP VoIP (udp 10000 .. 20000) – abierto
– permitir openLdap (en local) – abierto
– permitir SSH en mi redLocal (TCP 22)
– permitir MySQL en mi redLocal (TCP 3306)
– permitir TINC (655 tcp /udp)
– permitir www (80 tcp)
– permitir dundi (4520 tcp/udp)
– permitir tftp (udp 69)
– permitir syslog (udp 514)
– permitir icmp echo-reply
– permitir icmp unracheable
– permitir icmp echo-request
– permitir icmp unracheable
– permitir SMB en red Local

Una vez tenemos las reglas, vaciamos las reglas ip tables :

# iptables -F
# iptables -X

Y ahora hacemos un copy&paste de las reglas en la consola, quedando tal que:

# permitimos tráfico de loopback
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# permitimos tipos de icmp
iptables -A INPUT -i eth1 -p icmp –icmp-type destination-unreachable -j ACCEPT
iptables -A INPUT -i eth1 -p icmp –icmp-type time-exceeded -j ACCEPT
iptables -A INPUT -i eth1 -p icmp –icmp-type echo-reply -j ACCEPT
iptables -A INPUT -i eth1 -p icmp –icmp-type echo-request -j ACCEPT
# permitimos icmp en interface PLN /tinc
iptables -A INPUT -i pln -p icmp –icmp-type destination-unreachable -j ACCEPT
iptables -A INPUT -i pln -p icmp –icmp-type time-exceeded -j ACCEPT
iptables -A INPUT -i pln -p icmp –icmp-type echo-reply -j ACCEPT
iptables -A INPUT -i pln -p icmp –icmp-type echo-request -j ACCEPT
# reglas
#### reglas dundi ###
iptables -A INPUT -p udp -m udp –dport 4520 -j ACCEPT
iptables -A INPUT -p tcp –dport 4520 -j ACCEPT
# reglas sip, iax, rtp #
iptables -A INPUT -p udp -m udp –dport 5060 -j ACCEPT
iptables -A INPUT -p udp -m udp –dport 4569 -j ACCEPT
iptables -A INPUT -p udp -m udp –dport 10000:20000 -j ACCEPT
# reglas syslog #
iptables -A INPUT -p udp -m udp –dport 514 -j ACCEPT
# reglas tftp #
iptables -A INPUT -p udp -m udp –dport 69 -j ACCEPT
# reglas tinc #
iptables -A INPUT -p udp -m udp –dport 655 -j ACCEPT
iptables -A INPUT -p tcp –dport 655 -j ACCEPT
# reglas trafico www #
iptables -A INPUT -p tcp –dport 80 -j ACCEPT
# reglas ssh #
iptables -A INPUT -p tcp –dport 22 -s 192.168.2.0/24 -j ACCEPT
iptables -A INPUT -p tcp –dport 22 -s 127.0.0.0/8 -j ACCEPT
iptables -A INPUT -p tcp –dport 22 -j DROP
# reglas mysql
iptables -A INPUT -p tcp –dport 3306 -s 192.168.2.0/24 -j ACCEPT
# reglas ldap
iptables -A INPUT -p tcp –dport 389 -s 192.168.2.0/24 -j ACCEPT
# reglas SMB
iptables -A INPUT -p udp –dport 137 -s 192.168.2.0/24 -j ACCEPT
iptables -A INPUT -p udp –dport 138 -s 192.168.2.0/24 -j ACCEPT
iptables -A INPUT -p tcp –dport 139 -s 192.168.2.0/24 -j ACCEPT
iptables -A INPUT -p tcp –dport 445 -s 192.168.2.0/24 -j ACCEPT
iptables -A INPUT -p udp –dport 445 -s 192.168.2.0/24 -j ACCEPT
# el resto, rechazamos
iptables -A INPUT -j REJECT

Y con esto, añadimos un granito más de seguridad en nuestra red.

OpenMeetings 2.0 debian Squeeze + asterisk. Parte 1

Hoy toca la integración de OpenMeetings con Asterisk…. un gran paso. Primero instalaremos OpenMeetings 2.0 en nuestro debian y luego, lo integraremos con Asterisk.

Álvaro (aka Greenes), colaborador habitual del proyecto (http://incubator.apache.org/openmeetings/) es el responsable del manual original, del que yo, símplemente he “copiado” aquí, en mi blog.

Partimos de la base de nuestro debian recién instalado, nos vamos al fichero /etc/apt/sources.list y añadimos al principio:

deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free
deb http://ftp.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.debian.org/debian/ squeeze main contrib non-free
deb http://ftp.debian.org/debian/ squeeze-updates main contrib non-free
deb-src http://ftp.debian.org/debian/ squeeze-updates main contrib non-free
deb http://ftp2.de.debian.org/debian squeeze main non-free
deb http://deb-multimedia.org squeeze main

Hacemos un update:

#apt-get update

Y pasado un rato, estaremos en disposición de empezar a instalar dependencias, siendo :

apt-get install sun-java6-jdk
apt-get install openoffice.org-writer openoffice.org-calc openoffice.org-impress
openoffice.org-draw openoffice.org-math imagemagick gs-gpl -y
apt-get install libgif-dev xpdf libfreetype6 libfreetype6-dev libjpeg8 libjpeg62 libjpeg8-dev
apt-get install g++ libjpeg-dev libdirectfb-dev libart-2.0-2 libt1-5 zip unzip bzip2
apt-get install subversion git-core checkinstall yasm texi2html libfaac-dev libfaad-dev
apt-get install libmp3lame-dev libsdl1.2-dev libx11-dev libxfixes-dev libxvidcore4-dev zlib1g-dev
apt-get install libogg-dev sox libvorbis0a libvorbis-dev libgsm1 libgsm1-dev libfaad2 flvtool2 lame

al hacer el apt-get install sun-java6-jdk, tenemos que aceptar la licencia….. Googleando un poco en la página del proyecto, en versiones anteriores a la 2.0, funcionaba con la openJDK, pero ahora no, en fin.

Instalararemos el mysql-server + mysql-client y crearemos una BBDD para openmeetings, o usaremos otro MySQL que tengamos instalado en otro server. Entramos en el MySql en cuestión y creamos la BBDD y un usuario para tal caso, siendo openmeetings / openmeetings.

CREATE DATABASE openmeetings DEFAULT CHARACTER SET ‘utf8’;
GRANT ALL PRIVILEGES ON openmeetings.* TO ‘openmeetings’@’localhost’ IDENTIFIED BY ‘openmeetings’ WITH GRANT OPTION;

Ahora descargamos y compilamos el SWF:

wget http://www.swftools.org/swftools-2012-04-08-0857.tar.gz
tar -zxvf swftools-2012-04-08-0857.tar.gz
cd swftools-2012-04-08-0857
./configure
make
make install

Ahora toca el paquete ffmpeg:

wget http://ffmpeg.org/releases/ffmpeg-0.11.1.tar.gz
tar -zxvf ffmpeg-0.11.1.tar.gz
cd ffmpeg-0.11.1
./configure –enable-libmp3lame –enable-libxvid –enable-libvorbis –enable-libgsm –enable-libfaac –enable-gpl –enable-nonfree
make
checkinstall

Ahora seguimos con el JOD converter:

wget http://jodconverter.googlecode.com/files/jodconverter-core-3.0-beta-4-dist.zip
unzip jodconverter-core-3.0-beta-4-dist.zip

Y seguimos con ANT, pero usaremos la versión 1.8.4 para compilar openMeetings

wget http://mirror.catn.com/pub/apache//ant/binaries/apache-ant-1.8.4-bin.tar.gz
tar -zxvf apache-ant-1.8.4-bin.tar.gz

Y ahora descargamos openmeetings:

# svn checkout http://svn.apache.org/repos/asf/incubator/openmeetings/branches/2.0/

Y lo compilamos:

# cd /usr/adm/2.0
# /usr/adm/apache-ant-1.8.4/bin/ant clean.all
# /usr/adm/apache-ant-1.8.4/bin/ant -Ddb=mysql

Una vez compilado (tardará un buen rato), lo movemos a su ubicación correcta:

# cd /usr/adm/2.0/dist
# mv red5/ /usr/lib/

Movemos de sitio el JOD converter, a la carpeta de OM

cp -R /usr/adm/jodconverter-core-3.0-beta-4 /usr/lib/red5/webapps/openmeetings

Y cambiamos unos permisos:

# chown -R nobody /usr/lib/red5
# chmod +x /usr/lib/red5/red5.sh
# chmod +x /usr/lib/red5/red5-debug.sh

Y creamos el script para controlar red5:

# nano /etc/init.d/red5

Y hacemos copy & paste de lo siguiente…. (Gracias a Álvaro por modificar el script)

#! /bin/sh
### BEGIN INIT INFO
# Provides: red5
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts red5 server for Openmeetings.
# OpenMeetings 2.X Installation on Debian 64bit Squeeze
# Stephen Cottham 29/07/2012
### END INIT INFO
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server for OpenMeetings
# processname: red5
# Created By: Sohail Riaz (sohaileo@gmail.com)
# Modified by Alvaro Bustos
PROG=red5
RED5_HOME=/usr/lib/red5
DAEMON=$RED5_HOME/$PROG.sh
PIDFILE=/var/run/$PROG.pid
[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5
RETVAL=0
case “$1” in
start)
cd $RED5_HOME
start-stop-daemon –start -c nobody –pidfile $PIDFILE
–chdir $RED5_HOME –background –make-pidfile
–exec $DAEMON >/dev/null 2>/dev/null &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
fi
echo
;;
stop)
start-stop-daemon –stop –quiet –pidfile $PIDFILE
–name java
rm -f $PIDFILE
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
;;
restart|force-reload)
$0 stop
$0 start
;;
status)
# Debian and Ubuntu 10 status check
ps aux | grep -f $PIDFILE >/dev/null 2>/dev/null && RETVAL=0 || RETVAL=3
# Ubuntu 12 status check using improved “start-stop-daemon” status query
# (use the above command, or comment out above command and uncomment the two below commands.
# start-stop-daemon –status –pidfile $PIDFILE
# RETVAL=$?
[ $RETVAL -eq 0 ] && echo “$PROG is running”
[ $RETVAL -eq 1 ] && echo “$PROG is not running and the pid file exists”
[ $RETVAL -eq 3 ] && echo “$PROG is not running”
[ $RETVAL -eq 4 ] && echo “$PROG – unable to determine status”
;;
checkports)
netstat -anp | grep soffice
netstat -anp | grep java
;;
*)
echo $”Usage: $0 {start|stop|restart|force-reload|status|checkports}”
RETVAL=1
esac
exit $RETVAL

Seteamos permisos para que pueda ejecutarse:

chmod +x /etc/init.d/red5
update-rc.d red5 defaults

Hacemos backup del fichero persistence.xml, por si las moscas:

mv /usr/lib/red5/webapps/openmeetings/WEB-INF/classes/META-INF/persistence.xml
/usr/lib/red5/webapps/openmeetings/WEB-INF/classes/META-INF/persistence.xml-ori

Y ahora renombramos para habilitar el template de mysql:

# mv /usr/lib/red5/webapps/openmeetings/WEB-INF/classes/META-INF/mysql_persistence.xml
/usr/lib/red5/webapps/openmeetings/WEB-INF/classes/META-INF/persistence.xml

#mv /usr/lib/red5/webapps/openmeetings/WEB-INF/classes/META-INF/mysql_persistence.xml
/usr/lib/red5/webapps/openmeetings/WEB-INF/classes/META-INF/persistence.xml

Ahora editamos el fichero y cambiamos los datos de acceso mysql

, TestOnBorrow=true
, poolPreparedStatements=true
, Username=openmeetings
, Password=openmeetings”/>

Y iniciamos red5

# /etc/init.d/red5 start

Y si todo ha ido bien, empezaremos a configurarlo, accediendo a la web:

http://ip.del.web.server:5080/openmeetings/install

Rellenamos el user / pass:

Username: admin
Userpass: password
EMail: admin@dominio.com
User Time Zone: spain
Organisation(Domains) craem.net

Y al final de la hoja, le damos al botón de install. Esperamos un poco y ya tenemos la primera parte lista.

Forzar spa50x cambios por tftp

Otro apunte…. estos días ando liado cambiando configuraciones en los teléfonos de un cliente y, necesito forzar que el teléfono (en mi caso, un spa502g), se descargue de nuevo el fichero del TFTP para aplicar los cambios y verlo de nuevo registrado en mi asterisk, con las modificaciones.

Tengo los ficheros en el tftp de mi servidor debian, siendo la ruta tftp://spa$fichero_config.xml.

Abrimos el navegador y tecleamos como url:

http://10.0.1.71/admin/resync?tftp://10.0.1.5/spa$MA.xml

10.0.1.71 : Ip del teléfono
10.0.1.5 : Ip del tftp / asterisk
spa$MA.xml: el fichero de configuración que hayamos creado, que está basado en la cadena spa + la mac address del dispositivo y con la extensión XML

Y a seguir configurando 😉