I have the following chanspy configuration in extensions_override_freepbx.conf:

exten => 5555,1,Answer()
exten => 5555,n,Authenticate(XXXXXX)
exten => 5555,n,Read(SPYNUM,enter-ext-of-person)
exten => 5555,n,GotoIf($[${SPYNUM} = XXXX | …])
exten => 5555,n,Read(SPYNUM,enter-ext-of-person)
exten => 5555,n(gospy),Chanspy(SIP/${SPYNUM})
exten => 5555,n,Hangup()
exten => 5555,n(nospy),Playback(pbx-invalid)
exten => 5555,n,Playback(vm-goodbye)
exten => 5555,n,Hangup()

This configuration works fine but we need to modify it to meet our client’s needs. As you can see on the third line, the user is prompted to enter an extension that he/she would like to barge in. Basically, we would like to eliminate it.

What we need to accomplish, is after entering the password, the user is randomly redirected to any available extensions that are currently engaged on the phone. After the conversation/line has ended, the user is then again randomly redirected to any available extensions.

Can this be done?

Thanks a lot!