VOZ logo

Simplificando el uso de la consola CLI de Asterisk

Leo en VoIPNews que mvanbaak ha enviado un parche que permitiría a Asterisk manejar comandos alias de otros y de esta manera simplificar bastante los comandos que cada vez son más largos y más completos.

Así podríamos tener un archivo cli_aliases.conf con lo siguiente:

;
; CLI Aliases configuration
;
; This module also registers a «cli show aliases» CLI command to list
; configured CLI aliases.

[general]
; Here you define what alias templates you want to use. You can also define
; multiple templates to use as well. If you do, and there is a conflict, then
; the first alias defined will win.
;
template = friendly ; By default, include friendly aliases
;template = asterisk12 ; Asterisk 1.2 style syntax
;template = asterisk14 ; Asterisk 1.4 style syntax
;template = individual_custom ; see [individual_custom] example below which
; includes a list of aliases from an external
; file

; Because the Asterisk CLI syntax follows a «module verb argument» syntax,
; sometimes we run into an issue between being consistant with this format
; in the core system, and maintaining system friendliness. In order to get
; around this we’re providing some useful aliases by default.
;
[friendly]
hangup request=channel request hangup
originate=channel originate
help=core show help
pri intense debug span=pri set debug 2 span

; CLI Alias Templates
; ——————-
;
; You can define several alias templates.
; It works with context templates like all other configuration files
;
[asterisk](!)
; To create an alias you simply set the variable name as the alias and variable
; value as the real CLI command you want executed
;die die die=stop now

[asterisk16](asterisk)
; Alias for making voicemail reload actually do module reload app_voicemail.so
;voicemail reload=module reload app_voicemail.so
; This will make the CLI command «mr» behave as though it is «module reload».
mr=module reload
;
;
; In addition, you could also include a flat file of aliases which is loaded by
; the [individual_custom] template in the [general] section.
;
;[individual_custom]
;#include «/etc/asterisk/aliases»

Así, si en la consola escribimos mr, el sistema ejecutará module reload y así con otros comandos que podamos ejecutar habitualmente.

Es una estupenda idea y noticia para aquellos que nos quejamos que cada versión de Asterisk incluye nuevos comandos ‘core’ ‘module’ ‘…’ que alargan el comando final para simplemente ver quien está hablando o habilitar/deshabilitar el debug.

De momento el parche ya está disponible y ha sido añadido a la versión trunk de Asterisk.

*Actualización*
Según pudimos ver en la conferencia de Kevin P. Flemming  en el VoIP2DAY, esta utilidad estará disponible en la versión de Asterisk 1.6.2. 🙂

Anterior artículoVideoconferencia en GMail
Siguiente artículo 1910-1904Comienza el VoIP2DAY (Dia 1)