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
Initialize and register functions

Functions

void com.portsip.PortSipSdk.CreateCallManager (Context context)
 
void com.portsip.PortSipSdk.DeleteCallManager ()
 
int com.portsip.PortSipSdk.initialize (int enum_transport, String localIP, int localSIPPort, int enum_LogLevel, String LogPath, int maxLines, String agent, int audioDeviceLayer, int videoDeviceLayer, String TLSCertificatesRootPath, String TLSCipherList, boolean verifyTLSCertificate, String dnsServers)
 
int com.portsip.PortSipSdk.setInstanceId (String instanceId)
 
int com.portsip.PortSipSdk.setUser (String userName, String displayName, String authName, String password, String userDomain, String SIPServer, int SIPServerPort, String STUNServer, int STUNServerPort, String outboundServer, int outboundServerPort)
 
void com.portsip.PortSipSdk.removeUser ()
 remove user account info.
 
int com.portsip.PortSipSdk.registerServer (int expires, int retryTimes)
 
int com.portsip.PortSipSdk.refreshRegistration (int expires)
 
int com.portsip.PortSipSdk.unRegisterServer ()
 
int com.portsip.PortSipSdk.setLicenseKey (String key)
 

Detailed Description

Function Documentation

◆ CreateCallManager()

void com.portsip.PortSipSdk.CreateCallManager ( Context  context)

Create the callback handlers.

Parameters
contextThe context of application.

◆ DeleteCallManager()

void com.portsip.PortSipSdk.DeleteCallManager ( )

Release the callback Handlers.

◆ initialize()

int com.portsip.PortSipSdk.initialize ( int  enum_transport,
String  localIP,
int  localSIPPort,
int  enum_LogLevel,
String  LogPath,
int  maxLines,
String  agent,
int  audioDeviceLayer,
int  videoDeviceLayer,
String  TLSCertificatesRootPath,
String  TLSCipherList,
boolean  verifyTLSCertificate,
String  dnsServers 
)

Initialize the SDK.

Parameters
enum_transportTransport for SIP signaling, which can be set as: ENUM_TRANSPORT_UDP, ENUM_TRANSPORT_TCP, ENUM_TRANSPORT_TLS, ENUM_TRANSPORT_PERS. The ENUM_TRANSPORT_PERS_UDP is the private PortSIP transport for anti-SIP blocking, which must work with the PERS. ENUM_TRANSPORT_PERS. The ENUM_TRANSPORT_PERS_TCP is the private PortSIP transport for anti-SIP blocking, which must work with the PERS.
localIPThe local PC IP address (for example: 192.168.1.108). It will be used for sending and receiving SIP messages and RTP packets.
If the local IP is provided in IPv6 format, the SDK will use IPv6.
If you want the SDK to choose correct network interface (IP) automatically, please use "0.0.0.0" for IPv4, or "::" for IPv6.
localSIPPortThe listening port for SIP message transmission, for example 5060.
enum_LogLevelSet the application log level. The SDK will generate "PortSIP_Log_datatime.log" file if the log is enabled. ENUM_LOG_LEVEL_NONE ENUM_LOG_LEVEL_DEBUG ENUM_LOG_LEVEL_ERROR ENUM_LOG_LEVEL_WARNING ENUM_LOG_LEVEL_INFO ENUM_LOG_LEVEL_DEBUG
LogPathThe path for storing log file. The path (folder) specified MUST be existent.
maxLinesTheoretically, unlimited count of lines are supported depending on the device capability. For SIP client, it is recommended to limit it as ranging 1 - 100.
agentThe User-Agent header to be inserted in to SIP messages.
audioDeviceLayerSpecifies the audio device layer that should be using:
0 = Use the OS defaulted device.
1 = Virtual device, usually use this for the device that has no sound device installed.
videoDeviceLayerSpecifies the video device layer that should be using:
0 = Use the OS defaulted device.
1 = Use Virtual device, usually use this for the device that has no camera installed.
TLSCertificatesRootPathSpecify the TLS certificate path, from which the SDK will load the certificates automatically. Note: On Windows, this path will be ignored, and SDK will read the certificates from Windows certificates stored area instead.
TLSCipherListSpecify the TLS cipher list. This parameter is usually passed as empty so that the SDK will offer all available ciphers.
verifyTLSCertificateIndicate if SDK will verify the TLS certificate or not. By setting to false, the SDK will not verify the validity of TLS certificate.
dnsServersAdditional Nameservers DNS servers. Value null indicates system DNS Server. Multiple servers will be split by ";", e.g "8.8.8.8;8.8.4.4"
Returns
If the function succeeds, it returns value 0. If the function fails, it will return a specific error code

◆ setInstanceId()

int com.portsip.PortSipSdk.setInstanceId ( String  instanceId)

Set the instance Id, the outbound instanceId((RFC5626) ) used in contact headers.

Parameters
instanceIdThe SIP instance ID. If this function is not called, the SDK will generate an instance ID automatically. The instance ID MUST be unique on the same device (device ID or IMEI ID is recommended). Recommend to call this function to set the ID on Android devices.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ setUser()

int com.portsip.PortSipSdk.setUser ( String  userName,
String  displayName,
String  authName,
String  password,
String  userDomain,
String  SIPServer,
int  SIPServerPort,
String  STUNServer,
int  STUNServerPort,
String  outboundServer,
int  outboundServerPort 
)

Set user account info.

Parameters
userNameAccount (username) of the SIP, usually provided by an IP-Telephony service provider.
displayNameThe name displayed. You can set it as your like, such as "James Kend". It's optional.
authNameAuthorization user name (usually equal to the username).
passwordUser's password. It's optional.
userDomainUser domain; this parameter is optional, which allows to transfer an empty string if you are not using the domain.
SIPServerSIP proxy server IP or domain, for example xx.xxx.xx.x or sip.xxx.com.
SIPServerPortPort of the SIP proxy server, for example 5060.
STUNServerStun server for NAT traversal. It's optional and can be used to transfer empty string to disable STUN.
STUNServerPortSTUN server port. It will be ignored if the outboundServer is empty.
outboundServerOutbound proxy server, for example sip.domain.com. It's optional and allows to transfer an empty string if not using the outbound server.
outboundServerPortOutbound proxy server port, it will be ignored if the outboundServer is empty.
Returns
If this function succeeds, it will return value 0. If it fails, it will return a specific error code.

◆ registerServer()

int com.portsip.PortSipSdk.registerServer ( int  expires,
int  retryTimes 
)

Register to SIP proxy server (login to server)

Parameters
expiresTime interval for registration refreshment, in seconds. The maximum of supported value is 3600. It will be inserted into SIP REGISTER message headers.
retryTimesThe maximum of retry attempts if failed to refresh the registration. By setting to <= 0, the attempt will be disabled and onRegisterFailure callback will be triggered when facing retry failure.
Returns
If this function succeeds, it will return value 0. If fails, it will return a specific error code.
If the registration to server succeeds, onRegisterSuccess will be triggered; otherwise onRegisterFailure will be triggered.

◆ refreshRegistration()

int com.portsip.PortSipSdk.refreshRegistration ( int  expires)

Refresh the registration manually after successfully registered.

Parameters
expiresTime interval for registration refreshment, in seconds. The maximum of supported value is 3600. It will be inserted into SIP REGISTER message headers.
Returns
If this function succeeds, it will return value 0. If fails, it will return a specific error code.
If the registration to server succeeds, onRegisterSuccess will be triggered; otherwise onRegisterFailure will be triggered.

◆ unRegisterServer()

int com.portsip.PortSipSdk.unRegisterServer ( )

Un-register from the SIP proxy server.

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

◆ setLicenseKey()

int com.portsip.PortSipSdk.setLicenseKey ( String  key)

Set the license key. It must be called before setUser function.

Parameters
keyThe SDK license key. Please purchase from PortSIP.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.