[Home]

Summary:ASTERISK-11233: MixMonitor doesn't work right with SIP and FLASH on FXS channels
Reporter:viniciusfontes (viniciusfontes)Labels:
Date Opened:2008-01-14 04:20:34.000-0600Date Closed:2008-01-15 14:02:36.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_mixmonitor
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I want to record *every* call in my Asterisk box, so I use the MixMonitor() application like this is my extensions.conf:

exten => _0X.,1,Answer()
exten => _0X.,n,MixMonitor(${CALLERID(num)}-${STRFTIME(${EPOCH},America/Sao_Paulo,%Y-%m-%d-%H-%M-%S)}-${EXTEN}.wav)
exten => _0X.,n,Dial(IAX2/pabx-canall/${EXTEN},60,tT)

exten => _2XX,1,Answer() exten => _2XX,n,MixMonitor(${CALLERID(num)}-${STRFTIME(${EPOCH},America/Sao_Paulo,%Y-%m-%d-%H-%M-%S)}-${EXTEN}.wav) exten => _2XX,n,Dial(SIP/${EXTEN},60,tT)

The scenario is as following:

1) 201 asks operator for an external call, hangs up. The audio file is stored correctly. From the CLI:

[Jan 8 16:20:19] -- Executing [200@default:1] Answer("SIP/201-081d8740", "") in new stack
[Jan 8 16:20:19] -- Executing [200@default:2] MixMonitor("SIP/201-081d8740", "201-2008-01-08-16-20-19-200.wav") in new stack
[Jan 8 16:20:19] -- Executing [200@default:3] Dial("SIP/201-081d8740", "SIP/200|60|tT") in new stack
[Jan 8 16:20:19] == Begin MixMonitor Recording SIP/201-081d8740
[Jan 8 16:20:19] -- Called 200
[Jan 8 16:20:19] -- SIP/200-081fac90 is ringing
[Jan 8 16:20:23] -- SIP/200-081fac90 answered SIP/201-081d8740
[Jan 8 16:20:27] == Spawn extension (default, 200, 3) exited non-zero on 'SIP/201-081d8740'
[Jan 8 16:20:27] == End MixMonitor Recording SIP/201-081d8740



2) 200 dials to the PSTN. So far so good.

[Jan 8 16:20:35] -- Executing [021047020@default:1] Answer("SIP/200-081d8740", "") in new stack
[Jan 8 16:20:35] -- Executing [021047020@default:2] MixMonitor("SIP/200-081d8740", "200-2008-01-08-16-20-35-021047020.wav") in new stack
[Jan 8 16:20:35] -- Executing [021047020@default:3] Dial("SIP/200-081d8740", "IAX2/pabx-canall/021047020|60|tT") in new stack
[Jan 8 16:20:35] == Begin MixMonitor Recording SIP/200-081d8740
[Jan 8 16:20:35] -- Called pabx-canall/021047020
[Jan 8 16:20:35] -- Call accepted by 200.248.136.140 (format alaw)
[Jan 8 16:20:35] -- Format for call is alaw [Jan 8 16:20:35] -- IAX2/pabx-canall-16384 answered SIP/200-081d8740



3) Extension 200 is a Polycom SoundPoint 301 IP phone. It presses the Transfer button, putting 021047020 in hold and dialing to 201 who answers the call:

[Jan 8 16:20:45] -- Started music on hold, class 'default', on IAX2/pabx-canall-16384
[Jan 8 16:20:51] -- Executing [201@default:1] Answer("SIP/200-081fac90", "") in new stack
[Jan 8 16:20:51] -- Executing [201@default:2] MixMonitor("SIP/200-081fac90", "200-2008-01-08-16-20-51-201.wav") in new stack
[Jan 8 16:20:51] -- Executing [201@default:3] Dial("SIP/200-081fac90", "SIP/201|60|tT") in new stack
[Jan 8 16:20:51] -- Called 201
[Jan 8 16:20:51] == Begin MixMonitor Recording SIP/200-081fac90
[Jan 8 16:20:51] -- SIP/201-081edf80 is ringing
[Jan 8 16:20:54] -- SIP/201-081edf80 answered SIP/200-081fac90



4) The operator says "here's your call" to 201 and presses Transfer on the phone once more. The call is transferred correctly, but:
[Jan 8 16:20:57] -- Stopped music on hold on IAX2/pabx-canall-16384
[Jan 8 16:20:57] == Spawn extension (default, 021047020, 3) exited non-zero on 'SIP/200-081d8740'
[Jan 8 16:20:57] == End MixMonitor Recording SIP/200-081d8740
[Jan 8 16:20:57] == End MixMonitor Recording SIP/200-081fac90


Notice that all the MixMonitor processes stopped!

5) 201 finally hangs up the phone:

[Jan 8 16:21:45] == Spawn extension (default, 201, 3) exited non-zero on 'IAX2/pabx-canall-16384'
[Jan 8 16:21:45] -- Hungup 'IAX2/pabx-canall-16384'



So, all the audio regarding the important part -- the call to the PSTN itself -- is simply lost.

Although I'm using SIP in this example, the very same thing happens when I use a TDM2400 with FXS channels and press the FLASH button on the phone to transfer.

I noticed that if I use Asterisk's built-in transfer features (atxfer, blindxfer) everything works fine.

Any ideas on workarounds will be welcome as well (IE mapping the FLASH on the analog phone to the sequence configured on features.conf).
Comments:By: Joshua C. Colp (jcolp) 2008-01-14 08:18:07.000-0600

It actually is doing the logical thing... let me explain.

In your instance when you start MixMonitor it is on the calling channel, always a channel created by SIP/200 in your above scenario. This channel ultimately disappears though once the transfer completes. You actually want MixMonitor to start on the called channel instead. The one thing that comes to mind is using chan_local in between with /n so you can start MixMonitor on a channel that shouldn't go away.

By: viniciusfontes (viniciusfontes) 2008-01-14 08:50:10.000-0600

OK, but could I continue to use SIP and FLASH transfers using chan_local? If so, a simple example would be very appreciated.

By: Joshua C. Colp (jcolp) 2008-01-14 08:53:19.000-0600

Example:

[recorded-outbound]
exten => _X.,1,MixMonitor(${EXTEN}.wav)
exten => _X.,n,Dial(SIP/${EXTEN}@my_outgoing_provider)

[blah]
exten => _X.,1,Dial(Local/${EXTEN}@recorded-outbound)

Calls going out via blah will actually use chan_local and execute the dialplan logic in recorded-outbound. Since MixMonitor is actually started on the called channel it shouldn't disappear when you transfer.

By: viniciusfontes (viniciusfontes) 2008-01-14 08:57:30.000-0600

I'll try that on a test server tomorrow and keep you guys informed. Thank you very much for the quick answer.

By: viniciusfontes (viniciusfontes) 2008-01-15 04:50:57.000-0600

Unfortunely happened pretty much the same. Here is my extensions.conf:

[default]

exten => _0X.,1,MixMonitor(${CALLERID(num)}-${STRFTIME(${EPOCH},America/Sao_Paulo,%Y-%m-%d-%H-%M-%S)}-${EXTEN}.wav)
exten => _0X.,n,Dial(Local/${EXTEN}@calls/n)

exten => _2XX,1,MixMonitor(${CALLERID(num)}-${STRFTIME(${EPOCH},America/Sao_Paulo,%Y-%m-%d-%H-%M-%S)}-${EXTEN}.wav)
exten => _2XX,n,Dial(Local/${EXTEN}@calls/n)


[calls]

exten => _0X.,1,Dial(IAX2/pabx-canall/${EXTEN},60,tT)

exten => _2XX,1,Dial(SIP/${EXTEN},60,tT)



1) 201 calls 200 (the operator) asking to make an external call:

[Jan 15 08:47:21]     -- Executing [200@default:1] MixMonitor("SIP/201-081da258", "201-2008-01-15-08-47-21-200.wav") in new stack
[Jan 15 08:47:21]     -- Executing [200@default:2] Dial("SIP/201-081da258", "Local/200@calls/n") in new stack
[Jan 15 08:47:21]     -- Called 200@calls/n
[Jan 15 08:47:21]   == Begin MixMonitor Recording SIP/201-081da258
[Jan 15 08:47:21]     -- Executing [200@calls:1] Dial("Local/200@calls-8d08,2", "SIP/200|60|tT") in new stack
[Jan 15 08:47:21]     -- Called 200
[Jan 15 08:47:21] NOTICE[3663]: chan_iax2.c:5258 register_verify: No registration for peer 'iaxmodem0' (from 127.0.0.1)
[Jan 15 08:47:21] NOTICE[3666]: chan_iax2.c:5258 register_verify: No registration for peer 'iaxmodem1' (from 127.0.0.1)
[Jan 15 08:47:21]     -- SIP/200-081e6a68 is ringing
[Jan 15 08:47:21]     -- Local/200@calls-8d08,1 is ringing
[Jan 15 08:47:29]     -- SIP/200-081e6a68 answered Local/200@calls-8d08,2
[Jan 15 08:47:29]     -- Local/200@calls-8d08,1 stopped sounds
[Jan 15 08:47:29]     -- Local/200@calls-8d08,1 answered SIP/201-081da258
[Jan 15 08:47:32]   == Spawn extension (calls, 200, 1) exited non-zero on 'Local/200@calls-8d08,2'
[Jan 15 08:47:32]   == Spawn extension (default, 200, 2) exited non-zero on 'SIP/201-081da258'
[Jan 15 08:47:32]   == End MixMonitor Recording SIP/201-081da258

The audio file is recorded ok.

2) 200 makes the external call, puts on hold

[Jan 15 08:47:44]     -- Executing [021047020@default:1] MixMonitor("SIP/200-081da258", "200-2008-01-15-08-47-44-021047020.wav") in new stack
[Jan 15 08:47:44]     -- Executing [021047020@default:2] Dial("SIP/200-081da258", "Local/021047020@calls/n") in new stack
[Jan 15 08:47:44]   == Begin MixMonitor Recording SIP/200-081da258
[Jan 15 08:47:44]     -- Called 021047020@calls/n
[Jan 15 08:47:44]     -- Executing [021047020@calls:1] Dial("Local/021047020@calls-7cd0,2", "IAX2/pabx-canall/021047020|60|tT") in new stack
[Jan 15 08:47:44]     -- Called pabx-canall/021047020
[Jan 15 08:47:44]     -- Call accepted by 200.248.136.140 (format alaw)
[Jan 15 08:47:44]     -- Format for call is alaw
[Jan 15 08:47:44]     -- IAX2/pabx-canall-16384 answered Local/021047020@calls-7cd0,2
[Jan 15 08:47:44]     -- Local/021047020@calls-7cd0,1 answered SIP/200-081da258
[Jan 15 08:47:55]     -- Started music on hold, class 'default', on Local/021047020@calls-7cd0,1


3) 200 dials to 201 and transfers the call:

[Jan 15 08:48:01]     -- Executing [201@default:1] MixMonitor("SIP/200-081f1c78", "200-2008-01-15-08-48-01-201.wav") in new stack
[Jan 15 08:48:01]     -- Executing [201@default:2] Dial("SIP/200-081f1c78", "Local/201@calls/n") in new stack
[Jan 15 08:48:01]   == Begin MixMonitor Recording SIP/200-081f1c78
[Jan 15 08:48:01]     -- Called 201@calls/n
[Jan 15 08:48:01]     -- Executing [201@calls:1] Dial("Local/201@calls-6203,2", "SIP/201|60|tT") in new stack
[Jan 15 08:48:01]     -- Called 201
[Jan 15 08:48:01]     -- SIP/201-08203c10 is ringing
[Jan 15 08:48:01]     -- Local/201@calls-6203,1 is ringing
[Jan 15 08:48:04]     -- SIP/201-08203c10 answered Local/201@calls-6203,2
[Jan 15 08:48:04]     -- Local/201@calls-6203,1 stopped sounds
[Jan 15 08:48:04]     -- Local/201@calls-6203,1 answered SIP/200-081f1c78
[Jan 15 08:48:09]     -- Stopped music on hold on Local/021047020@calls-7cd0,1
[Jan 15 08:48:09]   == Spawn extension (default, 021047020, 2) exited non-zero on 'SIP/200-081da258'
[Jan 15 08:48:09]   == End MixMonitor Recording SIP/200-081f1c78
[Jan 15 08:48:09]   == End MixMonitor Recording SIP/200-081da258

Again, the MixMonitor processes are ended.

4) Finally 201 hangs up:

[Jan 15 08:48:16] NOTICE[3668]: chan_iax2.c:5258 register_verify: No registration for peer 'iaxmodem0' (from 127.0.0.1)
[Jan 15 08:48:16] NOTICE[3664]: chan_iax2.c:5258 register_verify: No registration for peer 'iaxmodem1' (from 127.0.0.1)
[Jan 15 08:48:20]     -- Hungup 'IAX2/pabx-canall-16384'
[Jan 15 08:48:20]   == Spawn extension (calls, 021047020, 1) exited non-zero on 'Local/021047020@calls-7cd0,2'
[Jan 15 08:48:20]   == Spawn extension (calls, 201, 1) exited non-zero on 'Local/201@calls-6203,2'
[Jan 15 08:48:20]   == Spawn extension (default, 201, 2) exited non-zero on 'Local/021047020@calls-7cd0,1'


I tried both with and without the /n, same results. Any further ideas?



By: Joshua C. Colp (jcolp) 2008-01-15 08:32:46.000-0600

You are still starting MixMonitor on the SIP channel that goes away, you want to start it on the Local channel... carefully read over my example again.

By: viniciusfontes (viniciusfontes) 2008-01-15 10:19:29.000-0600

Sorry for the inconvenience. Worked as a charm right now. You can close the ticket. Thank you very much!



By: Joshua C. Colp (jcolp) 2008-01-15 14:02:36.000-0600

Closed as a suitable way to do it has been described.