Initialize and register functions
§ initialize:localIP:localSIPPort:loglevel:logPath:maxLine:agent:audioDeviceLayer:videoDeviceLayer:TLSCertificatesRootPath:TLSCipherList:verifyTLSCertificate:()
- (int) initialize: |
|
(TRANSPORT_TYPE) |
transport |
localIP: |
|
(NSString *) |
localIP |
localSIPPort: |
|
(int) |
localSIPPort |
loglevel: |
|
(PORTSIP_LOG_LEVEL) |
logLevel |
logPath: |
|
(NSString *) |
logFilePath |
maxLine: |
|
(int) |
maxCallLines |
agent: |
|
(NSString *) |
sipAgent |
audioDeviceLayer: |
|
(int) |
audioDeviceLayer |
videoDeviceLayer: |
|
(int) |
videoDeviceLayer |
TLSCertificatesRootPath: |
|
(NSString *) |
TLSCertificatesRootPath |
TLSCipherList: |
|
(NSString *) |
TLSCipherList |
verifyTLSCertificate: |
|
(BOOL) |
verifyTLSCertificate |
|
|
| |
Initialize the SDK.
- Parameters
-
transport | Transport for SIP signaling. TRANSPORT_PERS is the PortSIP private transport for anti SIP blocking. It must be used with PERS. |
localIP | The local computer IP address to be bounded (for example: 192.168.1.108). It will be used for sending and receiving SIP messages and RTP packets. If this IP is transferred in IPv6 format, the SDK will use IPv6.
If you want the SDK to choose correct network interface (IP) automatically, please pass the "0.0.0.0"(for IPv4) or "::" (for IPv6). |
localSIPPort | The SIP message transport listener port (for example: 5060). |
logLevel | Set the application log level. The SDK will generate "PortSIP_Log_datatime.log" file if the log enabled. |
logFilePath | The log file path. The path (folder) MUST be existent. |
maxCallLines | Theoretically, unlimited lines are supported depending on the device capability. For SIP client recommended value ranges 1 - 100. |
sipAgent | The User-Agent header to be inserted in SIP messages. |
audioDeviceLayer | 0 = Use OS default device 1 = Set to 1 to use the virtual audio device if the no sound device installed. |
videoDeviceLayer | 0 = Use OS default device 1 = Set to 1 to use the virtual video device if no camera installed. |
TLSCertificatesRootPath | Specify 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. |
TLSCipherList | Specify the TLS cipher list. This parameter is usually passed as empty so that the SDK will offer all available ciphers. |
verifyTLSCertificate | Indicate if SDK will verify the TLS certificate or not. By setting to false, the SDK will not verify the validity of TLS certificate. |
- Returns
- If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
§ setInstanceId:()
- (int) setInstanceId: |
|
(NSString *) |
instanceId |
|
Set the instance Id, the outbound instanceId((RFC5626) ) used in contact headers.
- Parameters
-
instanceId | The 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:displayName:authName:password:userDomain:SIPServer:SIPServerPort:STUNServer:STUNServerPort:outboundServer:outboundServerPort:()
- (int) setUser: |
|
(NSString *) |
userName |
displayName: |
|
(NSString *) |
displayName |
authName: |
|
(NSString *) |
authName |
password: |
|
(NSString *) |
password |
userDomain: |
|
(NSString *) |
userDomain |
SIPServer: |
|
(NSString *) |
sipServer |
SIPServerPort: |
|
(int) |
sipServerPort |
STUNServer: |
|
(NSString *) |
stunServer |
STUNServerPort: |
|
(int) |
stunServerPort |
outboundServer: |
|
(NSString *) |
outboundServer |
outboundServerPort: |
|
(int) |
outboundServerPort |
|
|
| |
Set user account info.
- Parameters
-
userName | Account (username) of the SIP. It's usually provided by an IP-Telephony service provider. |
displayName | The display name of user. You can set it as your like, such as "James Kend". It's optional. |
authName | Authorization user name (usually equal to the username). |
password | The password of user. It's optional. |
userDomain | User domain. This parameter is optional. It allows to pass an empty string if you are not using domain. |
sipServer | SIP proxy server IP or domain. For example: xx.xxx.xx.x or sip.xxx.com. |
sipServerPort | Port of the SIP proxy server. For example: 5060. |
stunServer | Stun server, used for NAT traversal. It's optional and can pass an empty string to disable STUN. |
stunServerPort | STUN server port. It will be ignored if the outboundServer is empty. |
outboundServer | Outbound proxy server. For example: sip.domain.com. It's optional and allows to pass an empty string if not using outbound server. |
outboundServerPort | Outbound proxy server port. It will be ignored if the outboundServer is empty. |
- Returns
- If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
§ registerServer:retryTimes:()
- (int) registerServer: |
|
(int) |
expires |
retryTimes: |
|
(int) |
retryTimes |
|
|
| |
Register to SIP proxy server (login to server)
- Parameters
-
expires | Registration refreshment interval in seconds. Maximum of 3600 allowed. It will be inserted into SIP REGISTER message headers. |
retryTimes | The retry times if failed to refresh the registration. Once set to <= 0, the retry will be disabled and onRegisterFailure callback triggered for retry failure. |
- Returns
- If the function succeeds, it will return value 0. If the function fails, it will return a specific error code. If registration to server succeeds, onRegisterSuccess will be triggered, otherwise onRegisterFailure triggered.
§ refreshRegistration:()
- (int) refreshRegistration: |
|
(int) |
expires |
|
Refresh the registration manually after successfully registered.
- Parameters
-
expires | Registration refreshment interval in seconds. Maximum of 3600 supported. It will be inserted into SIP REGISTER message header. If it's set to 0, default value will be used. |
- Returns
- If the function succeeds, it will return value 0. If the function fails, it will return a specific error code. If registration to server succeeds, onRegisterSuccess will be triggered, otherwise onRegisterFailure triggered.
§ unRegisterServer()
Un-register from the SIP proxy server.
- Returns
- If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
§ setLicenseKey:()
- (int) setLicenseKey: |
|
(NSString *) |
key |
|
Set the license key. It must be called before setUser function.
- Parameters
-
key | The 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.