Summary:ASTERISK-05851: mixmonitor makes the second chanspy on a channel crash asterisk.
Reporter:Jose Pablo Fernandez (pupeno)Labels:
Date Opened:2005-12-15 13:06:33.000-0600Date Closed:2005-12-16 18:59:48.000-0600
Versions:Frequency of
Environment:Attachments:( 0) asterisk.bt
( 1) backtrace_and_more.txt
( 2) bug6010.backtrace.txt
Description:We have three devices:


and the following extensions.conf:

exten => 1,1,Dial(SIP/Test1)
exten => 1,2,hangup

exten => 2,1,MixMonitor(/tmp/pepe.WAV|bv(1)V(1))
exten => 2,2,Dial(SIP/Test2)
exten => 2,3,hangup

exten => 3,1,ChanSpy(SIP/Test1|b)
exten => 3,2,hangup

exten => 4,1,ChanSpy(SIP/Test2|b)
exten => 4,1,hangup

When we pick up phone SIP/Test1 and dial 2 (calling SIP/Test2), we get mixmonitor to record the call. From SIP/Test3 we dial 3 (to make a chanspy) and we hear the conversation between SIP/Test1 and SIP/Test2, if we hang up SIP/Test3 and re-dial 3 (to make a second chanspy), we get a segmentation fault *always on the second attempt*.
We can make as many calls from SIP/Test3 to 4, the other chanspy, without getting any segmentation fault.
If we hangup the call between SIP/Test1 and SIP/Test2, make another call and then the chanspy as when dialing 3, it works. That means that the problem happens only when making a second consecutive chanspy to the callee of a call being mixmonitored.


Output on the CLI up to the segmentation fault:
-- Executing MixMonitor("SIP/Test1-1b10", "/tmp/pepe.WAV|bv(1)V(1)") in new stack
   -- Executing Dial("SIP/Test1-1b10", "SIP/Test2") in new stack
   -- Called Test2
   -- SIP/Test2-1c40 is ringing
 == Begin MixMonitor Recording SIP/Test1-1b10
   -- SIP/Test2-1c40 answered SIP/Test1-1b10
   -- Executing ChanSpy("SIP/Test3-6b14", "SIP/Test1|b") in new stack
   -- Playing 'beep' (language 'en')
   -- Playing 'spy-sip' (language 'en')
 == Spying on channel SIP/Test1-1b10
Dec 15 17:01:13 NOTICE[10991]: app_chanspy.c:196 start_spying: Attaching SIP/Test3-6b14 to SIP/Test1-1b10
 == Done Spying on channel SIP/Test1-1b10
Dec 15 17:01:20 WARNING[10991]: file.c:583 ast_readaudio_callback: Failed to write frame
   -- Playing 'beep' (language 'en')
 == Spawn extension (default, 3, 1) exited non-zero on 'SIP/Test3-6b14'
   -- Executing ChanSpy("SIP/Test3-4238", "SIP/Test1|b") in new stack
   -- Playing 'beep' (language 'en')
   -- Playing 'spy-sip' (language 'en')
 == Spying on channel SIP/Test1-1b10
Dec 15 17:01:27 NOTICE[11004]: app_chanspy.c:196 start_spying: Attaching SIP/Test3-4238 to SIP/Test1-1b10
Segmentation fault (core dumped)

The backtrace is:
(gdb) backtrace
#0  0x0806007c in ast_channel_spy_add (chan=0x8190220, spy=0xb708e8b8) at channel.c:999
#1  0xb748c78e in start_spying (chan=0x8190220, spychan=0x81aa880, spy=0xb708e8b8) at app_chanspy.c:199
#2  0xb748cb05 in channel_spy (chan=0x81aa880, spyee=0x8190220, volfactor=0xb708ec58, fd=0) at app_chanspy.c:282
#3  0xb748d9fb in chanspy_exec (chan=0x81aa880, data=0xb7092fc8) at app_chanspy.c:516
#4  0x0808cef1 in pbx_extension_helper (c=0x81aa880, con=Variable "con" is not available.
) at pbx.c:544
ASTERISK-1  0x0808e4a4 in __ast_pbx_run (c=0x81aa880) at pbx.c:2220
ASTERISK-2  0x0808f09c in pbx_thread (data=0x0) at pbx.c:2507
ASTERISK-3  0xb7f82361 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
ASTERISK-4  0xb7e70bde in clone () from /lib/tls/i686/cmov/libc.so.6
Comments:By: Tilghman Lesher (tilghman) 2005-12-15 15:30:08.000-0600

Please upload a text file containing the output of 'bt full'

By: Tilghman Lesher (tilghman) 2005-12-15 15:33:05.000-0600

Duh, me... Please update to the latest 1.2, using svn to checkout the branch.  There have been changes to resolve a problem of this sort already.

By: Jose Pablo Fernandez (pupeno) 2005-12-16 10:43:18.000-0600

We have just tested this same situation on Asterisk 1.2 SVN (the svn branch) and the first spy works (like before); the second doesn't crash asterisk, but nothing is heard; the third spy crashed Asterisk.

By: Tilghman Lesher (tilghman) 2005-12-16 10:52:55.000-0600

Okay, and please upload a text file containing the output of 'bt full'.

By: Jose Pablo Fernandez (pupeno) 2005-12-16 12:06:33.000-0600

Here are both backtrace over a core dump generated from 1.2 SVN. What I said earlier wasn't right, Asterisk crashes on hang up of the second chanspy.


By: Tilghman Lesher (tilghman) 2005-12-16 12:15:56.000-0600

Please don't paste the output again.  As I suggested, UPLOAD A FILE.

By: Tilghman Lesher (tilghman) 2005-12-16 12:23:11.000-0600

The following output is also needed:

(bt) p *chan
(bt) frame 2
(bt) p *chan

By: Jose Pablo Fernandez (pupeno) 2005-12-16 12:28:54.000-0600

I have uploaded backtrace_and_more.txt with the commands you asked for, but since I've done it on the second core I generated (I deleted the first one), I also included the backtraces as well.

By: Tilghman Lesher (tilghman) 2005-12-16 18:12:05.000-0600

I've made a change to 1.2 in SVN that will hopefully fix this issue.  Please update to the latest 1.2 branch and do a 'make clean dont-optimize' and try again.

By: Tilghman Lesher (tilghman) 2005-12-16 18:59:11.000-0600

A related bug has been confirmed as fixed, so I'm going to close this one out as well.  Reopen if this is still an issue with the latest SVN 1.2.