ChanSpy problem

Hi, ChanSpy doesn’t work on my system. I hear just one channel at a time (the caller or the calee).

About the system:

[code]>uname -a
Linux pbx.provider.tld 2.6.18-164.el5 #1 SMP Thu Sep 3 03:33:56 EDT 2009 i686 i686 i386 GNU/Linux

cat /etc/redhat-release
CentOS release 5.4 (Final)

asterisk -V
Asterisk 1.4.26.3[/code]

Elastix 1.6-13
FreePBX 2.6.0.0

One of the extensions:

[152] deny=0.0.0.0/0.0.0.0 secret=XXXXXX dtmfmode=rfc2833 canreinvite=no context=from-internal host=dynamic type=friend nat=yes port=5060 qualify=yes callgroup= pickupgroup= dial=SIP/152 accountcode= mailbox=152@device permit=0.0.0.0/0.0.0.0 callerid=device <152> call-limit=50

The ChanSpy:

[app-chanspy] include => app-chanspy-custom exten => 555,1,Macro(user-callerid,) exten => 555,n,Answer exten => 555,n,Wait(1) exten => 555,n,ChanSpy() exten => 555,n,Hangup

Calling to ChanSpy gives:

During an active call i have:

pbx*CLI> core show channels Channel Location State Application(Data) SIP/155-b6c081b0 555@from-internal:4 Up ChanSpy() SIP/152-09891b98 (None) Up AppDial((Outgoing Line)) SIP/provider-b6c004b s@macro-dial:7 Up Dial(SIP/145&SIP/146&SIP 3 active channels 2 active call

Finaly i hear just one channel (SIP/152-09891b98 in this case). In Elastix 1.5.2 it was all ok: i heard the both channels.

I had to play some staff to both sides simultaneously, and I played what I want to play to every channel.
I suppose same is for listening.

I think i’ve found the problem: issues.asterisk.org/view.php?id=16167 . But is this actual for my version of asterisk ?

Simplest way is to modify code a little rebuild asterisk and check what happens:

//if (ast_test_flag(chan, OPTION_READONLY)) {
        /* Option 'o' was set, so don't mix channel audio */
//        f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_READ, AST_FORMAT_SLINEAR);
//    } else {
        f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR);
//    }

4 comments and you will see what happens.