this will help you.. ;-------- DIY VOICEMAIL -------------------- *[ck987_vm_record]* ;"start recording after the beep. Press # when done." exten => 1,1,Playback(/home/ck987/asterisk_sounds/vm-record-start) ;build this call's recorded message file name <uniqueID>_<phone number> ;every call is assigned a unique id. exten => 1,n,Set(record_file=${UNIQUEID}_${CALLERID(num)}) ; records into my vm_msg folder. ;Ends if # is hit, silence for 2 secs, or recording lasts for 60 seconds exten => 1,n,Record(/home/ck987/asterisk_sounds/vm_msg/${record_file}.wav,2,60) ; 2 to review message, 3 to re record, or hang up exten => 1,n,Background(/home/ck987/asterisk_sounds/vm-record-end) exten => 1,n,WaitExten(5) exten => 1,n,Playback(/home/ck987/asterisk_sounds/bye) exten => 1,n,Hangup()
exten => 2,1,Playback(/home/ck987/asterisk_sounds/vm_msg/${record_file}) ; press 1 to re-record, or hangup if satisfied exten => 2,n,Background(/home/ck987/asterisk_sounds/vm-record-again) exten => 2,n,WaitExten(5) ;no response, hang up on person. exten => 2,n,Playback(/home/ck987/asterisk_sounds/bye) exten => 2,n,Hangup() ;go back to the record option exten => 3,1,Goto(ck987_vm_record,1,1) ;----------DIY VOICEMAIL ADMIN---------------------- *[ck987_vm_admin]* ; pass is 9988, jump to n+101 if authentication fails, expect 4 digits exten => 1,1,Authenticate(9988,j,4) ; get number of voicemail messages ; SHELL function returns the output from a system command ; "ls -1" lists visible files in a list. "wc -l" will count how many lines there are. 1 line per file! exten => 1,n,Set(num_messages=${SHELL(ls -1 /home/ck987/asterisk_sounds/vm_msg/ | wc -l)}) ;you have... exten => 1,n,Playback(/home/ck987/asterisk_sounds/you-have) exten => 1,n,SayDigits(${num_messages}) ;...messages! exten => 1,n,Playback(/home/ck987/asterisk_sounds/messages) ;get file names. "sed" command trims off any .wav exten. "tr" command trims off whitespace and line feeds. exten => 1,n,Set(file_names=${SHELL(ls -m /home/ck987/asterisk_sounds/vm_msg/ | sed 's/.wav//g' | tr -d ' \n')}) ;start message counter exten => 1,n,Set(msg_counter=1) ; 1 to repeat message, 3 to go to the next message, 7 to go to the previous message exten => 1,n,Playback(/home/ck987/asterisk_sounds/msg-options) exten => 1,n,Goto(ck987_vm_play_message,1,1) ; playback loop ;try again if password is wrong exten => 1,102,Goto(ck987_vm_admin,1,1) *[ck987_vm_play_message]* exten => 1,1,Background(beep) exten => 1,n,Set(current_message=${CUT(file_names,\,,${msg_counter})}) exten => 1,n,NoOp(${file_names} ${current_message} ${msg_counter}) exten => 1,n,Background(/home/ck987/asterisk_sounds/vm_msg/${current_message}) exten => 1,n,Goto(3,1) ; next message: add 1 and go back to the top of the loop exten => 3,1,Set(msg_counter=$[${msg_counter} + 1]) exten => 3,n,Set(msg_counter=${IF($[${msg_counter} > ${num_messages}]?${num_messages}:${msg_counter})}) exten => 3,n,Goto(1,1) ; previous message: subtract 1 and go back to the top of the loop exten => 7,1,Set(msg_counter=$[${msg_counter} - 1]) ;make sure number never goes below 1 exten => 7,n,Set(msg_counter=${IF($[${msg_counter} < 1]?1:${msg_counter})}) exten => 7,n,Playback(/home/ck987/asterisk_sounds/previous_message) exten => 7,n,Goto(1,1) ;delete message exten => *,1,System(rm /home/ck987/asterisk_sounds/vm_msg/${current_message}) ;number of files has changed. reload number of files and file names ; "ls -1" lists visible files in a list. "wc -l" will count how many lines there are. 1 line per file! exten => *,n,Set(num_messages=${SHELL(ls -1 /home/ck987/asterisk_sounds/vm_msg/ | wc -l)}) ;get file names. "sed" command trims off any .wav exten. "tr" command trims off whitespace and line feeds. exten => *,n,Set(file_names=${SHELL(ls -m /home/ck987/asterisk_sounds/vm_msg/ | sed 's/.wav//g' | tr -d ' \n')}) exten => *,n,Goto(1,1) it's the actual voicemail example which is use by asterisk it self On Tue, May 10, 2011 at 2:53 AM, John Marvin <jm-aster...@themarvins.org>wrote: > On 5/9/2011 3:08 PM, Roger Burton West wrote: > > You could use Monitor to record the whole call, then use an AGI to do >> something with it on hangup if the other conditions haven't been >> satisfied...? >> >> > I understand how to do the first part, and I at least understand that I > could do something fancy with the AGI capability. But what I don't know is > how I can take the recording and insert it into a voicemail box such that it > can be retrieved through the normal "VoiceMailMain" mechanism. > > Would the asterisk voicemail app dynamically notice something new being > dropped into the voicemail mbox directory? Would it only be noticed once > Asterisk is restarted? Most importantly, would it send out the notifies to > the "phone" associated with that voicemail box? I can probably fake the last > part if necessary, but making the voicemail retrievable through the normal > voicemail mechanism is what I really need to achieve. > > Thanks, > > John > > > > -- > _____________________________________________________________________ > -- 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 > -- ----- Thanks and regards Virendra Bhati +91-9172341457 Asterisk Engineer
-- _____________________________________________________________________ -- 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