Robert Michel
2006-Jul-04 08:10 UTC
[Asterisk-Users] vserver (Debian) - no tty: howto use /usr/sbin/safe_asterisk with "-c" for color CLI?
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. /etc/init.d/asterisk start calls /usr/sbin/safe_asterisk root 5757 1 0 1149 1348 0 16:08 pts/30 00:00:00 /bin/sh/usr/sbin/safe_asterisk -g -vvv -U asterisk asterisk 5758 5757 0 4502 7992 0 16:08 pts/30 00:00:00 \_/usr/sbin/asterisk -g -vvv -U asterisk When I start asterisk by hand with "asterisk -cgvvv" I got a colored CLI ;) but inside /usr/sbin/safe_asterisk (started by /etc/init.d/asterisk - with "-U asterisk") or inside /etc/init.d/asterisk itself all my tries to use "-c" as additional parameter faild. ;( E.g. I changed line 52 inside etc/init.d/asterisk PARAMS="$PARAMS -U $USER" PARAMS="$PARAMS -c -U $USER" This does run the CLI with color :) also with color for asterisk -rcvvv *but* there is an fast running repeating output after running /etc/init.d/asterisk start Use EXIT or QUIT to exit the asterisk console Use EXIT or QUIT to exit the asterisk console Use EXIT or QUIT to exit the asterisk console [...] The handycap of vserver is, that as root@guest you can't creat devices yourself. I think asterisk is also reading from /dev/tty9, so a ls -s /dev/null /dev/tty9 does not help (tested). Does somebody have an idea how to deal with this? Can I run asterisk with color CLI without a TTY*? Greetings, rob
Tzafrir Cohen
2006-Jul-04 09:05 UTC
[Asterisk-Users] vserver (Debian) - no tty: howto use /usr/sbin/safe_asterisk with "-c" for color CLI?
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@local.xorcom.com icq#16849755 iax:tzafrir@local.xorcom.com +972-50-7952406 tzafrir.cohen@xorcom.com http://www.xorcom.com -------------- next part -------------- #! /bin/sh /usr/share/dpatch/dpatch-run ## remote_color.dpatch by Tzafrir Cohen <tzafrir.cohen@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++) {
Tzafrir Cohen
2006-Jul-08 08:16 UTC
[Asterisk-Users] vserver (Debian) - no tty: howto use /usr/sbin/safe_asterisk with "-c" for color CLI?
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. > > /etc/init.d/asterisk start > calls > /usr/sbin/safe_asterisk > > root 5757 1 0 1149 1348 0 16:08 pts/30 00:00:00 /bin/sh/usr/sbin/safe_asterisk -g -vvv -U asterisk > asterisk 5758 5757 0 4502 7992 0 16:08 pts/30 00:00:00 \_/usr/sbin/asterisk -g -vvv -U asterisk > > > When I start asterisk by hand with "asterisk -cgvvv" > I got a colored CLI ;)Some RTFM from asterisk(8): -c Provide a control console on the calling terminal. Specifying this option implies -f and will cause asterisk to no longer fork or detach from the controlling terminal. The fact that you only get colors there i a byproduct. -c simply tells asterisk not to act as a daemon. -- Tzafrir Cohen sip:tzafrir@local.xorcom.com icq#16849755 iax:tzafrir@local.xorcom.com +972-50-7952406 tzafrir.cohen@xorcom.com http://www.xorcom.com