[Application] Asterisk to Asterisk - Simulated Conversation

I am trying to guage the feasibility of setting up a connection between two Zap channels from a third Zap channel (via DTMF).

*1-Zap1 <-----> *2-Zap1

When connected *2-Zap1 would answer. *1-Zap1 would wait for silence and then play back a .wav file. *2-Zap1 would then wait for silence and then play back a response .wav file. The simulated conversation would continue until hangup.

The third Zap channel would monitor the call.

I am sure this is possible. Was wondering if anyone had attempted or could offer advice.

The third channel can simply monitor the call via ChanSpy. I am unsure as to how you would go about playing .wav files back and forth.

WaitForSilence should let me simulate a conversation. Probably with some tuning of the wait duration…

*1

exten => 123,1,Dial(Zap/1)
exten => 123,n,Set(CONVERSE=1)
exten => 123,n(listen),WaitForSilence(2000,1)
exten => 123,n(talk),Playback(${CONVERSE})
exten => 123,n,Set(CONVERSE=$[${CONVERSE} + 1])
exten => 123,n,GoTo(123,listen)

*2

exten => s,1,Answer()
exten => s,n,Set(CONVERSE=1)
exten => s,n(talk),Playback(${CONVERSE})
exten => s,n(listen),WaitForSilence(3000,1)
exten => s,n,Set(CONVERSE=$[${CONVERSE} + 1])
exten => s,n,GoTo(s,talk)

where CONVERSE are numbered .wav files:

1.wav
2.wav
3.wav
etc…