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

Functions

String com.portsip.PortSipSdk.getVersion ()
 
int com.portsip.PortSipSdk.enableRport (boolean enable)
 
int com.portsip.PortSipSdk.enableEarlyMedia (boolean enable)
 Enable/disable rport(RFC3581). More...
 
int com.portsip.PortSipSdk.enableReliableProvisional (boolean enable)
 
int com.portsip.PortSipSdk.enable3GppTags (boolean enable)
 
void com.portsip.PortSipSdk.enableCallbackSendingSignaling (boolean enable)
 
void com.portsip.PortSipSdk.setSrtpPolicy (int enum_srtppolicy)
 
int com.portsip.PortSipSdk.setRtpPortRange (int minimumRtpAudioPort, int maximumRtpAudioPort, int minimumRtpVideoPort, int maximumRtpVideoPort)
 
int com.portsip.PortSipSdk.setRtcpPortRange (int minimumRtcpAudioPort, int maximumRtcpAudioPort, int minimumRtcpVideoPort, int maximumRtcpVideoPort)
 
int com.portsip.PortSipSdk.enableCallForward (boolean forBusyOnly, String forwardTo)
 
int com.portsip.PortSipSdk.disableCallForward ()
 
int com.portsip.PortSipSdk.enableSessionTimer (int timerSeconds)
 
void com.portsip.PortSipSdk.disableSessionTimer ()
 
void com.portsip.PortSipSdk.setDoNotDisturb (boolean forBusyOnly)
 
void com.portsip.PortSipSdk.enableAutoCheckMwi (boolean state)
 
int com.portsip.PortSipSdk.setRtpKeepAlive (boolean state, int keepAlivePayloadType, int deltaTransmitTimeMS)
 
int com.portsip.PortSipSdk.setKeepAliveTime (int keepAliveTime)
 
int com.portsip.PortSipSdk.setAudioSamples (int ptime, int maxptime)
 
int com.portsip.PortSipSdk.addSupportedMimeType (String methodName, String mimeType, String subMimeType)
 

Detailed Description

Function Documentation

◆ getVersion()

String com.portsip.PortSipSdk.getVersion ( )

Get the version number of the current SDK.

Returns
String with version description

◆ enableRport()

int com.portsip.PortSipSdk.enableRport ( boolean  enable)

Enable/Disable rport(RFC3581).

Parameters
enableenable Set to true to enable the SDK to support rport. By default it is enabled.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ enableEarlyMedia()

int com.portsip.PortSipSdk.enableEarlyMedia ( boolean  enable)

Enable/disable rport(RFC3581).

Parameters
enableSet to true to enable the SDK to support rport. By default it is enabled.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code. Enable/Disable Early Media.
Parameters
enableSet to true to enable the SDK support Early Media. By default the Early Media is disabled.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ enableReliableProvisional()

int com.portsip.PortSipSdk.enableReliableProvisional ( boolean  enable)

Enable/Disable PRACK.

Parameters
enableSet to true to enable the SDK support PRACK. In default the PRACK is disabled.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ enable3GppTags()

int com.portsip.PortSipSdk.enable3GppTags ( boolean  enable)

Enable/disable the 3Gpp tags, including "ims.icsi.mmtel" and "g.3gpp.smsip".

Parameters
enableSet to true to enable 3Gpp tags for SDK.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ enableCallbackSendingSignaling()

void com.portsip.PortSipSdk.enableCallbackSendingSignaling ( boolean  enable)

Enable/disable the callback of the sent SIP messages.

Parameters
enableSet as true to enable the callback of the sent SIP messages, or false to disable it. Once enabled, the "onSendingSignaling" event will be triggered once the SDK sent a SIP message.

◆ setSrtpPolicy()

void com.portsip.PortSipSdk.setSrtpPolicy ( int  enum_srtppolicy)

Set the SRTP policy.

Parameters
enum_srtppolicyThe SRTP policy.allow: ENUM_SRTPPOLICY_NONE, ENUM_SRTPPOLICY_FORCE, ENUM_SRTPPOLICY_PREFER.

◆ setRtpPortRange()

int com.portsip.PortSipSdk.setRtpPortRange ( int  minimumRtpAudioPort,
int  maximumRtpAudioPort,
int  minimumRtpVideoPort,
int  maximumRtpVideoPort 
)

This function allows to set the RTP port 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()

int com.portsip.PortSipSdk.setRtcpPortRange ( int  minimumRtcpAudioPort,
int  maximumRtcpAudioPort,
int  minimumRtcpVideoPort,
int  maximumRtcpVideoPort 
)

This function allows to set the RTCP port 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()

int com.portsip.PortSipSdk.enableCallForward ( boolean  forBusyOnly,
String  forwardTo 
)

Enable call forwarding.

Parameters
forBusyOnlyIf this parameter is set to true, the SDK will forward incoming calls when the user is currently busy. If set it to false, SDK will forward all incoming calls.
forwardToThe target to which the call will be forwarded. It must be in the format of 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()

int com.portsip.PortSipSdk.disableCallForward ( )

Disable the call forwarding. The SDK will not forward any incoming call when this function is called.

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

◆ enableSessionTimer()

int com.portsip.PortSipSdk.enableSessionTimer ( int  timerSeconds)

This function allows to periodically refresh Session Initiation Protocol (SIP) sessions by sending repeated INVITE requests.

Parameters
timerSecondsThe value of the refresh interval in seconds. A minimum of 90 seconds required.
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 keep-alive 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 due to 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()

void com.portsip.PortSipSdk.disableSessionTimer ( )

Disable the session timer.

◆ setDoNotDisturb()

void com.portsip.PortSipSdk.setDoNotDisturb ( boolean  forBusyOnly)

Enable/disable the "Do not disturb" status.

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

◆ enableAutoCheckMwi()

void com.portsip.PortSipSdk.enableAutoCheckMwi ( boolean  state)

Enable/disable the "Auto Check MWI" status.

Parameters
stateIf it is set to true, the SDK will check Mwi automatically.

◆ setRtpKeepAlive()

int com.portsip.PortSipSdk.setRtpKeepAlive ( boolean  state,
int  keepAlivePayloadType,
int  deltaTransmitTimeMS 
)

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

Parameters
stateWhen it's set to true, it's allowed 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 interval for sending keep-alive RTP packet, in millisecond. Recommended 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()

int com.portsip.PortSipSdk.setKeepAliveTime ( int  keepAliveTime)

Enable or disable to send SIP keep-alive packet.

Parameters
keepAliveTimeThis is the time interval for SIP keep-alive, in seconds. When it is set to 0, the SIP keep-alive will be disabled. Recommended value is 30 or 50.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ setAudioSamples()

int com.portsip.PortSipSdk.setAudioSamples ( int  ptime,
int  maxptime 
)

Set the audio capture sample, which will be present in the SDP of INVITE and 200 OK message as "ptime and "maxptime" attribute.

Parameters
ptimeIt should be a multiple of 10 between 10 - 60 (included 10 and 60).
maxptimeThe "maxptime" attribute should be a multiple of 10 between 10 - 60 (included 10 and 60). It can't be less than "ptime".
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ addSupportedMimeType()

int com.portsip.PortSipSdk.addSupportedMimeType ( String  methodName,
String  mimeType,
String  subMimeType 
)

Set the SDK to receive SIP messages that include special mime type.

Parameters
methodNameMethod name of the SIP message, such as INVITE, OPTION, INFO, MESSAGE, UPDATE, ACK etc. For more details please refer to RFC3261.
mimeTypeThe mime type of SIP message.
subMimeTypeThe sub mime type of SIP message.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
In default, PortSIP VoIP SDK supports media types (mime types) included in the below incoming SIP messages:
"message/sipfrag" in NOTIFY message.
"application/simple-message-summary" in NOTIFY message.
"text/plain" in MESSAGE message. "application/dtmf-relay" in INFO
message. <br> "application/media_control+xml" in INFO message.

The SDK allows to receive SIP messages that include above mime types. Now if remote side send an INFO SIP message with its "Content-Type" header value "text/plain", SDK will reject this INFO message, because "text/plain" of INFO message is not included in the default type list. How should we enable the SDK to receive SIP INFO messages that include "text/plain" mime type? The answer is addSupportedMimyType:

addSupportedMimeType("INFO", "text", "plain");

If the user wishes to receive the NOTIFY message with "application/media_control+xml", it should be set as below:

addSupportedMimeType("NOTIFY", "application", "media_control+xml");

For more details about the mime type, please visit: http://www.iana.org/assignments/media-types/