PortSIP VoIP SDK Manual for Android  16.2
PortSIP features our newest, supported, quality-assured VoIP SDK used by Several hundred companies around the world for easy VoIP application develop and quality-assured code.
Functions
Call functions

Functions

long com.portsip.PortSipSdk.call (String callee, boolean sendSdp, boolean videoCall)
 
int com.portsip.PortSipSdk.rejectCall (long sessionId, int code)
 
int com.portsip.PortSipSdk.hangUp (long sessionId)
 
int com.portsip.PortSipSdk.answerCall (long sessionId, boolean videoCall)
 
int com.portsip.PortSipSdk.updateCall (long sessionId, boolean enableAudio, boolean enableVideo)
 
int com.portsip.PortSipSdk.hold (long sessionId)
 
int com.portsip.PortSipSdk.unHold (long sessionId)
 
int com.portsip.PortSipSdk.muteSession (long sessionId, boolean muteIncomingAudio, boolean muteOutgoingAudio, boolean muteIncomingVideo, boolean muteOutgoingVideo)
 
int com.portsip.PortSipSdk.forwardCall (long sessionId, String forwardTo)
 
long com.portsip.PortSipSdk.pickupBLFCall (String replaceDialogId, boolean videoCall)
 
int com.portsip.PortSipSdk.sendDtmf (long sessionId, int enum_dtmfMethod, int code, int dtmfDuration, boolean playDtmfTone)
 

Detailed Description

Function Documentation

◆ call()

long com.portsip.PortSipSdk.call ( String  callee,
boolean  sendSdp,
boolean  videoCall 
)

Make a call

Parameters
calleeThe callee. It can be a name only or full SIP URI, for example: user001 or sip:user0.nosp@m.01@s.nosp@m.ip.ip.nosp@m.tel..nosp@m.org or sip:user0.nosp@m.02@s.nosp@m.ip.yo.nosp@m.urdo.nosp@m.main..nosp@m.com:5068
sendSdpIf it is set to false, the outgoing call will not include the SDP in INVITE message.
videoCallIf it is set to true and at least one video codec was added, the outgoing call will include the video codec into SDP. Otherwise no video codec will be added into outgoing SDP.
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()

int com.portsip.PortSipSdk.rejectCall ( long  sessionId,
int  code 
)

rejectCall Reject the incoming call.

Parameters
sessionIdThe session ID of the call.
codeReject code, for example, 486, 480 etc.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ hangUp()

int com.portsip.PortSipSdk.hangUp ( long  sessionId)

hangUp Hang up the call.

Parameters
sessionIdSession ID of the call.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ answerCall()

int com.portsip.PortSipSdk.answerCall ( long  sessionId,
boolean  videoCall 
)

answerCall Answer the incoming call.

Parameters
sessionIdThe session ID of call.
videoCallIf the incoming call is a video call and the video codec is matched, set to true to answer the video call.
If set to false, the answer call does not include video codec answer anyway.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ updateCall()

int com.portsip.PortSipSdk.updateCall ( long  sessionId,
boolean  enableAudio,
boolean  enableVideo 
)

updateCall Use the re-INVITE to update the established call.

Parameters
sessionIdThe session ID of call.
enableAudioSet to true to allow the audio in updated call, or false to disable audio in updated call.
enableVideoSet to true to allow the video in update call, or false to disable video in updated call.
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.
addVideoCodec(VIDEOCODEC_H264);
updateCall(sessionId, true, true);

Example 2: Remove video stream from the current conversation.

updateCall(sessionId, true, false);

◆ hold()

int com.portsip.PortSipSdk.hold ( long  sessionId)

To place a call on hold.

Parameters
sessionIdThe session ID of call.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ unHold()

int com.portsip.PortSipSdk.unHold ( long  sessionId)

Take off hold.

Parameters
sessionIdThe session ID of call.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ muteSession()

int com.portsip.PortSipSdk.muteSession ( long  sessionId,
boolean  muteIncomingAudio,
boolean  muteOutgoingAudio,
boolean  muteIncomingVideo,
boolean  muteOutgoingVideo 
)

Mute the specified audio or video session.

Parameters
sessionIdThe session ID of the call.
muteIncomingAudioSet it to true to mute incoming audio stream. Once set, remote side audio cannot be heard.
muteOutgoingAudioSet it to true to mute outgoing audio stream. Once set, the remote side cannot hear the audio.
muteIncomingVideoSet it to true to mute incoming video stream. Once set, remote side video cannot be seen.
muteOutgoingVideoSet it to true to mute outgoing video stream, the remote side cannot see the video.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ forwardCall()

int com.portsip.PortSipSdk.forwardCall ( long  sessionId,
String  forwardTo 
)

Forward call to another one when receiving the incoming call.

Parameters
sessionIdThe session ID of the call.
forwardToTarget of the forward. It can be either "sip:number@sipserver.com" or "number".
Returns
If the function succeeds, it will return value 0. If the function fails, it will return value a specific error code.

◆ pickupBLFCall()

long com.portsip.PortSipSdk.pickupBLFCall ( String  replaceDialogId,
boolean  videoCall 
)

This function will be used for picking up a call based on the BLF (Busy Lamp Field) status.

Parameters
replaceDialogIdThe ID of the call which will be pickup. It comes with onDialogStateUpdated callback.
videoCallIndicates pickup video call or audio call
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:
  1. User 101 subscribed the user 100's call status: sendSubscription(mSipLib, "100", "dialog");
  2. 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.

◆ sendDtmf()

int com.portsip.PortSipSdk.sendDtmf ( long  sessionId,
int  enum_dtmfMethod,
int  code,
int  dtmfDuration,
boolean  playDtmfTone 
)

Send DTMF tone.

Parameters
sessionIdThe session ID of the call.
enum_dtmfMethodDTMF tone could be sent via two methods: DTMF_RFC2833 or DTMF_INFO. The DTMF_RFC2833 is recommend.
codeThe DTMF tone. Values include:
code Description
0 The DTMF tone 0.
1 The DTMF tone 1.
2 The DTMF tone 2.
3 The DTMF tone 3.
4 The DTMF tone 4.
5 The DTMF tone 5.
6 The DTMF tone 6.
7 The DTMF tone 7.
8 The DTMF tone 8.
9 The DTMF tone 9.
10 The DTMF tone *.
11 The DTMF tone #.
12 The DTMF tone A.
13 The DTMF tone B.
14 The DTMF tone C.
15 The DTMF tone D.
16 The DTMF tone FLASH.
Parameters
dtmfDurationThe DTMF tone samples. Recommended value 160.
playDtmfToneSet to true the SDK play local DTMF tone sound during send DTMF.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.