Summary:ASTERISK-08205: Chanspy whisper does not work as expected
Reporter:Tony Zhao (tony zhao)Labels:
Date Opened:2006-11-28 10:47:01.000-0600Date Closed:2007-03-11 20:35:40
Versions:Frequency of
Description:When using originate to call a local channel that attempts to spy on some channel with application Playback(filename), the sounds are not played back.

The Chanspy operation only attempts bridge for the amount of time the Application for originate is run.  Sometimes there will be a segmentation fault without a useful backtrace due to GSM to slin frame errors.  This is probably due to mixing of channels.

I want to provide a text to speech message on phone functionality through the playback of a file generated by another program then playing it back as soon as ChanSpy connects.


action: Originate
Channel: local/generate@ami-meetmewhisper/n
Variable: spychan=some channel
Application: Playback(some file)

exten => generate,1,Chanspy(${spychan}|W)
exten => generate,n,Hangup()
Comments:By: Joshua C. Colp (jcolp) 2006-11-28 10:53:58.000-0600

Are you using the beta, or an SVN checkout of 1.4?

By: Tony Zhao (tony zhao) 2006-11-28 11:04:04.000-0600

I am using the SVN trunk checkout of Asterisk.  I presume its the lastest version of 1.4.

By: Joshua C. Colp (jcolp) 2006-11-28 22:00:22.000-0600

Okay, I've figured out what needs to happen so you get the behavior you want.

1. You can't send it straight to Playback, you need to send it to an extension where it answers and waits for 3-5 seconds THEN do Playback. This allows everything to settle.
2. Answer before Chanspy.

Since I've determined that this isn't actually a bug I'm closing this bug out, but if you do still think it's a bug after trying these tips feel free to reopen. You may also want to enlist the help of others on asterisk-users or report your progress so others who want to do the same thing can search and find your information. Peace!

By: Tony Zhao (tony zhao) 2006-11-29 10:52:04.000-0600

I already tried this with

action: Originate
Channel: local/123@ami-playback/n
Data; IAX2|W
Application: ChanSpy


exten => _X.,1,Noop(Playing sounds)
exten => _X.,n,Wait(5)
exten => _X.,n,Playback(tt-monkeys)
exten => _X.,n,Hangup()

and the result is

  Executing [123@ami-playback:1] NoOp("Local/123@ami-playback-74f7,2", "Playing sounds") in new stack
   -- Executing [123@ami-playback:2] Wait("Local/123@ami-playback-74f7,2", "5") in new stack
   -- Executing [123@ami-playback:3] Playback("Local/123@ami-playback-74f7,2", "tt-monkeys") in new stack
   -- Playing 'tt-monkeys' (language 'en')
   -- Playing 'beep' (language 'en')
   -- Playing 'spy-iax2' (language 'en')
 == Spying on channel IAX2/pbx-jax-3
[Nov 29 08:47:34] NOTICE[13863]: app_chanspy.c:202 start_spying: Attaching Local/123@ami-playback-74f7,1 to IAX2/pbx-jax-3
[Nov 29 08:47:34] WARNING[13863]: codec_gsm.c:140 gsmtolin_framein: Invalid GSM data (1)
[Nov 29 08:47:34] WARNING[13863]: translate.c:197 framein: gsmtolin did not update samples 0
Segmentation fault

I get a segmentation fault when I try to put it into gdb.

**I think its due to the mixing of channels from playback and the ChanSpy that is causing the gsmtolin to screw up.


By: Joshua C. Colp (jcolp) 2006-11-29 21:13:24.000-0600

Do it using two local channels. One that goes to an extension that answers and does chanspy, then one that answers, waits for a few seconds, and does playback.

By: Tony Zhao (tony zhao) 2006-12-01 11:10:21.000-0600

I don't seem to understand, if 2 local channels are used, then how can the end user hear the playback since physically the 2 local channels are different channels and the whole point of chanspy is to bridge the local channel to one of the caller/callee channels.

By: Joshua C. Colp (jcolp) 2007-03-11 20:35:39

Since this was solved using other methods (if I remember correctly) closing it out.