|Summary:||ASTERISK-04575: no colors on console when asterisk is is running as remote console (asterisk -rc)|
|Reporter:||Frank Sautter (xylome)||Labels:|
|Date Opened:||2005-07-13 08:03:46||Date Closed:||2011-06-07 14:10:02|
|Environment:||Attachments:||( 0) colorterm.patch.txt|
|Description:||when asterisk runs detached (e.g. by a init.d script) and one connects to asterisk with asterisk -rc, no colors are show on the cli.|
it seems that on line 1830 of asterisk.c the argument count is set to another value than it gets on startup (the comment says something about remembering and therefore term_init (line 72 of term.c) returning early with no colors set.
|Comments:||By: Michael Jerris (mikej) 2005-07-13 08:34:34|
Can you supply a patch to fix this?
By: Frank Sautter (xylome) 2005-07-13 09:20:50
no, i can't supply a patch to this, as i don't know why argc is recalculated. i think someone did it with an intention, but i don't know why (as i wrote above the comment in the sourcecode says something about remembering the old values - but why?).
By: twisted (twisted) 2005-07-13 10:38:17
I have no problems getting color from remote console with -r or -R (without the c). I think you need to check your termcap/terminal type settings.
By: Russell Bryant (russell) 2005-07-13 10:53:37
It doesn't make any sense to use the 'r' and 'c' options together. 'c' is for starting up the Asterisk console, and 'r' is to connect to a running instance of Asterisk. Try it with just 'r'.
By: Frank Sautter (xylome) 2005-07-13 12:01:14
term.c line 72
if (!option_console || option_nocolor || !option_nofork)
according to this i need following parameters to get color: -rc or -Rc but not -n
so i need both to get color.
By: Frank Sautter (xylome) 2005-07-13 12:17:57
ok. i think i can provide a better bugreport now:
TERM is set to 'xterm' or whatever supports color (confirmed with printf in term.c)
when i do the following i get color on the remote console:
starting asterisk in console 1: asterisk -c
starting asterisk in console 2: asterisk -rcvvvv => color
when i do this i get _NO_ color (but deamonized is the way a startscript will start asterisk):
starting asterisk in console 1: asterisk
starting asterisk in console 2: asterisk -rcvvvv => _NO_ color
By: Kevin P. Fleming (kpfleming) 2005-07-13 12:29:22
I can understand why that would be the case, because there is no 'primary' console in that situation. However, I can't really justify spending any time to fix this one, it's purely cosmetic... If you or someone else can provide a patch to take care of it that would be fine, but I suspect that it will not be trivial.
By: twisted (twisted) 2005-07-13 13:27:43
You do NOT need -c to get color. I connect to (literally) hundreds of asterisk boxes a day, and get color just fine with -r or -R.
This issue has been touched many times before, and it depends on your terminal settings/termcap/terminfo db.
The only boxes I do not get color on are ones that do not have proper config in termcap/terminfo, or i'm not connected with a valid terminal type based on those files.
By: Frank Sautter (xylome) 2005-07-13 13:50:25
well i dug now deeper into source code. just read my posting above. you ONLY get color if:
* asterisk does not run detached -and
* has a proper TERM setting -and
* has proper termcap/terminfo files
the main asterisk process determines if there is color or not... not the remote clients!
obviously the main asterisk process on the machines you manage are not detached and have a console.
By: Frank Sautter (xylome) 2005-07-13 13:55:50
i supplied a patch, that solves the color problem for me.
yes, i know this is only cosmetics, but why should have someone programmed this colour stuff in asterisk. life is colourful!
now how about the odds getting this into cvs and quieting all the mailinglist questions on colored cli?
By: drmac (drmac) 2005-07-13 14:24:09
i just wish the default background color wasn't black. yuck. and asterisk doesn't seem to honor my env setting for a new background color.
By: twisted (twisted) 2005-07-13 15:39:45
xylome, actually, i'm using safe_asterisk with no arguments passed, and simply a redirected output to a vty. the command, as run, is this:
asterisk >& /dev/tty9 < /dev/tty9
as you will see, it is simply piping the output of the process to an un-initialized console, and reading stdin from that same console. That console is not running getty, therefore has no environment settings (term type, etc).
Wouldn't this have to be a console with an environment to be subject to the rules you stated? asterisk by iteself (with no arguments) detaches from the running terminal.
By: Michael Jerris (mikej) 2005-07-20 18:37:59
bug suspended due to lack of response to questions. Feel free to re-open if you wish to persue this.