[Asterisk-Users] vserver (Debian) - no tty: howto use /usr/sbin/safe_asterisk with "-c" for color CLI?

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Jul 4 09:05:46 MST 2006


On Tue, Jul 04, 2006 at 05:10:35PM +0200, Robert Michel wrote:
> Salve *!
> 
> I'm using asterisk for a while and now I want to have a colord CLI.
> I have apt-get install asterisk/testing, that is asterisk 1.2.7.1
> 
> I use Debian stable/testing on a vserver with any /dev/tty*.
> So, of course, I comment out "#TTY=9" inside /usr/sbin/safe_asterisk.

safe_asterisk has a flawed logic: it assumes that the tty device will
always exist. Thus it is not suited for use with screen.

However wouldn't it be better to tell asterisk to have colors even in a
remote terminal unless you use -n?

See attached patch for a possible route. I don't remember if I tested
it, though.

-- 
Tzafrir Cohen      sip:tzafrir at local.xorcom.com
icq#16849755       iax:tzafrir at local.xorcom.com
+972-50-7952406           
tzafrir.cohen at xorcom.com  http://www.xorcom.com
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## remote_color.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Make Asterisk's terminal use colors by default. Doesn't work

@DPATCH@
diff -urNad asterisk-1.2.7.1.dfsg/term.c /tmp/dpep.2czPCU/asterisk-1.2.7.1.dfsg/term.c
--- asterisk-1.2.7.1.dfsg/term.c	2005-11-29 20:24:39.000000000 +0200
+++ /tmp/dpep.2czPCU/asterisk-1.2.7.1.dfsg/term.c	2006-05-13 19:05:50.209354595 +0300
@@ -78,9 +78,11 @@
 	char buffer[512] = "";
 	int termfd = -1, parseokay = 0, i;
 
+	if (! option_nofork) /* if we daemonize, our terminal is irrelevant */
+		term = "xterm";
 	if (!term)
 		return 0;
-	if (!option_console || option_nocolor || !option_nofork)
+	if (option_nocolor)
 		return 0;
 
 	for (i=0 ;; i++) {


More information about the asterisk-users mailing list