PortSIP VoIP SDK Manual for Android  16.2
PortSIP features our newest, supported, quality-assured VoIP SDK used by Several hundred companies around the world for easy VoIP application develop and quality-assured code.
Functions
Presence events

Functions

void com.portsip.OnPortSIPEvent.onPresenceRecvSubscribe (long subscribeId, String fromDisplayName, String from, String subject)
 
void com.portsip.OnPortSIPEvent.onPresenceOnline (String fromDisplayName, String from, String stateText)
 
void com.portsip.OnPortSIPEvent.onPresenceOffline (String fromDisplayName, String from)
 
void com.portsip.OnPortSIPEvent.onRecvMessage (long sessionId, String mimeType, String subMimeType, byte[] messageData, int messageDataLength)
 
void com.portsip.OnPortSIPEvent.onRecvOutOfDialogMessage (String fromDisplayName, String from, String toDisplayName, String to, String mimeType, String subMimeType, byte[] messageData, int messageDataLength, String sipMessage)
 
void com.portsip.OnPortSIPEvent.onSendMessageSuccess (long sessionId, long messageId)
 
void com.portsip.OnPortSIPEvent.onSendMessageFailure (long sessionId, long messageId, String reason, int code)
 
void com.portsip.OnPortSIPEvent.onSendOutOfDialogMessageSuccess (long messageId, String fromDisplayName, String from, String toDisplayName, String to)
 
void com.portsip.OnPortSIPEvent.onSendOutOfDialogMessageFailure (long messageId, String fromDisplayName, String from, String toDisplayName, String to, String reason, int code)
 
void com.portsip.OnPortSIPEvent.onSubscriptionFailure (long subscribeId, int statusCode)
 
void com.portsip.OnPortSIPEvent.onSubscriptionTerminated (long subscribeId)
 

Detailed Description

Function Documentation

◆ onPresenceRecvSubscribe()

void com.portsip.OnPortSIPEvent.onPresenceRecvSubscribe ( long  subscribeId,
String  fromDisplayName,
String  from,
String  subject 
)

This event will be triggered when receiving the SUBSCRIBE request from a contact.

Parameters
subscribeIdThe ID of SUBSCRIBE request.
fromDisplayNameThe display name of contact.
fromThe contact who sends the SUBSCRIBE request.
subjectThe subject of the SUBSCRIBE request.

◆ onPresenceOnline()

void com.portsip.OnPortSIPEvent.onPresenceOnline ( String  fromDisplayName,
String  from,
String  stateText 
)

When the contact is online or changes presence status, this event will be triggered.

Parameters
fromDisplayNameThe display name of contact.
fromThe contact who sends the SUBSCRIBE request.
stateTextThe presence status text.

◆ onPresenceOffline()

void com.portsip.OnPortSIPEvent.onPresenceOffline ( String  fromDisplayName,
String  from 
)

When the contact is offline, this event will be triggered.

Parameters
fromDisplayNameThe display name of contact.
fromThe contact who sends the SUBSCRIBE request

◆ onRecvMessage()

void com.portsip.OnPortSIPEvent.onRecvMessage ( long  sessionId,
String  mimeType,
String  subMimeType,
byte []  messageData,
int  messageDataLength 
)

This event will be triggered when receiving a MESSAGE message in dialog.

Parameters
sessionIdThe session ID of the call.
mimeTypeThe message mime type.
subMimeTypeThe message sub mime type.
messageDataThe received message body. It can be text or binary data. Use the mimeType and subMimeType to differentiate them. For example, if the mimeType is "text" and subMimeType is "plain", "messageData" is text message body. If the mimeType is "application" and subMimeType is "vnd.3gpp.sms", "messageData" is binary message body.
messageDataLengthThe length of "messageData".

◆ onRecvOutOfDialogMessage()

void com.portsip.OnPortSIPEvent.onRecvOutOfDialogMessage ( String  fromDisplayName,
String  from,
String  toDisplayName,
String  to,
String  mimeType,
String  subMimeType,
byte []  messageData,
int  messageDataLength,
String  sipMessage 
)

This event will be triggered when receiving a MESSAGE message out of dialog. For example pager message.

Parameters
fromDisplayNameThe display name of sender.
fromThe message sender.
toDisplayNameThe display name of receiver.
toThe receiver.
mimeTypeThe message mime type.
subMimeTypeThe message sub mime type.
messageDataThe received message body. It can be text or binary data. Use the mimeType and subMimeType to differentiate them. For example, if the mimeType is "text" and subMimeType is "plain", "messageData" is text message body. If the mimeType is "application" and subMimeType is "vnd.3gpp.sms", "messageData" is binary message body.
messageDataLengthThe length of "messageData".
sipMessageThe SIP message received.

◆ onSendMessageSuccess()

void com.portsip.OnPortSIPEvent.onSendMessageSuccess ( long  sessionId,
long  messageId 
)

If the message is sent successfully in dialog, this event will be triggered.

Parameters
sessionIdThe session ID of the call.
messageIdThe message ID. It's equal to the return value of sendMessage function.

◆ onSendMessageFailure()

void com.portsip.OnPortSIPEvent.onSendMessageFailure ( long  sessionId,
long  messageId,
String  reason,
int  code 
)

If the message is failed to be sent out of dialog, this event will be triggered.

Parameters
sessionIdThe session ID of the call.
messageIdThe message ID. It's equal to the return value of sendMessage function.
reasonThe failure reason.
codeFailure code.

◆ onSendOutOfDialogMessageSuccess()

void com.portsip.OnPortSIPEvent.onSendOutOfDialogMessageSuccess ( long  messageId,
String  fromDisplayName,
String  from,
String  toDisplayName,
String  to 
)

If the message is sent successfully out of dialog, this event will be triggered.

Parameters
messageIdThe message ID. It's equal to the return value of SendOutOfDialogMessage function.
fromDisplayNameThe display name of message sender.
fromThe message sender.
toDisplayNameThe display name of message receiver.
toThe message receiver.

◆ onSendOutOfDialogMessageFailure()

void com.portsip.OnPortSIPEvent.onSendOutOfDialogMessageFailure ( long  messageId,
String  fromDisplayName,
String  from,
String  toDisplayName,
String  to,
String  reason,
int  code 
)

If the message failed to be sent out of dialog, this event would be triggered.

Parameters
messageIdThe message ID. It's equal to the return value of SendOutOfDialogMessage function.
fromDisplayNameThe display name of message sender
fromThe message sender.
toDisplayNameThe display name of message receiver.
toThe message receiver.
reasonThe failure reason.
codeThe failure code.

◆ onSubscriptionFailure()

void com.portsip.OnPortSIPEvent.onSubscriptionFailure ( long  subscribeId,
int  statusCode 
)

This event will be triggered on sending SUBSCRIBE failure.

Parameters
subscribeIdThe ID of SUBSCRIBE request.
statusCodeThe status code.

◆ onSubscriptionTerminated()

void com.portsip.OnPortSIPEvent.onSubscriptionTerminated ( long  subscribeId)

This event will be triggered when a SUBSCRIPTION is terminated or expired.

Parameters
subscribeIdThe ID of SUBSCRIBE request.