[asterisk-users] Recording interface (pause/PLAY/RERECORD)

Sherwood McGowan sherwood.mcgowan at gmail.com
Tue Jul 27 21:54:43 CDT 2010


Record does not continue until the end of the call, it records until the
# is pressed or the max duration is reached:

http://www.voip-info.org/wiki/view/Asterisk+cmd+Record

Enjoy

On 7/27/2010 9:00 PM, Michelle Dupuis wrote:
> That's along the lines of what I was thinking, but how do you trap the DTMF during record and cause that to end recording?  I thought record kept going until hangup?
> 
> MD
> ________________________________________
> From: asterisk-users-bounces at lists.digium.com [asterisk-users-bounces at lists.digium.com] On Behalf Of Leif Madsen [leif.madsen at asteriskdocs.org]
> Sent: Tuesday, July 27, 2010 9:49 PM
> To: Asterisk Users List
> Subject: Re: [asterisk-users] Recording interface (pause/PLAY/RERECORD)
> 
> On 10-07-27 08:39 PM, Michelle Dupuis wrote:
>> Is there a prebuild module/dialplan which gives me a nice interface to recording messages?  Assuming I can't use the voicemail command, I need to offer users a way to record, playback, erase, rerecord, etc.
>>
>> I can probably do it through dialplan but it feels like I'm reinventing the wheel.
> 
> Ya I haven't really written one generally yet, but here is something I'm
> whipping together without testing :) I'll probably test it tomorrow during our
> daily documentation session.
> 
> [globals]
> CUSTOM_RECORDINGS=/var/lib/asterisk/sounds/en/custom
> 
> 
> [subRecordPrompt]
> exten => _[A-Za-z0-9].,1,NoOp()
> 
> ; Safely handle extension name -- this will be our filename
> same => n,Set(RecordedFilename=${FILTER(A-Za-z0-9,${EXTEN})})
> same => n,Set(RandomNumber=${RAND()})
> same => n,Answer()
> 
> ; Record the prompt
> same => n(record),Playback(please-enter-your&vm-message&after-the-tone)
> same => n,Wait(1)
> same =>
> n,Record(${GLOBAL(CUSTOM_RECORDINGS)}/temporaryRecording-${RandomNumber}.wav)
> 
> ; Ask how we want to handle the recording
> same => n(handle_recording),Read(ActionItem,vm-review,1)
> 
> ; Verify we got values we expect
> same => n,GotoIf($['${ActionItem}' = '1' | '${ActionItem}' = '2' |
> ${ActionItem}' = 3]?valid_action)
> same => n,Playback(wrong-try-again-smarty)
> same => n,Goto(handle_recording)
> same => n(valid_action),NoOp()
> 
> ; Handle the recording
> ; 1 accept
> ; 2 review
> ; 3 re-record
> same => n,GotoIf($['${ActionItem}' = '1']?accept,1) ; keep this recording
> same => n,GotoIf($['${ActionItem}' = '3']?record)   ; re-record it
> 
> ; If we get here they pressed 2
> same => n,Playback(${GLOBAL(CUSTOM_RECORDINGS)}/temporaryRecording-${RandomNumber})
> same => n,Goto(handle_recording)
> 
> exten => accept,1,Verbose(2,Recording accepted!)
> same => n,System(mv
> ${GLOBAL(CUSTOM_RECORDINGS)}/temporaryRecording-${RandomNumber}.wav
> ${GLOBAL(CUSTOM_RECORDINGS)}/${RecordedFilename}.wav)
> 
> exten => h,1,Verbose(2,Cleanup the file)
> same => n,System(rm -f
> ${GLOBAL(CUSTOM_RECORDINGS)}/temporaryRecording-${RandomNumber}.wav)
> 
> 
> ...or something like that.
> 
> Leif Madsen.
> 
> --
> _____________________________________________________________________
> -- 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
> 



More information about the asterisk-users mailing list