PortSIP VoIP SDK Manual for Windows  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 functions

Functions

Int32 PortSIP.PortSIPLib.presenceSubscribe (String to, String subject)
 Send a SUBSCRIBE message for subscribing the contact's presence status. More...
 
Int32 PortSIP.PortSIPLib.presenceTerminateSubscribe (Int32 subscribeId)
 Terminate the given presence subscription. More...
 
Int32 PortSIP.PortSIPLib.presenceRejectSubscribe (Int32 subscribeId)
 Reject a presence SUBSCRIBE request which is received from contact. More...
 
Int32 PortSIP.PortSIPLib.presenceAcceptSubscribe (Int32 subscribeId)
 Accept the presence SUBSCRIBE request which is received from contact. More...
 
Int32 PortSIP.PortSIPLib.setPresenceStatus (Int32 subscribeId, String stateText)
 Set the presence status. More...
 

Detailed Description

Function Documentation

◆ presenceSubscribe()

Int32 PortSIP.PortSIPLib.presenceSubscribe ( String  to,
String  subject 
)

Send a SUBSCRIBE message for subscribing the contact's presence status.

Parameters
toThe target contact. It must be like sip:conta.nosp@m.ct00.nosp@m.1@sip.nosp@m..por.nosp@m.tsip..nosp@m.com.
subjectThis subject text will be inserted into the SUBSCRIBE message. For example: "Hello, I'm Jason".
The subject maybe in UTF-8 format. You should use UTF-8 to decode it.
Returns
If the function succeeds, it will return value subscribeId. If the function fails, it will return a specific error code.

◆ presenceTerminateSubscribe()

Int32 PortSIP.PortSIPLib.presenceTerminateSubscribe ( Int32  subscribeId)

Terminate the given presence subscription.

Parameters
subscribeIdThe ID of the subscription.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ presenceRejectSubscribe()

Int32 PortSIP.PortSIPLib.presenceRejectSubscribe ( Int32  subscribeId)

Reject a presence SUBSCRIBE request which is received from contact.

Parameters
subscribeIdSubscription ID. When receiving a SUBSCRIBE request from contact, the event onPresenceRecvSubscribe will be triggered. The event includes the subscription ID.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
If the P2P presence mode is enabled, when someone subscribe your presence status, you will receive the subscribe request in the callback, and you can use this function to accept it.

◆ presenceAcceptSubscribe()

Int32 PortSIP.PortSIPLib.presenceAcceptSubscribe ( Int32  subscribeId)

Accept the presence SUBSCRIBE request which is received from contact.

Parameters
subscribeIdSubscription ID. When receiving a SUBSCRIBE request from contact, the event onPresenceRecvSubscribe will be triggered. The event will include the subscription ID.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
If the P2P presence mode is enabled, when someone subscribes your presence status, you will receive the subscription request in the callback, and you can use this function to reject it.

◆ setPresenceStatus()

Int32 PortSIP.PortSIPLib.setPresenceStatus ( Int32  subscribeId,
String  stateText 
)

Set the presence status.

Parameters
subscribeIdSubscription ID.
stateTextThe state text of presence online. For example: "I'm here". If you want to appear as offline to others, please pass the "Offline" to "statusText" parameter.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
With P2P presence mode, when receiving a SUBSCRIBE request from contact, the event onPresenceRecvSubscribe will be triggered. The event includes the subscription ID. This function will cause the SDK sending a NOTIFY message to update your presence status, and you must pass the correct subscribeId.

With presence agent mode, this function will cause the SDK to send a PUBLISH message to update your presence status, and you must pass 0 to the "subscribeId" parameter.