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

Functions

(long) - PortSIPSDK::call:sendSdp:videoCall:
 Make a call. More...
 
(int) - PortSIPSDK::rejectCall:code:
 rejectCall Reject the incoming call. More...
 
(int) - PortSIPSDK::hangUp:
 hangUp Hang up the call. More...
 
(int) - PortSIPSDK::answerCall:videoCall:
 answerCall Answer the incoming call. More...
 
(int) - PortSIPSDK::updateCall:enableAudio:enableVideo:
 Use the re-INVITE to update the established call. More...
 
(int) - PortSIPSDK::hold:
 Place a call on hold. More...
 
(int) - PortSIPSDK::unHold:
 Take off hold. More...
 
(int) - PortSIPSDK::muteSession:muteIncomingAudio:muteOutgoingAudio:muteIncomingVideo:muteOutgoingVideo:
 Mute the specified session audio or video. More...
 
(int) - PortSIPSDK::forwardCall:forwardTo:
 Forward the call to another user once received an incoming call. More...
 
(long) - PortSIPSDK::pickupBLFCall:videoCall:
 This function will be used for picking up a call based on the BLF (Busy Lamp Field) status. More...
 
(int) - PortSIPSDK::sendDtmf:dtmfMethod:code:dtmfDration:playDtmfTone:
 Send DTMF tone. More...
 

Detailed Description

Function Documentation

◆ call:sendSdp:videoCall:()

- (long) call: (NSString *)  callee
sendSdp: (BOOL)  sendSdp
videoCall: (BOOL)  videoCall 

Make a call.

Parameters
calleeThe callee. It can be a name only 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 set to false, the outgoing call will not include the SDP in INVITE message.
videoCallIf set to true and at least one video codec was 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, 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:code:()

- (int) rejectCall: (long)  sessionId
code: (int)  code 

rejectCall Reject the incoming call.

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

◆ hangUp:()

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

- (int) answerCall: (long)  sessionId
videoCall: (BOOL)  videoCall 

answerCall Answer the incoming call.

Parameters
sessionIdThe session ID of the 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 set to false, the answer 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:enableAudio:enableVideo:()

- (int) updateCall: (long)  sessionId
enableAudio: (BOOL)  enableAudio
enableVideo: (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 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.

[myVoIPSdk clearVideoCodec];
[myVoIPSdk addVideoCodec:VIDEOCODEC_H264];
[myVoIPSdk updateCall:sessionId enableAudio:true enableVideo:true];

Example 2: Remove video stream from current conversation.

[myVoIPSdk updateCall:sessionId enableAudio:true enableVideo:false];

◆ hold:()

- (int) hold: (long)  sessionId

Place a call on hold.

Parameters
sessionIdThe session 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.

◆ unHold:()

- (int) 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:muteIncomingAudio:muteOutgoingAudio:muteIncomingVideo:muteOutgoingVideo:()

- (int) muteSession: (long)  sessionId
muteIncomingAudio: (BOOL)  muteIncomingAudio
muteOutgoingAudio: (BOOL)  muteOutgoingAudio
muteIncomingVideo: (BOOL)  muteIncomingVideo
muteOutgoingVideo: (BOOL)  muteOutgoingVideo 

Mute the specified session audio or video.

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

◆ forwardCall:forwardTo:()

- (int) forwardCall: (long)  sessionId
forwardTo: (NSString *)  forwardTo 

Forward the call to another user once received an incoming call.

Parameters
sessionIdThe session ID of the call.
forwardToTarget of the call 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 a specific error code.

◆ pickupBLFCall:videoCall:()

- (long) pickupBLFCall: (const char *)  replaceDialogId
videoCall: (BOOL)  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 to be picked up. It comes with onDialogStateUpdated callback.
videoCallIndicates if it is video call or audio call to be picked up.
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:dtmfMethod:code:dtmfDration:playDtmfTone:()

- (int) sendDtmf: (long)  sessionId
dtmfMethod: (DTMF_METHOD)  dtmfMethod
code: (int)  code
dtmfDration: (int)  dtmfDuration
playDtmfTone: (BOOL)  playDtmfTone 

Send DTMF tone.

Parameters
sessionIdThe session ID of the call.
dtmfMethodSupport sending DTMF tone with two methods: DTMF_RFC2833 and DTMF_INFO. The DTMF_RFC2833 is recommended.
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.
playDtmfToneBy setting 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.