I need to originate chanspy after call is established

HI,

I want to originate ChanSpy on calling channel after call is answered by agent. I have written a dialplan with hardcoded extensions and my logs are showing chanspy application has launched but i am not getting any sound on the Spying channel.

Can someone please help me understand where i am getting things wrong. Also i need help in spying only callers channel dynamically.

I am calling from 1005 to 1006 and i want 1007 to spy on 1005.

My Dialplan is -

[from-internal]
exten => _X.,1,Answer()
same => n,Dial(PJSIP/{EXTEN},20,tU(jump_to_here^{EXTEN}))

[jump_to_here]
exten => s,1,verbose({ARG1}) same => n,set(EXTEN={ARG1})
same => n,Originate(PJSIP/1007,app,ChanSpy,(,be(PJSIP/1005)Eqo))

My CLI Output is,

   > Launching ChanSpy((,be(PJSIP/1005)Eqo)) on PJSIP/1007-0000006b

Launching ChanSpy((,be(PJSIP/1005)Eqo)) on PJSIP/1007-0000006b

I suspect you need to use double quotes, rather than parentheses, around the arguments of the spy application.

Hi David,

Yes it require double quotes to spy on channel.

can you please assist me as well on how to get callers extension in dialplan? Bcoz i want to spy on callers extension primarily.

Caller’s never have extensions in Asterisk. Do you mean the caller ID (${CALLERID(num)}, or the the peer (see https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_CHANNEL for various options).

Extensions are defined by the name in extensions.* and there is no requirement that it be even possible to call a caller.

Hi David,

I tried with ${CALLERID(num) but it returns number of called extension.

Here in my scenario caller is calling on PRI line and landing on some extension and i want to spy on callers extension/channel. So, how would i retrieve it and spy on it.

Use case is,

user is calling on 4000, which is inturn picked up by PJSIP/1006.
and I want to spy on what 4000 is talking on extension PJSIP/1007

That may be the result of running it on the outgoing channel.

You could capture it on the incoming channel, before the Dial, using an exported variable, or you could IMPORT the value from the incoming side, using the bridge peer variable, or you use g to allow code on both channels, followed by Bridge. You may find you can use the connected line functions to get the other party from the outgoing side.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.