[asterisk-users] Recording with MixMonitor and AGI

Henrik Westerberg henrik.westerberg at ain.se
Thu Mar 14 02:43:12 CDT 2013


Hi,

The idea was to record an ongoing call by three party bridging on the mobile phone.
Well my problem was to halt execution of the Dialplan so the server would not hang up the call. And I don´t want the server to say anything during the call.
Now I solved this case as well by using Answer and then Record in the dialplan . So I´m not recording with MixMonitor.

But just out of curiosity. How did you mean using hold (in answer/hold). Is that MusicOnHold? For me I can´t use that since I don´t want to make any noise. Is there another way?

exten => 111,1,Answer()
exten => 111,n,?????

I have tried using Wait with a long duration but have not succeeded to make it work as I want.

I am using asterisk-java and originate calls to local channels.

Regards,
Henrik


Från: "Yves A." <yves030 at gmx.de<mailto:yves030 at gmx.de>>
Datum: söndag 10 mars 2013 11:42
Till: Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users at lists.digium.com<mailto:asterisk-users at lists.digium.com>>, Henrik Westerberg <henrik.westerberg at ain.se<mailto:henrik.westerberg at ain.se>>
Ämne: Re: [asterisk-users] Recording with MixMonitor and AGI

Hi,

so if your are ok with the way you solved part 1... alright, lets go to part 2..
but again... hu.. I don´t understand..
what do you mean with merging to a mobile phone?
do you want do bridge the calls (three partys) or do you want to play the just recorded file
from your server-initiated call into a another running call?
what is "by hand"?
the more explicit you are, the more helpful will be the answer.

you ask "but if there is a way to just
dial out and then let the server side of the call "Keep the channel up but do nothing forever until the call is hang up""

of course you can...you could e.g.:
call into a queue
call into a meetme room
call with the help of a local channel into a context where you do nothing but answer / hold

but as i said.... i did not quite catch what your objective really is... i just dont understand
your scenario or cant imagine its sense.

if you are a java programmer, i think your using the asterisk-java lib from s. reuter..
if so, you have any freedom, you could also use ami connection to listen to events
to start and stop recordings and so on.

regards,
yves

Am 09.03.2013 21:32, schrieb Henrik Westerberg:
Hi,

Thanks for your answer!

1.
> so you want to establish a call (triggered by ami) between two partys, record the conversation
> and save the file to a(nother) server (afterwards), right?

Yes this is correct, and I prefer to do the transferring of the file to another server with my existing AGI.
My AGIs are written in java. Today I the upload is done over http.
Today I schedule the upload in the AGI script a couple of seconds after the channel is hang up. But the two
lines might not be hung up at the same time.
Your suggestion of always fixing the file is wise, it now seems to work fine after having been processed with sox.

So now I think that this case 1 is ok for me :-)

2.
> and another task is to establish (also ami triggered) a call to a mobile and play, lets say a voicefile.
> this "conversation" should also be recorded and saved on a(nother) server (afterwards), right?

The idea is to perform a "probe call" with the only task of recording what the other party says.
It will be merged "by hand" on a mobile phone to an ongoing call with another party.
This could be done by calling out and letting AGI execute a RECORD FILE but if there is a way to just
dial out and then let the server side of the call "Keep the channel up but do nothing forever until the call is hang up"
Then I could easily use the MixMonitor and write the whole conversation in the dialplan with uploading similar to the first case.
Any suggestions?

Regards,
Henrik



Från: "Yves A." <yves030 at gmx.de<mailto:yves030 at gmx.de>>
Svara till: Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users at lists.digium.com<mailto:asterisk-users at lists.digium.com>>
Datum: torsdag 7 mars 2013 20:10
Till: Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users at lists.digium.com<mailto:asterisk-users at lists.digium.com>>
Ämne: Re: [asterisk-users] Recording with MixMonitor and AGI

hi,

hard to understand, what your objective is... at least for me ;-)

so you want to establish a call (triggered by ami) between two partys, record the conversation
and save the file to a(nother) server (afterwards), right?

and another task is to establish (also ami triggered) a call to a mobile and play, lets say a voicefile.
this "conversation" should also be recorded and saved on a(nother) server (afterwards), right?

let me know, if i understood you right, the solution is not so hard to implement.
In what language do you preferrably write your AGIs? (although there is no absolute need for using an
agi... you can all write down in your dialplan...)
is there a special protocol requirement for saving/transferring the recorded voicefile (e.g. ftps)?
One obstacle is, that the recorded file is not fully written _immediately_ after stopmixmonitor or hangup...
this has to be taken care of and depending on your agi... it might be interrupted, if the call is hungup...
but as you did not show your agi... these are just hints..

regards,
yves



Am 07.03.2013 16:21, schrieb Henrik Westerberg:
Hi,

I am developing a call recording application on Asterisk 11.2 and have this configuration in my dialplan:

[macro-ccdev2-rec]
exten => s,1,MixMonitor(${ARG1},b)

[outgoing-originate]
exten => _X.,1,NoOp(Will send call to ${EXTEN})
exten => _X.,n,Dial(SIP/${EXTEN}@x.y.z<mailto:EXTEN%7D at x.y.z>)

[outgoing-originate-rec]
exten => h,1,Agi(agi://localhost/ajpbx.agi?path=uploadrec&callid=${CC_CALLID})

exten => _X,1,NoOp(Will send call to ${EXTEN}, CC_CALLID is ${CC_CALLID}, CC_FILENAME is ${CC_FILENAME})
exten => _X,n,Dial(SIP/${EXTEN}@x.y.z,60,M<mailto:EXTEN%7D at x.y.z,60,M>(ccdev2-rec^${CC_FILENAME})e)

If I want to make a recorded server callout from 077777777 to 0888888888 I then originate a call via AMI to Local/077777777 at outgoing-originate with context set to outgoing-originate-rec and extension to 0888888888.
The result will be something like this:

    -- Executing [s at macro-ccdev2-rec:1] MixMonitor("SIP/upps-ccm-tq01-0000003f", "cbrec-15605.wav,b") in new stack
  == Begin MixMonitor Recording SIP/upps-ccm-tq01-0000003f
    -- Executing [h at outgoing-originate-rec:1] AGI("SIP/upps-ccm-tq01-0000003e", "agi://l4574/ajpbxtest.agi?path=uploadrec&callid=15605") in new stack
    -- <SIP/upps-ccm-tq01-0000003e>AGI Script agi://localhost/ajpbxtest.agi?path=uploadrec&callid=15605 completed, returning 0
    -- Executing [h at outgoing-originate-rec-dev2:1] AGI("SIP/upps-ccm-tq01-0000003f", "agi://4574/ajpbxtest.agi?path=uploadrec&callid=") in new stack
    -- <SIP/upps-ccm-tq01-0000003f>AGI Script agi://localhost/ajpbxtest.agi?path=uploadrec&callid= completed, returning 0
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording SIP/upps-ccm-tq01-0000003f

Unfortunately I get two different calls to the h extension, but this I can cope with. The one without called is not interesting.
The uploading will fail since the MixMonitor is still on when I try to upload the file. The file will not have a duration. It works when I schedule the uploading a while after from my agi application but I would rather not rely on a timeout.

When I tried to run StopMixMonitor before the Agi call in the h extension, the first call fail and I never get any uploading with callid.

    -- Executing [s at macro-ccdev2-rec:1] MixMonitor("SIP/upps-ccm-tq01-00000043", "cbrec-15607.wav,b") in new stack
  == Begin MixMonitor Recording SIP/upps-ccm-tq01-00000043
    -- Executing [h at outgoing-originate-rec-dev2:1] StopMixMonitor("SIP/upps-ccm-tq01-00000042", "") in new stack
  == Spawn extension (outgoing-originate-rec-dev2, h, 1) exited non-zero on 'SIP/upps-ccm-tq01-00000042'
    -- Executing [h at outgoing-originate-rec-dev2:1] StopMixMonitor("SIP/upps-ccm-tq01-00000043", "") in new stack
  == MixMonitor close filestream (mixed)
    -- Executing [h at outgoing-originate-rec-dev2:2] AGI("SIP/upps-ccm-tq01-00000043", "agi://localhost/ajpbxtest.agi?path=uploadrec&callid=") in new stack

Am I missing something here? I also looked at the possibility to specify a command to execute when MixMonitor stops but I would rather handle the file uploading in my agi application.

I also have another case: I want to dial out a call and record it. It will be a "oneway-call" from the server to a mobile. Do I need to get AGI-control of it and record with an AGI command or how can I hack it directly in the dial plan using MixMonitor?

Best Regards,
Henrik



--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130314/7b85265d/attachment-0001.htm>


More information about the asterisk-users mailing list