cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
771
Views
5
Helpful
4
Replies

* new code sample for sending email with WAV as voice mail *

lindborg
Cisco Employee
Cisco Employee

Hey folks – there’s been a number of folks that have asked about this type of thing in the past so I finally got around to working through an example project that shows how to set properties on an email message such that Unity will recognize it as a voice mail message. I should note here that the upcoming IP Fax service that will be posted for download here in about a week will also include the ability to route emails with attached WAV files into Unity subscribers as voice mail messages – this will be TAC supported. Sending or editing messages using CDO or the like is not TAC supported.

I’ve just posted a simple sample project that shows you how to send a voice mail message to a Unity subscriber using CDO. The primary purpose of this example is to show you which extended MAPI properties Unity needs to see on a message and it’s WAV attachment before it’ll consider it a voice mail message (same deal with the VMO plug ins). You’ll find the “Send Voice Mail via CDO” project on the Code Samples page here:

http://www.ciscounitytools.com/CodeSamples.htm

The short version is that on a message we need 4 extended MAPI properties set and the message class set to IPM.Note.Voice.Unity and on the WAV attachment itself there’s a couple properties you need to add. The very short version of how this is done via CDO using VB with all the error handling and stuff removed is here:

‘Open a MAPI session using the Unity System Profile – you’ll need to be logged into the box as the message store facing account for this to work.

Set objSession = CreateObject("MAPI.Session")

objSession.Logon profileName:="Unity System Profile"

' create a message and fill in its properties

Set objMessage = objSession.Outbox.Messages.Add

objMessage.Subject = "Test Voice Mail Message"

'create a voice attachment

Set objAttachment = objMessage.Attachments.Add

strTemp = "VoiceMessage.wav"

With objAttachment

.Type = CdoFileData

.Position = 0 ' render at first character of message

.Name = strTemp

.ReadFromFile txtWAVPath.Text

'assign the MAPI properties Unity needs on the message itself:

.Fields.Add &H3707001E, strTemp 'this is the name of the attachment

.Fields.Add &H3703001E, ".wav" 'this is the extension type of the attachment

.Fields.Add &H3001001E, "VoiceMessage" 'this is the display name of the attachment.

End With

'set MAPI properties on the message that Unity needs:

'AVP_RECORDING_ATTACHMENT_FILENAME - the attachment name should always be VoiceMessage.wav, but you can change it to something else so long as you update this property to match it.

objMessage.Fields.Add &H7D00001E, strTemp

'AVP_MEDIA_TYPE - "2" means voice mail message here.

objMessage.Fields.Add &H72090003, 2

'AVP_IS_DRAFT – should always be set to 1

objMessage.Fields.Add &H7C08000B, 1

'AVP_LAST_ACTION_TYPE - Unity doesn't explicitly use this value but you should set it to "1" to avoid problems.

objMessage.Fields.Add &H72020003, 1

'force the message type to be IPM.Note.Voice.Unity"

objMessage.Type = "IPM.Note.Voice.Unity"

' create the recipient

Set objOneRecip = objMessage.Recipients.Add

objOneRecip.Name = “AliasOfSubscriber”

objOneRecip.Type = CdoTo

objOneRecip.Resolve ‘this will result in a name resolution dialog box if it’s not unique.

objMessage.Update

objMessage.Send showDialog:=False

objSession.Logoff

4 Replies 4

jasyoung
Level 7
Level 7

This will be very, very useful. Will the IP Fax service implement the "VOICE:foo@bar.com" sending syntax you spoke of at one point? That will allow sending voicemail without having to write any extra code. Among other things, this should let us send voicemails directly out of an IPCC Express script using a Recording step.

The CDO code is obviously Exchange dependent. Will the IP Fax service method work with Domino integrations? That's a lesser priority for us, but I'd like to know if it works nonetheless.

The IP fax service sets up a mailbox that it monitors and uses for both inbound and outbound fax routing - this is the same mailbox it'll watch for inbound voice mail messages. There's no "gateway" here (i.e. no "VOICE:" vs "SMTP:" address type registered) - it's much simpler than that. you forward an email with attached WAV file (the attachment can be named anything) to this mailbox you designate and in the subject line you include "[VMAIL][RECIPIENT=xxxx][SENDER=yyyy]" where xxxx is the extension (either primary or alternate) of the subscriber to get the message and yyyy is the extension (either primary or alternate) of the subscriber you'd like it sent from - the Sender value is optional - if it's omitted then it's sent as an outside caller voice mail message.

Pretty straight forward stuff.

No, it wont work with Domino at this point - only Exchange based systems can use this at the moment.

what would we do differently if we wanted to make a fax message instead of a voice message?

Well, you'd include a TIF file instead of a WAV file, of course... the name of the file doesn't matter and technically you could have multiple TIFs but in general it's a good idea to stick to a single TIF file. With 3rd party fax servers Unity just forwards the message directly to their gateway in Exchange or Domino and it takes care of it so it would depend on how the fax server deal with such things. But you'll never go wrong with a single multiple page TIF file.

You also need to change the media type from 2 (voice) to 4 (fax).

Other than that, the same sample code should work just dandy.