{"id":99,"date":"2016-06-03T17:13:07","date_gmt":"2016-06-03T17:13:07","guid":{"rendered":"http:\/\/symbioticindia.in\/docu\/?p=99"},"modified":"2016-06-03T17:21:48","modified_gmt":"2016-06-03T17:21:48","slug":"how-to-monitor-certain-queues-with-chanspy","status":"publish","type":"post","link":"http:\/\/symbioticindia.in\/docu\/2016\/06\/03\/how-to-monitor-certain-queues-with-chanspy\/","title":{"rendered":"How to monitor certain Queues with Chanspy"},"content":{"rendered":"<p>In this installment of hackrr.com, we are going to talk about listening to specific queues with FreePBX.<\/p>\n<p>Previously, we showed you how to <a title=\"Listening &amp; Barging with FreePBX\" href=\"http:\/\/hackrr.com\/wp-admin\/post.php?post=50&amp;action=edit\">How to barge with freepbx<\/a>, and now this is how to spy on queues that may each have their own members.<\/p>\n<p><em>Basically here is the theory:<\/em><br \/>\nWe are going to add a SPYGROUP variable to each channel that comes in to a queue, and then add in a custom subroutine that creates a chanspy hook into all channels with that queue number.<\/p>\n<p><em>Procedure:<\/em><br \/>\nYou will need to patch FreePBX. At the bottom of the posts there is a patch for 2.9 and 2.10+<\/p>\n<p>This patch modified FreePBX to add dialplan which adds the SPYGROUP, which is how we monitor a specific queue.<\/p>\n<p>After successfully modifying the functions.inc, we need to edit \/etc\/asterisk\/extensions_custom.conf<\/p>\n<p>Add the following code (1 time hint: if you already have an ext-local-custom context, then add that line there, don\u2019t make 2 of them):<\/p>\n<p><code><br \/>\n[ext-local-custom]<br \/>\nexten =&gt; _*200X.,1,Gosub(sub-my-chanspy,s,1(${EXTEN:4}))<\/code><\/p>\n<p><code>[sub-my-chanspy]<br \/>\n;include =&gt; app-chanspy-custom<br \/>\nexten =&gt; s,1,Macro(user-callerid,)<br \/>\nexten =&gt; s,n,Answer<br \/>\nexten =&gt; s,n,Wait(1)<br \/>\nexten =&gt; s,n,ChanSpy(,g(q${ARG1}))<br \/>\nexten =&gt; s,n,Hangup<br \/>\n<\/code><\/p>\n<p>Now, make a minor change in FreePBX and then apply config to make freepbx recreate the dialplan and reload it. Now you can spy on any channel in your queue.<\/p>\n<p>If your primary queue is 5000 Try it out by dialing *2005000.<\/p>\n<p><em>Note<\/em>: This will only spy on calls that come into the queue AFTER you apply these changes, so it won\u2019t let you spy on active calls made before the change.<\/p>\n<p><em>Expert tip<\/em>: If you want the ability to barge,as well as listen, then add the d flag to the ChanSpy command.<br \/>\n<code><br \/>\nexten =&gt; s,n,ChanSpy(,dg(q${ARG1}))<br \/>\n<\/code><br \/>\nNow you can switch modes by pressing 4,5,and 6<br \/>\n4 \u2013 Spy\/Listen<br \/>\n5 \u2013 Whisper<br \/>\n6 \u2013 Barge<\/p>\n<p>Hope you enjoyed today\u2019s tip!<br \/>\nIf this article helps you, please +1! ( At the bottom of the post )<\/p>\n<p><em>Patch Files<\/em>:(If the diff fails, just look for lines 390-397, and insert the 2 lines with a + on them, between the lines without them)<br \/>\nFor 2.9 \u2013 \/var\/www\/html\/admin\/modules\/queues\/functions.inc.php<br \/>\n<code><br \/>\n***************<br \/>\n*** 390,397 ****<br \/>\n\/\/ Inform all the children NOT to send calls to destinations or voicemail<br \/>\n\/\/<br \/>\n$ext-&gt;add('ext-queues', $exten, '', new ext_setvar('__NODEST', '${EXTEN}'));<br \/>\n+ \/\/add SPYGROUP=q1000<br \/>\n+ $ext-&gt;add('ext-queues',$exten,'', new ext_set('__SPYGROUP','q'.$exten));<\/code><\/p>\n<p><code>\/\/ deal with group CID prefix<br \/>\nif ($grppre != '') {<br \/>\n--- 390,395 ----<br \/>\n<\/code><br \/>\nFor 2.10: \/var\/www\/html\/admin\/modules\/queues\/functions.inc.php\/dialplan.php<br \/>\n<code><br \/>\n***************<br \/>\n*** 120,127 ****<br \/>\n* Virtual Queue Settings, dialplan designed so these can be changed by other modules and those changes<br \/>\n* will override the configured changes here.<br \/>\n*\/<br \/>\n+ \/\/add SPYGROUP=q1000<br \/>\n+ $ext-&gt;add($c,$exten,'', new ext_set('__SPYGROUP','q'.$exten));<br \/>\n\/\/ deal with group CID prefix<br \/>\n$ext-&gt;add($c, $exten, '', new ext_set('QCIDPP', '${IF($[${LEN(${VQ_CIDPP})}&gt;0]?${VQ_CIDPP}' . ':' . ($grppre == '' ? ' ':$grppre) . ')}'));<br \/>\n$ext-&gt;add($c, $exten, '', new ext_execif('$[\"${QCIDPP}\"!=\"\"]', 'Macro', 'prepend-cid, ${QCIDPP}'));<br \/>\n--- 120,125 ----<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this installment of hackrr.com, we are going to talk about listening to specific queues with FreePBX. Previously, we showed you how to How to barge with freepbx,\u2026<\/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-99","post","type-post","status-publish","format-standard","hentry","category-asterisk"],"_links":{"self":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/99","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=99"}],"version-history":[{"count":1,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/99\/revisions"}],"predecessor-version":[{"id":100,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/99\/revisions\/100"}],"wp:attachment":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/media?parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/categories?post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/tags?post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}