Suggestions

close search

StringeeCall

public class StringeeCall
extends Object



Represents a voice, video call.
Used to capture an audio-video stream from the device's microphone and camera for use to make or answer a call. Create a StringeeCall instance by calling the StringeeCall constructor.



Summary


Nested classes  
public static class StringeeCallStats

Used to get the call's statistics.

public static enum SignalingState

Defines values for the state of the call.

public static enum MediaState

Defines values for the call media state.

public interface StringeeCallListener

Monitors the call's events.

public interface CallStatsListener

Monitors the call states and medias.

Public Constructors  
StringeeCall(StringeeClient client, String from, String to)

Creates a new StringeeCall instance to make a call.

Public methods  
void answer()

Answers a call and starts the conversation.

void enableVideo(boolean enable)

Enables or disables the local video stream.

String getCallId()

Returns the id of the call.

int getCallStatus()

Returns the call's state.

String getCustomDataFromYourServer()

Returns the custom data from your server.

String getFrom()

Returns the caller's id or phone number.

org.webrtc.SurfaceViewRenderer getLocalView()

Returns the view which Stringee SDK renders local video to.

org.webrtc.SurfaceViewRenderer getRemoteView()

Returns the view which Stringee SDK renders remote video to.

void getStats(CallStatsListener statsListener)

Get the call's statistics.

String getTo()

Returns the callee's id or phone number.

void hangup()

Terminates a call.

void hold(StatusListener listener)

Hold a call.

void ringing(StatusListener listener)

Connect to call and send ringing signal.

boolean isPhoneToAppCall()

Check whether the call is a phone-to-app call.

boolean isAppToPhoneCall()

Check whether the call is a app-to-phone call.

boolean isVideoCall()

Check whether the call is a video call.

void makeCall()

Makes a call.

void mute(boolean mute)

Toggle audio on or off.

void reject()

Reject a call.

void renderLocalView(boolean isMediaOverlay)

Displays the caller's video.

void renderRemoteView(boolean isMediaOverlay)

Displays the callee's video.

void sendCallInfo(JSONObject info)

Sends any data in JSON format to other clients.

int sendDTMF(String s)

Sends a DTMF code.

void setCustom(String custom)

Set a customizable text of the call. This text will be sent to Stringee server. Then Stringee server sends it to Your Server via the project's answer_url.

void setCallListener(StringeeCallListener callListener)

Set a StringeeCall.StringeeCallListener object to monitor the call's events'.

void setQuality(int quality)

Set the video call's quality.

void setVideoCall(boolean videoCall)

By defalt, a Stringee call is a voice call.

void switchCamera(StatusListener listener)

Switches the device's camera.

void transferToUserId(String userId, StatusListener listener)

Transfer the call to another client.

void unHold(StatusListener listener)

Unhold a call.

void resumeVideo()

Resume local stream.


Public constructors


StringeeCall

StringeeCall(StringeeClient client, String from, String to)

Creates a new StringeeCall instance to make a call.

Parameters  
client

The client who wants to make or answer a call.

from

The caller's alias to be displayed to the callee (app-to-app call) or the number you've bought (app-to-phone call).

to

The user id of the callee.




Public methods


answer

void answer()

Answers a call and starts the conversation.



enableVideo

void enableVideo(boolean enable)

Enable or disable local video stream.

Parameters  
enable

True to enable or false to disable video stream.



getCallId

String getCallId()

Returns the id of the call. The id is generated on Stringee server and passed to the caller via the StringeeCall.StringeeCallStateListener.onStateChange interface or to callee via the StringeeConnectionListener.onIncomingCall interface.



getCallStatus

int getCallStatus()

Returns the call's state. The call's state can be StringeeConstant.STATE_CONNECTING, StringeeConstant.STATE_RINGING, StringeeConstant.STATE_START, StringeeConstant.STATE_BUSY, StringeeConstant.STATE_END



getCustomDataFromYourServer

String getCustomDataFromYourServer()

Returns the custom data from your server when a client makes a call or receives an incoming call.



getFrom

String getFrom()

Returns the caller's id or phone number.



getLocalView

org.webrtc.SurfaceViewRenderer getLocalView()

Returns the view which Stringee SDK renders local video to. You can add this view as a child of ViewGroup objects in your app.



getRemoteView

org.webrtc.SurfaceViewRenderer getRemoteView()

Returns the view which Stringee SDK renders remote video to. You can add this view as a child of ViewGroup objects in your app.



getStats

void getStats(CallStatsListener statsListener)

Get the call's statistics such as: bytesReceived, packetsReceived, packetsLost. The call statistics are returned in a StringeeCall.StringeeCallStats object via statsListener.onCallStats(StringeeCallStats statsReport).

Parameters  
statsListener

A CallStatsListener instance.



getTo

String getTo()

Returns the callee's id or phone number.



hangup

void hangup()

Terminates a call. This method must be called when you hangs up to release resources. Otherwise, the memory is leaked.



hold

void hold(StatusListener listener)

Hold a call.

Parameters  
listener

A StatusListener instance.



ringing

void ringing(StatusListener listener)

Connect to call and send ringing signal.

Parameters  
StatusListener

A StatusListener instance.



isPhoneToAppCall

boolean isPhoneToAppCall()

Check whether the call is a phone-to-app call.



isAppToPhoneCall

boolean isAppToPhoneCall()

Check whether the call is a app-to-phone call.



isVideoCall

boolean isVideoCall()

Check whether the call is a video call.



makeCall

void makeCall()

Makes a call.



mute

void mute(boolean mute)

Toggle audio on or off

Parameters  
mute

True to toggle audio off or false to toggle audio on.



reject

void reject()

Reject a call.



renderLocalView

void renderLocalView(boolean isMediaOverlay)

Displays the caller's video.

Parameters  
isMediaOverlay

Control whether the video is placed on top of another regular surface view in the window.



renderRemoteView

void renderRemoteView(boolean isMediaOverlay)

Displays the callee's video.

Parameters  
isMediaOverlay

Control whether the video is placed on top of another regular surface view in the window.



sendCallInfo

int sendCallInfo(JSONObject info)

Sends any data in JSON format to other clients.

Parameters  
info

Data in JSON format to be sent.



sendDTMF

int sendDTMF(String s)

Sends a DTMF code.

Parameters  
s

The DTMF code.



setCustom

void setCustom(String custom)

Set a customizable text of the call. This text will be sent to Stringee server. Then Stringee server sends it to Your Server via the project's answer_url.

Parameters  
custom

The customizable text.



setCallListener

void setCallListener(StringeeCallListener callListener)

Set a StringeeCall.StringeeCallListener object to monitor the call's events'.

Parameters  
callListener

A StringeeCallListener instance.



setQuality

void setQuality(int quality)

Set the video call's quality. The quality can be: StringeeConstant.QUALITY_NORMAL, StringeeConstant.QUALITY_HD, StringeeConstant.QUALITY_FULLHD.

Parameters  
quality

The quality of video.



setVideoCall

void setVideoCall(boolean videoCall)

By defalt, a Stringee call is a voice call. If you want to make a video call, call the setVideoCall(true) after instantiating a StringeeCall instance.

Parameters  
videoCall

True for video call, false for audio call.



switchCamera

void switchCamera(StatusListener listener)

Switches the device's camera. By defalt, Stringee SDK uses the front camera.

Parameters  
listener

A StatusListener instance.



transferToUserId

void transferToUserId(String userId, StatusListener listener)

Transfer the call to another client. You only can transfer an app-to-phone or a phone-to-app call.

Parameters  
userId

The user's id to transfer the call to.

StatusListener

A StatusListener instance.



unHold

void unHold(StatusListener listener)

Unhold a call.

Parameters  
listener

A StatusListener instance.



resumeVideo

void resumeVideo()

Resume local stream.