Mod console

From FreeSWITCH Wiki
Jump to: navigation, search

Contents

Configuration

mod_console simply lets the user control the console messages. There are just a few global options in console.conf.xml, which are found in the <settings> section:

  <settings>
    <param name="colorize" value="true"/>
    <param name="loglevel" value="info"/>
  </settings>

The colorize parameter can be commented out or set to "false" which will cause all console message to be monochrome.
The loglevel parameter specifies the default log level when starting FreeSWITCH. (See Log Levels below.)

(Michael will return later to discuss the <mappings> section of the console.conf.xml file. In the meantime see the comments in the actual console.conf.xml file for some nice tidbits.)

Log Levels

The possible loglevels are:

"CONSOLE" (0),
"ALERT" (1),
"CRIT" (2),
"ERR" (3),
"WARNING" (4),
"NOTICE" (5),
"INFO" (6),
"DEBUG", (7+)

Colors

Colors are specified here

API commands

The console API command can be used to view and modify the colorize/loglevel settings. They can be used from the console, ESL (including fs_cli) or from dialplan (although that seems less useful).

loglevel

To see the current setting:

console loglevel

To change the logging level:

console loglevel console|alert|crit|err|warning|notice|info|debug

This only affects the console, not mod_logfile or clients such as fs_cli.

colorize

To see the current setting:

console colorize

To turn on/off colorization:

console colorize on|off|toggle

This only affects the console, not mod_logfile or clients such as fs_cli.

Hot Keys (defaults)

Note: These can be changed in switch.conf.xml

  • F1: 'help'
  • F2: 'status'
  • F3: 'show channels'
  • F4: 'show calls'
  • F5: 'sofia status'
  • F6: 'reloadxml'
  • F7: 'console loglevel 0'
  • F8: 'console loglevel 7'
  • F9: 'sofia status profile internal'
  • F10: 'sofia profile internal siptrace on'
  • F11: 'sofia profile internal siptrace off'
  • F12: 'version'

General Usage

The console has (customizable) tab completion, as well as aliases, etc. It can be configured to be in colour, or plain.
Most/All of the FSAPI is available at the console, so use it wisely.

Command-Line Editing

As of SVN r13964, functionality in libeditline has been exposed that allows you to customize your command line for the purposes of
editing. For documentation on this matter, see editrc(5).

Examples:

vi-style command line editing, contents of $HOME/.editrc :

 bind -v
 bind ^L ed-clear-screen
 switch_console.c:bind \\t ed-complete
 switch_console.c:bind ^[OP f1-key
 switch_console.c:bind ^[OQ f2-key
 switch_console.c:bind ^[OR f3-key
 switch_console.c:bind ^[OS f4-key
 switch_console.c:bind ^[[15~ f5-key
 switch_console.c:bind ^[[17~ f6-key
 switch_console.c:bind ^[[18~ f7-key
 switch_console.c:bind ^[[19~ f8-key
 switch_console.c:bind ^[[20~ f9-key
 switch_console.c:bind ^[[21~ f10-key
 switch_console.c:bind ^[[23~ f11-key
 switch_console.c:bind ^[[24~ f12-key


emacs-style command line editing, contents of $HOME/.editrc :

 bind -e
 bind ^L ed-clear-screen
 bind ^R em-inc-search-prev
 switch_console.c:bind \\t ed-complete
 switch_console.c:bind ^[OP f1-key
 switch_console.c:bind ^[OQ f2-key
 switch_console.c:bind ^[OR f3-key
 switch_console.c:bind ^[OS f4-key
 switch_console.c:bind ^[[15~ f5-key
 switch_console.c:bind ^[[17~ f6-key
 switch_console.c:bind ^[[18~ f7-key
 switch_console.c:bind ^[[19~ f8-key
 switch_console.c:bind ^[[20~ f9-key
 switch_console.c:bind ^[[21~ f10-key
 switch_console.c:bind ^[[23~ f11-key
 switch_console.c:bind ^[[24~ f12-key


Many other options are possible. Read the editrc(5) manpage for details.