User Manual for macOS
FAQ
Where can I download the PortSIP VoIP SDK for testing?
You can download the PortSIP VoIP SDK, along with sample projects, from the PortSIP Website.
What macOS versions are required for development?
Development using the PortSIP VoIP/IMS SDK for macOS requires a Mac running macOS Ventura 13.5 or later and Xcode 15.0 or above.
How can I create a new project with the PortSIP VoIP SDK?
Download the Sample Project: Download the sample project from tthe PortSIP Website and extract it to a desired directory.
Create a New Project: In Xcode, create a new OS X Cocoa Application project.
Add the PortSIPVoIPSDK Framework: Drag and drop the
PortSIPVoIPSDK.framework
from Finder to your project's Frameworks folder.Copy Frameworks Files: Under the Build Phases section of your project editor, add a "Copy Files" build phase. Specify the destination as "Frameworks" and add the
PortSIPVoIPSDK.framework
to be copied.Import the SDK: In your header file, import the SDK using the following line:
How can I process callback events?
Inherit the PortSIPEventDelegate: Your class should inherit the
PortSIPEventDelegate
protocol to handle callback events.Implement Callback Methods: Implement the necessary callback methods (e.g.,
onRegistrationState
,onCallState
) to handle specific events.
How do I initialize the SDK?
Create an Instance: Create an instance of the
PortSIPSDK
class.Set the Delegate: Set the delegate of the SDK instance to your class that implements the
PortSIPEventDelegate
protocol.
Is the SDK thread-safe?
Yes, the PortSIP SDK is thread-safe. You can call API functions from multiple threads without worrying about synchronization issues. However, there are exceptions: the onAudioRawCallback
, onVideoRawCallback
, and onRTPPacketCallback
callbacks should not be called directly from other threads.
SDK Callback events
Register events
When successfully registered to server, this event will be triggered.
Parameters
If registration to SIP server fails, this event will be triggered.
Parameters
Call events
When the call is coming, this event will be triggered.
Parameters
If the outgoing call is being processed, this event will be triggered.
Parameters
Once the caller received the "183 session in progress" message, this event will be triggered.
Parameters
If the outgoing call is ringing, this event will be triggered.
Parameters
If the remote party answered the call, this event would be triggered.
Parameters
If the outgoing/incoming call fails, this event will be triggered.
Parameters
This event will be triggered when remote party updates this call.
Parameters
This event will be triggered when UAC sent/UAS received ACK (the call is connected). Some functions (hold, updateCall etc...) can be called only after the call is connected, otherwise it will return error.
Parameters
If the enableCallForward method is called and a call is incoming, the call will be forwarded automatically and this event will be triggered.
Parameters
This event will be triggered once remote side closes the call.
Parameters
If a user subscribed and his dialog status monitored, when the monitored user is holding a call or being rang, this event will be triggered.
Parameters
If the remote side has placed the call on hold, this event will be triggered.
Parameters
If the remote side un-holds the call, this event will be triggered.
Parameters
Refer events
This event will be triggered once receiving a REFER message.
Parameters
This callback will be triggered once remote side calls "acceptRefer" to accept the REFER.
Parameters
This callback will be triggered once remote side calls "rejectRefer" to reject the REFER.
Parameters
When the refer call is being processed, this event will be trigged.
Parameters
When the refer call rings, this event will be triggered.
Parameters
When the refer call succeeds, this event will be triggered. ACTV means Active. For example: A starts the call with B, and A transfers B to C. When C accepts the refered call, A will receive this event.
Parameters
When the refer call fails, this event will be triggered. ACTV means Active. For example: A starts the call with B, and A transfers B to C. When C rejects the refered call, A will receive this event.
Parameters
Signaling events
This event will be triggered when receiving an SIP message. This event is disabled by default. To enable, use enableCallbackSignaling.
Parameters
This event will be triggered when a SIP message is sent. This event is disabled by default. To enable, use enableCallbackSignaling.
Parameters
MWI events
If there are any waiting voice messages (MWI), this event will be triggered.
Parameters
If there are any waiting fax messages (MWI), this event will be triggered.
Parameters
DTMF events
This event will be triggered when receiving a DTMF tone from remote side.
Parameters
INFO/OPTIONS message events
This event will be triggered when receiving the OPTIONS message.
Parameters
This event will be triggered when receiving the INFO message.
Parameters
This event will be triggered when receiving a NOTIFY message of the subscription.
Parameters
Presence events
This event will be triggered when receiving the SUBSCRIBE request from a contact.
Parameters
This event will be triggered when the contact is online or changes presence status.
Parameters
When the contact status is changed to offline, this event will be triggered. Parameters
MESSAGE message events
This event will be triggered when receiving a MESSAGE message in dialog.
Parameters
This event will be triggered when receiving a MESSAGE message out of dialog. For example: pager message.
Parameters
This event will be triggered when the message is sent successfully in dialog.
Parameters
This event will be triggered when the message fails to be sent out of dialog.
Parameters
This event will be triggered when the message is sent successfully out of dialog.
Parameters
This event will be triggered when the message fails to be sent out of dialog.
Parameters
This event will be triggered on sending SUBSCRIBE failure.
Parameters
This event will be triggered when a SUBSCRIPTION is terminated or expired.
Parameters
Play audio and video file finished events
If startPlayingFileToRemote function is called with no loop mode, this event will be triggered once the file play finished.
Parameters
If getStatistics function is called, this event will be triggered once receiving a RTP statistics .
Parameters
RTP callback events
If enableRtpCallback function is called to enable the RTP callback, this event will be triggered once a RTP packet received.
Parameters
Parameters
Note
Don't call any SDK API functions in this event directly. If you want to call the API functions or other code, which is time-consuming, you should post a message to another thread and execute SDK API functions or other code in another thread.
Audio and video stream callback events
This event will be triggered once receiving the audio packets when enableAudioStreamCallback function is called.
Parameters
Note
Don't call any SDK API functions in this event directly. If you want to call the API functions or other code, which is time-consuming, you should post a message to another thread and execute SDK API functions or other code in another thread.
This event will be triggered once received the video packets if called enableVideoStreamCallback function.
Parameters
Returns
If you changed the sent video data, dataLength should be returned, otherwise 0.
Note
Don't call any SDK API functions in this event directly. If you want to call the API functions or other code, which is time-consuming, you should post a message to another thread and execute SDK API functions or other code in another thread.
SDK functions
Initialize and register functions
Initialize the SDK.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the instance Id, the outbound instanceId((RFC5626) ) used in contact headers.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Un-initialize the SDK and release resources.
Set user account info.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the display name of user.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remove user account info.
Register to SIP proxy server (login to server)
Parameters
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.
Refresh the registration manually after successfully registered.
Parameters
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.
Un-register from the SIP proxy server.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the license key. It must be called before setUser function.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Parameters
NIC and local IP functions
Get the Network Interface Card numbers. Returns
If the function succeeds, it will return NIC numbers, which are greater than or equal to 0. If the function fails, it will return a specific error code.
Get the local IP address by Network Interface Card index.
Parameters
Returns
The buffer for receiving the IP.
Audio and video codecs functions
Enable an audio codec. It will appear in SDP.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Enable a video codec. It will appear in SDP.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Detect if the enabled audio codecs is empty.
Returns
If no audio codec is enabled, it will return value true, otherwise false.
Detect if enabled video codecs is empty or not.
Returns
If no video codec is enabled, it will return value true, otherwise false.
Set the RTP payload type for dynamic audio codec.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the RTP payload type for dynamic Video codec.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the codec parameter for audio codec.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Example:
[myVoIPsdk setAudioCodecParameter:AUDIOCODEC\_AMR parameter:"mode-set=0; octet-align=1; robust-sorting=0"];
Set the codec parameter for video codec.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return value a specific error code.
Remarks
Example:
[myVoIPsdk setVideoCodecParameter:VIDEOCODEC\_H264 parameter:"profile-level-id=420033; packetization-mode=0"];
Remove all enabled audio codecs.
Remove all enabled video codecs.
Additional settings functions
Get the current version number of the SDK.
Returns
Return a current version number MAJOR.MINOR.PATCH of the SDK.
Enable/disable rport(RFC3581).
Parameters
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.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Enable/disable which allows specifying the preferred protocol when a domain supports both IPV4 and IPV6 simultaneously.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Modifies the default URI user character needs to be escaped.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Enable/disable PRACK.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Enable/disable the 3Gpp tags, including "ims.icsi.mmtel" and "g.3gpp.smsip".
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Enable/disable to callback the SIP messages.
Parameters
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the RTP ports range for audio and video streaming.
Parameters
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.
Enable call forwarding.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
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.
Allows to periodically refresh Session Initiation Protocol (SIP) sessions by sending INVITE requests repeatedly.
Parameters
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.
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.
Enable the "Do not disturb" to enable/disable.
Parameters
Enable the CheckMwi to enable/disable.
Parameters
Enable or disable to send RTP keep-alive packet when the call is established.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Enable or disable to send SIP keep-alive packet.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the audio capturing sample.
Parameters
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.
Set the SDK to receive the SIP message that includes special mime type.
Parameters
|*mimeType *| The mime type of SIP message. |
|subMimeType| The 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/
Access SIP message header functions
Access the SIP header of SIP message.
Parameters
Returns
If the function succeeds, it will return value headerValue. If the function fails, it will return value null.
Remarks
When receiving an SIP message in the onReceivedSignaling callback event, and user wishes to get SIP message header value, use getExtensionHeaderValue:
NSString* headerValue = [myVoIPSdk getSipMessageHeaderValue:message headerName:name];
Add the SIP Message header into the specified outgoing SIP message.
Parameters
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.
Remove the headers (custom header) added by addSipMessageHeader.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
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.
Modify the special SIP header value for every outgoing SIP message.
Parameters
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.
Remove the extension header (custom header) from every outgoing SIP message.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
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 outging SIP message and wish to clear it:
Audio and video functions
Set the video device that will be used for video call.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the video Device Orientation.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the video capturing resolution.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the audio bit rate.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the video bitrate.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the video frame rate.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Usually you do not need to call this function to set the frame rate, as the SDK uses default frame rate.
Send the video to remote side.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the window for a session to display the received remote video image.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the window for a session to display the received remote screen image.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Start/stop displaying the local video image.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Enable/disable the NACK feature (RFC4585) to help to improve the video quality.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Mute the device microphone. It's unavailable for Android and iOS.
Mute the device speaker. It's unavailable for Android and iOS.
Parameters
Set the audio device that will be used for audio call.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Allow to switch between earphone and loudspeaker only.
Set a volume |scaling| to be applied to the outgoing signal of a specific audio channel.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set a volume |scaling| to be applied to the microphone signal of a specific audio channel.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Call functions
Make a call.
Parameters
Returns
If the function succeeds, it will return the session ID of the call, which is greater than 0. If the function fails, it will return a specific error code. Note: the function success just means the outgoing call is being processed, and you need to detect the final state of calling in onInviteTrying, onInviteRinging, onInviteFailure callback events.
rejectCall Reject the incoming call.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
hangUp Hang up the call.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Use the re-INVITE to update the established call.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Example usage:
Example 1: A called B with the audio only, and B answered A, then there would be an audio conversation between A and B. Now if A wants to see B visually, A could use these functions to fulfill it.
Example 2: Remove video stream from current conversation.
Place a call on hold.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Take off hold.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Mute the specified session audio or video.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Forward the call to another user once received an incoming call.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
This function will be used for picking up a call based on the BLF (Busy Lamp Field) status.
Parameters
Returns
If the function succeeds, it will return a session ID that is greater than 0 to the new call, otherwise returns a specific error code that is less than 0.
Remarks
The scenario is:
User 101 subscribed the user 100's call status: sendSubscription("100", "dialog");
When 100 hold a call or 100 is ringing, onDialogStateUpdated callback will be triggered, and 101 will receive this callback. Now 101 can use pickupBLFCall function to pick the call rather than 100 to talk with caller.
Send DTMF tone.
Parameters
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Refer functions
Refer the current call to another one.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
[myVoIPSdk refer:sessionId referTo:@"sip:testuser12@sip.portsip.com"];
You can watch the video on YouTube at https://www.youtube.com/watch?v=_2w9EGgr3FY. It will demonstrate the transfer.
Make an attended refer.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Please read the sample project source code for more details, or you can watch the video on YouTube at https://www.youtube.com/watch?v=NezhIZW4lV4, which will demonstrate the transfer.
Make an attended refer with specified request line and specified method embedded into the "Refer-To" header.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Please read the sample project source code for more details, or you can watch the video on YouTube at https://www.youtube.com/watch?v=NezhIZW4lV4, which will demonstrate the transfer.
Send an out of dialog REFER to replace the specified call.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Once the REFER request accepted, a new call will be made if called this function. The function is usually called after onReceivedRefer callback event.
Parameters
Returns
If the function succeeds, it will return a session ID that is greater than 0 to the new call for REFER, otherwise returns a specific error code that is less than 0.
Reject the REFER request.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Send audio and video stream functions
Enable the SDK to send PCM stream data to remote side from another source instead of microphone.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
To send the PCM stream data to another side, this function MUST be called first.
Send the audio stream in PCM format from another source instead of audio device capturing (microphone).
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Usually we should use it like below:
You can't have too much audio data at one time as we have 100ms audio buffer only. Once you put too much, data will be lost. It is recommended to send 20ms audio data every 20ms.
Enable the SDK to send video stream data to remote side from another source instead of camera.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Send the video stream to remote side.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Send the video stream in i420 from another source instead of video device capturing (camera).
Before calling this function, you MUST call the enableSendVideoStreamToRemote function. Usually we should use it like below:
RTP packets, audio stream and video stream callback functions
Set the RTP callbacks to allow to access the sent and received RTP packets.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Enable/disable the audio stream callback.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
onAudioRawCallback event will be triggered if the callback is enabled.
Enable/disable the video stream callback.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
The onVideoRawCallback event will be triggered if the callback is enabled.
Record functions
Start recording the call.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Stop recording.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Play audio and video files to remote party
Play a file to remote party.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Stop playing file to remote party.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Play a file to locally.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Stop playing file to locally. Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Used for the loop back testing against audio device.
Parameters
Conference functions
Create an audio conference.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Create a video conference.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Destroy the existent conference.
Set the window for a conference that is used to display the received remote video image.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Join a session into existent conference. If the call is in hold, please un-hold first.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remove a session from an existent conference.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
RTP and RTCP QOS functions
Set the audio RTCP bandwidth parameters as the RFC3556.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the video RTCP bandwidth parameters as the RFC3556.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the DSCP (differentiated services code point) value of QoS (Quality of Service) for audio channel.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the DSCP (differentiated services code point) value of QoS (Quality of Service) for video channel.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the MTU size for video RTP packet.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Media statistics functions
Obtain the statistics of channel. the event onStatistics will be triggered.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Audio effect functions
Enable/disable Voice Activity Detection (VAD).
Parameters
Enable/disable Comfort Noise Generator (CNG).
Parameters
Send OPTIONS/INFO/MESSAGE functions
Send OPTIONS message.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Send an INFO message to remote side in dialog.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Send a MESSAGE message to remote side in dialog.
Parameters
Returns
If the function succeeds, it will return a message ID that allows to track the message sending state in onSendMessageSuccess and onSendMessageFailure. If the function fails, it will return a specific error code less than 0.
Remarks
Example 1: Send a plain text message. Note: to send other languages text, please use the UTF-8 to encode the message before sending.
[myVoIPsdk sendMessage:sessionId mimeType:@"text" subMimeType:@"plain" message:data messageLength:dataLen];
Example 2: Send a binary message.
[myVoIPsdk sendMessage:sessionId mimeType:@"application" subMimeType:@"vnd.3gpp.sms" message:data messageLength:dataLen];
Send an out of dialog MESSAGE message to remote side.
Parameters
Returns
If the function succeeds, it will return a message ID that allows to track the message sending state in onSendOutOfMessageSuccess and onSendOutOfMessageFailure. If the function fails, it will return a specific error code less than 0.
Remarks
Example 1: Send a plain text message. Note: to send text in other languages, please use UTF-8 to encode the message before sending.
[myVoIPsdk sendOutOfDialogMessage:@"sip:user1@sip.portsip.com" mimeType:@"text" subMimeType:@"plain" message:data messageLength:dataLen];
Example 2: Send a binary message.
[myVoIPsdk sendOutOfDialogMessage:@"sip:user1@sip.portsip.com" mimeType:@"application" subMimeType:@"vnd.3gpp.sms" isSMS:NO message:data messageLength:dataLen];
Presence functions
Indicate that SDK uses the P2P mode for presence or presence agent mode.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Since presence agent mode requires the PBX/Server support the PUBLISH, please ensure you have your server and PortSIP PBX support this feature. For more details please visit: https://www.portsip.com/portsip-pbx
Set the default expiration time to be used when creating a subscription.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the default expiration time to be used when creating a publication.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Send a SUBSCRIBE message for subscribing the contact's presence status.
Parameters
Returns
If the function succeeds, it will return subscribeId. If the function fails, it will return a specific error code.
Terminate the given presence subscription.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Accept the presence SUBSCRIBE request which is received from contact.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
If the P2P presence mode is enabled, when someone subscribes your presence status, you will receive the subscription request in the callback, and you can use this function to reject it.
Reject a presence SUBSCRIBE request which is received from contact.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
If the P2P presence mode is enabled, when someone subscribe your presence status, you will receive the subscribe request in the callback, and you can use this function to accept it.
Send a NOTIFY message to contact to notify that presence status is online/offline/changed.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return value a specific error code.
Send a SUBSCRIBE message to remote side.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
Example 1, to subscribe the MWI (Message Waiting notifications), You can use this code: long mwiSubId = sendSubscription("sip:101@test.com", "message-summary");
Example 2, to monitor a user/extension call status, You can use code: sendSubscription("100", "dialog"); Extension 100 is the one to be monitored. Once being monitored, when extension 100 hold a call or is ringing, the onDialogStateUpdated callback will be triggered.
Terminate the given subscription.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
For example, if you want stop check the MWI, use below code:
'terminateSubscription(mwiSubId); '
Device Manage functions.
Gets the number of available capturing devices. Returns
The return value is the count of video capturing devices. If fails, it will return a specific error code less than 0.
Gets the name of a specific video capturing device given by an index. Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Gets the number of audio devices available for audio recording. Returns
The return value is the count of recording devices. If the function fails, it will return a specific error code less than 0.
Gets the number of audio devices available for audio playout.
Returns
The return value is the count of playout devices. If the function fails, it will return a specific error code less than 0.
Get the name of a specific recording device given by an index. Parameters
Returns
A NSString to which the device name will be copied as a null-terminated string in UTF-8 format.
Get the name of a specific playout device given by an index.
Parameters
Returns
A NSString to which the device name will be copied as a null-terminated string in UTF8 format.
Set the speaker volume level.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Gets the speaker volume.
Returns
If the function succeeds, it will return the value of speaker volume that ranges 0 - 255. If the function fails, it will return a specific error code.
Sets the microphone volume level.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Retrieves the current microphone volume.
Returns
If the function succeeds, it will return the value of microphone volume. If the function fails, it will return a specific error code.
Retrieves the current number of screen.
Returns
If the function succeeds, it will return the screen number. If the function fails, it will return a specific error code.
Retrieves the current screen title .
Parameters
Returns
If the function succeeds, return value 0. If the function fails, it will return a specific error code.
Sets the Screen to share .
Parameters
Returns
If the function succeeds, return value 0. If the function fails, it will return a specific error code.
Sets the Screen video framerate .
Parameters
Returns
If the function succeeds, return value 0. If the function fails, it will return a specific error code.
PortSIPVideoRenderView
Change the Video Render size.
Remarks
Example:
Last updated