Just over a month ago I was having issues getting the Spy Extension feature working. It was working for a while after we applied the DEVICE_STATUS=BUSY fix as mentioned in this post:
https://forums.vitalpbx.org/t/how-to-get-spy-extension-working/3216
It is now back to doing the same thing it did before. I try to spy on an extension, and then the prompt just hangs up the call.
Here’s the relevant (I think) logs for ext 403 trying to spy on 401.
[2023-11-01 11:50:37] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-spy-ext:1] NoOp("PJSIP/403-00000006", "FEATURE: SPY SPECIFIED EXTENSION") in new stack
[2023-11-01 11:50:37] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-spy-ext:2] Gosub("PJSIP/403-00000006", "sub-extension-spy,s,1") in new stack
[2023-11-01 11:50:37] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:1] Set("PJSIP/403-00000006", "SPY_OPTIONS=qS") in new stack
[2023-11-01 11:50:37] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:2] Read("PJSIP/403-00000006", "EXTENSION_NUMBER,vpbx/vital-spy-extension-number") in new stack
[2023-11-01 11:50:37] VERBOSE[1900399][C-00000004] file.c: <PJSIP/403-00000006> Playing 'vpbx/vital-spy-extension-number.ulaw' (language 'en')
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] app_read.c: User entered '401'
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:3] GotoIf("PJSIP/403-00000006", "0?read_ext") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:4] Set("PJSIP/403-00000006", "EXTENSION_DIAL=PJSIP/401&PJSIP/401vitxi") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:5] GotoIf("PJSIP/403-00000006", "0?read_ext") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:6] GotoIf("PJSIP/403-00000006", "0?:skip_pwd") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx_builtins.c: Goto (sub-extension-spy,s,10)
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:10] NoOp("PJSIP/403-00000006", "") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:11] Set("PJSIP/403-00000006", "DEVICE_TO_SPY=") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:12] Set("PJSIP/403-00000006", "COUNTER=1") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:13] Set("PJSIP/403-00000006", "CURRENT_DEVICE=PJSIP/401") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:14] While("PJSIP/403-00000006", "1") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:15] Set("PJSIP/403-00000006", "DEVICE_STATUS=BUSY") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:16] GotoIf("PJSIP/403-00000006", "0|1]?:next") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx_builtins.c: Goto (sub-extension-spy,s,20)
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:20] Set("PJSIP/403-00000006", "COUNTER=2") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:21] Set("PJSIP/403-00000006", "CURRENT_DEVICE=PJSIP/401vitxi") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:22] EndWhile("PJSIP/403-00000006", "") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:14] While("PJSIP/403-00000006", "1") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:15] Set("PJSIP/403-00000006", "DEVICE_STATUS=UNAVAILABLE") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:16] GotoIf("PJSIP/403-00000006", "0|0]?:next") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx_builtins.c: Goto (sub-extension-spy,s,20)
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:20] Set("PJSIP/403-00000006", "COUNTER=3") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:21] Set("PJSIP/403-00000006", "CURRENT_DEVICE=") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:22] EndWhile("PJSIP/403-00000006", "") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:14] While("PJSIP/403-00000006", "0") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:23] GotoIf("PJSIP/403-00000006", "1?h-call") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx_builtins.c: Goto (sub-extension-spy,s,25)
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@sub-extension-spy:25] Hangup("PJSIP/403-00000006", "") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Spawn extension (sub-extension-spy, s, 25) exited non-zero on 'PJSIP/403-00000006'
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] app_stack.c: PJSIP/403-00000006 Internal Gosub(local-call-hangup,s,1) start
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@local-call-hangup:1] Verbose("PJSIP/403-00000006", "0, Hangup Local Call") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] app_verbose.c: Hangup Local Call
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@local-call-hangup:2] UserEvent("PJSIP/403-00000006", ""EXTENSIONS_SUMMARY","Data: EXT_TO_FC,PJSIP/403,LOCAL"") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] pbx.c: Executing [s@local-call-hangup:3] Return("PJSIP/403-00000006", "") in new stack
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] app_stack.c: Spawn extension (sub-extension-spy, s, 25) exited non-zero on 'PJSIP/403-00000006'
[2023-11-01 11:50:45] VERBOSE[1900399][C-00000004] app_stack.c: PJSIP/403-00000006 Internal Gosub(local-call-hangup,s,1) complete GOSUB_RETVAL=
Here’s my config for the spy feature, in /etc/asterisk/vitalpbx/extensions__20-baseplan.conf
[sub-extension-spy]
exten => s,1,Set(SPY_OPTIONS=${IF($["${ARG1}"="whisper"]?qwS:${IF($["${ARG1}"="barge"]?qBS:qS)})})
same => n(read_ext),Read(EXTENSION_NUMBER,vpbx/vital-spy-extension-number)
same => n,GotoIf($["${EXTENSION_NUMBER}"=""]?read_ext)
same => n,Set(EXTENSION_DIAL=${DB(${TENANT}/extensions/${EXTENSION_NUMBER}/dial)})
same => n,GotoIf($["${EXTENSION_DIAL}"=""]?read_ext)
same => n,GotoIf($["${DB(${TENANT}/extensions/${EXTENSION_NUMBER}/spyb)}"="yes"]?:skip_pwd)
same => n,Set(EXTENSION_PASSWORD=${DB(${TENANT}/extensions/${EXTENSION_NUMBER}/password)})
same => n,GotoIf($["${EXTENSION_PASSWORD}"=""]skip_pwd)
same => n,Authenticate(${EXTENSION_PASSWORD},,${LEN(${EXTENSION_PASSWORD})},please-enter-the&extension&vm-password&followed_pound)
same => n(skip_pwd),NoOp()
same => n,Set(DEVICE_TO_SPY=)
same => n,Set(COUNTER=1)
same => n,Set(CURRENT_DEVICE=${CUT(EXTENSION_DIAL,&,${COUNTER})})
same => n,While($[${EXISTS(${CURRENT_DEVICE})}])
same => n,Set(DEVICE_STATUS=${DEVICE_STATE(${CURRENT_DEVICE})})
same => n,GotoIf($["${DEVICE_STATUS}"="INUSE"]|$["${DEVICE_STATUS}"="BUSY"]]?:next)
same => n,Set(DEVICE_TO_SPY=${CURRENT_DEVICE})
same => n,Set(CURRENT_DEVICE=)
same => n,Goto(end)
same => n(next),Set(COUNTER=$[${COUNTER} + 1])
same => n,Set(CURRENT_DEVICE=${CUT(EXTENSION_DIAL,&,${COUNTER})})
same => n(end),EndWhile()
same => n,GotoIf($[${LEN(${DEVICE_TO_SPY})}=0]?h-call)
same => n,ChanSpy(${DEVICE_TO_SPY},${SPY_OPTIONS})
same => n(h-call),Hangup()
Any further ideas?