Version 0.1.7 from FTP
[asterisk/asterisk.git] / asterisk.c
index bec0894..de86f56 100755 (executable)
@@ -16,6 +16,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/options.h>
 #include <asterisk/cli.h>
+#include <asterisk/channel.h>
 #include <stdio.h>
 #include <signal.h>
 #include <sched.h>
@@ -32,6 +33,8 @@ int option_console=0;
 int option_highpriority=0;
 int fully_booted = 0;
 
+char defaultlanguage[MAX_LANGUAGE] = DEFAULT_LANGUAGE;
+
 #define HIGH_PRIORITY 1
 #define HIGH_PRIORITY_SCHED SCHED_RR
 
@@ -45,6 +48,19 @@ static void urg_handler(int num)
        return;
 }
 
+static void set_title(char *text)
+{
+       /* Set an X-term or screen title */
+       if (getenv("TERM") && strstr(getenv("TERM"), "xterm"))
+               fprintf(stdout, "\033]2;%s\007", text);
+}
+
+static void set_icon(char *text)
+{
+       if (getenv("TERM") && strstr(getenv("TERM"), "xterm"))
+               fprintf(stdout, "\033]1;%s\007", text);
+}
+
 static int set_priority(int pri)
 {
        struct sched_param sched;
@@ -207,6 +223,10 @@ int main(int argc, char *argv[])
        if (option_console) {
                /* Console stuff now... */
                /* Register our quit function */
+               char title[256];
+               set_icon("Asterisk");
+               snprintf(title, sizeof(title), "Asterisk Console (pid %d)", getpid());
+               set_title(title);
            ast_cli_register(&quit);
                consolethread = pthread_self();
                if (strlen(filename))