Asterisk retransmission timeout
Sometimes Asterisk log show this message:
WARNING[9380] chan_sip.c: Retransmission timeout reached on transmission 1a1df1ca5a8cc898668aaabf73852da2@10.10.10.10:5060 for seqno 102 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
This can be because of several reasons and usually the easiest way to get rid of this is to:
core restart now from Asterisk console.
While this solves the problem, you can have many calls you don't want to lose, in such a situation you can do:
core restart gracefully
now new calls will not come into system, and restart will be done as long as all (old) calls are ended.
But I found one way around - to issue core restart gracefully - when you have retransmission error and execute - core abort shutdown - when error disappears. This approach gives you ability to accept phone calls and also eliminates problems caused by retransmission error (bad voice, lost calls, simultaneous calls to the same operator etc.).
Save below script into the file (i.e. named: retransmission_timeout_resolving.py) and setup cron to execute this file every minute ( * * * * * /root/retransmission_timeout_resolving.py):
#!/usr/bin/python
from subprocess import PIPE,Popen
import time
try:
proc1 = Popen(["/usr/bin/tail", "-n", "10", "/var/log/asterisk/messages"], stdout=PIPE)
tail = (proc1.communicate()[0].split("\n"))
except:
LOG_LINE = "77 ==> " + str(time.ctime()) + "\n"
with open('/var/log/asterisk/RETRANSMISSION_ERR.log', 'a') as f:
f.write(LOG_LINE)
for x in tail:
if 'SIP+Retransmissions' in x:
ERR = 1
break
elif 'SIP+Retransmissions' not in x:
ERR = 0
if ERR == 1:
proc2 = Popen(["/usr/sbin/asterisk", "-rx", "core restart gracefully"])
elif ERR == 0:
proc3 = Popen(["/usr/sbin/asterisk", "-rx", "core abort shutdown"])
else:
ERR = "SMTH WRONG HAPPENED"
LOG_LINE = str(ERR) + " ==> " + str(time.ctime()) + "\n"
with open('/var/log/asterisk/RETRANSMISSION_ERR.log', 'a') as f:
f.write(LOG_LINE)
No comments:
Post a Comment