Programmatic Voicemail Access

Hello! I’ve begun on an Asterisk project, and come to a problem that I’m uncertain about. Documentation has been unable to help me.

So, first, the problem. I am building a system that connects a disruption tolerant voice network to the main telephone network. I plan to do this in the following way:

1)Voice file arrives over disruption tolerant network, with destination X.
2)If voicemail mailbox for X exists:
insert voice file into mailbox
shoot off an SMS or email or whatever.
create mailbox,
insert voice file into mailbox
shoot off sms informing the user of how to use the system and that they have a message waiting.

This requires me to be able to programmatically create new mailboxes, which I’m uncertain of how to do.
Then, given such a mailbox, I would like to insert it through Asterisk rather than just the file system. This will allow it to gain the advantages of asterisk, such as the email/sms thing.

Is there a way to interface with the Voicemail system to do both of these? I believe the AMI system will allow me to create new mailboxes, albeit in sort of a hacky way. the best way would be some generic configuration in voicemail.conf that simply matched the incoming number to the voicemail number directory.

The programmatic insertion of voicemail seems even worse. I suppose I could create a loop inside of asterisk and just manually leave the voicemail, but that’s again hacky and hopefully unnecessary.

Thanks! I hope someone with a greater knowledge base will show me the proper way.

Just as an update, I’ve written a python script that adds a new mailbox. So that’s solved. Directly copying the file into the mailbox, however, did not accomplish anything. So I’m still stuck on entering the audio file into the mailbox in a programmatic way.

Why not use asterisk real time and interact with a db from your scripts to create a new db.

Why can you just copy the wav files over to the new mailbox and then make your own messageXXXX.txt file ?

That’s what I was looking for! For some reason I missed the existence of the damned .txt file…

I already implemented a system using python SIP library to play the sound over an opened SIP channel, though this will be much quicker. Thanks!

It’s nice to have both methods so that I can use the asterisk functionality (SMS for instance) as well as the more efficient direct copying of files.