{"id":287,"date":"2023-01-28T17:16:35","date_gmt":"2023-01-29T00:16:35","guid":{"rendered":"https:\/\/datashed.tech\/?p=287"},"modified":"2023-01-28T17:16:35","modified_gmt":"2023-01-29T00:16:35","slug":"att-merlin-legend-pri-to-freepbx-asterisk","status":"publish","type":"post","link":"https:\/\/datashed.tech\/index.php\/2023\/01\/28\/att-merlin-legend-pri-to-freepbx-asterisk\/","title":{"rendered":"AT&#038;T Merlin Legend PRI to FreePBX\/Asterisk"},"content":{"rendered":"<p><em><strong>DISCLAIMER:\u00a0<\/strong>I am a telephony hobbyist, and nothing remotely resembling a professional installer or consultant. What I&#8217;ve done here is tied to a particular hardware and software configuration, and a specific set of goals for how I want my phone network to work. My limited experience thus far has taught me that ISDN PRIs&#8211;<strong>especially<\/strong>\u00a0on gear of this vintage, and with its many quirks&#8211;can be configured in nearly any way you can imagine, in pursuit of nearly any functional outcome, depending entirely on what you want your system to do. Thus, this guide is necessarily narrow in its focus, and cannot possibly begin to cover every scenario you might dream up. We will only cover the particular scenario I developed in my mind way back when I first got my Merlin Legend. I will try to keep things as generic as possible, but YMMV.<\/em><\/p>\n<h1>About the AT&amp;T Merlin Legend<\/h1>\n<p style=\"text-align: center;\"><img loading=\"lazy\" class=\"alignnone size-large wp-image-292\" src=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/20230125_111359-576x1024.jpg\" alt=\"\" width=\"576\" height=\"1024\" srcset=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/20230125_111359-576x1024.jpg 576w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/20230125_111359-169x300.jpg 169w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/20230125_111359-768x1366.jpg 768w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/20230125_111359-864x1536.jpg 864w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/20230125_111359-1152x2048.jpg 1152w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/20230125_111359-scaled.jpg 1439w\" sizes=\"(max-width: 576px) 100vw, 576px\" \/><\/p>\n<p>The AT&amp;T Merlin Legend is a wonderful old PBX system. Wonderful, old, cranky and cantankerous, frustrating, and immensely rewarding,\u00a0<em>once you get it working<\/em>. I am\u00a0<em>not\u00a0<\/em>a telephony professional, nor do I play one on TV, and as a great many seasoned veterans (many of whom can undoubtedly trace many a gray hair and facial wrinkle back to adventures with this hardware) will tell you, the Merlin Legend is probably a less-than-optimal choice for a hobbyist&#8217;s first PBX: Fisher-Price\u00a0<em>My First PBX<\/em> it most decidedly is not. However, the aesthetics of MLX handsets, the aesthetics of the PBX itself, and its vibe&#8211;reminiscent of a bygone era&#8211;proved irresistible to me.<\/p>\n<p>I probably would choose something else if I had to do it over again, but in the end, it&#8217;s been a highly-rewarding learning experience.<\/p>\n<h1>My Gear<\/h1>\n<p>This is the gear I had coming into the project:<\/p>\n<h2>Merlin Legend PBX<\/h2>\n<ul>\n<li>Processor: CKE4<\/li>\n<li>Slot 1: 008 MLX &#8211; 8 MLX (Digital) Telephones<\/li>\n<li>Slot 2: Merlin Messaging R1 with 4 ports<\/li>\n<li>Slot 3: 100D &#8211; 1 DS1 Trunk<\/li>\n<li>Slot 4: 408 MLX GS\/LS-ID<\/li>\n<li>Slot 5: 016 with Ring Gen. &#8211; 16 Basic Telephone Sets<\/li>\n<\/ul>\n<p>I&#8217;m running the Merlin Legend with the following basic characteristics:<\/p>\n<ul>\n<li>System mode is\u00a0<strong>Hybrid\/PBX\u00a0<\/strong>(Key mode is decidedly\u00a0<em>not\u00a0<\/em>what you want for this setup)<\/li>\n<li>Numbering scheme is\u00a0<strong>Default Numbering -&gt; 2-digit Extensions<\/strong><\/li>\n<li>The operator station is\u00a0<strong>Extension 10<\/strong> and is an MLX-20L, if memory serves<\/li>\n<li>The line\/trunk pool in use for outbound calling is\u00a0<strong>Pool 70,\u00a0<\/strong>which I believe is the norm on the Merlin Legend<\/li>\n<\/ul>\n<h2>FreePBX\/Asterisk Server<\/h2>\n<ul>\n<li>Dell PowerEdge R610 1U server<\/li>\n<li>Sangoma A102 2-port PCIe T1 card<\/li>\n<li>Running the Sangoma FreePBX distribution<\/li>\n<\/ul>\n<p>My first run at this fence was with a Digium TE110PE T1 card&#8211;it would NOT talk to the 100D board in slot 3 of the Merlin Legend by any craft I possess, nor would any amount of coaxing, wheedling, or bold-faced threats dissuade it from its indefatigable contumacy. It also threw spurious interrupts constantly, and caused the server to hard reboot and throw fatal PCIe errors constantly. I do <em>not\u00a0<\/em>recommend the Digium card! Also, the Sangoma\u00a0<em>wanpipe\u00a0<\/em>tools cannot deal with it at all, making DAHDI troubleshooting way harder than it needs to be. Spare yourself the trouble I went through and <em>find yourself a Sangoma A102!<\/em><\/p>\n<p>Now, let&#8217;s take a look at the goals I had when looking to set up an ISDN PRI between the Merlin Legend and FreePBX.<\/p>\n<h1>Goals<\/h1>\n<p>Going into this, I already had a SIP trunk on the FreePBX server going off to voip.ms, where I have 16 DIDs, as well as a Cisco 7965G IP phone running SCCP firmware, using the <em>chan_sccp\u00a0<\/em>Asterisk module. I could place and receive calls with this system. Configuring IP phones and SIP trunks is out of the scope of this article, but it is decidedly the\u00a0<em>easy\u00a0<\/em>part, and others have covered it far better than I ever could.<\/p>\n<p>Also, the Merlin Legend already had a single LS trunk (extension 827) provisioned from Xfinity, which could place and receive calls. Extensions could dial each other and dial out. I have the Merlin Messaging board running an auto-attendant that helps filter my incoming calls.<\/p>\n<p>What I wanted was as follows:<\/p>\n<ul>\n<li>The ability to dial Merlin Legend extensions from my IP phones on the FreePBX side<\/li>\n<li>The ability to dial FreePBX IP phone extensions from the Merlin Legend side<\/li>\n<li>The ability for the Merlin Legend to place outbound calls through FreePBX, allowing more than one concurrent conversation involving the PSTN to take place<\/li>\n<\/ul>\n<p>Let&#8217;s get into the setup!<\/p>\n<h1>Setup<\/h1>\n<h2>Cable Plant<\/h2>\n<p>First, we&#8217;ll tackle the physical layer here. You will need a\u00a0<em>T1 Crossover Cable\u00a0<\/em>to connect the FreePBX server to the 100D board in your Merlin Legend. You do\u00a0<em>not\u00a0<\/em>need a channel service unit in between. I used plain, unshielded twisted pair Category 5e cable. See the image below for the correct pinout.<\/p>\n<div id=\"attachment_293\" style=\"width: 429px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-293\" loading=\"lazy\" class=\"wp-image-293 size-full\" src=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/t1_crossover.png\" alt=\"\" width=\"419\" height=\"418\" srcset=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/t1_crossover.png 419w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/t1_crossover-300x300.png 300w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/t1_crossover-150x150.png 150w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/t1_crossover-200x200.png 200w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/t1_crossover-320x320.png 320w\" sizes=\"(max-width: 419px) 100vw, 419px\" \/><p id=\"caption-attachment-293\" class=\"wp-caption-text\">Figure 1: T1\/E1 Crossover Cable<\/p><\/div>\n<p>Note that in the above diagram, pins 3 and 6-8 are not connected.<\/p>\n<h2>Merlin Legend T1 Configuration<\/h2>\n<p>A T1 line consists of 24 channels each having 64K\/s bandwidth. Think of it as the delivery mechanism on which our PRI will be carried.<\/p>\n<p>The 100D DS1 Trunk board in the Merlin Legend is\u00a0<em>notoriously\u00a0<\/em>picky. The slightest misconfiguration will not allow it to work. Please follow the below steps\u00a0<em>very carefully,\u00a0<\/em>but\u00a0<em>don&#8217;t panic<\/em>.<\/p>\n<p>In all of these Merlin Legend menu instructions,\u00a0<em>&lt;slot-number<\/em>&gt; refers to the slot in the Merlin Legend where your 100D board is installed. In mine, that&#8217;s slot 3.<\/p>\n<p><em>If you have just installed a 100D board in your Merlin Legend, you will need to do a <strong>board renumber<\/strong> to make sure all of the board&#8217;s trunks are added to the system inventory. Please note that this will very like change the trunk numbers on boards\u00a0<strong>subsequent to\u00a0<\/strong>your 100D board, and thus may require some fairly substantial re-programming efforts. For example, if your 100D is in slot 3 (like mine), any trunks appearing in slots 4 and 5 will likely be re-numbered.<\/em><\/p>\n<p><em>If possible, it would be ideal to put your 100D board in the\u00a0<strong>last\u00a0<\/strong>slot (slot 5) of your Merlin Legend chassis. It is also advisable to keep a backup of your configuration on hand, in case you blow anything up! I restored mine from backup several times during this process.<\/em><\/p>\n<h3>\u00a0Framing and Suppression<\/h3>\n<p>Framing must be set to ESF:<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; LS\/GS\/DS1 -&gt; &lt;slot-number&gt; -&gt; Frame Format -&gt; Extended Super Frame -&gt; Enter<\/pre>\n<p>Suppression must be set to B8ZS:<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; LS\/GS\/DS1 -&gt; &lt;slot-number&gt; -&gt; Suppression -&gt; B8ZS -&gt; Enter<\/pre>\n<h3>Type<\/h3>\n<p>Type must be set to PRI:<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; LS\/GS\/DS1 -&gt; &lt;slot-number&gt; -&gt; Type -&gt; PRI -&gt; Enter<\/pre>\n<p><em>This will cause the PBX to reboot.<\/em><\/p>\n<h2>Merlin Legend PRI Configuration<\/h2>\n<p>PRI (<em>Primary Rate Interface<\/em>) is an ISDN (<em>Integrated Services Digital Network<\/em>) technology. For our purposes, the PRI consists of twenty-three B-channels (or <em>bearer channels<\/em>) that each carry a single telephone line, and one D-channel (or\u00a0<em>data channel<\/em>) that is used by our equipment as a control plane, dealing with call setup and teardown, and other such tasks.<\/p>\n<h3>Switch Type<\/h3>\n<p>First, we will set the PRI switch type to <em>5ESS<\/em>:<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; PRI -&gt; SwitchType -&gt; 5ESS -&gt; Enter<\/pre>\n<h3>T1 Clock Source<\/h3>\n<p>You will need to set the primary clock source on the Merlin Legend to\u00a0<em>Loop,\u00a0<\/em>causing the Merlin to derive clocking for the T1 from the line, rather than generating the clock locally. This is required for our configuration.<\/p>\n<p><em>TODO: document the location of this setting in the operator console<\/em><\/p>\n<h3>Line Buildout<\/h3>\n<p>The line buildout on the Merlin Legend must be set to\u00a0<strong>1.<\/strong><\/p>\n<p><em>TODO: document the location of this setting in the operator console<\/em><\/p>\n<h3>B-Channel Group<\/h3>\n<p>Next, we will set up a B-channel group (group 1) containing channels 1-23:<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; PRI -&gt; B-Channel Group -&gt; B-Channel -&gt; 1 -&gt; Enter<\/pre>\n<p>At this point, you will be prompted for B-channels to add to the channel group. The format here is\u00a0<em>SSCC<\/em>, where <em>SS\u00a0<\/em>represents the slot number of our 100D board, and\u00a0<em>CC\u00a0<\/em>represents the B-channel number in the specified slot. We need to add channels <em>SS<\/em>01 through\u00a0<em>SS<\/em>23 to B-channel group 1.<\/p>\n<p>Once this is done, you can get out of this menu and head back to the B-Channel Group menu.<\/p>\n<h3>Lines<\/h3>\n<p>Next, we need to add the first 23 lines on the 100D board to the inventory of lines associated with B-channel group 1. On my system, these are lines 801-823. Having an up-to-date inventory report on your Merlin Legend&#8217;s contents from WinSPM is very handy here.<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; PRI -&gt; B-Channel Group -&gt; 1 -&gt; Lines -&gt; 1 -&gt; Enter<\/pre>\n<p>From this point, you are associating line numbers with B-channel group 1. Add the first 23 lines. Do\u00a0<em>not\u00a0<\/em>add the 24th line, as it is the D-channel, and adding it to the lines for the b-channel group will prevent your PRI from functioning correctly.<\/p>\n<h3>Network Service<\/h3>\n<p>We need to set the Network Service to CBC (Call-by-call).<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; PRI -&gt; B-Channel Group -&gt; 1 -&gt; NtwkSvc -&gt; Misc -&gt; CallByCall -&gt; Enter<\/pre>\n<h3>Incoming Routing<\/h3>\n<p>We need to set incoming routing to\u00a0<em>Dial Plan<\/em>:<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; PRI -&gt; B-Channel Group -&gt; 1 -&gt; IncomingRtg -&gt; Dial Plan -&gt; Enter<\/pre>\n<h3>Dial Plan Routing<\/h3>\n<p>Next, we&#8217;ll set Dial Plan Routing to\u00a0<em>Any<\/em>:<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; PRI -&gt; Dial PlanRouting -&gt; Service -&gt; 0 -&gt; Misc -&gt; Any -&gt; Enter<\/pre>\n<h3>Outgoing Table<\/h3>\n<p>This gets a little bit complex. Basically, the outgoing table for call-by-call service has 10 patterns, numbered 0 through 9, that it will use to match the phone numbers of outbound calls.\u00a0 For example, a pattern of <em>8\u00a0<\/em>matches any number beginning with\u00a0<em>8\u00a0<\/em>(e.g. 8, 813, 890).<\/p>\n<p>Since we&#8217;re looking to have any phone number match, we need patterns of 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9:<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; PRI -&gt; Outgoing Table -&gt; CBC Svc -&gt; Pattern -&gt; 00 -&gt; Enter<\/pre>\n<p>At this point, you will be prompted for a pattern number. Enter:<\/p>\n<pre>0 -&gt; Next -&gt; 1 -&gt; Next -&gt; 2 -&gt; Next. . . 8-&gt; Next 9-&gt; Enter<\/pre>\n<h3>Network Service<\/h3>\n<p>Next, we&#8217;ll set the network service:<\/p>\n<p>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; PRI -&gt; NtwkSvc -&gt; Misc -&gt; No -&gt; Enter<\/p>\n<h3>Special Service Table<\/h3>\n<p>We must now set all eight DelDigit entries in the Special Service Table to zero, as we don&#8217;t want to chop off any digits for calls going out through our PRI:<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; PRI -&gt; Outgoing Table -&gt; Special Svc -&gt; Del Digit -&gt; 0 -&gt; Enter<\/pre>\n<p>At this point, set all DelDigit entries to\u00a0<em>0<\/em>:<\/p>\n<pre>(Change to 0) -&gt; Next -&gt; (change to 0) -&gt; Next<\/pre>\n<p>Until entries 0-7 are all 0.<\/p>\n<h3>Add PRI Lines to Line Pool 70<\/h3>\n<p>Next, you need to add lines 1-23 on your 100D board to line pool 70:<\/p>\n<pre>Sys Program -&gt; Exit -&gt; LinesTrunks -&gt; Pools -&gt; 70<\/pre>\n<p>And add those first 23 lines. On my rig, this is lines 801-823. Consult your inventory!<\/p>\n<p>This will cause the Merlin Legend to try your PRI lines for any attempted outbound call.<\/p>\n<p>At this point, use your maintenance menu to un-busy the slot where your 100D board is, as well as all ports on that slot. Explaining how to un-busy (aka\u00a0<em>Restore<\/em>) slots and ports is beyond the scope of this article, at least for now.<\/p>\n<h2>FreePBX PRI Configuration<\/h2>\n<p>Now, we turn our attention to the other end of our little setup here.<\/p>\n<p><span style=\"color: #ff0000;\">TIP: If FreePBX complains that it cannot connect to Asterisk after clicking\u00a0<em>Restart DAHDI and Asterisk\u00a0<\/em>in any of the below steps, log into your FreePBX server via SSH, and type the following command at the UNIX shell prompt:<\/span><\/p>\n<pre>fwconsole restart<\/pre>\n<h3>DAHDI Channel Configuration<\/h3>\n<p>DAHDI is the\u00a0<em>Digium Asterisk Hardware Device Interface<\/em>, and is the component of an Asterisk (and by extension, FreePBX) system that handles communication with T1, PRI, FXO, and FXS interfaces, among others.<\/p>\n<h3>Configure Sangoma Settings<\/h3>\n<ol>\n<li>In the FreePBX menus, navigate to\u00a0<em>Connectivity -&gt; DAHDi Config<\/em><\/li>\n<li>Click\u00a0<em>Sangoma Settings\u00a0<\/em>on the right side of the screen<\/li>\n<li>Configure per Figure 2, below<\/li>\n<li>Click the red <em>Apply Config\u00a0<\/em>button at the top right of the screen<\/li>\n<li>Click the\u00a0<em>Restart DAHDI and Asterisk\u00a0<\/em>button beneath the <em>DAHDI Configuration\u00a0<\/em>tabs<\/li>\n<\/ol>\n<div id=\"attachment_302\" style=\"width: 592px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-302\" loading=\"lazy\" class=\"size-full wp-image-302\" src=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/sangoma_settings.png\" alt=\"\" width=\"582\" height=\"519\" srcset=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/sangoma_settings.png 582w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/sangoma_settings-300x268.png 300w\" sizes=\"(max-width: 582px) 100vw, 582px\" \/><p id=\"caption-attachment-302\" class=\"wp-caption-text\">Figure 2: Sangoma Settings<\/p><\/div>\n<p>The crucial settings here are <em>WANPIPE_GLOBAL_FE_MEDIA<\/em> and <em>WANPIPE_GLOBAL_FE_CLOCK.\u00a0<\/em>Remember, for a PRI, the Merlin Legend requires the T1 clocksource to come from the loop, not local. Setting\u00a0<em>WANPIPE_GLOBAL_FE_CLOCK\u00a0<\/em>to\u00a0<em>Master<\/em> is crucial for that.<\/p>\n<h3>Configure T1 Span<\/h3>\n<ol>\n<li>In the FreePBX menus, navigate to\u00a0<em>Connectivity -&gt; DAHDi Config<\/em><\/li>\n<li>If you are using a Sangoma A102 T1 interface, in the\u00a0<em>Digital Hardware<\/em> tab, you should see two spans,\u00a0<em>Sangoma Technologies &#8211; wanpipe1 card 0 [1]\u00a0<\/em>and\u00a0<em>Sangoma Technologies &#8211; wanpipe2 card 1 [2],\u00a0<\/em>representing the first and second ports on the A102 card; we assume that you have the Merlin Legend 100D board connected to the first<\/li>\n<li>Click the\u00a0<em>Edit\u00a0<\/em>hyperlink for the first card\/port<\/li>\n<li>Configure per Figure 3, below<\/li>\n<li>Click the red\u00a0<em>Apply Config\u00a0<\/em>button at the top right of the screen<\/li>\n<li>Click the\u00a0<em>Restart DAHDI and Asterisk\u00a0<\/em>button beneath the\u00a0<em>DAHDI Configuration\u00a0<\/em>tabs<\/li>\n<\/ol>\n<div id=\"attachment_301\" style=\"width: 648px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-301\" loading=\"lazy\" class=\"wp-image-301 size-full\" src=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/span_configuration.png\" alt=\"\" width=\"638\" height=\"706\" srcset=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/span_configuration.png 638w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/span_configuration-271x300.png 271w\" sizes=\"(max-width: 638px) 100vw, 638px\" \/><p id=\"caption-attachment-301\" class=\"wp-caption-text\">Figure 3: Span Configuration<\/p><\/div>\n<p>When you change\u00a0<em>Signaling\u00a0<\/em>to\u00a0<em>PRI &#8211; Net<\/em>, please note that the switchtype will automatically change to\u00a0<em>EuroISDN<\/em>, which is\u00a0<em>not\u00a0<\/em>what we want. Switchtype\u00a0<em>must\u00a0<\/em>be\u00a0<em>Lucent 5ESS<\/em>.<\/p>\n<p>The <em>Sync\/Clock Source<\/em> setting being 0 means that we will generate our own clocking. Line Build Out (LBO) being set to <em>0db (CSU)\/0-133 feet (DSX-1)\u00a0<\/em>is critical for our purposes.<\/p>\n<p>I left\u00a0<em>PRI Dialplan, PRI Local Dialplan,\u00a0<\/em>and\u00a0<em>PRI Exclusive\u00a0<\/em>settings, as well as the TX\/RX gain settings, at their defaults.<\/p>\n<p><strong>NOTE ON SWITCHTYPES:\u00a0<\/strong>Many of you with Merlin Legend experience will probably be shouting at the screen that we didn&#8217;t do anything to option our PRI for\u00a0<em>AT&amp;T Custom\u00a0<\/em>protocol. I chased this for\u00a0<em>days\u00a0<\/em>when I was trying to get this set up initially, convinced that this was why I had a yellow alarm on the Asterisk side and a red alarm on the 100D board. It was not the reason. The reason was the awful Digium TE110PE board. The long and short of it is, from an Asterisk perspective, setting the switchtype to\u00a0<em>Lucent 5ESS\u00a0<\/em>is enough. There\u00a0<em>is no setting in DAHDI for AT&amp;T Custom protocol,\u00a0<\/em>and setting your switchtype to\u00a0<em>Lucent 5ESS\u00a0<\/em>provisions this automatically. Apparently, DAHDI and Asterisk don&#8217;t support a 5ESS switchtype using NI2 protocol, or any others. So\u00a0<em>don&#8217;t worry about it!<\/em><\/p>\n<h4>Asterisk Context<\/h4>\n<p>Note that in Figure 3, <em>Context\u00a0<\/em>is set to\u00a0<em>from-internal.\u00a0<\/em>This was a manual change, as the setting will default to\u00a0<em>from-digital.\u00a0<\/em>This affects our PRI&#8217;s interaction with the Asterisk dialplan rules, and is the key to allowing Asterisk to route calls from the Merlin to a SIP trunk. Leaving Context at\u00a0<em>from-digital <\/em>will cause our calls originating from the Merlin and destined for the PSTN through our SIP trunk to fail.<\/p>\n<h3>Create DAHDI Trunk<\/h3>\n<p>For this step, navigate through the FreePBX GUI menus to\u00a0<em>Connectivity -&gt; Trunks,\u00a0<\/em>then click\u00a0<em>Add Trunk -&gt;\u00a0<\/em><em>Add DAHDi Trunk<\/em>, and configure your trunk as in Figures 4 and 5, below:<\/p>\n<div id=\"attachment_306\" style=\"width: 630px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-306\" loading=\"lazy\" class=\"size-large wp-image-306\" src=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/trunk_1-1024x643.png\" alt=\"\" width=\"620\" height=\"389\" srcset=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/trunk_1-1024x643.png 1024w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/trunk_1-300x188.png 300w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/trunk_1-768x482.png 768w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/trunk_1.png 1157w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-306\" class=\"wp-caption-text\">Figure 4: DAHDi Trunk Settings<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_307\" style=\"width: 916px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-307\" loading=\"lazy\" class=\"size-full wp-image-307\" src=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/trunk_2.png\" alt=\"\" width=\"906\" height=\"260\" srcset=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/trunk_2.png 906w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/trunk_2-300x86.png 300w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/trunk_2-768x220.png 768w\" sizes=\"(max-width: 906px) 100vw, 906px\" \/><p id=\"caption-attachment-307\" class=\"wp-caption-text\">Figure 5: DAHDi Settings<\/p><\/div>\n<p>In Figure 5, note that the DAHDi identifier is <strong>g0<\/strong>. The <em>0\u00a0<\/em>represents the group number displayed in our DAHDi Span Settings in Figure 3. This is how we associate our new DAHDi trunk with our PRI.<\/p>\n<h3>Set Inbound Routes<\/h3>\n<p>We will need an inbound route to tell Asterisk how to route calls coming from our PRI (and ultimately from the Merlin Legend) that follow the North American Numbering Plan. This route will take such calls and route them through a SIP trunk. Note that if you live outside the United States, you will need to modify this route.<\/p>\n<p>To do this, navigate in the FreePBX GUI menus to\u00a0<em>Connectivity -&gt; Inbound Routes<\/em>, click the\u00a0<em>Add Inbound Route<\/em> button, and configure your new route as follows:<\/p>\n<div id=\"attachment_309\" style=\"width: 727px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-309\" loading=\"lazy\" class=\"size-full wp-image-309\" src=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-inbound.png\" alt=\"\" width=\"717\" height=\"605\" srcset=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-inbound.png 717w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-inbound-300x253.png 300w\" sizes=\"(max-width: 717px) 100vw, 717px\" \/><p id=\"caption-attachment-309\" class=\"wp-caption-text\">Figure 6: Inbound Route Configuration<\/p><\/div>\n<p>You can change the\u00a0<em>Description<\/em> if you wish. I like to name routes in a consistent manner that reveals something about their purpose. The non-default fields here are:<\/p>\n<ul>\n<li>Description: can be whatever you like<\/li>\n<li>DID Number: this is a pattern matching NANPA phone numbers (three-digit area code, three-digit exchange code, four-digit number). You may change this to match your country.<\/li>\n<li>Set Destination: The important parts are to choose\u00a0<em>Trunks,\u00a0<\/em>and then select the SIP trunk to which you want to redirect calls coming from our PRI in the list at the bottom of the dialog.<\/li>\n<\/ul>\n<h3>Set Outbound Routes (Optional)<\/h3>\n<p>Next, we&#8217;ll establish an\u00a0<em>Outbound Route<\/em> to allow us to reach extensions on our Merlin Legend system from our Asterisk system. If you are not using any VoIP phones, this step may be skipped.<\/p>\n<p>This route will require you to enter a prefix of 8 from any VoIP phone on your Asterisk system in order to dial your Merlin Legend extensions.<\/p>\n<p>In order to complete this step, navigate to\u00a0<em>Connectivity -&gt; Outbound Routes<\/em> and click\u00a0<em>Add Outbound Route.\u00a0<\/em>Configure the routes per figures 7 and 8 below:<\/p>\n<div id=\"attachment_311\" style=\"width: 921px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-311\" loading=\"lazy\" class=\"size-full wp-image-311\" src=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-outbound-1.png\" alt=\"\" width=\"911\" height=\"704\" srcset=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-outbound-1.png 911w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-outbound-1-300x232.png 300w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-outbound-1-768x593.png 768w\" sizes=\"(max-width: 911px) 100vw, 911px\" \/><p id=\"caption-attachment-311\" class=\"wp-caption-text\">Figure 7: Outbound Route Configuration<\/p><\/div>\n<p>The important fields in Figure 7 are <em>Route Type<\/em> and\u00a0<em>Trunk Sequence for Matched Routes<\/em>. You must set\u00a0<em>Route Type<\/em> to\u00a0<em>Intra-Company,\u00a0<\/em>and the only entry in\u00a0<em>Trunk Sequence for Matched Routes\u00a0<\/em>must be the trunk associated with our PRI.<\/p>\n<div id=\"attachment_312\" style=\"width: 630px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-312\" loading=\"lazy\" class=\"size-large wp-image-312\" src=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-outbound-2-1024x368.png\" alt=\"\" width=\"620\" height=\"223\" srcset=\"https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-outbound-2-1024x368.png 1024w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-outbound-2-300x108.png 300w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-outbound-2-768x276.png 768w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-outbound-2-1536x552.png 1536w, https:\/\/datashed.tech\/wp-content\/uploads\/2023\/01\/route-outbound-2.png 1753w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-312\" class=\"wp-caption-text\">Figure 8: Outbound Route Dial Patterns<\/p><\/div>\n<p>Note the use of <strong>8 <\/strong>as our prefix, and the use of three patterns. These will allow one, two, and three-digit extensions on our Merlin Legend to be reached from our Asterisk\/FreePBX network. If you use four-digit extensions, you will need to add an additional dial pattern.<\/p>\n<h2>Conclusion<\/h2>\n<p>As you can tell, using a PRI to integrate a &#8220;legacy&#8221; PBX like our Merlin Legend with a modern VoIP system is a lengthy and involved process, but once these basics are established, you will be able to give your Merlin Legend network access to all kinds of nifty features and creature comforts offered by modern VoIP systems, not the least of which being the low cost of SIP trunks. For instance, I have 16 VoIP DIDs, and pay less than $20\/mo. for the privilege! Hopefully, this will allow telephony hobbyists and other PBX enjoyers like myself to get more out of our systems. I especially enjoy tinkering with Merlin Messaging auto-attendants and having them forward calls to other family members&#8217; mobile phones!<\/p>\n<p>This is why telephony is so rewarding for me: there is always a new thing to discover, learn, and play with. It&#8217;s a rich field for hours of enlightened and historically-relevant fun for the hobbyist willing to commit to it.<\/p>\n<p>Please feel free to reach me on the\u00a0<a href=\"https:\/\/discord.gg\/vZN2DddxKc\" target=\"_blank\" rel=\"noopener\">Telephone Hobbyist&#8217;s Conference<\/a> on Discord, or find me in the <strong>AT&amp;T \/ Lucent \/ Avaya Phone Systems<\/strong> group on Facebook, which I frequent, if you find problems with these instructions, or have other feedback.<\/p>\n<p>I would like to thank the members of the aforementioned Facebook for inspiring me to continue in this hobby, and also the\u00a0 <a href=\"https:\/\/www.youtube.com\/@telecomguy10\" target=\"_blank\" rel=\"noopener\">YouTube channel of telecomguy10<\/a>, whose recent videos have re-kindled my love of telephony and inspired this entire project.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DISCLAIMER:\u00a0I am a telephony hobbyist, and nothing remotely resembling a professional installer or consultant. What I&#8217;ve done here is tied to a particular hardware and software&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,18,17,19,20,15],"tags":[],"_links":{"self":[{"href":"https:\/\/datashed.tech\/index.php\/wp-json\/wp\/v2\/posts\/287"}],"collection":[{"href":"https:\/\/datashed.tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/datashed.tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/datashed.tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/datashed.tech\/index.php\/wp-json\/wp\/v2\/comments?post=287"}],"version-history":[{"count":17,"href":"https:\/\/datashed.tech\/index.php\/wp-json\/wp\/v2\/posts\/287\/revisions"}],"predecessor-version":[{"id":313,"href":"https:\/\/datashed.tech\/index.php\/wp-json\/wp\/v2\/posts\/287\/revisions\/313"}],"wp:attachment":[{"href":"https:\/\/datashed.tech\/index.php\/wp-json\/wp\/v2\/media?parent=287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/datashed.tech\/index.php\/wp-json\/wp\/v2\/categories?post=287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/datashed.tech\/index.php\/wp-json\/wp\/v2\/tags?post=287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}