Authenticate in chanspy

Hi all,

I have this little piece of code that allways worked fine for me when using Chanspy (1.8, 2.9) but on a newly installed server (distro 1.8, 2.10) I run in to some problems.

When I try to authenticate it says login incorrect. This has always worked before, some changes on 2.10 maybe or anyone who sees the error?

in extensions_custom.conf:

exten => 555,1,Macro(user-callerid)
exten => 555,2,Authenticate(1234)
exten => 555,3,Read(SPYNUM,agent-newlocation)
exten => 555,4,ChanSpy(SIP/${SPYNUM))

My Asterisk log:

[2012-06-25 13:40:46] VERBOSE[-1] pbx.c: -- Executing [[email protected]:2] Authenticate("SIP/500-00000000", "1234") in new stack
[2012-06-25 13:40:46] VERBOSE[-1] file.c: -- <SIP/500-00000000> Playing 'agent-pass.alaw' (language 'nl')
[2012-06-25 13:41:00] VERBOSE[-1] file.c: -- <SIP/500-00000000> Playing 'auth-incorrect.alaw' (language 'nl')
[2012-06-25 13:41:16] VERBOSE[-1] file.c: -- <SIP/500-00000000> Playing 'auth-incorrect.alaw' (language 'nl')
[2012-06-25 13:41:31] VERBOSE[-1] file.c: -- <SIP/500-00000000> Playing 'vm-goodbye.alaw' (language 'nl')
[2012-06-25 13:41:32] VERBOSE[-1] pbx.c: == Spawn extension (from-internal, 555, 2) exited non-zero on 'SIP/500-00000000'
[2012-06-25 13:41:32] VERBOSE[-1] pbx.c: -- Executing [[email protected]:1] Hangup("SIP/500-00000000", "") in new stack
[2012-06-25 13:41:32] VERBOSE[-1] pbx.c: == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/500-00000000'

I guess mine doesn’t have the sophistication yours does, but here it is. Mine doesn’t limit access to a specific user, so yours might be better (but mine works).

Create an entry in the /etc/asterisk/extensions_custom.conf file that reads:

;Password Protect Channel Spy
exten => 555,1,Authenticate(1234)

;Password Protect ZapBarge
exten => 888,1,Authenticate(1234)

Well that is basically the same line I use.
When I remove that line the script works fine and I can chanspy.

Problems still is I don’t want everyone to use chanspy so I must have a way to authenticate…


Here’s what i’ve been using that has always worked…(seemed very similar to yours)…but hey, why not give it a shot? In this case tho, im dialing 500 instead of 555 (as 555 already exist as a FreePBX default ChanSpy)

you can change the “d” to other Chanspy options…

exten => 500,1,Answer
exten => 500,n,Authenticate(8888)
exten => 500,n,Wait(1)
exten => 500,n,Goto(custom-app-enh-chanspy,s,1)
exten => 500,n,Hangup

exten => s,1,BackGround(please-enter-the)
exten => s,n,Read(SPYNUM,extension)
exten => s,n,Set(SPYTODEV=$[${DB(DEVICE/${SPYNUM}/user)}])
exten => s,n,ChanSpy(SIP/${SPYTODEV},d)
exten => s,n,Hangup()

Be sure to include in from-internal-custom

[from-internal-custom] ;;;put this on the very top
include => app-chanspy-custom

Thanks for the script, I tried that one too but got the same error.

It won’t accept the authentication…


I suspect asterisk is not receiving DTMFs from your phone.

Can you try this, place these contexts into extensions_custom.conf

include => dtmftester

exten => 10101,1,Answer
exten => 10101,n,BackGround(please-enter-the)
exten => 10101,n,Read(READTHIS,extension)
exten => 10101,n,NoOp(Value entered was ${READTHIS})
exten => 10101,n,Hangup()

Be sure to reload asterisk prior to dialing 10101. Then before dialing do a
tail -f /var/log/asterisk/full

After hangingup, copy the output of the log here.