Want an easy way for customers/users to record prompts in Asterisk and then assign a unique ID to each? I threw this together and it works extremely well. Hope everyone finds it useful.
Note: The filenames are generated by the second of the day. I didn’t want to shell out to generate a unique ID and I wanted to keep it simple so I’m betting that it’s pretty unlikely that two users with the same account code will record the prompts at the exact same second of the day. I also wanted the ID to be all numeric and small enough for users to write down easily. 🙂
exten => s,1,BackGround(prompt_instruct)
exten => s,n,Set(FILENAME=${TIMESTAMP:-6:6})
exten => s,n,Record(${ACCOUNTCODE}/${FILENAME}:ulaw)
exten => s,n,Background(prompt_save)
exten => s,n,Background(prompt_review)
exten => s,n,Background(prompt_delete)
exten => 1,1,Playback(prompt_saved)
exten => 1,n,Playback(prompt_id)
exten => 1,n,SayDigits(${FILENAME})
exten => 1,n,Wait(3)
exten => 1,n,Playback(prompt_id)
exten => 1,n,SayDigits(${FILENAME})
exten => 1,n,Wait(3)
exten => 1,n,Playback(prompt_id)
exten => 1,n,SayDigits(${FILENAME})
exten => 1,n,Hangup
exten => 2,1,Playback(${ACCOUNTCODE}/${FILENAME})
exten => 2,n,GoTo(s,4)
exten => 3,1,System(rm /var/lib/asterisk/sounds/${ACCOUNTCODE}/${FILENAME}.ulaw)
exten => 3,n,Playback(prompt_deleted)
exten => 3,n,GoTo(s,1)
exten => *,1,GoTo(s,2)