We needed to allow the managers listen their team calls.
We did it like this:
;Listen
exten => 2201,1,Macro(user-callerid)
exten => 2201,n,Noop( The callerid = ${CALLERID(num)})
exten => 2201,n,GotoIF($[$[${CALLERID(num)} =3031]| $[${CALLERID(num)} =3033| $[${CALLERID(num)} =3005]]?Allowed:Failed) ;This is possible extra form of checking to allow the call from only certain extensions.
exten => 2201,n(Allowed),Read(PIN,enter-password)
exten => 2201,n,GotoIF($[${PIN} = 1234]?Passed:Allowed) ;Set your password here.
exten => 2201,n(Passed),Background(beep)
exten => 2201,n,Read(SPYNUM,,4)
exten => 2201,n,Noop(Spynum = ${SPYNUM})
exten => 2201,n,GotoIF($[$[${SPYNUM} =3009] | $[${SPYNUM} =5846] |$[${SPYNUM} =5839]| $[${SPYNUM} =5817]| $[${SPYNUM} =6052]| $[${SPYNUM} =5808]| $[${SPYNUM} =3012]| $[${SPYNUM} =6009]| $[${SPYNUM} =6021]]?Spy:Bye) ; This locks down to what extensions can be spied on
exten => 2201,n(Spy),ChanSpy(SIP/${SPYNUM},q)
exten => 2201,n(Bye),Hangup()
exten => 2201,n(Failed),Playback(sorry)
exten => 2201,n,Hangup()
;whisper
exten => 2202,1,Macro(user-callerid)
exten => 2202,n,Noop( The callerid = ${CALLERID(num)})
exten => 2202,n,GotoIF($[$[${CALLERID(num)} =3031]| $[${CALLERID(num)} =3033| $[${CALLERID(num)} =3005]]?Allowed:Failed) ;This is possible extra form of checking to allow the call from only certain extensions.
exten => 2202,n(Allowed),Read(PIN,enter-password)
exten => 2202,n,GotoIF($[${PIN} = 1234]?Passed:Allowed) ;Set your password here.
exten => 2202,n(Passed),Background(beep)
exten => 2202,n,Read(SPYNUM,,4)
exten => 2202,n,Noop(Spynum = ${SPYNUM})
exten => 2202,n,GotoIF($[$[${SPYNUM} =3009] | $[${SPYNUM} =5846] |$[${SPYNUM} =5839]| $[${SPYNUM} =5817]| $[${SPYNUM} =6052]| $[${SPYNUM} =5808]| $[${SPYNUM} =3012]| $[${SPYNUM} =6009]| $[${SPYNUM} =6021]]?Spy:Bye) ; This locks down to what extensions can be spied on
exten => 2202,n(Spy),ChanSpy(SIP/${SPYNUM},qw)
exten => 2202,n(Bye),Hangup()
exten => 2202,n(Failed),Playback(sorry)
exten => 2202,n,Hangup()
;barge
exten => 2203,1,Macro(user-callerid)
exten => 2203,n,Noop( The callerid = ${CALLERID(num)})
exten => 2203,n,GotoIF($[$[${CALLERID(num)} =3031]| $[${CALLERID(num)} =3033| $[${CALLERID(num)} =3005]]?Allowed:Failed) ;This is possible extra form of checking to allow the call from only certain extensions.
exten => 2203,n(Allowed),Read(PIN,enter-password)
exten => 2203,n,GotoIF($[${PIN} = 1234]?Passed:Allowed) ;Set your password here.
exten => 2203,n(Passed),Background(beep)
exten => 2203,n,Read(SPYNUM,,4)
exten => 2203,n,Noop(Spynum = ${SPYNUM})
exten => 2203,n,GotoIF($[$[${SPYNUM} =3009] | $[${SPYNUM} =5846] |$[${SPYNUM} =5839]| $[${SPYNUM} =5817]| $[${SPYNUM} =6052]| $[${SPYNUM} =5808]| $[${SPYNUM} =3012]| $[${SPYNUM} =6009]| $[${SPYNUM} =6021]]?Spy:Bye) ; This locks down to what extensions can be spied on
exten => 2203,n(Spy),ChanSpy(SIP/${SPYNUM},qB)
exten => 2203,n(Bye),Hangup()
exten => 2203,n(Failed),Playback(sorry)
exten => 2203,n,Hangup()