{"id":95,"date":"2016-06-03T17:08:24","date_gmt":"2016-06-03T17:08:24","guid":{"rendered":"http:\/\/symbioticindia.in\/docu\/?p=95"},"modified":"2016-06-03T17:11:22","modified_gmt":"2016-06-03T17:11:22","slug":"adding-listen-whisper-and-barge-to-freepbx-or-asterisk","status":"publish","type":"post","link":"http:\/\/symbioticindia.in\/docu\/2016\/06\/03\/adding-listen-whisper-and-barge-to-freepbx-or-asterisk\/","title":{"rendered":"Adding Listen, Whisper, and Barge to FreePBX or Asterisk"},"content":{"rendered":"<p>If you are running a call center on FreePBX or Asterisk, most likely you will want the ability to listen in on agents calls, also known as joining multiple calls, or connected two calls to a manager, or other variations of barging in on a bridged channel.<\/p>\n<p>For the purpose of this article, we will define\u00a0<strong>manager<\/strong> as the callee who is the spying channel,\u00a0<strong>agent<\/strong> who is the spied-on channel, and\u00a0<strong>client<\/strong> who is the bridged channel \/ 3rd party. We define listen, whisper, and barge as follows:<\/p>\n<p><strong>Listen:<\/strong> Monitor an agents call. The manager can hear both the agent and client channels, but no-one can hear the manager.<\/p>\n<p><strong>Whisper:<\/strong>\u00a0 Whisper to the agent. The manager can hear both the agent and client channels, and the agent can also hear the manager, but the client can only hear the agent, hence \u201cwhisper.\u201d<\/p>\n<p><strong>Barge:<\/strong> Barge in on both channels. The manager channel is joined onto the agent and client channels, and all parties can hear each other. Be warned, if the original agent leaves the call, the call is dropped. This is not a 3-way call.<br \/>\n(However you can barge in, and when comfortable, initiate a 3way call to your extension so you can continue the call without the agent. This procedure varies from client to client (soft\/hard phones))<\/p>\n<p>One more note: We can also provide 3-way calling [live transfer] services on the server side, however this is outside the scope of this document. Please contact us for details.<\/p>\n<p>Enough chit-chat, let\u2019s get to the dialplan!<\/p>\n<p><strong>Note:<\/strong> In newer versions of FreePBX, custom includes are disabled by default.<br \/>\nThis means that the new \u201cext-local-custom\u201d or \u201cfrom-internal-custom\u201d context\u2019s that we just created <strong>won\u2019t be imported<\/strong> into the PBX \u201cBrain\u201d. To fix this, go to :<br \/>\n<strong>Settings-&gt;Advanced Settings<\/strong><br \/>\nFind the \u201c<strong>Dialplan and Operational<\/strong>\u201d section, and change <u>Disable -custom Context Includes?<\/u>to False.<br \/>\nBe sure to click on the little checkbox that appears to the right to save the setting, then Apply Settings to rebuild the files. This is required or else the <em>ext-local-custom<\/em> context that we add won\u2019t be included into the engine.<\/p>\n<p><code>[ext-local-custom]<\/code><\/p>\n<p>;listen<br \/>\nexten =&gt; _*222x.#,1,Macro(user-callerid,)<br \/>\nexten =&gt; _*222x.#,n,Answer<br \/>\nexten =&gt; _*222x.#,n,NoCDR<br \/>\nexten =&gt; _*222x.#,n,Wait(1)<br \/>\nexten =&gt; _*222x.#,n,ChanSpy(sip\/${EXTEN:4},q)<br \/>\nexten =&gt; _*222x.#,n,Hangup<\/p>\n<p>;whisper<br \/>\nexten =&gt; _*223x.#,1,Macro(user-callerid,)<br \/>\nexten =&gt; _*223x.#,n,Answer<br \/>\nexten =&gt; _*223x.#,n,NoCDR<br \/>\nexten =&gt; _*223x.#,n,Wait(1)<br \/>\nexten =&gt; _*223x.#,n,ChanSpy(sip\/${EXTEN:4},qw)<br \/>\nexten =&gt; _*223x.#,n,Hangup<\/p>\n<p><code>;barge<br \/>\nexten =&gt; _*224x.#,1,Macro(user-callerid,)<br \/>\nexten =&gt; _*224x.#,n,Answer<br \/>\nexten =&gt; _*224x.#,n,NoCDR<br \/>\nexten =&gt; _*224x.#,n,Wait(1)<br \/>\nexten =&gt; _*224x.#,n,ChanSpy(SIP\/${EXTEN:4},qB)<br \/>\nexten =&gt; _*224x.#,n,Hangup<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.paypalobjects.com\/en_US\/i\/scr\/pixel.gif\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" \/><\/p>\n<p>Let\u2019s break it down:<br \/>\nDialing *222970 would initiate listen on channel 970. *224401 would barge in on 401\u2019s call speaking to both parties.<\/p>\n<p>We start by finding (or adding) the ext-local-custom context, and declaring: exten =&gt; _*222x.# which will catch calls going to *222 followed by a sequence of numbers.<\/p>\n<p>We define the first line with priority 1, and initiate Macro(user-callerid,) which basically sets the environment and loads up details about the extension, like caller id, and display name.<\/p>\n<p>On the 2nd and subsequent lines, we start them the same way, and instead set priorty to n, this will let asterisk generate priorities automatically, so you don\u2019t always have to change each priority just to add new code.<\/p>\n<p><strong>Expert Tip:<\/strong> We could have used <em>same =&gt; n,Answer()<\/em> and continued to use same. This is shorthand that was added later to asterisk, and just simplifies it that much more.<\/p>\n<p>We answer the call on priority 2, then we tell asterisk\u2019s cdr_mysql module not to store this \u201ccall\u201d as a CDR record.<\/p>\n<p>We wait a second with Wait(1) to give everything time to get ready, then we initialize the ChanSpy app. There are various options you can use, we chose q (which prevents \u201cSIP.6626\u2033 or whatever from being spoken when you start spying.) w, which is \u201cwhisper mode\u201d, and B which is barge. Do not get this confused with b (lowercase) which is for only joining bridged calls.<\/p>\n<p>Lastly we hangup to prevent a floating channel, and we\u2019re done!<\/p>\n<p>To monitor only specific channels, for example 8100 \u2013 8199, set the chanprefix parameter like so:<br \/>\n;barge<br \/>\nexten =&gt; _*22481x.#,n,Chanspy(SIP\/${EXTEN:4},qB)<\/p>\n<p>This would let you monitor channels starting with SIP\/81. (Potentially change SIP\/ to Local\/, Agent\/, or whatever your channel type is)<\/p>\n<p>This is a very simple method that will allow only a single extension the authority to barge. If you need to be able to manage a list of \u201cauthorized users\u201d, then you should order our one of our commercial packages:<\/p>\n<p>;barge<br \/>\nexten =&gt; _*224x.#\/8001,1,Macro(user-callerid,)<br \/>\nexten =&gt; _*224x.#\/8001,n,Answer<br \/>\n\u2026<\/p>\n<p>You can also use the same notation to repeat the above expression, so if you wanted to allow people with extensions 8000-8009 (ie managers or something), you could do: (Don\u2019t forget the _ before the CID this time as it denotes a pattern.)<br \/>\nexten =&gt; _*224x.#\/_800X,1,Macro(user-callerid,)<br \/>\nsame =&gt; n,Answer<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Ref:\u00a0http:\/\/hackrr.com\/2013\/freepbx\/adding-listen-whisper-and-barge-to-freepbx-or-asterisk\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are running a call center on FreePBX or Asterisk, most likely you will want the ability to listen in on agents calls, also known as joining multiple calls, or connected two calls to a manager, or other variations of barging in on a bridged channel. For the purpose of this article, we will ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"http:\/\/symbioticindia.in\/docu\/2016\/06\/03\/adding-listen-whisper-and-barge-to-freepbx-or-asterisk\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-95","post","type-post","status-publish","format-standard","hentry","category-asterisk"],"_links":{"self":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":3,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":98,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/95\/revisions\/98"}],"wp:attachment":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}