Voicemail Configuration

Home » Asterisk Users » Voicemail Configuration
Asterisk Users 2 Comments

On Mon, May 09, 2011 at 03:00:19PM -0600, John Marvin wrote:
>However, I want to record what is “said” during that time and send it
>to a third voicemail box once the caller hangs up without having
>pressed 1 or 2.

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…?

2 thoughts on - Voicemail Configuration

  • 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 _ ;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

  • Thanks, that’s given me some ideas. I don’t think I can totally roll my
    own, since I also make use of the MWI features of voicemail. Another
    thread pointed out the existence of minivm, which I hadn’t realized was
    available. I just need to find the time to play around with some of the
    proposed options.

    John