I am trying to set up color prompt in
asterisk CLI. In the documentation I have found this:
%Cn[;n]Change terminal foreground (and optional background) color to specified. A full list of colors may be found in include/asterisk/term.h*
But nowhere could I find what format the color code should be. I have tried all possible permutations, none of them works:
ASTERISK_PROMPT="%Cn[COLOR_BLUE] %H: " asterisk -vvvvvvr ASTERISK_PROMPT="%Cn[32;128] %H: " asterisk -vvvvvvr ASTERISK_PROMPT="%Cn[32;] %H: " asterisk -vvvvvvr ASTERISK_PROMPT="%Cn[;32] %H: " asterisk -vvvvvvr ASTERISK_PROMPT="%Cn[;COLOR_CYAN] %H: " asterisk -vvvvvvr ASTERISK_PROMPT="%Cn[32|128] %H: " asterisk -vvvvvvr
can somebody please tell me how to make my asterisk prompt red, for example?
Also, I have another issue with the CLI prompt:
I am using Asterisk 11.13 on Debian Wheezy. When I am in
asterisk CLI, I can use command history and "readline-like" functions such as CTRL+r to search. But not all functions are available. For example, the alternate mappings for "page up" and "page down" to search the history do not work. They work in everything else (bash, mysql, ..)
$ cat /etc/inputrc "\e[5~": history-search-forward "\e[6~": history-search-backward
is there a way to make it work in asterisk ?
The "ASTERISK_PROMPT" is an environment variable and should be set prior to starting the CLI for it to take affect.
export ASTERISK_PROMPT="%C31%H*CLI%#" asterisk -r
As for your specific version, (Asterisk 11 branch) The reasons for not displaying colors is as follows:
- The command-line options to connect to the server includes the "no-color" flag.
- No "term" environment variable is defined.
- If the terminfo database exists, and either does not include a max_colors definition, or the value = 0.
- The "term" environment variable does not include one of the following:
If any of those criteria are met... you won't get vt100 colors.
This information is taken directly from the source-code.