PortSIP VoIP SDK Manual for iOS  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

(NSString *) - PortSIPSDK::getVersion
 Get the current version number of the SDK. More...
 
(int) - PortSIPSDK::enableRport:
 Enable/disable rport(RFC3581). More...
 
(int) - PortSIPSDK::enableEarlyMedia:
 Enable/disable Early Media. More...
 
(int) - PortSIPSDK::enableReliableProvisional:
 Enable/disable PRACK. More...
 
(int) - PortSIPSDK::enable3GppTags:
 Enable/disable the 3Gpp tags, including "ims.icsi.mmtel" and "g.3gpp.smsip". More...
 
(void) - PortSIPSDK::enableCallbackSendingSignaling:
 Enable/disable to callback the sent SIP messages. More...
 
(int) - PortSIPSDK::setSrtpPolicy:
 Set the SRTP policy. More...
 
(int) - PortSIPSDK::setRtpPortRange:maximumRtpAudioPort:minimumRtpVideoPort:maximumRtpVideoPort:
 Set the RTP ports range for audio and video streaming. More...
 
(int) - PortSIPSDK::setRtcpPortRange:maximumRtcpAudioPort:minimumRtcpVideoPort:maximumRtcpVideoPort:
 Set the RTCP ports range for audio and video streaming. More...
 
(int) - PortSIPSDK::enableCallForward:forwardTo:
 Enable call forwarding. More...
 
(int) - PortSIPSDK::disableCallForward
 Disable the call forwarding. The SDK is not forwarding any incoming calls once this function is called. More...
 
(int) - PortSIPSDK::enableSessionTimer:refreshMode:
 Allows to periodically refresh Session Initiation Protocol (SIP) sessions by sending INVITE requests repeatedly. More...
 
(int) - PortSIPSDK::disableSessionTimer
 Disable the session timer. More...
 
(void) - PortSIPSDK::setDoNotDisturb:
 Enable the "Do not disturb" to enable/disable. More...
 
(void) - PortSIPSDK::enableAutoCheckMwi:
 Enable the CheckMwi to enable/disable. More...
 
(int) - PortSIPSDK::setRtpKeepAlive:keepAlivePayloadType:deltaTransmitTimeMS:
 Enable or disable to send RTP keep-alive packet when the call is established. More...
 
(int) - PortSIPSDK::setKeepAliveTime:
 Enable or disable to send SIP keep-alive packet. More...
 
(int) - PortSIPSDK::setAudioSamples:maxPtime:
 Set the audio capturing sample. More...
 
(int) - PortSIPSDK::addSupportedMimeType:mimeType:subMimeType:
 Set the SDK to receive the SIP message that includes special mime type. More...
 

Detailed Description

Function Documentation

◆ getVersion()

- (NSString*) getVersion

Get the current version number of the SDK.

Returns
Return a current version number MAJOR.MINOR.PATCH of the SDK.

◆ enableRport:()

- (int) enableRport: (BOOL)  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.

◆ enableEarlyMedia:()

- (int) enableEarlyMedia: (BOOL)  enable

Enable/disable Early Media.

Parameters
enableSet to true to enable the SDK to 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) enableReliableProvisional: (BOOL)  enable

Enable/disable PRACK.

Parameters
enableSet to true to enable the SDK to support PRACK. By 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) enable3GppTags: (BOOL)  enable

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

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

◆ enableCallbackSendingSignaling:()

- (void) enableCallbackSendingSignaling: (BOOL)  enable

Enable/disable to callback the sent SIP messages.

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

◆ setSrtpPolicy:()

- (int) setSrtpPolicy: (SRTP_POLICY)  srtpPolicy

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 a specific error code.

◆ setRtpPortRange:maximumRtpAudioPort:minimumRtpVideoPort:maximumRtpVideoPort:()

- (int) setRtpPortRange: (int)  minimumRtpAudioPort
maximumRtpAudioPort: (int)  maximumRtpAudioPort
minimumRtpVideoPort: (int)  minimumRtpVideoPort
maximumRtpVideoPort: (int)  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:maximumRtcpAudioPort:minimumRtcpVideoPort:maximumRtcpVideoPort:()

- (int) setRtcpPortRange: (int)  minimumRtcpAudioPort
maximumRtcpAudioPort: (int)  maximumRtcpAudioPort
minimumRtcpVideoPort: (int)  minimumRtcpVideoPort
maximumRtcpVideoPort: (int)  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:forwardTo:()

- (int) enableCallForward: (BOOL)  forBusyOnly
forwardTo: (NSString *)  forwardTo 

Enable call forwarding.

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 target of call forwarding. It must 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) disableCallForward

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

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

◆ enableSessionTimer:refreshMode:()

- (int) enableSessionTimer: (int)  timerSeconds
refreshMode: (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 of 90 seconds required.
refreshModeAllow to set the session refreshment 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 INVITE requests, or re-INVITEs, are sent repeatedly 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 for remembering incoming and outgoing requests (stateful proxies) may continue to retain call state needlessly. 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 does not know that the session has ended. The re-INVITEs ensure that active sessions stay active and completed sessions are terminated.

◆ disableSessionTimer()

- (int) 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) setDoNotDisturb: (BOOL)  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:()

- (void) enableAutoCheckMwi: (BOOL)  state

Enable the CheckMwi to enable/disable.

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

◆ setRtpKeepAlive:keepAlivePayloadType:deltaTransmitTimeMS:()

- (int) setRtpKeepAlive: (BOOL)  state
keepAlivePayloadType: (int)  keepAlivePayloadType
deltaTransmitTimeMS: (int)  deltaTransmitTimeMS 

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

Parameters
stateSet as 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 milliseconds. 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) setKeepAliveTime: (int)  keepAliveTime

Enable or disable to send SIP keep-alive packet.

Parameters
keepAliveTimeThis is the SIP keep-alive time interval in seconds. By setting 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:maxPtime:()

- (int) setAudioSamples: (int)  ptime
maxPtime: (int)  maxPtime 

Set the audio capturing sample.

Parameters
ptimeIt should be a multiple of 10 between 10 - 60 (with 10 and 60 inclusive).
maxPtimeFor the "maxptime" attribute, it should be a multiple of 10 between 10 - 60 (with 10 and 60 inclusive). It cannot 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.
Remarks
It will appear in the SDP of INVITE and 200 OK message as "ptime and "maxptime" attribute.

◆ addSupportedMimeType:mimeType:subMimeType:()

- (int) addSupportedMimeType: (NSString *)  methodName
mimeType: (NSString *)  mimeType
subMimeType: (NSString *)  subMimeType 

Set the SDK to receive the SIP message that includes 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 the 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
By default, PortSIP VoIP SDK supports the media types (mime types) listed 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.
"application/media_control+xml" in INFO message.
The SDK allows to receive SIP messages that include above mime types. Now if remote side sends an INFO SIP message with its "Content-Type" header value "text/plain", SDK will reject this INFO message, for "text/plain" of INFO message is not included in the default supported list. How should we enable the SDK to receive the SIP INFO messages that include "text/plain" mime type? The answer is to use addSupportedMimyType:
[myVoIPSdk addSupportedMimeType:@"INFO" mimeType:@"text" subMimeType:@"plain"];
To receive the NOTIFY message with "application/media_control+xml":
[myVoIPSdk addSupportedMimeType:@"NOTIFY" mimeType:@"application" subMimeType:@"media_control+xml"];
For more details about the mime type, please visit: http://www.iana.org/assignments/media-types/