{"id":93,"date":"2012-10-25T12:22:19","date_gmt":"2012-10-25T11:22:19","guid":{"rendered":"http:\/\/cyber-cottage.co.uk\/en\/?p=93"},"modified":"2012-10-25T12:22:19","modified_gmt":"2012-10-25T11:22:19","slug":"checking-registered-sip-peers","status":"publish","type":"post","link":"https:\/\/www.cyber-cottage.co.uk\/?p=93","title":{"rendered":"Checking registered SIP peers"},"content":{"rendered":"<p>We got a call recently from a customer who uses skype trunks for some international incoming numbers. We have found that these lose registration on a regular basis, We could let them be set try and register indefinitely but this can have performance effects on the server.<\/p>\n<p>This is not our only customer with this problem, We have also of late noticed a similar problem with Voip-unlimited where registration times out every day at 8pm, we have noted this on ours and other dealers servers.<\/p>\n<p>So what to do?<\/p>\n<p>Well we have written a quick script to check registration details and reload if not correct.<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>HITS=`asterisk -r -x &#8220;sip show registry&#8221; | grep Registered |grep $1| wc -l`<\/p>\n<p>if [ $HITS != $2 ]; then<\/p>\n<p>echo &#8220;Incorrect number of $1 trunks are registered, we wanted $2 \u00a0&#8221;<\/p>\n<p>echo &#8220;We will now reload asterisk &#8221;<\/p>\n<p>asterisk -r -x &#8220;reload chan_sip.so&#8221;<\/p>\n<p>exit 0<\/p>\n<p>else<\/p>\n<p>echo &#8220;$HITS $1 trunks are registered, we wanted $2 \u00a0ALL OK&#8221;<\/p>\n<p>exit 0<\/p>\n<p>fi<\/p>\n<p>&nbsp;<\/p>\n<p>the syntax for running the script is<\/p>\n<p>&nbsp;<\/p>\n<p>script_name.sh hostname 2<\/p>\n<p>with hostname being part of the string you get when doing a sip show registry.<\/p>\n<p>and the number is the number of registered trunks you expect with that name.<\/p>\n<address>if all is well:&#8221;2 sipgate trunks are registered, we wanted 2 :-) ALL OK&#8221;and nothing happens<\/p>\n<p>if not correct number then:<\/p>\n<p>&#8220;Incorrect number of sipgate trunks are registered, we wanted 2<\/p>\n<p>&#8220;We will now reload asterisk&#8221;<\/p>\n<p>we only relaod the sip channel driver as this is enough to sort the problem normally<\/p>\n<\/address>\n","protected":false},"excerpt":{"rendered":"<p>We got a call recently from a customer who uses skype trunks for some international incoming numbers. We have found that these lose registration on a regular basis, We could let them be set try and register indefinitely but this can have performance effects on the server. This is not our only customer with this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[11],"tags":[],"class_list":["post-93","post","type-post","status-publish","format-standard","hentry","category-knowledge"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p5daZy-1v","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\/93","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=93"}],"version-history":[{"count":0,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/93\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}