Send and receive faxes
This code sample shows how
SendVoiceFile
can be used to automatically play a message on connection of a call.
The message
is followed by a tone which in this case is the '*' dial-digit tone, sent using
SendDigits.
Dim res As DivaResultCodes
Dim num As String = "384720"
Dim digits As String = "*"
' Single call program, so create DivaCall directly
Dim CallObj As DivaCall = new DivaCall()
Log("calling " & num)
res = CallObj.Connect ( num )
If res = DivaResultCodes.DivaResultSuccess Then
Log("playing voice file ")
res = CallObj.SendVoiceFile ("defaultgreeting.wav", DivaAudioFmt.DivaAudioAutodetect)
' Using synchronous (blocking) mode so next line is executed after
' completion of previous operation
Log("file played, sending [" & digits & "]")
res = CallObj.SendDigits(digits)
res = CallObj.Disconnect
End If
The Component API will accept .WAV files in μ-law (North America) and A-law (Europe) formats as well as
both 8-bit and 16-bit PCM formats at a sampling rate of 8kHz.
The available formats are enumerated in DivaAudioFmt.
The format of the defaultgreeting.wav file is detected automatically in this case.
The DivaCall object is created directly here because the code handles only one call; to create more than
one DivaCall object in your program use
DivaSystem and
DivaInstance and create the
DivaCall
objects using the
CreateCall method of DivaInstance.