Debugging in Yate

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Debug using msgsniff module)
(Use filters with msgsniff)
 
(38 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This page purpose is to show you the methods of debugging in Yate. You can use logging in a file at startup or modules like [[rmanager]] to see debug output in telnet client or [[Debugging_and,_or_Investigation_of_messages|msgsniff]] to  dump the Yate messages to output console or log into file.
+
In Yate there are several ways to debug issues that permits you to monitorize the state of the system and of the modules.
  
=== Debug logged in file===
+
The debugging can be done in two ways:
  
At startup Yate can be started with logging in a file so that you can see the errors in the specified file.
+
* by following the logs from the file
 +
 
 +
* at runtime - use [[rmanager]] module that allows you to see logs in real time and control the logging level.
 +
 
 +
You can use [[Debugging_and,_or_Investigation_of_messages|msgsniff]] to dump the Yate's messages to an output console or log them into a file.
 +
 
 +
When starting Yate with logging, [[rmanager]] module can be used to change the levels for debugging. By doing this the debugging messages will be seen in the console and in the log file.
 +
 
 +
===Start Yate with logging===
 +
 
 +
Start Yate with logging in a file so that you can debug the errors.
  
 
To increase the visible debug level you have to add -v option more than once to the command line or to service start script:
 
To increase the visible debug level you have to add -v option more than once to the command line or to service start script:
Line 9: Line 19:
 
  yate -vvvvv -l logfile -d -s -r  
 
  yate -vvvvv -l logfile -d -s -r  
  
To see what all the other options are please run
+
Also you can use [[rmanager]] module to increase the level of debugging and the output will be seen in the logging file.
 
+
yate --help
+
  
 
=== Debug using [[rmanager]] module===
 
=== Debug using [[rmanager]] module===
Line 17: Line 25:
 
This module allows controlling Yate using a simple [http://en.wikipedia.org/wiki/Telnet telnet] client.  
 
This module allows controlling Yate using a simple [http://en.wikipedia.org/wiki/Telnet telnet] client.  
  
Use telnet in console:
+
When we say to control Yate from console that means that remotely logged you can:  
 +
* start/stop/restart Yate
 +
* debug the modules
 +
* start/stop calls
  
telnet localhost 5038
+
==== Debug modules in Yate====
To:
+
 
* enable debugging and to increase the level of debugging:
+
Reloads module configuration files:
 +
 
 +
:* '''reload''' [plugin]
 +
 
 +
Restarts the engine:
 +
 
 +
:* '''restart''' [now]
 +
 
 +
Stops the engine with optionally provided exit code:
 +
 
 +
:* '''stop''' [exitcode]
 +
 
 +
Show information on how long Yate has run:
 +
 
 +
:* '''uptime'''
 +
 
 +
Controls the modules loaded in the Telephony Engine:
 +
 
 +
:* '''module''' {{load|reload} modulefile|unload modulename|list}
 +
 
 +
Show or change debugging level globally or per module:
 +
 
 +
:* '''debug''' [module] [level|on|off]
  
 +
Example: Enable debugging and increase the level of debugging:
 
  telnet localhost 5038
 
  telnet localhost 5038
 
  debug on  
 
  debug on  
Line 28: Line 62:
 
  debug sip level 10
 
  debug sip level 10
  
* to colorize the output in console:
+
Colorize the output in console:
color on
+
:* '''color''' [on|off]
  
* see output for scripts by setting in PHP script:
+
Shows status of all or selected modules or channels
Yate::Debug(true);
+
:* '''status''' [overview] [modulename]
  
* stop/start a script, useful when changers are done in a script to reload the code in Yate:
+
Example: Show status module accfile
 +
 +
status accfile
 +
%%+status:accfile
 +
name=accfile,type=misc;users=2;line_1=outcalls_1,line_2=outcalls_2
 +
%%-status
  
external stop scriptname.php
+
The output is different depending on the module that is investigated:
external start scriptname.php
+
  
* see the status of modules use command:
+
* for sip module
status
+
  
* view logs in console:
+
status sip                                                                                                                                                         
  logview
+
%%+status:sip                                                                                                                                                       
 +
name=sip,type=varchans,format=Status|Address|Peer;routed=1,routing=0,total=3,chans=2;sip/2=answered|192.168.168.185:5060|sip/3,\ 
 +
sip/3=answered|192.168.168.156:5060|sip/2                                                                                                                                                                 
 +
%%-status
 +
 
 +
* for regfile module says that are 2 users defined
 +
 
 +
status regfile                                                                                                                                                     
 +
%%+status:regfile                                                                                                                                                   
 +
  name=regfile,type=misc;create=false,defined=2,users=2;444=sip/sip:444@192.168.168.156,333=sip/sip:333@192.168.168.185:5060                                         
 +
%%-status                                                                                                                                                           
 +
 
 +
* for mysqldb module:
 +
 
 +
status mysqldb
 +
%%+status:mysqldb
 +
name=mysqldb,type=database,format=Total|Failed|Errors|AvgExecTime;conns=1,failed=0;my_database=1|0|0|15
 +
%%-status
 +
 
 +
Show log of engine startup and initialization process:
 +
 
 +
:* '''logview'''
 +
 
 +
==== Debug calls ====
 +
 
 +
Drops one or all active calls:
 +
 
 +
:* '''drop''' {chan|*|all} [reason]
 +
 
 +
Execute an outgoing call:
 +
 
 +
:* '''call''' chan target
 +
 
 +
==== Debug external scripts ====
 +
 
 +
Enable output in PHP scripts:
 +
 
 +
:* '''Yate::Output(true);'''
 +
 
 +
Stop/start a script, useful when changes are done and you want to reload the new file in Yate:
 +
 
 +
:* external '''stop''' scriptname.php
 +
:* external '''start''' scriptname.php
  
 
=== Debug using [[Debugging_and,_or_Investigation_of_messages|msgsniff]] module===
 
=== Debug using [[Debugging_and,_or_Investigation_of_messages|msgsniff]] module===
Line 49: Line 128:
 
The module will dump the Yate messages to output console or log into file.
 
The module will dump the Yate messages to output console or log into file.
  
This module is loaded but not started by default. To start this module you must enable it in yate.conf as you can see below.
+
By default this module should be loaded but not started. To start this module use the telnet command or configure it to start together with yate.
  
* First enable the module in yate.conf:  
+
====Load module msgsniff====
 +
 
 +
Enable module in yate.conf:  
  
 
  [general]
 
  [general]
  msgsniff=yes
+
  msgsniff=no
 
  modload=no
 
  modload=no
 
  ;Don't forget to load the sniffer module if modload parameter value is 'no'.
 
  ;Don't forget to load the sniffer module if modload parameter value is 'no'.
Line 61: Line 142:
 
  rmanager.yate=yes
 
  rmanager.yate=yes
 
  msgsniff.yate=yes
 
  msgsniff.yate=yes
 +
 +
====Start msgsniff====
  
 
* Start Yate with logging:
 
* Start Yate with logging:
Line 74: Line 157:
 
  ;and disabled with:
 
  ;and disabled with:
 
  sniffer off
 
  sniffer off
 +
 +
====Use filters with msgsniff====
  
 
* Filters can be applied  by specifying regex to match in telnet:  
 
* Filters can be applied  by specifying regex to match in telnet:  
  
 
  sniffer filter ^\(chan\.\|engine\.halt$\)
 
  sniffer filter ^\(chan\.\|engine\.halt$\)
 +
or
 +
sniffer filter ^\(msg\.execute\|call\.route$\)
  
 
* or in yate.conf:  
 
* or in yate.conf:  
Line 87: Line 174:
 
  filtersniff=^\(chan\.\|engine\.halt$\)
 
  filtersniff=^\(chan\.\|engine\.halt$\)
  
 +
===Compiling Yate with xdebug, ddebug or debug===
 +
 +
This is used by developers to test their code, to see information about creating specific objects or if some specific functions are called.
 +
 +
To compile with debug messages when compiling Yate you have to specify:
 +
 +
make xdebug
 +
make ddebug
 +
make debug
 +
 +
When compiling with xdebug, the ddebug messages are included but if ddebug is compiled, xdebug messages are not included.
 +
 +
When compiling with debug symbols of functions are added. This will allow creating a useful core file for debugging purpose.
 +
 +
===Frequently asked question when debugging===
 +
 +
==== How you see if a module is loaded or not?====
 +
 +
Give '''status''' command from telnet, this will list all modules that are loaded in that moment. If module is not listed, then it's not loaded.
 +
 +
====How do I see if a script is running?====
 +
 +
Give command '''external''' from telnet, this will display all scripts running in that moment.
 +
 +
====Why is my script not starting? ====
 +
 +
First check the path to the script to be correct, then check that the file is executable and that Yate has permission to execute the script.
  
 
'''See also'''
 
'''See also'''
Line 94: Line 208:
 
* [[Debugging_and,_or_Investigation_of_messages|msgsniff]]
 
* [[Debugging_and,_or_Investigation_of_messages|msgsniff]]
 
* [[Debug Output]]
 
* [[Debug Output]]
 +
* [[Debugging Yate Client on Windows]]
 +
 +
[[Category:Debug]] [[Category:MsgSniff]]

Latest revision as of 17:03, 14 October 2016

In Yate there are several ways to debug issues that permits you to monitorize the state of the system and of the modules.

The debugging can be done in two ways:

  • by following the logs from the file
  • at runtime - use rmanager module that allows you to see logs in real time and control the logging level.

You can use msgsniff to dump the Yate's messages to an output console or log them into a file.

When starting Yate with logging, rmanager module can be used to change the levels for debugging. By doing this the debugging messages will be seen in the console and in the log file.

Contents

[edit] Start Yate with logging

Start Yate with logging in a file so that you can debug the errors.

To increase the visible debug level you have to add -v option more than once to the command line or to service start script:

yate -vvvvv -l logfile -d -s -r 

Also you can use rmanager module to increase the level of debugging and the output will be seen in the logging file.

[edit] Debug using rmanager module

This module allows controlling Yate using a simple telnet client.

When we say to control Yate from console that means that remotely logged you can:

  • start/stop/restart Yate
  • debug the modules
  • start/stop calls

[edit] Debug modules in Yate

Reloads module configuration files:

  • reload [plugin]

Restarts the engine:

  • restart [now]

Stops the engine with optionally provided exit code:

  • stop [exitcode]

Show information on how long Yate has run:

  • uptime

Controls the modules loaded in the Telephony Engine:

  • module {{load|reload} modulefile|unload modulename|list}

Show or change debugging level globally or per module:

  • debug [module] [level|on|off]

Example: Enable debugging and increase the level of debugging:

telnet localhost 5038
debug on 
debug level 10
debug sip level 10

Colorize the output in console:

  • color [on|off]

Shows status of all or selected modules or channels

  • status [overview] [modulename]

Example: Show status module accfile

status accfile
%%+status:accfile
name=accfile,type=misc;users=2;line_1=outcalls_1,line_2=outcalls_2
%%-status

The output is different depending on the module that is investigated:

  • for sip module
status sip                                                                                                                                                           
%%+status:sip                                                                                                                                                        
name=sip,type=varchans,format=Status|Address|Peer;routed=1,routing=0,total=3,chans=2;sip/2=answered|192.168.168.185:5060|sip/3,\  
sip/3=answered|192.168.168.156:5060|sip/2                                                                                                                                                                  
%%-status 
  • for regfile module says that are 2 users defined
status regfile                                                                                                                                                       
%%+status:regfile                                                                                                                                                    
name=regfile,type=misc;create=false,defined=2,users=2;444=sip/sip:444@192.168.168.156,333=sip/sip:333@192.168.168.185:5060                                           
%%-status                                                                                                                                                            
  • for mysqldb module:
status mysqldb
%%+status:mysqldb
name=mysqldb,type=database,format=Total|Failed|Errors|AvgExecTime;conns=1,failed=0;my_database=1|0|0|15
%%-status

Show log of engine startup and initialization process:

  • logview

[edit] Debug calls

Drops one or all active calls:

  • drop {chan|*|all} [reason]

Execute an outgoing call:

  • call chan target

[edit] Debug external scripts

Enable output in PHP scripts:

  • Yate::Output(true);

Stop/start a script, useful when changes are done and you want to reload the new file in Yate:

  • external stop scriptname.php
  • external start scriptname.php

[edit] Debug using msgsniff module

The module will dump the Yate messages to output console or log into file.

By default this module should be loaded but not started. To start this module use the telnet command or configure it to start together with yate.

[edit] Load module msgsniff

Enable module in yate.conf:

[general]
msgsniff=no
modload=no
;Don't forget to load the sniffer module if modload parameter value is 'no'.
[modules]
;for debugging yate
rmanager.yate=yes
msgsniff.yate=yes

[edit] Start msgsniff

  • Start Yate with logging:
./run -vvvvv -l logfile
  • Enable / Disable sniffer in telnet:

The module must be loaded so that you can use this commands from telnet:

telnet 0 5038
;enable sniffer: 
sniffer on
;and disabled with:
sniffer off

[edit] Use filters with msgsniff

  • Filters can be applied by specifying regex to match in telnet:
sniffer filter ^\(chan\.\|engine\.halt$\)
or
sniffer filter ^\(msg\.execute\|call\.route$\)
  • or in yate.conf:
[default]
; filtersniff: regexp: Default filter to apply to message sniffer at initialization
; If empty it will match all messages except engine.timer which is never displayed
; Example for a filter matching all chan.Anything messages and engine.halt:
filtersniff=^\(chan\.\|engine\.halt$\)

[edit] Compiling Yate with xdebug, ddebug or debug

This is used by developers to test their code, to see information about creating specific objects or if some specific functions are called.

To compile with debug messages when compiling Yate you have to specify:

make xdebug
make ddebug
make debug

When compiling with xdebug, the ddebug messages are included but if ddebug is compiled, xdebug messages are not included.

When compiling with debug symbols of functions are added. This will allow creating a useful core file for debugging purpose.

[edit] Frequently asked question when debugging

[edit] How you see if a module is loaded or not?

Give status command from telnet, this will list all modules that are loaded in that moment. If module is not listed, then it's not loaded.

[edit] How do I see if a script is running?

Give command external from telnet, this will display all scripts running in that moment.

[edit] Why is my script not starting?

First check the path to the script to be correct, then check that the file is executable and that Yate has permission to execute the script.

See also

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers