现象
invite 到opensips的时候,发现opensips无响应,这个情况不是固定出现,而是周期性的,比如几个invite出现一次。
日志
将日志调整为debug级别后,查看到关键日志的信息
DBG:core:mk_proxy: doing DNS lookup...
Aug 19 19:42:25 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25820]: DBG:core:sip_resolvehost: no port, no proto -> do NAPTR lookup!Aug 19 19:42:27 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25819]: DBG:tm:timer_routine: timer routine:2,tl=0x7f7d193b7c10 next=(nil), timeout=65Aug 19 19:42:27 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25819]: DBG:tm:wait_handler: removing 0x7f7d193b7b90 from table
Aug 19 19:42:27 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25819]: DBG:tm:delete_cell: delete transaction 0x7f7d193b7b90
Aug 19 19:42:27 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25819]: DBG:tm:wait_handler: done
Aug 19 19:43:05 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25820]: DBG:core:get_record: lookup({}, 35) failed
Aug 19 19:43:05 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25820]: DBG:core:sip_resolvehost: no valid NAPTR record found for {}, trying direct SRV lookup...Aug 19 19:43:45 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25820]: DBG:core:get_record: lookup(_sip._udp.{}, 33) failed
Aug 19 19:43:45 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25820]: DBG:core:sip_resolvehost: no valid SRV record found for _sip._udp.{}, trying A record lookup...
Aug 19 19:43:45 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25820]: CRITICAL:core:mk_proxy: could not resolve hostname: "{}"Aug 19 19:43:45 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25820]: ERROR:tm:uri2proxy: bad host name in URI <SIP:{}>Aug 19 19:43:45 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25820]: ERROR:tm:t_forward_nonack: failure to add branches
Aug 19 19:43:45 tv7-inbound-proxy-1 /usr/local/sbin/opensips[25820]: DBG:tm:t_relay_to: t_forward_nonack returned error
可以判断是dns解析出的问题
解决办法
在opensips脚本上增加
dns=no
rev_dns=no
dns_try_naptr=no
增加DNS vim /etc/resolv.conf
nameserver 119.29.29.29
nameserver 114.114.114.114
|