Dialogic logo

Using the Diva Component API

  Introduction  
     2 pages
  About the Component API  
     4 pages
  Preparing to use the API  
     2 pages
  Component API objects  
     2 pages
  Making and receiving calls  
     3 pages
  Voice, tones, fax & data  
     7 pages
  Accessing the adapters  
     2 pages
  Handling multiple calls  
     9 pages
  Using non-blocking mode  
     18 pages
  Samples  
 
  << Back     Next page >>  
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.

Copyright© 2016 Dialogic® Corporation. All rights reserved. Legal Notice
45-010.htm 100 10000