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
Additional setting functions

Functions

Int32 PortSIP.PortSIPLib.setSrtpPolicy (SRTP_POLICY srtpPolicy, Boolean allowSrtpOverUnsecureTransport)
 Set the SRTP policy. More...
 
Int32 PortSIP.PortSIPLib.setRtpPortRange (Int32 minimumRtpAudioPort, Int32 maximumRtpAudioPort, Int32 minimumRtpVideoPort, Int32 maximumRtpVideoPort)
 Set the RTP ports range for audio and video streaming. More...
 
Int32 PortSIP.PortSIPLib.setRtcpPortRange (Int32 minimumRtcpAudioPort, Int32 maximumRtcpAudioPort, Int32 minimumRtcpVideoPort, Int32 maximumRtcpVideoPort)
 Set the RTCP ports range for audio and video streaming. More...
 
Int32 PortSIP.PortSIPLib.enableCallForward (Boolean forBusyOnly, String forwardTo)
 Enable call forward. More...
 
Int32 PortSIP.PortSIPLib.disableCallForward ()
 Disable the call forwarding. The SDK is not forwarding any incoming call after this function is called. More...
 
Int32 PortSIP.PortSIPLib.enableSessionTimer (Int32 timerSeconds, SESSION_REFRESH_MODE refreshMode)
 Allows to periodically refresh Session Initiation Protocol (SIP) sessions by sending INVITE requests repeatedly. More...
 
Int32 PortSIP.PortSIPLib.disableSessionTimer ()
 Disable the session timer. More...
 
void PortSIP.PortSIPLib.setDoNotDisturb (Boolean state)
 Enable the "Do not disturb" to enable/disable. More...
 
Int32 PortSIP.PortSIPLib.enableAutoCheckMwi (Boolean state)
 Allows to enable/disable the check MWI (Message Waiting Indication) automatically. More...
 
Int32 PortSIP.PortSIPLib.setRtpKeepAlive (Boolean state, Int32 keepAlivePayloadType, Int32 deltaTransmitTimeMS)
 Enable or disable to send RTP keep-alive packet when the call is established. More...
 
Int32 PortSIP.PortSIPLib.setKeepAliveTime (Int32 keepAliveTime)
 Enable or disable to send SIP keep-alive packet. More...
 
Int32 PortSIP.PortSIPLib.getSipMessageHeaderValue (String sipMessage, String headerName, StringBuilder headerValue, Int32 headerValueLength)
 Access the SIP header of SIP message. More...
 
Int32 PortSIP.PortSIPLib.addSipMessageHeader (Int32 sessionId, String methodName, Int32 msgType, String headerName, String headerValue)
 Add the SIP Message header into the specified outgoing SIP message. More...
 
Int32 PortSIP.PortSIPLib.removeAddedSipMessageHeader (Int32 sipMessageHeaderId)
 Remove the headers (custom header) added by addSipMessageHeader. More...
 
Int32 PortSIP.PortSIPLib.clearAddedSipMessageHeaders ()
 Clear the added extension headers (custom headers) More...
 
Int32 PortSIP.PortSIPLib.modifySipMessageHeader (Int32 sessionId, String methodName, Int32 msgType, String headerName, String headerValue)
 Modify the special SIP header value for every outgoing SIP message. More...
 
Int32 PortSIP.PortSIPLib.removeModifiedSipMessageHeader (Int32 sipMessageHeaderId)
 Remove the extension header (custom header) from every outgoing SIP message. More...
 
Int32 PortSIP.PortSIPLib.clearModifiedSipMessageHeaders ()
 Clear the modified headers value, and do not modify every outgoing SIP message header values any longer. More...
 

Detailed Description

Function Documentation

◆ setSrtpPolicy()

Int32 PortSIP.PortSIPLib.setSrtpPolicy ( SRTP_POLICY  srtpPolicy,
Boolean  allowSrtpOverUnsecureTransport 
)

Set the SRTP policy.

Parameters
srtpPolicyThe SRTP policy.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return value a specific error code.

◆ setRtpPortRange()

Int32 PortSIP.PortSIPLib.setRtpPortRange ( Int32  minimumRtpAudioPort,
Int32  maximumRtpAudioPort,
Int32  minimumRtpVideoPort,
Int32  maximumRtpVideoPort 
)

Set the RTP ports range for audio and video streaming.

Parameters
minimumRtpAudioPortThe minimum RTP port for audio stream.
maximumRtpAudioPortThe maximum RTP port for audio stream.
minimumRtpVideoPortThe minimum RTP port for video stream.
maximumRtpVideoPortThe maximum RTP port for video stream.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
The port range ((max - min) % maxCallLines) should be greater than 4.

◆ setRtcpPortRange()

Int32 PortSIP.PortSIPLib.setRtcpPortRange ( Int32  minimumRtcpAudioPort,
Int32  maximumRtcpAudioPort,
Int32  minimumRtcpVideoPort,
Int32  maximumRtcpVideoPort 
)

Set the RTCP ports range for audio and video streaming.

Parameters
minimumRtcpAudioPortThe minimum RTCP port for audio stream.
maximumRtcpAudioPortThe maximum RTCP port for audio stream.
minimumRtcpVideoPortThe minimum RTCP port for video stream.
maximumRtcpVideoPortThe maximum RTCP port for video stream.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
The port range ((max - min) % maxCallLines) should be greater than 4.

◆ enableCallForward()

Int32 PortSIP.PortSIPLib.enableCallForward ( Boolean  forBusyOnly,
String  forwardTo 
)

Enable call forward.

Parameters
forBusyOnlyIf this parameter is set as true, the SDK will forward all incoming calls when currently it's busy. If it's set as false, the SDK forward all incoming calls anyway.
forwardToThe call forward target. It must be like sip:xxxx@.nosp@m.sip..nosp@m.ports.nosp@m.ip.c.nosp@m.om.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ disableCallForward()

Int32 PortSIP.PortSIPLib.disableCallForward ( )

Disable the call forwarding. The SDK is not forwarding any incoming call after this function is called.

Returns
If the function succeeds, it will return value 0. If the function fails, the return value is a specific error code.

◆ enableSessionTimer()

Int32 PortSIP.PortSIPLib.enableSessionTimer ( Int32  timerSeconds,
SESSION_REFRESH_MODE  refreshMode 
)

Allows to periodically refresh Session Initiation Protocol (SIP) sessions by sending INVITE requests repeatedly.

Parameters
timerSecondsThe value of the refreshment interval in seconds. Minimum value of 90 seconds required.
refreshModeAllow to set the session refresh by UAC or UAS: SESSION_REFERESH_UAC or SESSION_REFERESH_UAS;
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
The repeated INVITE requests, or re-INVITEs, are sent during an active call log to allow user agents (UA) or proxies to determine the status of a SIP session. Without this keepalive mechanism, proxies that remember incoming and outgoing requests (stateful proxies) may continue to retain call state in vain. If a UA fails to send a BYE message at the end of a session or if the BYE message is lost because of network problems, a stateful proxy will not know that the session has ended. The re-INVITES ensure that active sessions stay active and completed sessions are terminated.

◆ disableSessionTimer()

Int32 PortSIP.PortSIPLib.disableSessionTimer ( )

Disable the session timer.

Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ setDoNotDisturb()

void PortSIP.PortSIPLib.setDoNotDisturb ( Boolean  state)

Enable the "Do not disturb" to enable/disable.

Parameters
stateIf it is set to true, the SDK will reject all incoming calls anyway.

◆ enableAutoCheckMwi()

Int32 PortSIP.PortSIPLib.enableAutoCheckMwi ( Boolean  state)

Allows to enable/disable the check MWI (Message Waiting Indication) automatically.

Parameters
stateIf it is set as true, MWI will be checked automatically once successfully registered to a SIP proxy server.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ setRtpKeepAlive()

Int32 PortSIP.PortSIPLib.setRtpKeepAlive ( Boolean  state,
Int32  keepAlivePayloadType,
Int32  deltaTransmitTimeMS 
)

Enable or disable to send RTP keep-alive packet when the call is established.

Parameters
stateSet to true to allow to send the keep-alive packet during the conversation.
keepAlivePayloadTypeThe payload type of the keep-alive RTP packet. It's usually set to 126.
deltaTransmitTimeMSThe keep-alive RTP packet sending interval, in millisecond. Recommend value ranges 15000 - 300000.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ setKeepAliveTime()

Int32 PortSIP.PortSIPLib.setKeepAliveTime ( Int32  keepAliveTime)

Enable or disable to send SIP keep-alive packet.

Parameters
keepAliveTimeThis is the SIP keep alive time interval in seconds. Set it to 0 to disable the SIP keep alive. Recommend to set as 30 or 50.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ getSipMessageHeaderValue()

Int32 PortSIP.PortSIPLib.getSipMessageHeaderValue ( String  sipMessage,
String  headerName,
StringBuilder  headerValue,
Int32  headerValueLength 
)

Access the SIP header of SIP message.

Parameters
sipMessageThe SIP message.
headerNameThe header which wishes to access the SIP message.
headerValueThe buffer to receive header value.
headerValueLengthThe headerValue buffer size. Usually we recommend to set it more than 512 bytes.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
When receiving a SIP message in the onReceivedSignaling callback event, and wishes to get SIP message header value, please use getSipMessageHeaderValue:
StringBuilder value = new StringBuilder();
value.Length = 512;
getSipMessageHeaderValue(message, name, value);

◆ addSipMessageHeader()

Int32 PortSIP.PortSIPLib.addSipMessageHeader ( Int32  sessionId,
String  methodName,
Int32  msgType,
String  headerName,
String  headerValue 
)

Add the SIP Message header into the specified outgoing SIP message.

Parameters
sessionIdAdd the header to the SIP message with the specified session Id only. By setting to -1, it will be added to all messages.
methodNameJust add the header to the SIP message with specified method name. For example: "INVITE", "REGISTER", "INFO" etc. If "ALL" specified, it will add all SIP messages.
msgType1 refers to apply to the request message, 2 refers to apply to the response message, 3 refers to apply to both request and response.
headerNameThe custom header name that will appears in every outgoing SIP message.
headerValueThe custom header value.
Returns
If the function succeeds, it will return addedSipMessageId, which is greater than 0. If the function fails, it will return a specific error code.

◆ removeAddedSipMessageHeader()

Int32 PortSIP.PortSIPLib.removeAddedSipMessageHeader ( Int32  sipMessageHeaderId)

Remove the headers (custom header) added by addSipMessageHeader.

Parameters
addedSipMessageIdThe addedSipMessageId return by addSipMessageHeader.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ clearAddedSipMessageHeaders()

Int32 PortSIP.PortSIPLib.clearAddedSipMessageHeaders ( )

Clear the added extension headers (custom headers)

Remarks
For example, we have added two custom headers into every outgoing SIP message and wish to remove them.
addExtensionHeader(-1, "ALL", 3, "Blling", "usd100.00");
addExtensionHeader(-1, "ALL", 3, "ServiceId", "8873456");

◆ modifySipMessageHeader()

Int32 PortSIP.PortSIPLib.modifySipMessageHeader ( Int32  sessionId,
String  methodName,
Int32  msgType,
String  headerName,
String  headerValue 
)

Modify the special SIP header value for every outgoing SIP message.

Parameters
sessionIdThe header to the SIP message with the specified session Id. By setting to -1, it will be added to all messages.
methodNameModify the header to the SIP message with specified method name only. For example: "INVITE", "REGISTER", "INFO" etc. If "ALL" specified, it will add all SIP messages.
msgType1 refers to apply to the request message, 2 refers to apply to the response message, 3 refers to apply to both request and response.
Returns
If the function succeeds, it will return modifiedSipMessageId, which is greater than 0. If the function fails, it will return a specific error code.

◆ removeModifiedSipMessageHeader()

Int32 PortSIP.PortSIPLib.removeModifiedSipMessageHeader ( Int32  sipMessageHeaderId)

Remove the extension header (custom header) from every outgoing SIP message.

Parameters
modifiedSipMessageIdThe modifiedSipMessageId is returned by modifySipMessageHeader.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ clearModifiedSipMessageHeaders()

Int32 PortSIP.PortSIPLib.clearModifiedSipMessageHeaders ( )

Clear the modified headers value, and do not modify every outgoing SIP message header values any longer.

Remarks
For example, to modify two headers' value for every outgoing SIP message and wish to clear it:
modifySipMessageHeader(-1, "ALL", 3, "Expires", "1000");
modifySipMessageHeader(-1, "ALL", 3, "User-Agent", "MyTest Softphone 1.0"");
clearModifiedSipMessageHeaders();