User Manual for Android
FAQ
Where can I download the PortSIP VoIP SDK for testing?
You can download the PortSIP VoIP SDK and sample projects from the PortSIP Website.
What Android API version is required?
The PortSIP VoIP SDK requires Android API version 16 or later.
How can I create a new project with the PortSIP VoIP SDK?
Download the Sample Project and SDK: Obtain the sample project and trial SDK from the PortSIP Website and extract them to a desired directory.
Create a New Project: In Android Studio, create a new Android Application project.
Add the SDK Libraries: Copy all files from the
libs
directory of the extracted SDK to thelibs
directory of your new application.Import Necessary Classes: Import the required classes from the SDK:
How can I process callback events?
Implement the OnPortSIPEvent Interface: Your class should implement the
OnPortSIPEvent
interface to handle callback events.Override Callback Methods: Override 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 Event Listener: Set the event listener using
setOnPortSIPEvent
.Create a Call Manager: Create a call manager using
CreateCallManager
.Initialize the SDK: Call the
initialize
method with appropriate parameters.
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
When failed to register to SIP server, this event will be triggered.
Parameters
Call events
When a 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 progress" message, this event would 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
This event will be triggered if the outgoing or incoming call fails.
Parameters
This event will be triggered when remote party updates the 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 connected, otherwise the functions 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 is triggered once remote side ends the call.
Parameters
If a user subscribed and his dialog status monitored, when the monitored user is holding a call or is being rang, this event will be triggered.
Parameters
If the remote side places 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 received 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 triggered.
Parameters
When the refer call is ringing, this event will be triggered.
Parameters
When the refer call succeeds, this event will be triggered. The ACTV means Active. For example, A establishes the call with B, A transfers B to C, C accepts the refer call, and A will receive this event.
Parameters
When the refer call fails, this event will be triggered. The ACTV means Active. For example, A establish the call with B, A transfers B to C, C rejects this refer call, and A will receive this event.
Parameters
Signaling events
This event will be triggered when receiving a SIP message. This event is disabled by default. To enable, use enableCallbackSignaling.
Parameters
This event will be triggered when sent a SIP message. This event is disabled by default. To enable, use enableCallbackSignaling.
Parameters
MWI events
If there is the waiting voice message (MWI), this event will be triggered.
Parameters
If there is waiting fax message (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
When the contact is online or changes presence status, this event will be triggered.
Parameters
When the contact is offline, this event will be triggered.
Parameters
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
If the message is sent successfully in dialog, this event will be triggered.
Parameters
If the message is failed to be sent out of dialog, this event will be triggered.
Parameters
If the message is sent successfully out of dialog, this event will be triggered.
Parameters
If the message failed to be sent out of dialog, this event would be triggered.
Parameters
This event will be triggered on sending SUBSCRIBE failure.
Parameters
This event will be triggered when a SUBSCRIPTION is terminated or expired.
Parameters
audio device changed,Play audio and video file finished events
If called startPlayingFileToRemote function with no loop mode, this event will be triggered once the file play finished.
Parameters
If called getStatistics function, this event will be triggered once the statistics get finished.
Parameters
fired When available audio devices changed or audio device currently in use changed.
Parameters
fired when the audio focus has been changed.
Parameters
RTP callback events
If enableRtpCallback function is called to enable the RTP callback, this event will be triggered once a RTP packet is received or sent.
Parameters
Remarks
Donot 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 if called enableAudioStreamCallback function.
Parameters
Remarks
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.
See also
PortSipSdk::enableAudioStreamCallback
This event will be triggered once receiving the video packets if enableVideoStreamCallback function is called.
Parameters
See also
PortSipSdk::enableVideoStreamCallback
SDK functions
Initialize and register functions
Initialize the SDK.
Parameters
Returns
If the function succeeds, it returns value 0. If the function fails, it will return a specific error code
Un-initialize the SDK and release resources.
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.
Set user account info.
Parameters
Returns
If this function succeeds, it will return value 0. If it fails, it will return a specific error code.
remove user account info.
Register to SIP proxy server (login to server)
Parameters
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.
Refresh the registration manually after successfully registered.
Parameters
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.
Un-register from the SIP proxy server.
Parameters
Returns
If this 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.
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.
Audio and video codecs functions
Enable an audio codec, and it will be shown 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, and it will be shown 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 audio codecs are enabled.
Returns
If no audio codec enabled, it will return value true; otherwise it returns false.
Detect if the video codecs are enabled.
Returns
If no video codec enabled, it will return value true; otherwise it returns 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.
Remove all the enabled audio codecs.
Remove all the enabled video codecs.
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.
See also
PortSipEnumDefine
Remarks
Example:
setAudioCodecParameter(AUDIOCODEC_AMR, "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 a specific error code.
Remarks
Example:
setVideoCodecParameter(PortSipEnumDefine.enum_VIDEOCODEC_H264, profile-level-id=420033; packetization-mode=0");
Additional settings functions
Get the version number of the current SDK.
Returns
String with version description
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 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.
Parameters
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 the callback of the SIP messages.
Parameters
Set the SRTP policy.
Parameters
This function allows to set the RTP port 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 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.
This function allows to periodically refresh Session Initiation Protocol (SIP) sessions by
sending repeated INVITE requests.
Parameters
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.
Disable the session timer.
Enable/disable the "Do not disturb" status.
Parameters
Enable/disable the "Auto Check MWI" status.
Parameters
Enable or disable to send RTP keep-alive packet when the call is ongoing.
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 capture sample, which will be present in the SDP of INVITE and 200 OK message as "ptime and "maxptime" attribute.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Set the SDK to receive SIP messages that include special mime type.
Parameters
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. "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/
Access SIP message header functions
Access the SIP header of SIP message.
Parameters
Returns
String. The SIP header of SIP message.
Add the SIP Message header into the specified outgoing SIP message.
Parameters
Returns
If the function succeeds, it will return the 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 want to have them removed.
If this function is called, the added extension headers will no longer appear in outgoing SIP message.
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.
Remarks
Example: modify "Expires" header and "User-Agent" header value for every outgoing SIP message:
modifySipMessageHeader(-1,"ALL",3, "Expires", "1000"); modifySipMessageHeader(-1,"ALL",3, "User-Agent", "MyTest Softphone 1.0");
Remove the headers (custom header) added by modifiedSipMessageId.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Clear the modify headers value. Once cleared, it will no longer modify every outgoing SIP message header values.
Remarks Example: modify two headers value for every outgoing SIP message and then clear it:
Parameters
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.
Setting 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 enable/disable video Hardware codec.
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 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 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. Usually you do not need to call this function to set the frame rate since the SDK uses default frame rate.
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 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 that is used for displaying 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.
Set the window for a session that is used for displaying 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
Enable/disable the NACK feature (rfc6642) which helps 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.
Set a volume |scaling| to be applied to the outgoing signal of a specific audio channel.
47 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.
enable/disable sdk audio manager,when enable sdk will auto manager audio device input/output. if the state is enabled, the onAudioDeviceChanged event will be triggered when available audio devices changed or audio device currently in use changed .
Parameters
Get current set of available/selectable audio devices.
Returns
Current set of available/selectable audio devices.
Set the audio device that will used for audio call. For Android and iOS, switch between earphone and Loudspeaker allowed.
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 processing, you need to detect the call final state 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.
answerCall Answer 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.
updateCall 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 specific error code.
Remarks
Example usage:
Example 1: A called B with the audio only, and B answered A, there would be an audio conversation between A and B. Now A want to see B through video, A could use these functions to fulfill it.
clearVideoCodec(); addVideoCodec(VIDEOCODEC_H264); updateCall(sessionId, true, true);
Example 2: Remove video stream from the current conversation. updateCall(sessionId, true, false);
To 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 audio or video session.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Forward call to another one when receiving the incoming call.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return value a specific error code.
This function will be used for picking up a call based on the BLF (Busy Lamp Field) status.
Parameters
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(mSipLib, "100", "dialog");
When 100 holds 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
Transfer the current call to another callee.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Remarks
refer(sessionId, "sip:testuser12@sip.portsip.com");
You can refer to the video on Youtube at:
https://www.youtube.com/watch?v=_2w9EGgr3FY, which will demonstrate how to complete 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 to get more details, or you can refer to the video on YouTube at:
https://www.youtube.com/watch?v=_2w9EGgr3FY
Note: Please use Windows Media Player to play the AVI file, which demonstrates how to complete 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.
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.
By accepting the REFER request, a new call will be made if this function is called. The
function is usually called after onReceivedRefer callback event.
Parameters
Returns
If the function succeeds, it will return a session ID greater than 0 to the new call for REFER; otherwise it will return a specific error code 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 send PCM stream data to remote side from another source instead of microphone. This function MUST be called first to send the PCM stream data to another
side.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
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.
This function MUST be called first to send the video stream data to another side.
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 in i420 from another source instead of video device capturing (camera).
Before calling this function, you MUST call the enableSendVideoStreamToRemote function.
Parameters
Returns
If the function succeeds, it will return value is 0. If the function fails, it will return a specific error code.
RTP packets, Audio stream and video stream callback
Set the RTP callbacks to allow access to the sent and received RTP packets.
Parameters
Returns
If the function succeeds, it will return value is 0. If the function fails, it will return a specific error code.
Enable/disable the audio stream callback. The onAudioRawCallback event will be triggered if the callback is enabled.
Parameters
Enable/disable the video stream callback, the onVideoRawCallback event will be triggered if the callback is enabled.
Parameters
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 file and RTMP/RTSP stream functions
Play an local file or RTSP/RTMP stream 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 play file 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.
Play an local file or RTSP/RTMP stream.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Stop play file locally.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
Used for testing loopback for the audio device.
Parameters
Conference functions
Create an audio conference. It will fail if the existing conference is not ended yet. 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. It will fail if the existing conference is not ended yet.
Parameters
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.
End the exist conference.
Set the window for a conference that is used for displaying 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 existing conference. If the call is in hold, it will be un-hold
automatically.
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 existing 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 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, the return value is 0. If the function fails, the return value is a specific error code.
RTP statistics functions
Obtain the statistics of channel. the event onStatistics will be triggered.
Parameters
Returns
If the function succeeds, it will return value is 0. If the function fails, it will return a specific error code.
Audio effect functions
Enable/disable Voice Activity Detection(VAD).
Parameters
Enable/disable AEC (Acoustic Echo Cancellation).
Parameters
Enable/disable Comfort Noise Generator(CNG).
Parameters
Enable/disable Automatic Gain Control(AGC).
Parameters
Enable/disable Audio Noise Suppression(ANS).
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 value a specific error code.
Send a 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 that is less than 0.
Remarks
Example 1: Send a plain text message. Note: to send other languages text, please use the UTF8 to encode the message before sending.
sendMessage(sessionId, "text", "plain", "hello",6);
Example 2: Send a binary message.
sendMessage(sessionId, "application", "vnd.3gpp.sms", binData, binDataSize);
Send a 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 that is less than 0.
Remarks
Example 1: Send a plain text message. Note: to send other languages text, please use the UTF8 to encode the message before sending.
sendOutOfDialogMessage("sip:user1@sip.portsip.com", "text", "plain", "hello", 6);
Example 2: Send a binary message.
sendOutOfDialogMessage("sip:user1@sip.portsip.com","application", "vnd.3gpp.sms", binData, binDataSize);
Indicate the 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 presence to a contact.
Parameters
Returns
If the function succeeds, it will return value 0. 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 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.
Reject a presence SUBSCRIBE request 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.
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 a specific error code.
Send a SUBSCRIBE message to subscribe an event.
Parameters
Returns
If the function succeeds, it will return the ID of that SUBSCRIBE which is greater than 0. If the function fails, it will return a specific error code which is less than 0.
Remarks
Example 1, below code indicates that user/extension 101 is subscribed to MWI (Message Waiting notifications) for checking his voicemail: int32 mwiSubId = sendSubscription("sip:101@test.com", "message-summary");
Example 2, to monitor a user/extension call status, You can use code: sendSubscription(mSipLib, "100", "dialog"); Extension 100 refers to the user/extension 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);
Class Documentation
com.portsip.PortSipEnumDefine
com.portsip.PortSipEnumDefine.AudioDevice Enum Reference
Public Attributes
SPEAKER_PHONE
WIRED_HEADSET
EARPIECE
BLUETOOTH
NONE
Detailed Description
AudioDevice list possible audio devices that we currently support.
Static Public Attributes
static final int enum_AUDIOCODEC_G729 = 18
static final int enum_AUDIOCODEC_PCMA = 8
static final int enum_AUDIOCODEC_PCMU = 0
static final int enum_AUDIOCODEC_GSM = 3
static final int enum_AUDIOCODEC_G722 = 9
static final int enum_AUDIOCODEC_ILBC = 97
static final int enum_AUDIOCODEC_AMR = 98
static final int enum_AUDIOCODEC_AMRWB = 99
static final int enum_AUDIOCODEC_SPEEX = 100
static final int enum_AUDIOCODEC_SPEEXWB =102
static final int enum_AUDIOCODEC_ISACWB = 103
static final int enum_AUDIOCODEC_ISACSWB =104
static final int enum_AUDIOCODEC_OPUS =105
static final int enum_AUDIOCODEC_DTMF = 101
static final int enum_VIDEOCODEC_NONE = -1
static final int enum_VIDEOCODEC_I420 = 133
static final int enum_VIDEOCODEC_H264 = 125
static final int enum_VIDEOCODEC_VP8 = 120
static final int enum_VIDEOCODEC_VP9 = 122
static final int enum_SRTPPOLICY_NONE = 0
static final int enum_SRTPPOLICY_FORCE = 1
static final int enum_SRTPPOLICY_PREFER = 2
static final int enum_TRANSPORT_UDP = 0
static final int enum_TRANSPORT_TLS = 1
static final int enum_TRANSPORT_TCP = 2
static final int enum_LOG_LEVEL_NONE = -1
static final int enum_LOG_LEVEL_ERROR = 1
static final int enum_LOG_LEVEL_WARNING = 2
static final int enum_LOG_LEVEL_INFO = 3
static final int enum_LOG_LEVEL_DEBUG = 4
static final int enum_DTMF_MOTHOD_RFC2833 = 0
static final int enum_DTMF_MOTHOD_INFO = 1
static final int enum_DIRECTION_NONE = 0
static final int enum_DIRECTION_SEND_RECV = 1
static final int enum_DIRECTION_SEND = 2
static final int enum_DIRECTION_RECV = 3
static final int enum_RECORD_MODE_NONE = 0
static final int enum_RECORD_MODE_RECV = 1
static final int enum_RECORD_MODE_SEND = 2
static final int enum_RECORD_MODE_BOTH = 3
static final int enum_FILE_FORMAT_WAVE = 1
The record audio file is in WAVE format.
static final int enum_FILE_FORMAT_AMR = 2
The record audio file is in AMR format - all voice data are compressed by AMR codec. Mono.
static final int enum_FILE_FORMAT_MP3 = 3 The record audio file is in MP3 format.
static final int enum_FILE_FORMAT_MP4 = 4
The record video file is in MP4(AAC and H264) format. ![ref6]
Member Data Documentation
final int com.portsip.PortSipEnumDefine.enum_VIDEOCODEC_NONE = -1[static]
Used in startRecord only
final int com.portsip.PortSipEnumDefine.enum_VIDEOCODEC_I420 = 133[static]
Used in startRecord only
final int com.portsip.PortSipEnumDefine.enum_DIRECTION_SEND_RECV = 1[static]
both received and sent
final int com.portsip.PortSipEnumDefine.enum_DIRECTION_SEND = 2[static]
Only the sent
final int com.portsip.PortSipEnumDefine.enum_DIRECTION_RECV = 3[static]
Only the received
final int com.portsip.PortSipEnumDefine.enum_RECORD_MODE_NONE = 0[static]
Not Recorded.
final int com.portsip.PortSipEnumDefine.enum_RECORD_MODE_RECV = 1[static]
Only record the received data.
final int com.portsip.PortSipEnumDefine.enum_RECORD_MODE_SEND = 2[static]
Only record the sent data.
final int com.portsip.PortSipEnumDefine.enum_RECORD_MODE_BOTH = 3[static]
Static Public Attributes
static final int ECoreErrorNone = 0
static final int INVALID_SESSION_ID = -1
static final int ECoreAlreadyInitialized = -60000
static final int ECoreNotInitialized = -60001
static final int ECoreSDKObjectNull = -60002
static final int ECoreArgumentNull = -60003
static final int ECoreInitializeWinsockFailure = -60004
static final int ECoreUserNameAuthNameEmpty = -60005
static final int ECoreInitiazeStackFailure = -60006
static final int ECorePortOutOfRange = -60007
static final int ECoreAddTcpTransportFailure = -60008
static final int ECoreAddTlsTransportFailure = -60009
static final int ECoreAddUdpTransportFailure = -60010
static final int ECoreNotSupportMediaType = -60011
static final int ECoreNotSupportDTMFValue = -60012
static final int ECoreAlreadyRegistered = -60021
static final int ECoreSIPServerEmpty = -60022
static final int ECoreExpiresValueTooSmall = -60023
static final int ECoreCallIdNotFound = -60024
static final int ECoreNotRegistered = -60025
static final int ECoreCalleeEmpty = -60026
static final int ECoreInvalidUri = -60027
static final int ECoreAudioVideoCodecEmpty = -60028
static final int ECoreNoFreeDialogSession = -60029
static final int ECoreCreateAudioChannelFailed = -60030
static final int ECoreSessionTimerValueTooSmall = -60040
static final int ECoreAudioHandleNull = -60041
static final int ECoreVideoHandleNull = -60042
static final int ECoreCallIsClosed = -60043
static final int ECoreCallAlreadyHold = -60044
static final int ECoreCallNotEstablished = -60045
static final int ECoreCallNotHold = -60050
static final int ECoreSipMessaegEmpty = -60051
static final int ECoreSipHeaderNotExist = -60052
static final int ECoreSipHeaderValueEmpty = -60053
static final int ECoreSipHeaderBadFormed = -60054
static final int ECoreBufferTooSmall = -60055
static final int ECoreSipHeaderValueListEmpty = -60056
static final int ECoreSipHeaderParserEmpty = -60057
static final int ECoreSipHeaderValueListNull = -60058
static final int ECoreSipHeaderNameEmpty = -60059
static final int ECoreAudioSampleNotmultiple = -60060
static final int ECoreAudioSampleOutOfRange = -60061
static final int ECoreInviteSessionNotFound = -60062
static final int ECoreStackException = -60063
static final int ECoreMimeTypeUnknown = -60064
static final int ECoreDataSizeTooLarge = -60065
static final int ECoreSessionNumsOutOfRange = -60066
static final int ECoreNotSupportCallbackMode = -60067
static final int ECoreNotFoundSubscribeId = -60068
static final int ECoreCodecNotSupport = -60069
static final int ECoreCodecParameterNotSupport = -60070
static final int ECorePayloadOutofRange = -60071
static final int ECorePayloadHasExist = -60072
static final int ECoreFixPayloadCantChange = -60073
static final int ECoreCodecTypeInvalid = -60074
static final int ECoreCodecWasExist = -60075
static final int ECorePayloadTypeInvalid = -60076
static final int ECoreArgumentTooLong = -60077
static final int ECoreMiniRtpPortMustIsEvenNum = -60078
static final int ECoreCallInHold = -60079
static final int ECoreNotIncomingCall = -60080
static final int ECoreCreateMediaEngineFailure = -60081
static final int ECoreAudioCodecEmptyButAudioEnabled = -60082
static final int ECoreVideoCodecEmptyButVideoEnabled = -60083
static final int ECoreNetworkInterfaceUnavailable = -60084
static final int ECoreWrongDTMFTone = -60085
static final int ECoreWrongLicenseKey = -60086
static final int ECoreTrialVersionLicenseKey = -60087
static final int ECoreOutgoingAudioMuted = -60088
static final int ECoreOutgoingVideoMuted = -60089
static final int ECoreFailedCreateSdp = -60090
static final int ECoreTrialVersionExpired = -60091
static final int ECoreStackFailure = -60092
static final int ECoreTransportExists = -60093
static final int ECoreUnsupportTransport = -60094
static final int ECoreAllowOnlyOneUser = -60095
static final int ECoreUserNotFound = -60096
static final int ECoreTransportsIncorrect = -60097
static final int ECoreCreateTransportFailure = -60098
static final int ECoreTransportNotSet = -60099
static final int ECoreECreateSignalingFailure = -60100
static final int ECoreArgumentIncorrect = -60101
static final int ECoreIVRObjectNull = -61001
static final int ECoreIVRIndexOutOfRange = -61002
static final int ECoreIVRReferFailure = -61003
static final int ECoreIVRWaitingTimeOut = -61004
static final int EAudioFileNameEmpty = -70000
static final int EAudioChannelNotFound = -70001
static final int EAudioStartRecordFailure = -70002
static final int EAudioRegisterRecodingFailure = -70003
static final int EAudioRegisterPlaybackFailure = -70004
static final int EAudioGetStatisticsFailure = -70005
static final int EAudioPlayFileAlreadyEnable = -70006
static final int EAudioPlayObjectNotExist = -70007
static final int EAudioPlaySteamNotEnabled = -70008
static final int EAudioRegisterCallbackFailure = -70009
static final int EAudioCreateAudioConferenceFailure = -70010
static final int EAudioOpenPlayFileFailure = -70011
static final int EAudioPlayFileModeNotSupport = -70012
static final int EAudioPlayFileFormatNotSupport = -70013
static final int EAudioPlaySteamAlreadyEnabled = -70014
static final int EAudioCreateRecordFileFailure = -70015
static final int EAudioCodecNotSupport = -70016
static final int EAudioPlayFileNotEnabled = -70017
static final int EAudioPlayFileUnknowSeekOrigin = -70018
static final int EAudioCantSetDeviceIdDuringCall =-70019
static final int EAudioVolumeOutOfRange =-70020
static final int EVideoFileNameEmpty = -80000
static final int EVideoGetDeviceNameFailure = -80001
static final int EVideoGetDeviceIdFailure = -80002
static final int EVideoStartCaptureFailure = -80003
static final int EVideoChannelNotFound = -80004
static final int EVideoStartSendFailure = -80005
static final int EVideoGetStatisticsFailure = -80006
static final int EVideoStartPlayAviFailure = -80007
static final int EVideoSendAviFileFailure = -80008
static final int EVideoRecordUnknowCodec = -80009
static final int EVideoCantSetDeviceIdDuringCall = -80010
static final int EVideoUnsupportCaptureRotate = -80011
static final int VideoUnsupportCaptureResolution = -80012
static final int ECameraSwitchTooOften = -80013
static final int EMTUOutOfRange = -80014
static final int EDeviceGetDeviceNameFailure = -90001
Last updated