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

Int32 PortSIP.PortSIPLib.call (String callee, Boolean sendSdp, Boolean videoCall)
 Make a call. More...
 
Int32 PortSIP.PortSIPLib.rejectCall (Int32 sessionId, int code)
 rejectCall Reject the incoming call. More...
 
Int32 PortSIP.PortSIPLib.hangUp (Int32 sessionId)
 hangUp Hang up the call. More...
 
Int32 PortSIP.PortSIPLib.answerCall (Int32 sessionId, Boolean videoCall)
 answerCall Answer the incoming call. More...
 
Int32 PortSIP.PortSIPLib.updateCall (Int32 sessionId, bool enableAudio, bool enableVideo)
 Use the re-INVITE to update the established call. More...
 
Int32 PortSIP.PortSIPLib.hold (Int32 sessionId)
 To place a call on hold. More...
 
Int32 PortSIP.PortSIPLib.unHold (Int32 sessionId)
 Take off hold. More...
 
Int32 PortSIP.PortSIPLib.muteSession (Int32 sessionId, Boolean muteIncomingAudio, Boolean muteOutgoingAudio, Boolean muteIncomingVideo, Boolean muteOutgoingVideo)
 Mute the specified session audio or video. More...
 
Int32 PortSIP.PortSIPLib.forwardCall (Int32 sessionId, String forwardTo)
 Forward call to another one when receiving the incoming call. More...
 
Int32 PortSIP.PortSIPLib.pickupBLFCall (String replaceDialogId, Boolean videoCall)
 This function will be used for picking up a call based on the BLF (Busy Lamp Field) status. More...
 
Int32 PortSIP.PortSIPLib.sendDtmf (Int32 sessionId, DTMF_METHOD dtmfMethod, int code, int dtmfDuration, bool playDtmfTone)
 Send DTMF tone. More...
 

Detailed Description

Function Documentation

◆ call()

Int32 PortSIP.PortSIPLib.call ( String  callee,
Boolean  sendSdp,
Boolean  videoCall 
)

Make a call.

Parameters
calleeThe callee. It can be either name or full SIP URI. For example: user001, 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's set to false, the outgoing call doesn't include the SDP in INVITE message.
videoCallIf it's set to true with at least one video codecs added, the outgoing call will include the video codec into SDP.
Returns
If the function succeeds, it will return the session ID of the call that 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. You need to detect the call final state in onInviteTrying, onInviteRinging, onInviteFailure callback events.

◆ rejectCall()

Int32 PortSIP.PortSIPLib.rejectCall ( Int32  sessionId,
int  code 
)

rejectCall Reject the incoming call.

Parameters
sessionIdThe sessionId 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()

Int32 PortSIP.PortSIPLib.hangUp ( Int32  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()

Int32 PortSIP.PortSIPLib.answerCall ( Int32  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 it to true to answer the video call.
If it's set to false, the answered call will 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()

Int32 PortSIP.PortSIPLib.updateCall ( Int32  sessionId,
bool  enableAudio,
bool  enableVideo 
)

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 updated 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 value a specific error code.
Remarks
Example usage:
Example 1: A called B with the audio only, B answered A, there has an audio conversation between A, B. Now A wants to see B visually, A could use these functions to do it.
addVideoCodec(VIDEOCODEC_H264);
updateCall(sessionId, true, true);
Example 2: Remove video stream from current conversation.
updateCall(sessionId, true, false);

◆ hold()

Int32 PortSIP.PortSIPLib.hold ( Int32  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()

Int32 PortSIP.PortSIPLib.unHold ( Int32  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()

Int32 PortSIP.PortSIPLib.muteSession ( Int32  sessionId,
Boolean  muteIncomingAudio,
Boolean  muteOutgoingAudio,
Boolean  muteIncomingVideo,
Boolean  muteOutgoingVideo 
)

Mute the specified session audio or video.

Parameters
sessionIdThe session ID of the call.
muteIncomingAudioSet it to true to mute incoming audio stream, and remote side audio cannot be heard.
muteOutgoingAudioSet it to true to mute outgoing audio stream, and the remote side can't hear the audio.
muteIncomingVideoSet it to true to mute incoming video stream, and the remote side video will be invisible.
muteOutgoingVideoSet it to true to mute outgoing video stream, and the remote side can't 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()

Int32 PortSIP.PortSIPLib.forwardCall ( Int32  sessionId,
String  forwardTo 
)

Forward call to another one when receiving the incoming call.

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

◆ pickupBLFCall()

Int32 PortSIP.PortSIPLib.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 session ID of the call.
videoCallTarget of the forwarding. It can be "sip:number@sipserver.com" or "number" only.
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 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.

◆ sendDtmf()

Int32 PortSIP.PortSIPLib.sendDtmf ( Int32  sessionId,
DTMF_METHOD  dtmfMethod,
int  code,
int  dtmfDuration,
bool  playDtmfTone 
)

Send DTMF tone.

Parameters
sessionIdThe session ID of the call.
dtmfMethodDTMF tone could be sent with two methods: DTMF_RFC2833 and DTMF_INFO, of which DTMF_RFC2833 is recommend.
codeThe DTMF tone (0-16).
codeDescription
0The DTMF tone 0.
1The DTMF tone 1.
2The DTMF tone 2.
3The DTMF tone 3.
4The DTMF tone 4.
5The DTMF tone 5.
6The DTMF tone 6.
7The DTMF tone 7.
8The DTMF tone 8.
9The DTMF tone 9.
10The DTMF tone *.
11The DTMF tone #.
12The DTMF tone A.
13The DTMF tone B.
14The DTMF tone C.
15The DTMF tone D.
16The DTMF tone FLASH.
Parameters
dtmfDurationThe DTMF tone samples. Recommended value 160.
playDtmfToneIf it is set to true, the SDK plays local DTMF tone sound when sending DTMF.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.