“如何使用Debug方式来排查Asterisk和FreePBX问题”的版本间的差异
来自最权威最新完整开源SIP,语音通信,融合通信中文技术文档资料,提供详细的Asterisk Freepbx, FreeSBC, 免费会话边界控制器,网关,语音板卡,IPPBX,SBC配置资料-asterisk,freepbx,freesbc 用户手册 界面配置,呼叫路由,IVR, 网关对接,拨号规则,SIP 分机呼叫,pjsip, IVR, 录音, CDR, 队列呼叫,振铃组,CLI 命令中文资料手册
(创建页面,内容为“如何排查问题是技术人员经常遇到的问题,如果技术人员能够提供非常完整的debug消息,这样就会大大提高排查问题的速度,...”) |
|||
(未显示同一用户的1个中间版本) | |||
第12行: | 第12行: | ||
*Asterisk Logs - Part II | *Asterisk Logs - Part II | ||
*Backtraces (Segfaults/Core Dumps/Asterisk Crashing) | *Backtraces (Segfaults/Core Dumps/Asterisk Crashing) | ||
− | * | + | *官方权威工具 |
+ | |||
+ | 1)通过执行命令来激活Debug方式,保存相关的日志到相应的默认路径。 | ||
+ | 在linux CLI环境下,执行amportal a dbug,显示以下输出结果, 开发人员可以根据相应的路径文件检查问题。 | ||
+ | <pre> | ||
+ | <nowiki>[root@dahdidev1 ~]# amportal a dbug | ||
+ | Fetching FreePBX settings with gen_amp_conf.php.. | ||
+ | trying to run as user asterisk: | ||
+ | [FPBXDBUGDISABLE] already set to [0] | ||
+ | |||
+ | ==> /var/log/asterisk/freepbx_dbug <== | ||
+ | |||
+ | ==> /var/log/httpd/error_log <== | ||
+ | mv: cannot stat `/var/lib/asterisk/agi-bin/license-*.zl': No such file or directory | ||
+ | [Wed Dec 03 00:05:09 2014] [error] [client 125.64.35.67] File does not exist: /var/www/html/zc | ||
+ | [Wed Dec 03 01:14:26 2014] [error] [client 125.64.35.67] File does not exist: /var/www/html/ucp/zc | ||
+ | [Wed Dec 03 01:14:26 2014] [error] [client 125.64.35.67] File does not exist: /var/www/html/restapi | ||
+ | [Wed Dec 03 01:14:26 2014] [error] [client 125.64.35.67] File does not exist: /tftpboot/zc | ||
+ | [Wed Dec 03 01:14:26 2014] [error] [client 125.64.35.67] File does not exist: /var/www/html/aastra | ||
+ | [Wed Dec 03 01:14:26 2014] [error] [client 125.64.35.67] File does not exist: /var/www/html/restapps | ||
+ | [Wed Dec 03 01:59:48 2014] [error] [client 94.102.49.82] script '/var/www/html/recordings/index.php' not found or unable to stat | ||
+ | [Wed Dec 03 01:59:50 2014] [error] [client 94.102.49.82] File does not exist: /var/www/html/admin/modules/admindashboard | ||
+ | [Wed Dec 03 01:59:51 2014] [error] [client 94.102.49.82] client denied by server configuration: /var/www/html/admin/page.framework.php | ||
+ | |||
+ | ==> /var/log/asterisk/freepbx.log <== | ||
+ | [2014-Dec-03 09:44:02] [PHP-WARNING] (/var/www/html/admin/modules/endpoint/functions.inc/functions_epm_ucp.php:0) - No license for this product (PBXact) - make sure zend_loader.license_path is properly configured in your ini file! | ||
+ | [2014-Dec-03 09:44:02] [PHP-WARNING] (/var/www/html/admin/modules/endpoint/functions.inc/functions_epm_ucp.php:0) - License check failed! | ||
+ | [2014-Dec-03 09:57:01] [WARNING] (libraries/modulefunctions.legacy.php:7) - Depreciated Function _module_distro_id detected in /var/www/html/admin/modules/sysadmin/functions.inc/general.php on line 107 | ||
+ | [2014-Dec-03 09:57:01] [PHP-NOTICE] (/var/www/html/admin/modules/sysadmin/functions.inc/license.php:53) - Undefined index: register | ||
+ | [2014-Dec-03 09:57:02] [WARNING] (libraries/modulefunctions.legacy.php:7) - Depreciated Function _module_distro_id detected in /var/www/html/admin/modules/sysadmin/functions.inc/general.php on line 107 | ||
+ | [2014-Dec-03 09:57:02] [PHP-NOTICE] (/var/www/html/admin/modules/sysadmin/functions.inc/license.php:53) - Undefined index: register | ||
+ | [2014-Dec-03 09:58:20] [INFO] (bin/freepbx_setting:39) - trying to run as user asterisk: | ||
+ | [2014-Dec-03 09:58:20] [INFO] (bin/freepbx_setting:40) - | ||
+ | [2014-Dec-03 09:58:21] [INFO] (bin/freepbx_setting:61) - [FPBXDBUGDISABLE] already set to [0] | ||
+ | [2014-Dec-03 09:58:21] [INFO] (bin/freepbx_setting:62) -</nowiki> | ||
+ | </pre> | ||
+ | 2)Browser Debug (Console Log),这个方法是通过浏览器的开放模式来检查问题。开发人员需要根据自己所使用的浏览器,通过不同的命令方式来排查。 | ||
+ | <pre> | ||
+ | CHROME: | ||
+ | Press either CTRL + SHIFT + J to open the “console” tab of the Developer Tools. | ||
+ | Alternative method: | ||
+ | |||
+ | Press either CTRL + SHIFT + I or F12 to open the Developer Tools. | ||
+ | Press ESC (or click on “Show console” in the bottom right corner) to slide the console up. | ||
+ | Note: In Chrome’s dev tools, there is a “console” tab. However, a smaller “slide-up” console can be opened while any of the other tabs is active. | ||
+ | |||
+ | SAFARI: | ||
+ | Press CTRL + ALT + I to open the Web Inspector. | ||
+ | See Chrome’s step 2. (Chrome and Safari have pretty much identical dev tools.) | ||
+ | Note: Step 1 only works if the “Show Develop menu in menu bar” check box in the Advanced tab of the Preferences menu is checked! | ||
+ | |||
+ | IE9: | ||
+ | Press F12 to open the developer tools. | ||
+ | Click the “console” tab. | ||
+ | FIREFOX: | ||
+ | Press CTRL + SHIFT + K to open the Web console (COMMAND + SHIFT + K on Macs). | ||
+ | or, if Firebug is installed: | ||
+ | |||
+ | Press F12 to open Firebug. | ||
+ | Click on the “console” tab. | ||
+ | OPERA: | ||
+ | Press CTRL + SHIFT + I to open Dragonfly. | ||
+ | Click on the “console” tab. | ||
+ | </pre> | ||
+ | |||
+ | 3) Asterisk Logs 日志文件 | ||
+ | <pre> | ||
+ | root@freepbxdev1 ivr]# tail -f /var/log/asterisk/full // 默认asterisk日志存储路径 | ||
+ | [2014-12-03 13:20:53] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed | ||
+ | [2014-12-03 13:22:41] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed | ||
+ | [2014-12-03 13:23:22] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed | ||
+ | [2014-12-03 13:25:51] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed | ||
+ | [2014-12-03 13:27:41] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed | ||
+ | [2014-12-03 13:27:59] WARNING[6287] res_calendar_caldav.c: Unknown response to CalDAV calendar myGoogleCal, request REPORT to /calendar/dav/en.usa%23holiday%40group.v.calendar.google.com/events: SSL handshake failed: SSL error: GnuTLS internal error. | ||
+ | [2014-12-03 13:28:20] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed | ||
+ | [2014-12-03 13:30:49] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed | ||
+ | [2014-12-03 13:32:41] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed | ||
+ | [2014-12-03 13:33:18] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed | ||
+ | </pre> | ||
+ | |||
+ | 如果需要查找特定的条件的话,也可以通过以下命令grep排查报错日志信息: | ||
+ | <pre> | ||
+ | [root@34693894 ~]# grep 1518526777.67 /var/log/asterisk/full* | ||
+ | /var/log/asterisk/full-20180214:[2018-02-13 08:59:37] VERBOSE[24184][C-00000001] pbx.c: Executing [s@macro-user-callerid:1] Set("SIP/5002-00000001", "TOUCH_MONITOR=1518526777.67") in new stack | ||
+ | /var/log/asterisk/full-20180214:[2018-02-13 08:59:37] VERBOSE[24184][C-00000001] pbx.c: Executing [700@from-internal:37] QueueLog("SIP/5002-00000001", "700,1518526777.67,NONE,DID,") in new stack | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | 4) 使用Backtraces (Segfaults/Core Dumps/Asterisk Crashing)检查崩溃信息 | ||
+ | 4.1 可以使用命令查找方式: | ||
+ | <pre> | ||
+ | ls -l /tmp | grep core. // 找到相关的core dump 信息。 | ||
+ | </pre> | ||
+ | 4.2 可以使用Sangoma 的开发排查根据来排查,用户需要安装这些开发工具,安装的是ISO版本: | ||
+ | <pre> | ||
+ | # 仅支持 FreePBX Distro 7! | ||
+ | yum install -y sangoma-devel | ||
+ | debuginfo-install --enablerepo=centos7-debuginfo asterisk14 // 这里的支持的是asterisk 14,用户可以使用不同的版本,例如15来排查Asterisk15. | ||
+ | </pre> | ||
+ | 4.3 如果用户运行 13.14.0 或者 14.3.0以上版本,也可以使用系统默认支持的工具: | ||
+ | <pre> | ||
+ | /var/lib/asterisk/scripts/ast_coredumper /tmp/[name of the core file] | ||
+ | </pre> | ||
+ | 4.4 使用最简单命令获得崩溃信息: | ||
+ | <pre> | ||
+ | gdb -se "asterisk" -ex "bt full" -ex "thread apply all bt" --batch -c [name of the core file] > /tmp/backtrace.txt | ||
+ | </pre> | ||
+ | 5) 使用Asterisk官方权威资料和工具来排查问题: | ||
+ | https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace |
2018年12月1日 (六) 10:53的最新版本
如何排查问题是技术人员经常遇到的问题,如果技术人员能够提供非常完整的debug消息,这样就会大大提高排查问题的速度,提高工作效率。在Asterisk和FreePBX环境下,官方提供了多种排查的方式,通过价值排查方式可以轻松解决这些问题。 主要的排查方式包括:
- FreePBX CLI Debug
- FreePBX Debug
- Browser Debug (Console Log)
- CHROME:
- SAFARI:
- IE9:
- FIREFOX:
- OPERA:
- Asterisk Logs
- Asterisk Logs - Part II
- Backtraces (Segfaults/Core Dumps/Asterisk Crashing)
- 官方权威工具
1)通过执行命令来激活Debug方式,保存相关的日志到相应的默认路径。 在linux CLI环境下,执行amportal a dbug,显示以下输出结果, 开发人员可以根据相应的路径文件检查问题。
[root@dahdidev1 ~]# amportal a dbug Fetching FreePBX settings with gen_amp_conf.php.. trying to run as user asterisk: [FPBXDBUGDISABLE] already set to [0] ==> /var/log/asterisk/freepbx_dbug <== ==> /var/log/httpd/error_log <== mv: cannot stat `/var/lib/asterisk/agi-bin/license-*.zl': No such file or directory [Wed Dec 03 00:05:09 2014] [error] [client 125.64.35.67] File does not exist: /var/www/html/zc [Wed Dec 03 01:14:26 2014] [error] [client 125.64.35.67] File does not exist: /var/www/html/ucp/zc [Wed Dec 03 01:14:26 2014] [error] [client 125.64.35.67] File does not exist: /var/www/html/restapi [Wed Dec 03 01:14:26 2014] [error] [client 125.64.35.67] File does not exist: /tftpboot/zc [Wed Dec 03 01:14:26 2014] [error] [client 125.64.35.67] File does not exist: /var/www/html/aastra [Wed Dec 03 01:14:26 2014] [error] [client 125.64.35.67] File does not exist: /var/www/html/restapps [Wed Dec 03 01:59:48 2014] [error] [client 94.102.49.82] script '/var/www/html/recordings/index.php' not found or unable to stat [Wed Dec 03 01:59:50 2014] [error] [client 94.102.49.82] File does not exist: /var/www/html/admin/modules/admindashboard [Wed Dec 03 01:59:51 2014] [error] [client 94.102.49.82] client denied by server configuration: /var/www/html/admin/page.framework.php ==> /var/log/asterisk/freepbx.log <== [2014-Dec-03 09:44:02] [PHP-WARNING] (/var/www/html/admin/modules/endpoint/functions.inc/functions_epm_ucp.php:0) - No license for this product (PBXact) - make sure zend_loader.license_path is properly configured in your ini file! [2014-Dec-03 09:44:02] [PHP-WARNING] (/var/www/html/admin/modules/endpoint/functions.inc/functions_epm_ucp.php:0) - License check failed! [2014-Dec-03 09:57:01] [WARNING] (libraries/modulefunctions.legacy.php:7) - Depreciated Function _module_distro_id detected in /var/www/html/admin/modules/sysadmin/functions.inc/general.php on line 107 [2014-Dec-03 09:57:01] [PHP-NOTICE] (/var/www/html/admin/modules/sysadmin/functions.inc/license.php:53) - Undefined index: register [2014-Dec-03 09:57:02] [WARNING] (libraries/modulefunctions.legacy.php:7) - Depreciated Function _module_distro_id detected in /var/www/html/admin/modules/sysadmin/functions.inc/general.php on line 107 [2014-Dec-03 09:57:02] [PHP-NOTICE] (/var/www/html/admin/modules/sysadmin/functions.inc/license.php:53) - Undefined index: register [2014-Dec-03 09:58:20] [INFO] (bin/freepbx_setting:39) - trying to run as user asterisk: [2014-Dec-03 09:58:20] [INFO] (bin/freepbx_setting:40) - [2014-Dec-03 09:58:21] [INFO] (bin/freepbx_setting:61) - [FPBXDBUGDISABLE] already set to [0] [2014-Dec-03 09:58:21] [INFO] (bin/freepbx_setting:62) -
2)Browser Debug (Console Log),这个方法是通过浏览器的开放模式来检查问题。开发人员需要根据自己所使用的浏览器,通过不同的命令方式来排查。
CHROME: Press either CTRL + SHIFT + J to open the “console” tab of the Developer Tools. Alternative method: Press either CTRL + SHIFT + I or F12 to open the Developer Tools. Press ESC (or click on “Show console” in the bottom right corner) to slide the console up. Note: In Chrome’s dev tools, there is a “console” tab. However, a smaller “slide-up” console can be opened while any of the other tabs is active. SAFARI: Press CTRL + ALT + I to open the Web Inspector. See Chrome’s step 2. (Chrome and Safari have pretty much identical dev tools.) Note: Step 1 only works if the “Show Develop menu in menu bar” check box in the Advanced tab of the Preferences menu is checked! IE9: Press F12 to open the developer tools. Click the “console” tab. FIREFOX: Press CTRL + SHIFT + K to open the Web console (COMMAND + SHIFT + K on Macs). or, if Firebug is installed: Press F12 to open Firebug. Click on the “console” tab. OPERA: Press CTRL + SHIFT + I to open Dragonfly. Click on the “console” tab.
3) Asterisk Logs 日志文件
root@freepbxdev1 ivr]# tail -f /var/log/asterisk/full // 默认asterisk日志存储路径 [2014-12-03 13:20:53] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed [2014-12-03 13:22:41] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed [2014-12-03 13:23:22] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed [2014-12-03 13:25:51] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed [2014-12-03 13:27:41] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed [2014-12-03 13:27:59] WARNING[6287] res_calendar_caldav.c: Unknown response to CalDAV calendar myGoogleCal, request REPORT to /calendar/dav/en.usa%23holiday%40group.v.calendar.google.com/events: SSL handshake failed: SSL error: GnuTLS internal error. [2014-12-03 13:28:20] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed [2014-12-03 13:30:49] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed [2014-12-03 13:32:41] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed [2014-12-03 13:33:18] WARNING[6227] res_pjsip_mwi.c: AOR 1000 has no configured mailboxes. MWI subscription failed
如果需要查找特定的条件的话,也可以通过以下命令grep排查报错日志信息:
[root@34693894 ~]# grep 1518526777.67 /var/log/asterisk/full* /var/log/asterisk/full-20180214:[2018-02-13 08:59:37] VERBOSE[24184][C-00000001] pbx.c: Executing [s@macro-user-callerid:1] Set("SIP/5002-00000001", "TOUCH_MONITOR=1518526777.67") in new stack /var/log/asterisk/full-20180214:[2018-02-13 08:59:37] VERBOSE[24184][C-00000001] pbx.c: Executing [700@from-internal:37] QueueLog("SIP/5002-00000001", "700,1518526777.67,NONE,DID,") in new stack
4) 使用Backtraces (Segfaults/Core Dumps/Asterisk Crashing)检查崩溃信息 4.1 可以使用命令查找方式:
ls -l /tmp | grep core. // 找到相关的core dump 信息。
4.2 可以使用Sangoma 的开发排查根据来排查,用户需要安装这些开发工具,安装的是ISO版本:
# 仅支持 FreePBX Distro 7! yum install -y sangoma-devel debuginfo-install --enablerepo=centos7-debuginfo asterisk14 // 这里的支持的是asterisk 14,用户可以使用不同的版本,例如15来排查Asterisk15.
4.3 如果用户运行 13.14.0 或者 14.3.0以上版本,也可以使用系统默认支持的工具:
/var/lib/asterisk/scripts/ast_coredumper /tmp/[name of the core file]
4.4 使用最简单命令获得崩溃信息:
gdb -se "asterisk" -ex "bt full" -ex "thread apply all bt" --batch -c [name of the core file] > /tmp/backtrace.txt
5) 使用Asterisk官方权威资料和工具来排查问题: https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace