{"id":994,"date":"2013-10-15T10:18:47","date_gmt":"2013-10-15T10:18:47","guid":{"rendered":"http:\/\/cyber-cottage.co.uk\/en\/?p=994"},"modified":"2014-11-16T20:44:51","modified_gmt":"2014-11-16T20:44:51","slug":"iax2-peers-going-unreachable","status":"publish","type":"post","link":"https:\/\/www.cyber-cottage.co.uk\/?p=994","title":{"rendered":"IAX2 Peers going unreachable."},"content":{"rendered":"<p>In the past we have found that IAX@ peers have been reliable and solid.<\/p>\n<p>But lately with the advent of bonded ADSL lines and other forms of\u00a0aggregated\u00a0lines we have seen issues where the IAX2 trunk will go down and a simple reload of Asterisk or even a restart\u00a0doesn&#8217;t\u00a0fix it.<\/p>\n<p>Taken from Voip-info<\/p>\n<h4 style=\"padding-left: 30px;\">A report of the problem by another user :<\/h4>\n<p style=\"padding-left: 30px;\">This is something I&#8217;ve run into myself and my VOIP IAX2 provider has this issue with many clients running Asterisk on TrixBox or other custom made systems behing a NAT (Linux) router.<\/p>\n<p>If our PPPoE goes down, we have to reboot our Asterisk server to get our IAX2 trunk to re-register otherwise, it will try and just keep timing out. I have the 4569 forwarded internal (Pierre Belanger adds: in many cases, the 4569 port forwarding useless unless your Asterisk server provides service to IAX2 phones from the Internet, i.e. not on your local LAN).<\/p>\n<p>I have a dirty script that avoids having to reboot the TrixBox and restore our service within 2 minutes of a blip automatically, and logs the &#8216;blips&#8217; so i can see how &#8216;reliable&#8217; our service is.<\/p>\n<p>We have take the original script posted and made\u00a0some\u00a0changes,\u00a0Notably\u00a0it checks a defined peer name as we\u00a0have\u00a0seen that the problem\u00a0doesn&#8217;t\u00a0always affect all peers on a system.<\/p>\n<p>======Code follows ======<\/p>\n<pre>#!\/bin\/sh\r\n#We record the status of the IAX2 Trunk\r\ncd \/root\/ # I have script live in root,\r\n# Set the peer name to monitor here\r\n# ******\r\npeername=\"YOURIAX2PEERNAME\"\r\n# ******\r\ndate &gt;&gt; slap.log\r\necho \"Testing $peername peer\" &gt;&gt; slap.log\r\n\/usr\/sbin\/asterisk -rx 'iax2 show peers' |grep -i $peername &gt;&gt; slap.log\r\n\/usr\/sbin\/asterisk -rx 'iax2 show peers' |grep -i $peername &gt; reg_status\r\nsleep 1\r\n#We then Scan the Status and see if we're online or not...\r\nTEST=\"OK\"\r\nif grep $TEST reg_status &gt; \/dev\/null\r\nthen\r\necho \"All OK Here\" &gt;&gt; slap.log\r\nexit #Abort, we are online, all is well...\r\nfi\r\n#IF we're this far down, we've lost IAX. Log the incident.\r\necho \"we have a problem with $peername, Restarting it\" &gt;&gt; slap.log\r\n#Restart the IAX2 trunk. Delay required for some reason.\r\n\/usr\/sbin\/asterisk -rx 'module unload chan_iax2.so' &gt;&gt; slap.log\r\nsleep 90;\r\n\/usr\/sbin\/asterisk -rx 'module load chan_iax2.so' &gt; \/dev\/null\r\necho \"Restarted it Now lets check status\" &gt;&gt; slap.log\r\nsleep 5;\r\n\/usr\/sbin\/asterisk -rx 'iax2 show peers' |grep -i $peername &gt;&gt; slap.log\r\n#We record the status of the IAX2 Trunk\r\n\/usr\/sbin\/asterisk -rx 'iax2 show peers' |grep -i $peername &gt; reg_status\r\nsleep 1\r\n#We then Scan the Status and see if we're online or not...\r\nTEST=\"OK\"\r\nif grep $TEST reg_status &gt; \/dev\/null\r\nthen\r\necho \"All OK Here\" &gt;&gt; slap.log\r\nexit #Abort, we are online, all is well...\r\nfi\r\n#IF we're this far down, we've lost IAX. Log the incident.\r\necho \"we have a problem with $peername, Restarting it\" &gt;&gt; slap.log\r\n#Restart the IAX2 trunk. Delay required for some reason.\r\n\/usr\/sbin\/asterisk -rx 'module unload chan_iax2.so' &gt;&gt; slap.log\r\nsleep 120;\r\n\/usr\/sbin\/asterisk -rx 'module load chan_iax2.so' &gt; \/dev\/null\r\necho \"Restarted it Now lets check status\" &gt;&gt; slap.log\r\nsleep 5;\r\n\/usr\/sbin\/asterisk -rx 'iax2 show peers' |grep -i $peername &gt;&gt; slap.log\r\n#We record the status of the IAX2 Trunk<\/pre>\n<p>======Code ends======<\/p>\n<p>This seems to do\u00a0the\u00a0trick and its cronned to run every night or hour in some cases.<\/p>\n<p>UPDATE<\/p>\n<p>on testing and speaking to suppliers. We would advise adding the following settings to your IAX2 peers<\/p>\n<p>&nbsp;<\/p>\n<pre>qualifysmoothing=yes\r\nqualifyfreqnotok=30000\r\nqualifyfreqok=120000\r\nqualify=yes<\/pre>\n<p>With this added we have not seen any unexpected unreachables.<\/p>\n<p>&nbsp;<\/p>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In the past we have found that IAX@ peers have been reliable and solid. But lately with the advent of bonded ADSL lines and other forms of\u00a0aggregated\u00a0lines we have seen issues where the IAX2 trunk will go down and a simple reload of Asterisk or even a restart\u00a0doesn&#8217;t\u00a0fix it. Taken from Voip-info A report of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":656,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[88,89,11,7],"tags":[22,23,35,45,51,73,100,76,77],"class_list":["post-994","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-astsupport","category-elxsupport","category-knowledge","category-technical","tag-adsl","tag-asterisk","tag-elastix","tag-iax2","tag-linux","tag-support","tag-technical","tag-voip","tag-xorcom"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.cyber-cottage.co.uk\/wp-content\/uploads\/2013\/02\/asterisk.png?fit=96%2C82&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p5daZy-g2","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=994"}],"version-history":[{"count":2,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/994\/revisions"}],"predecessor-version":[{"id":1294,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/994\/revisions\/1294"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/media\/656"}],"wp:attachment":[{"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}