com.skype.api
Class Voicemail

java.lang.Object
  extended by com.skype.api.SkypeObject
      extended by com.skype.api.Voicemail

public class Voicemail
extends SkypeObject

Wrapper class that includes voicemail-specific methods and properties. In the Skype Conversation API, Voicemail is actually something of a misnomer for what would be more accurately called Voice Message.

The traditional Voicemail use case involves recording a voice message when an incoming call does not get answered in a pre-determined amount of time. In the Skype Conversation API, voicemail does not depend on a call going unanswered - you can post a voice message asynchronously into any dialog conversation at any time.

In fact, a high-level action flow directing unanswered incoming live sessions to voicemail is not something provided by the Conversation API - implementation of this use case is largely up to your UI.

The fact that your UI must retrieve incoming Voicemails by monitoring changes to a Conversation instance's Messages illustrates this conceptual difference between traditional voicemail and voice messages. The message type Message.POSTED_VOICE_MESSAGE indicates that a Message instance should be handled as a voice message instead of by displaying its body text in the Conversation UI. Message.GetVoiceMessage enables you to retrieve the associated Voicemail instance; Voicemail.StartPlayback enables you to listen to the message audio.

To put it another way, the object chain goes like this:
@code
Contact->Conversation->Message->Voicemail


There are three basic types of Voicemail objects:
- INCOMING - received voice messages that can be retrieved from Message objects;
- OUTGOING - outbound voice messages that can be created with Conversation.StartVoiceMessage;
- GREETING - voice messages that represent auto-answer greetings, either recorded by the user (CUSTOM_GREETING) or included as part of SkypeKit (DEFAULT_GREETING). This is the audio that gets played back to sender of the voice message before he can start recording his voice message.

Before trying to send out a voicemail, you should ensure that target Contact has the capability to receive them. Use Contact.GetCapabilityStatus to check for Contact.CAPABILITY_CAN_BE_SENT_VM.

Recording and Sending a Voice Message

The first step is to obtain a dialog Conversation with the target Contact. In that conversation, you can initiate the outgoing voice message with Conversation.StartVoiceMessage

Note that this call does not return an actual Voicemail object. To catch when an object gets created, you will need to check Conversation.P_ACTIVE_VM_ID property updates.

After invoking Conversation.StartVoiceMessage, SkypeKit instantiates a Voicemail instance for the target Contact's greeting (with type CUSTOM_GREETING or DEFAULT_GREETING). At this point, the Conversation.P_ACTIVE_VM_ID property update fires, newVM contains a reference to the greeting, and playback of the greeting for the sender starts automatically.

Once the greeting playback finishes, SkypeKit instantiates a second Voicemail instance for the outgoing voice message. At this point, the Conversation.P_ACTIVE_VM_ID property update fires again, newVM now contains a reference to the outgoing message, and recording starts automatically. If you want to include notification and/or error handling for whether this message was sent successfully, you should make a copy of newVM now.

Once the user finishes (or abandons) recording of their message, they want to either send the message or to cancel it. To send the message, use Conversation.PostVoiceMessage; to cancel the message, use Conversation.LeaveLiveSession.

Both of these actions results in the Conversation.P_ACTIVE_VM_ID property update firing for a third time, setting the value to NULL. However, the Voicemail object will actually continue its existence past this point. Saving a reference to the message's Voicemail object when you start recording it enables you to keep receiving Voicemail property updates. This in turn enables your UI to check whether voice message send succeeded or failed.

The relevant terminal state Voicemail.P_STATUS property values are:
- Voicemail.CANCELLED - recording and/or sending of this message was cancelled
- Voicemail.UPLOADED - message sent
- Voicemail.FAILED - message could not be sent

Receiving and Playing Back a Voice Message

On the remote side, the Voicemail appears as a Message object of type Message.POSTED_VOICE_MESSAGE. The message's author property contains the Skype Name of the Voicemail originator, and its BodyXml property contains the message length and title text in following format:

@code



Receiver side UI can then retrieve the Voicemail object from the message with Message.GetVoiceMessage and
start local playback with Message.StartPlayback.


Nested Class Summary
static class Voicemail.FAILUREREASON
           
static class Voicemail.PROPERTY
          Properties of the Voicemail class
static class Voicemail.STATUS
           
static class Voicemail.TYPE
           
static interface Voicemail.VoicemailListener
           
 
Field Summary
 
Fields inherited from class com.skype.api.SkypeObject
mObjectId, mPropCache, skype
 
Constructor Summary
Voicemail(int oid, Skype skype)
           
 
Method Summary
 void Cancel()
          Canceling recording of your own auto-answer greeting message.
 boolean CheckPermission()
          check if we can send voicemail (unauth,blocked,no priv etc cases).
 void Delete()
          first from server, and then the local copy
 byte[] GetBinProperty(Voicemail.PROPERTY prop)
           
 boolean GetBooleanProperty(Voicemail.PROPERTY prop)
           
 int GetIntProperty(Voicemail.PROPERTY prop)
           
 java.lang.Object GetPropertyAsEnum(int propid)
           
 java.lang.String GetStrProperty(Voicemail.PROPERTY prop)
           
static int moduleID()
           
 void StartPlayback()
          Initiates playback of a voice message
 void StartRecording()
          Start recording your own auto-answer greeting message (leave message after the beep...) only.
 void StopPlayback()
          Terminates playback of a voice message
 void StopRecording()
          Stop recording of your own auto-answer greeting message only.
 
Methods inherited from class com.skype.api.SkypeObject
close, getOid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Voicemail

public Voicemail(int oid,
                 Skype skype)
Method Detail

moduleID

public static final int moduleID()

GetPropertyAsEnum

public java.lang.Object GetPropertyAsEnum(int propid)
Specified by:
GetPropertyAsEnum in class SkypeObject

GetStrProperty

public java.lang.String GetStrProperty(Voicemail.PROPERTY prop)

GetIntProperty

public int GetIntProperty(Voicemail.PROPERTY prop)

GetBooleanProperty

public boolean GetBooleanProperty(Voicemail.PROPERTY prop)

GetBinProperty

public byte[] GetBinProperty(Voicemail.PROPERTY prop)

StartRecording

public void StartRecording()
Start recording your own auto-answer greeting message (leave message after the beep...) only. Recording of outgoing Voicemail messages start automatically (using Conversation.StartVoiceMessage) after playback of the remote side greeting message has finished.


StopRecording

public void StopRecording()
Stop recording of your own auto-answer greeting message only. To stop recording of and send an outgoing Voicemail, use Conversation.PostVoiceMessage.


StartPlayback

public void StartPlayback()
Initiates playback of a voice message


StopPlayback

public void StopPlayback()
Terminates playback of a voice message


Delete

public void Delete()
first from server, and then the local copy


Cancel

public void Cancel()
Canceling recording of your own auto-answer greeting message. To stop recording of and cancel an outgoing Voicemail, use Conversation.LeaveLiveSession.


CheckPermission

public boolean CheckPermission()
check if we can send voicemail (unauth,blocked,no priv etc cases). only OUTGOING

Returns:
result


Copyright © 2010, 2011 Skype Technologies. All Rights Reserved.