[asterisk-users] Stopping chanspy

Jim Dickenson dickenson at cfmc.com
Wed Feb 4 01:39:04 CST 2009


I would like to be able to stop the chanspy application and go to the next
step in the dialplan but I do not see a way to do that.

I have looked at the code and I do not see a way to stop the chanspy
application.

Even if there are no channels that match the chanprefix pattern the chanspy
application is not exited.

Hitting the * key stops spying on a channel but then starts spying on the
same channel if the chanprefix has only one match.

Is there something I am not seeing that I can do to stop spying and move on?

I am running version 1.4.23.1

Additionally there must be some tricks to debug this code as there is timing
going on that gets messed up while stepping through the code.

My situation is that I have an agent logged in but not in any queue. I use
an AMI packet like this:

Action: Originate
Channel: Agent/1001
Exten: DoChanMon
Context: cfmc_cdi_info
Priority: 1
Variable: CfMC_ActionID=callE1334
Variable: CfMC_WhoHear=SIP/dickenson
ActionID: callE1324
Async: true


to connect to an extension like this:

exten => DoChanMon,1,Answer()
exten => DoChanMon,n,NoOp(Just got '${CfMC_ActionID}')
exten => DoChanMon,n,ChanSpy(${CfMC_WhoHear},q)
exten => DoChanMon,n,Hangup()


and I would like to be able to make the agent available again without them
having to hang up and log back in again.

If I add a line of code like this:

                                if (running == 99999) running = -1;

in app_chanspy.c around line 348:

                        if (!ast_strlen_zero(inp)) {
                                running = atoi(inp);
                                if (running == 99999) running = -1;
                                break;

Then hitting 99999# on the keypad does what I want.

I do not particularly want to patch future versions of the code to add this
ability.

The only other conditions that set running to -1 is if you hang up the
channel or res = (f->frametype == AST_FRAME_DTMF) ? f->subclass : 0; sets
res < 0. As I do not know what I can type on the keypad to cause that I do
not know how to exit the chanspy application.

-- 
Jim Dickenson
mailto:dickenson at cfmc.com

CfMC
http://www.cfmc.com/






More information about the asterisk-users mailing list