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
Send OPTIONS/INFO/MESSAGE functions

Functions

Int32 PortSIP.PortSIPLib.sendOptions (String to, String sdp)
 Send OPTIONS message. More...
 
Int32 PortSIP.PortSIPLib.sendInfo (Int32 sessionId, String mimeType, String subMimeType, String infoContents)
 Send a INFO message to remote side in a call. More...
 
Int32 PortSIP.PortSIPLib.sendSubscription (String to, String eventName)
 Send a SUBSCRIBE message to subscribe an event. More...
 
Int32 PortSIP.PortSIPLib.terminateSubscription (Int32 subscribeId)
 Terminate the given subscription. More...
 
Int32 PortSIP.PortSIPLib.sendMessage (Int32 sessionId, String mimeType, String subMimeType, byte[] message, Int32 messageLength)
 Send a MESSAGE message to remote side in dialog. More...
 
Int32 PortSIP.PortSIPLib.sendOutOfDialogMessage (String to, String mimeType, String subMimeType, Boolean isSMS, byte[] message, Int32 messageLength)
 Send an out of dialog MESSAGE message to remote side. More...
 
Int32 PortSIP.PortSIPLib.setDefaultSubscriptionTime (Int32 secs)
 Set the default expiration time to be used when creating a subscription. More...
 
Int32 PortSIP.PortSIPLib.setDefaultPublicationTime (Int32 secs)
 Set the default expiration time to be used when creating a publication. More...
 
Int32 PortSIP.PortSIPLib.setPresenceMode (Int32 mode)
 Indicate the SDK uses the P2P mode for presence or presence agent mode. More...
 

Detailed Description

Function Documentation

◆ sendOptions()

Int32 PortSIP.PortSIPLib.sendOptions ( String  to,
String  sdp 
)

Send OPTIONS message.

Parameters
toThe recipient of OPTIONS message.
sdpThe SDP of OPTIONS message. It's optional if user does not wish to send the SDP with OPTIONS message.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ sendInfo()

Int32 PortSIP.PortSIPLib.sendInfo ( Int32  sessionId,
String  mimeType,
String  subMimeType,
String  infoContents 
)

Send a INFO message to remote side in a call.

Parameters
sessionIdThe session ID of call.
mimeTypeThe mime type of INFO message.
subMimeTypeThe sub mime type of INFO message.
infoContentsThe contents that is sent with INFO message.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ sendSubscription()

Int32 PortSIP.PortSIPLib.sendSubscription ( String  to,
String  eventName 
)

Send a SUBSCRIBE message to subscribe an event.

Parameters
toThe user/extension to be subscribed.
eventNameThe event name to be subscribed.
Returns
If the function succeeds, it will return the ID of SUBSCRIBE which is greater than 0. If the function fails, it will return a specific error code which is less than 0.
Remarks
Example 1, below code indicates that user/extension 101 is subscribed to MWI (Message Waiting notifications) for checking his voicemail: int32 mwiSubId = sendSubscription("sip:101@test.com", "message-summary");

Example 2, to monitor a user/extension call status, You can use code: sendSubscription(mSipLib, "100", "dialog"); Extension 100 refers to the user/extension to be monitored. Once being monitored, when extension 100 hold a call or is ringing, the onDialogStateUpdated callback will be triggered.

◆ terminateSubscription()

Int32 PortSIP.PortSIPLib.terminateSubscription ( Int32  subscribeId)

Terminate the given 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.
Remarks
For example, if you want stop check the MWI, use below code:

◆ sendMessage()

Int32 PortSIP.PortSIPLib.sendMessage ( Int32  sessionId,
String  mimeType,
String  subMimeType,
byte []  message,
Int32  messageLength 
)

Send a MESSAGE message to remote side in dialog.

Parameters
sessionIdThe session ID of the call.
mimeTypeThe mime type of MESSAGE message.
subMimeTypeThe sub mime type of MESSAGE message.
messageThe contents which is sent with MESSAGE message. Binary data allowed.
messageLengthThe message size.
Returns
If the function succeeds, it will return a message ID that allows to track the message sending state in onSendMessageSuccess and onSendMessageFailure. If the function fails, it will return a specific error code less than 0.
Remarks
Example 1: send a plain text message. Note: to send text in other languages, please use the UTF-8 to encode the message before sending.
sendMessage(sessionId, "text", "plain", "hello",6);
Example 2: send a binary message.
sendMessage(sessionId, "application", "vnd.3gpp.sms", binData, binDataSize);

◆ sendOutOfDialogMessage()

Int32 PortSIP.PortSIPLib.sendOutOfDialogMessage ( String  to,
String  mimeType,
String  subMimeType,
Boolean  isSMS,
byte []  message,
Int32  messageLength 
)

Send an out of dialog MESSAGE message to remote side.

Parameters
toThe message recipient, such as sip:recei.nosp@m.ver@.nosp@m.ports.nosp@m.ip.c.nosp@m.om
mimeTypeThe mime type of MESSAGE message.
subMimeTypeThe sub mime type of MESSAGE message. isSMS Set to YES to specify "messagetype=SMS" in the To line, or NO to disable.
messageThe contents which is sent with MESSAGE message. Binary data allowed.
messageLengthThe message size.
Returns
If the function succeeds, it will return a message ID that allows to track the message sending state in onSendOutOfMessageSuccess and onSendOutOfMessageFailure. If the function fails, it will return a specific error code less than 0.
Remarks
Example 1: send a plain text message. Note: to send text in other languages, please use the UTF-8 to encode the message before sending.
sendOutOfDialogMessage("sip:user1@sip.portsip.com", "text", "plain", false, "hello", 6);
Example 2: send a binary message.
sendOutOfDialogMessage("sip:user1@sip.portsip.com","application", "vnd.3gpp.sms", false, binData, binDataSize);

◆ setDefaultSubscriptionTime()

Int32 PortSIP.PortSIPLib.setDefaultSubscriptionTime ( Int32  secs)

Set the default expiration time to be used when creating a subscription.

Parameters
secsThe default expiration time of subscription.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ setDefaultPublicationTime()

Int32 PortSIP.PortSIPLib.setDefaultPublicationTime ( Int32  secs)

Set the default expiration time to be used when creating a publication.

Parameters
secsThe default expiration time of publication.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ setPresenceMode()

Int32 PortSIP.PortSIPLib.setPresenceMode ( Int32  mode)

Indicate the SDK uses the P2P mode for presence or presence agent mode.

Parameters
mode0 - P2P mode; 1 - Presence Agent mode, default is P2P mode.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Since presence agent mode requires the PBX/Server support the PUBLISH, please ensure you have your and PortSIP PBX support this feature. For more details please visit: https://www.portsip.com/portsip-pbx