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 😉

Protegiendo nuestro gateway sip, parte 2

Como ya he comentado en otras ocasiones, la mayoría de ataques a pbx SIP abiertas a internet, están realizados por software tipo sipVicious y similares.

Si tenemos la posibilidad de usar un firewall con inspección a layer 7, podemos filtrar los User-Agent, tal y como expliqué en la entrada anterior.

Ahora, supongamos que tenemos un mikrotik, con RouterOS 6.x…


/ip firewall layer7-protocol
add name=sip regexp="^.+(sundayddr).*\$"
add name=sip1 regexp="^.+(sipsak).*\$"
add name=sip2 regexp="^.+(sipvicious).*\$"
add name=sip3 regexp="^.+(friendly-scanner).*\$"
add name=sip4 regexp="^.+(iWar).*\$"
add name=sip5 regexp="^.+(sip-scan).*\$"
add name=sip6 regexp="^.+(Ozeki).*\$"
add name=sip8 regexp="^.+(sip-cli).*\$"
add name=sip7 regexp="^.+(VaxSIPUserAgent).*\$"
add name=sip9 regexp="^.+(sipcli).*\$"

/ip firewall filter
add action=fasttrack-connection chain=forward connection-state=established,related
add chain=forward connection-state=established,related
add action=drop chain=forward connection-state=invalid
add action=drop chain=forward comment=voip_sundayddr_deny dst-address-list=AUTH layer7-protocol=sip
add action=drop chain=forward comment=voip_sipsak_deny dst-address-list=AUTH layer7-protocol=sip1
add action=drop chain=forward comment=voip_sipvicious_deny dst-address-list=AUTH layer7-protocol=sip2
add action=drop chain=forward comment=voip_friendly-scanner_deny dst-address-list=AUTH layer7-protocol=sip3
add action=drop chain=forward comment=voip_iWar_deny dst-address-list=AUTH layer7-protocol=sip4
add action=drop chain=forward comment=voip_sip-scan_deny dst-address-list=AUTH layer7-protocol=sip5
add action=drop chain=forward comment=voip_Ozeki_deny dst-address-list=AUTH layer7-protocol=sip6
add action=drop chain=forward comment=voip_VaxSIPUserAgent_deny dst-address-list=AUTH layer7-protocol=sip7
add action=drop chain=forward comment=voip_sip-cli_deny dst-address-list=AUTH layer7-protocol=sip8
add action=drop chain=forward comment=voip_sipcli_deny dst-address-list=AUTH layer7-protocol=sip9

hay que tener activado el connection Tracking activado.

enjoy 😉

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 🙂

Protegiendo nuestro gateway SIP

Desde hace tiempo, en los gateways SIP, proxys o centralitas que tengo publicados en internet, he visto un aumento importante de los ataques y escaneos…. no me quita el sueño, pero siempre me queda la “intranquilidad” de .. ¿y si un día acaban entrando ?.

Capturando paquetes con ngrep, veo la siguiente traza …

#
U +113.591586 46.251.228.241:5065 -> 192.168.10.17:5060
OPTIONS sip:100@192.168.2.17:5060 SIP/2.0
Via: SIP/2.0/UDP 46.251.228.241:5065;branch=z9hG4bK-3879111841;rport
Content-Length: 0
From: "sipvicious"<sip:100@1.1.1.1>;tag=3664343530613930313363340131333838313931323031
Accept: application/sdp
User-Agent: friendly-scanner
To: "sipvicious"<sip:100@1.1.1.1>
Contact: sip:100@46.251.228.241:5065
CSeq: 1 OPTIONS
Call-ID: 1162121562622760871341331
Max-Forwards: 70

46.251.228.241 = es uno de los amigos que me intenta atacar
192.168.10.17 = La ip interna de un asterisk
From: “sipvicious” = El identificador del software que hace el ataque
User-Agent: friendly-scanner = Cadena que identifica el software, que el caso de los teléfonos, por ejemplo un snom 320 es : User-Agent: snom320/8.7.3.7

Investigando el iptables y googleando veo ésto, así que manos a la obra y hago este script:

iptables -N SIPDDOS
iptables -A INPUT -i eth0 -p udp -m udp --dport 5060 -m string --string "sundayddr" --algo bm --to 65535 -m comment --comment "deny sundayddr" -j SIPDDOS
iptables -A INPUT -i eth0 -p udp -m udp --dport 5060 -m string --string "sipsak" --algo bm --to 65535 -m comment --comment "deny sipsak" -j SIPDDOS
iptables -A INPUT -i eth0 -p udp -m udp --dport 5060 -m string --string "sipvicious" --algo bm --to 65535 -m comment --comment "deny sipvicious" -j SIPDDOS
iptables -A INPUT -i eth0 -p udp -m udp --dport 5060 -m string --string "friendly-scanner" --algo bm --to 65535 -m comment --comment "deny friendly-scanner" -j SIPDDOS
iptables -A INPUT -i eth0 -p udp -m udp --dport 5060 -m string --string "iWar" --algo bm --to 65535 -m comment --comment "deny iWar" -j SIPDDOS
iptables -A INPUT -i eth0 -p udp -m udp --dport 5060 -m string --string "sip-scan" --algo bm --to 65535 -m comment --comment "deny sip-scan" -j SIPDDOS
iptables -A SIPDDOS -j LOG --log-prefix "firewall-sipddos: " --log-level 6
iptables -A SIPDDOS -j DROP

Para ver si es efectivo, esperamos un rato y de mientras miramos en /var/log/syslog ……. y encontramos ya un intento 🙂

..
poseidon kernel: [1710588.138605] firewall-sipddos: IN=eth0 OUT= MAC=00:0c:29:2d:1e:1f:00:0e:38:d5:26:0f:08:00 SRC=183.87.140.226 DST=192.168.2.17 LEN=438 TOS=0x00 PREC=0x00 TTL=47 ID=0 DF PROTO=UDP SPT=5069 DPT=5060 LEN=418

Nuestro IPTABLES, ya se ha encargado de filtrar este intruso… ahora a seguir con ngrep….

Recordamos el comando :

ngrep -d any -P ' ' -W byline -T port 5060

Y enjoy your rules 😉

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

Llámame a mi email

Otra entrada que es un apunte.

Recientemente, he tenido que probar esta funcionalidad con mi centralita casera, basada en asterisk.

La idea es, que desde cualquier teléfono IP compatible, sin necesidad de estar registrado en ningún servicio voIP, marques craem@craem.net y la llamada llegue a mi casa / móvil o lo que sea…. la verdad es que es bastante chulo y lo veo realmente práctico; tu teléfono es tu dirección de email.

Nos ponemos a ello; primero de todo hemos de modificar nuestro dominio para que sepa que tenemos un servicio SIP:

SipDNS

Y explicamos un poco el registro:

_sip._tcp.craem.net SRV 0 5 5060 sip.craem.net.
_sip._udp.craem.net SRV 0 5 5060 sip.craem.net.

_sip._tcp.craem.net SRV 0 5 5060 sip.craem.net.

_sip._tcp –> tipo de servicio SIP, en este caso, TCP (por ahora no lo tengo funcionando)
_sip._udp –> Este es el que tengo activo.

SRV –> tipo de registro

0 –> Prioridad (de momento sólo tengo una conexión a internet).
5 –> Peso
5060 –> Puerto donde tenemos el servicio
sip.craem.net –> donde tenemos apuntando el servicio.

Una vez llegados aquí, nos toca configurar el asterisk; editamos el fichero sip.conf y en la sección [general], lo tenemos que dejar tal que:

context=default ; contexto por defecto, entrantes... por si peta que solo puedan llamar a las locales
allowguest=yes ; Allow or reject guest calls (default is yes)
language=es ; lo pasamos a castellano
allowexternalinvites=no ; para evitar marrones

Hemos de permitir las llamadas anónimas, pero las enviaremos al contexto DEFAULT… OJO CON PONER EN EL CONTEXTO DEFAULT, REFERENCIAS A LLAMADAS SALIENTES. Seguro de que alguno de los que leen el blog ha sufrido “robos” de dinero en la centralita por culpa de malas configuraciones.

No vamos a explicar cómo protegerla, pero empieza por tener contraseñas fuertes, límite de llamadas, etc… y ahora el contexto default en en extensions.conf

[default]
exten => test1,1,Dial(SIP/3010,30)
exten => test1,n,VoiceMail()
exten => test1,n,Hangup()
exten => test2,1,Dial(SIP/3000,30)
exten => test2,n,VoiceMail()
exten => test2,n,Hangup()
exten => music,1,MusicOnHold(default)
exten => music,n,Hangup
exten => s,1,Noop(Colgando la llamada.....)
exten => s,2,Hangup

Si queréis probar, llamar a music@craem.net y os sonará la música en espera que tengo en el asterisk.

Y ahora, desde nuestro móvil, hacemos una llamada a music@craem.net y vemos:

-- Executing [music@default:1] MusicOnHold("SIP/1024-9408c880", "default") in new stack
-- Started music on hold, class 'default', on SIP/1024-9408c880

Se ejecuta: music@default:1

music –> donde hemos llamado
default –> contexto default de las llamadas entrantes (SIN PERMISO DE LLAMADAS SALIENTES)

Enjoy 🙂

Group_count asterisk 1.4

Otra entrada que es un apunte.

Recientemente, me ha tocado controlar en un cliente, que los usuarios que usan softphones en sus pc’s, no puedan recibir más de una llamada a la vez.

Mirando por encima en voipinfo, veo que existe la función call-limit, pero mi decepción al comprobar que si lo seteaba a 1, los usuarios podían hacer / recibir llamadas, pero no podían hacer transferencias atendidas, pues se necesitan 2 canales para ello.

Buscando un poco, veo que existe la función GROUP() y GROUP_COUNT(), así que vamos a ello en el fichero extensions.conf:


exten => _[23]XX,n,NoOP(.... llamadas entre extensiones ......)
exten => _[23]XX,n,set(GROUP()=${EXTEN})
exten => _[23]XX,n,NoOP(Group Count = ${GROUP_COUNT(${EXTEN})} para grupo = ${EXTEN})
exten => _[23]XX,n,GotoIf($[ ${GROUP_COUNT(3${EXTEN})} > 1 ]?maxtrucades)
exten => _[23]XX,n,Dial(SIP/${EXTEN},60,tTwWm)
exten => _[23]XX,n,Hangup
exten => _[23]XX,n(maxtrucades),Congestion
exten => _[23]XX,n(maxtrucades),Hangup()

Explicamos un poco el dialplan:

Como lo queremos controlar por extensión, haremos un grupo por extensión:

exten => _[23]XX,n,set(GROUP()=${EXTEN})

Si tiene más de una llamada, lo enviamos a la etiqueta “maxtrucades”

exten => _[23]XX,n,GotoIf($[ ${GROUP_COUNT(3${EXTEN})} > 1 ]?maxtrucades)

Y el resto, es leer el dialplan 😉

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 😉