Asterisk 故障排查
系统问题排查
- 硬件的问题
- 中断
- 版本问题
- 考虑降级测试
- 驱动问题
- 如果是用的 OpenVox, 那么需要从新编译
- 编译驱动时和内核版本有关
- 系统问题
- 切换操作系统
- AsteriskNow, Alpine, CentOS
- 配置问题
- SIP/PJSIP 的问题
- 切换使用
chan_sip
和chan_pjsip
进行尝试
- PJSIP 的问题
- 可能是由于
pjproject
的 bug 问题, 使用 asterisk bundle 的 pj
诊断命令
# 系统状态 - 内存, 运行时间
core show sysinfo
# 查看线程
core show threads
# 查看通话统计
# uptime 会显示通话时间
core show calls uptime
# 查看通道信息
core show channels
# 终止一个 channel
channel request hangup SIP/4003-00000a2f
# 查看注册的 PBX 交换
core show switches
# 开启日志进行排查
core set verbose 4
core set debug 4
# 开启 SIP 日志
pjsip set logger on
From 头包含的地址无效导致解析问题
- 尝试修改 hostname
error parsing header 'Contact' error parsing header 'From'
From: "100" <sip:100@0f7a4948f2>;tag=b6a43727-f5d2-40af-8a93-80739de6d092
Contact: <sip:asterisk@0f7a4948f2ba:5060;transport=ws>
这里的 0f7a4948f2 是不符合 uri 规范的,会导致部分客户端异常
0f7a4948f2 是 hostname - 可以修改
PJSIP 会将请求过来的地址进行转换
same => n,DumpChan()
same => n,NoOp(CALLERID ${CALLERID(all)})
same => n,NoOp(From ${PJSIP_HEADER(read,From)})
原始的 From 里是 IP 地址
接口 originate 一定概率没有声音
查看通话数量和当前开启通道
asterisk -rx 'core show channels'
终端问题排查
- 确保 context 正确
- 尝试关闭 ICE
常见 HTTP 异常状态码
No Response 408 Request Timeout 500 Internal Server Error 502 Bad Gateway 503 Service Unavailable 线路忙、拥塞 504 Server Timeout Any 600-class response
401 Unauthorized 407 Proxy Authentication Required
Assertion failed: sess && sess->endpt
- 该异常后程序会直接崩溃
- pjproject sip_auth_client.c#L507
- https://github.com/asterisk/pjproject/blob/master/pjsip/src/pjsip/sip_auth_client.c
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=842878
- asterisk 14.4.1 依赖的 pjproject 2.5.5 未修复
- 代码
- #1946 Assertion in deinitializing client auth session when dialog creation fails
- changeset#5401
- 避免处理未初始化的客户端授权会话
- changeset#5373
- 添加了断言
- 建议编译 asterisk 使用 bundle pjproject 的形式, 避免外部依赖, 并且 asterisk 也有不少针对 pjproject 的补丁
Assertion failed: sess && sess->endpt (../src/pjsip/sip_auth_client.c: pjsip_auth_clt_deinit: 507)
Bridge: Could not create class basic. No technology to support it.
可能是没有加载 bridge 模块
Couldn't execute statement: SQL logic error
看看是不是数据库没有权限
CallerID presentation
- allowed_not_screened - Presentation Allowed, Not Screened.
- allowed_passed_screen - Presentation Allowed, Passed Screen.
- allowed_failed_screen - Presentation Allowed, Failed Screen.
- allowed - Presentation Allowed, Network Number.
- prohib_not_screened - Presentation Prohibited, Not Screened.
- prohib_passed_screen - Presentation Prohibited, Passed Screen.
- prohib_failed_screen - Presentation Prohibited, Failed Screen.
- prohib - Presentation Prohibited, Network Number.
- unavailable - Number Unavailable.
translate.c:407 framein: no samples for ulawtolin
- http://lists.digium.com/pipermail/asterisk-users/2012-October/275509.html
- It means that one of clients, is using 'silence suppression' mechanism
- RTP Silence Suppression
- Asterisk config sip.conf
- Silence suppression:wiki
- pjsip Adaptive Silence Detection
- X-Lite 中可以设置
Transmit Silence=YES
- 在配合 Asterisk 时, 建议都将客户端的 静音抑制 都关闭
- 讯时网关中有 静音压缩(G.723,GSM,iLBC) 和 静音包丢弃 的相关设置
[Sep 11 09:25:37] WARNING[1109][C-00000068]: translate.c:407 framein: no samples for ulawtolin
app_dial.c:2472 dial_exec_full: Dial argument takes format (technology/resource)
- 一般是 Dial 的参数没传, 或者是错误的参数
[Sep 11 09:43:18] WARNING[11181][C-000000bb]: app_dial.c:2472 dial_exec_full: Dial argument takes format (technology/resource)
tcptls.c:746 ast_tcptls_close_session_file: ast_tcptls_close_session_file invoked on session instance without file or file descriptor
- 调用 ARI 时会触发
- ASTERISK-26842
- 这里提到使用 ARI Websocket 时也会触发
- tcptls.c#L780
[Sep 12 11:13:38] ERROR[25317]: tcptls.c:746 ast_tcptls_close_session_file: ast_tcptls_close_session_file invoked on session instance without file or file descriptor
Log queue threshold exceeded. Discarding new message
- logger.c#L1980
- logger.c#L727
logger.conf
中配置[general]
/logger_queue_limit
默认为 1000- 示例配置中没有说明
- 系统卡顿的时候会出现该问题
- 请求加压过多时会出现该问题
[Jun 29 11:11:57] WARNING[5024]: logger:0 ***: Log queue threshold (5000) exceeded. Discarding new messages.
[Jun 29 11:16:37] WARNING[28086]: logger:0 ***: Logging resumed. 158329 messages discarded.
系统间歇性卡顿
Error loading module 'res_pjsip.so': undefined symbol: ast_sip_session_register_supplement
- ASTERISK-26518
- 将部分代码注释即可
curl -O https://issues.asterisk.org/jira/secure/attachment/54695/ast.diff
Read factory 0xb6d0acb8 was pretty quick last time, waiting for them / DTMF best
- ASTERISK-15743
- Read factory 0xb6d0acb8 was pretty quick last time, waiting for them
- audiohook.c#L275
"Read factory %p and write factory %p both fail to provide %zu samples\n"
- audiohook.c#L281
"Write factory %p was pretty quick last time, waiting for them.\n"
- dsp.c#L735
"DTMF best '%c' Erow=%.4E Ecol=%.4E Erc=%.4E Et=%.4E\n"
- 出现大量这样的日志时, 还会有噪音
- 可能是线路 干扰导致, 尝试调整线路测试噪音是否发生变化
[Sep 15 10:51:36] DEBUG[27592][C-00000024] audiohook.c: Read factory 0x559839609568 and write factory 0x559839609fa8 both fail to provide 160 samples
[Sep 15 10:51:36] DEBUG[27592][C-00000024] audiohook.c: Write factory 0x559839609fa8 was pretty quick last time, waiting for them.
[Sep 15 10:51:36] DEBUG[27589][C-00000024] dsp.c: DTMF best 'B' Erow=4.6720E+03 Ecol=1.9114E+04 Erc=2.3786E+04 Et=5.8752E+04
[Sep 15 10:51:36] DEBUG[27592][C-00000024] audiohook.c: Read factory 0x559839609568 and write factory 0x559839609fa8 both fail to provide 160 samples
[Sep 15 10:51:36] DEBUG[27592][C-00000024] audiohook.c: Write factory 0x559839609fa8 was pretty quick last time, waiting for them.
[Sep 15 10:51:36] DEBUG[27589][C-00000024] dsp.c: DTMF best 'B' Erow=4.6720E+03 Ecol=1.9114E+04 Erc=2.3786E+04 Et=5.8752E+04
[Sep 15 10:51:36] DEBUG[27589][C-00000024] dsp.c: DTMF best 'B' Erow=4.6720E+03 Ecol=1.9114E+04 Erc=2.3786E+04 Et=5.8752E+04
[Sep 15 10:51:36] DEBUG[27592][C-00000024] audiohook.c: Read factory 0x559839609568 and write factory 0x559839609fa8 both fail to provide 160 samples
[Sep 15 10:51:36] DEBUG[27592][C-00000024] audiohook.c: Write factory 0x559839609fa8 was pretty quick last time, waiting for them.
[Sep 15 10:51:36] DEBUG[27589][C-00000024] dsp.c: DTMF best 'B' Erow=4.6720E+03 Ecol=1.9114E+04 Erc=2.3786E+04 Et=5.8752E+04
[Sep 15 10:51:36] DEBUG[27592][C-00000024] audiohook.c: Read factory 0x559839609568 and write factory 0x559839609fa8 both fail to provide 160 samples
[Sep 15 10:51:36] DEBUG[27592][C-00000024] audiohook.c: Write factory 0x559839609fa8 was pretty quick last time, waiting for them.
[Sep 15 10:51:36] DEBUG[27589][C-00000024] dsp.c: DTMF best 'B' Erow=4.6720E+03 Ecol=1.9114E+04 Erc=2.3786E+04 Et=5.8752E+04
chan_dahdi.c:19031 process_dahdi: Ignoring any changes to 'userbase' (on reload)
- 只是说这部分配置不能被重载
[Sep 11 14:07:34] WARNING[12741]: chan_dahdi.c:19031 process_dahdi: Ignoring any changes to 'userbase' (on reload) at line 23.
[Sep 11 14:07:34] WARNING[12741]: chan_dahdi.c:19031 process_dahdi: Ignoring any changes to 'vmsecret' (on reload) at line 31.
[Sep 11 14:07:34] WARNING[12741]: chan_dahdi.c:19031 process_dahdi: Ignoring any changes to 'hassip' (on reload) at line 35.
[Sep 11 14:07:34] WARNING[12741]: chan_dahdi.c:19031 process_dahdi: Ignoring any changes to 'hasiax' (on reload) at line 39.
[Sep 11 14:07:34] WARNING[12741]: chan_dahdi.c:19031 process_dahdi: Ignoring any changes to 'hasmanager' (on reload) at line 47.