Streaming live call audio to another server

Hi Team,

I am trying to implement streaming of live call audio to another server. For this , I am using Chanspy() to listen individually ,to both of the channels bridged.
First of all, I am originating a local channel, that calls the extension using Chanspy application, where I have provided the group to be spied on.
After that, we are calling the script to be executed, on the spied on channel, using eagi application, which streams over the audio to another server.

Now, I have one doubt in this implementation, which is, the channel that is spying on both the channels, can it be the local channel, by which I am calling the chanspy application?

//
[default]
exten => connectagent,1,NoOp(‘Here we connect the channel of caller’)
same => n,set(SPYGROUP={CHANNEL}) //same => n,Originate(Local/112233{CHANNEL}@default,app,eagi,/etc/asterisk/script.js, me)

exten => connectcall,1,NoOp(‘Here we connect the calleel’)
same => n,set(SPYGROUP={CHANNEL}) // same => n,Originate(Local/112233{CHANNEL}@default,app,eagi,/etc/asterisk/script.js, them)

exten => _112233.,1,NoOp(‘Here we engage ChanSpy’)
same => n,Answer()
same => n,ChanSpy(,g(${EXTEN:6})o)

//

Please mark up your dialplan correctly, using the <//> button. I am assuming the original dialplan was well formed.

Channel is used ambiguously in Asterisk. In reality what is passed to Originate is a dial string, not a a channel name, and always results in the creation of a new channel, that did not previously exist (or fails).