{Solved} Chanspy help

I have been asked to configure chanspy for a local user, I have done a couple of searches but everything is really old for the results. I using a distro and at the top of the extensions.conf file it plainly says “DO NOT MODIFY” this file so can someone explain to me how chanspy works? I put this in my Extensions_custom.conf file and I read where I need to put the include in the extensions.conf file right now it has a # sign in front of it, I’m guessing that means ignore this statement, like a “REM” in batch files? the goal is to allow one user to listen to another user while she is being trained, so he would like to be able to listen, and whisper.
I found this code and put it in the extension_custom.conf. but I sure would like to understand what it means… :slight_smile:

[ext-local-custom]

;listen
exten => 556,1,Macro(user-callerid)
exten => 556,n,Authenticate(1234)
exten => 556,n,Read(SPYNUM,agent-newlocation)
exten => 556,n,ChanSpy(SIP/${SPYNUM},q)
exten => 556,n,Hangup

;whisper
exten => 557,1,Macro(user-callerid)
exten => 557,n,Authenticate(1234)
exten => 557,n,Read(SPYNUM,agent-newlocation)
exten => 557,n,ChanSpy(SIP/${SPYNUM},qw)
exten => 557,n,Hangup

;barge
exten => 558,1,Macro(user-callerid)
exten => 558,n,Authenticate(1234)
exten => 558,n,Read(SPYNUM,agent-newlocation)
exten => 558,n,ChanSpy(SIP/${SPYNUM},qB)
exten => 558,n,Hangup

The # is part of the Include Directive. You can’t modify the extensions.conf file and hope that the changes will stick.

It’s really amazingly simple:

exten => 556,1,Macro(user-callerid)
This calls the Callerid Macro

exten => 556,n,Authenticate(1234)
You need to put in ‘1234’ for this code to run.

exten => 556,n,Read(SPYNUM,agent-newlocation)
This reads the number you want to monitor.

exten => 556,n,ChanSpy(SIP/${SPYNUM},q)
This monitors the channel. Note the special use of braces and parenthesis.

exten => 556,n,Hangup
This hangs up the call.

The only thing remotely tricky is the type of barge call you are making. ‘q’ is for “quiet” - all you get to do is listen. ‘qw’ is so you can whisper to the caller on the local extension. ‘qB’ allows you to drop into the conversation uninvited.

The ‘556’, ‘557’, and ‘558’ are just the “extensions” you dial to get into the barge subsystem. Everything else is straight dial planning.

1 Like

thanks so much! so the #Include means that file is already included correct?
I have to restart the freepbx server to take effect correct?

Yes, and yes (sort of). You can do a reload instead of a restart, but both will get you where you want to go.

ok last question, so to use it, I would dial the 556 then 1234, then the ext I want to listen too?

Three for three. I suggest you log into the console and watch it as it happens, just so you can see what’s actually happening while you test it.

1 Like

well poop! when I did it, this is what I saw?
– <SIP/137-000023d4> Playing ‘agent-newlocation.ulaw’ (language ‘en’)
– SIP/sip0000001_baseamx-000023d1 answered SIP/239-000023d0
– Channel SIP/sip0000001_baseamx-000023d1 joined ‘simple_bridge’ basic-bridge <92154790-9b8b-4f35-b858-1b037e226be7>
– Channel SIP/239-000023d0 joined ‘simple_bridge’ basic-bridge <92154790-9b8b-4f35-b858-1b037e226be7>
– User entered ‘115’
[2018-05-08 14:24:08] WARNING[15104][C-00000bf9]: pbx_variables.c:659 pbx_substitute_variables_helper_full: Error in extension logic (missing ‘}’)
– Executing [[email protected]:4] ChanSpy(“SIP/137-000023d4”, “SIP/”) in new stack
it connected me with ext 239?

I figured it out, I had a ) instead of a } at the end of each of the exten => 556,n,ChanSpy(SIP/${SPYNUM),q)
should have been exten => 556,n,ChanSpy(SIP/${SPYNUM},q)

Would you mind correcting the code your original post?
Like future visitors won’t have the same trouble… :grinning:

Done! Thanks again for all your help and knowledge!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.