{"id":29,"date":"2026-02-27T00:39:20","date_gmt":"2026-02-27T00:39:20","guid":{"rendered":"https:\/\/rtnvfrmedia.net\/?p=29"},"modified":"2026-02-27T00:39:20","modified_gmt":"2026-02-27T00:39:20","slug":"custom-freepbx-asterisk-code-for-caller-id","status":"publish","type":"post","link":"https:\/\/rtnvfrmedia.net\/?p=29","title":{"rendered":"Custom FreePBX\/Asterisk code for caller ID"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">If you have your system set up with escape digit such as &#8220;9&#8221; for outside line (still a popular practice in UK and Europe), you will need to put this 9 on any incoming caller IDs so endusers can dial the numbers from the history menu of VOIP telephones.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add this code to <strong>extensions_custom.conf <\/strong>in <strong>\/etc\/asterisk<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>; ***********************************************\n; * ratcoTEL Networks Ipswich, Suffolk, England *\n; *                                             *\n; * custom code for Asterisk goes here          *\n; ***********************************************\n;\n; put 9 on VOIP calls\n; altered to get both name and number correct\n; and deal correctly with WITHHELD or ANONYMOUS etc\n; this assumes that trunks present the name and\n; number in UK format with leading \"0\"\n; leave CLID from voipfone alone \n; and present as normal number\n; leave behind CNAM in case this contains something useful\n\n&#91;from-trunk-custom]\nexten => _X.,1,GotoIf($&#91; \"${CALLERID(name)}\" != \"anonymous\" ] ?cidothername)\nexten => _X.,n,Set(CALLERID(all)=\"WITHHELD &lt;WITHHELD>\")\nexten => _X.,n(cidothername),GotoIf($&#91; \"${CALLERID(num):0:1}\" != \"0\" ] ?cidnotpstn)\n\n; here there is a numeric CLID but check if CNAM contains number or anything else\nexten => _X.,n,GotoIf($&#91; \"${CALLERID(name):0:1}\" != \"0\" ] ?cnamisalpha)\n; if CNAM is a number put the 9 on the front\nexten => _X.,n,Set(CALLERID(name)=9${CALLERID(num)})\nexten => _X.,n(cnamisalpha),Set(CALLERID(num)=9${CALLERID(num)})\nexten => _X.,n(cidnotpstn),Noop(CallerID on VOIP trunk is ${CALLERID(all)})\nexten => _X.,n,Goto(from-trunk,${EXTEN},1)\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you have your system set up with escape digit such as &#8220;9&#8221; for outside line (still a popular practice in UK and Europe), you will need to put this 9 on any incoming caller IDs so endusers can dial the numbers from the history menu of VOIP telephones. Add this code to extensions_custom.conf in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9,7,6],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-asterisk","category-freepbx","category-telecoms","category-voip"],"_links":{"self":[{"href":"https:\/\/rtnvfrmedia.net\/index.php?rest_route=\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rtnvfrmedia.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rtnvfrmedia.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rtnvfrmedia.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rtnvfrmedia.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29"}],"version-history":[{"count":1,"href":"https:\/\/rtnvfrmedia.net\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":30,"href":"https:\/\/rtnvfrmedia.net\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions\/30"}],"wp:attachment":[{"href":"https:\/\/rtnvfrmedia.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rtnvfrmedia.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rtnvfrmedia.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}