-
Notifications
You must be signed in to change notification settings - Fork 2
Call
String id()
CallStatus status()
int duration()
Date startTime()
Date establishTime()
Date endTime()
Endpoint source()
Endpoint destination()
Endpoint counterpart()
void mute(boolean shouldMute) throws ActionFailedException
boolean muted()
void speakerphone(boolean enabled)
boolean speakerphone()
void sendDTMF(String dtmf) throws ActionFailedException
void setNetworkQualityEventListener(NetworkQualityEventListener networkQualityEventListener)
NetworkQualityEventListener getNetworkQualityEventListener()
void hangup()
Returns a unique call identifier.
none
-
String
- Call ID.
String token = obtainToken();
InfobipRTC infobipRTC = InfobipRTC.getInstance();
CallWebrtcRequest callWebrtcRequest = new CallWebrtcRequest(
token,
getApplicationContext(),
"45g2gql9ay4a2blu55uk1628",
new DefaultWebrtcCallEventListener()
);
WebrtcCall webrtcCall = infobipRTC.callWebrtc(callWebrtcRequest);
Toast.makeText(getApplicationContext(), "Call ID: " + webrtcCall.id(), Toast.LENGTH_LONG);
Returns current call status.
none
-
CallStatus
- Call status.
String token = obtainToken();
InfobipRTC infobipRTC = InfobipRTC.getInstance();
CallWebrtcRequest callWebrtcRequest = new CallWebrtcRequest(
token,
getApplicationContext(),
"45g2gql9ay4a2blu55uk1628",
new DefaultWebrtcCallEventListener()
);
WebrtcCall webrtcCall = infobipRTC.callWebrtc(callWebrtcRequest);
Toast.makeText(getApplicationContext(), "Call status: " + webrtcCall.status(), Toast.LENGTH_LONG);
Returns call duration in seconds calculated from the time call was established. 0
if the call has not been established yet.
none
-
int
- Call duration in seconds
String token = obtainToken();
InfobipRTC infobipRTC = InfobipRTC.getInstance();
CallWebrtcRequest callWebrtcRequest = new CallWebrtcRequest(
token,
getApplicationContext(),
"45g2gql9ay4a2blu55uk1628",
new DefaultWebrtcCallEventListener()
);
WebrtcCall webrtcCall = infobipRTC.callWebrtc(callWebrtcRequest);
webrtcCall.setEventListener(new WebrtcCallEventListener() {
...
@Override
public void onHangup(CallHangupEvent callHangupEvent) {
int durationInSeconds = webrtcCall.duration();
int seconds = durationInSeconds % 60;
long minutes = durationInSeconds / 60 % 60;
long hours = durationInSeconds / 3600;
String duration = String.format(Locale.getDefault(), "%02d:%02d:%02d", hours, minutes, seconds);
Toast.makeText(getApplicationContext(), "Duration: " + duration, Toast.LENGTH_LONG);
}
...
});
Returns the time when the call started (but was not yet established). Initially, startTime is null
.
none
-
Date
- Time when the call was initiated
String token = obtainToken();
InfobipRTC infobipRTC = InfobipRTC.getInstance();
CallWebrtcRequest callWebrtcRequest = new CallWebrtcRequest(
token,
getApplicationContext(),
"45g2gql9ay4a2blu55uk1628",
new DefaultWebrtcCallEventListener()
);
WebrtcCall webrtcCall = infobipRTC.callWebrtc(callWebrtcRequest);
Toast.makeText(getApplicationContext(), "Start time: " + webrtcCall.startTime(), Toast.LENGTH_LONG).show();
Returns the time when the call was established. Initially, establishTime is null
.
none
-
Date
- Time when the call was established
String token = obtainToken();
InfobipRTC infobipRTC = InfobipRTC.getInstance();
CallWebrtcRequest callWebrtcRequest = new CallWebrtcRequest(
token,
getApplicationContext(),
"45g2gql9ay4a2blu55uk1628",
new DefaultWebrtcCallEventListener()
);
WebrtcCall webrtcCall = infobipRTC.callWebrtc(callWebrtcRequest);
webrtcCall.setEventListener(new WebrtcCallEventListener() {
...
@Override
public void onEstablished(CallEstablishedEvent callEstablishedEvent) {
Toast.makeText(getApplicationContext(), "Establish time: " + webrtcCall.establishTime(), Toast.LENGTH_LONG);
}
...
});
Returns the time when the call finished. Initially, endTime is null
.
none
-
Date
- Time when the call finished
String token = obtainToken();
InfobipRTC infobipRTC = InfobipRTC.getInstance();
CallWebrtcRequest callWebrtcRequest = new CallWebrtcRequest(
token,
getApplicationContext(),
"45g2gql9ay4a2blu55uk1628",
new DefaultWebrtcCallEventListener()
);
WebrtcCall webrtcCall = infobipRTC.callWebrtc(callWebrtcRequest);
webrtcCall.setEventListener(new WebrtcCallEventListener() {
...
@Override
public void onEstablished(CallEstablishedEvent callEstablishedEvent) {
webrtcCall.hangup();
}
@Override
public void onHangup(CallHangupEvent callHangupEvent) {
Toast.makeText(getApplicationContext(), "End time: " + webrtcCall.endTime(), Toast.LENGTH_LONG);
}
...
});
Returns the endpoint from which the call originated.
none
-
Endpoint
- Endpoint which initiated the call
InfobipRTC infobipRTC = InfobipRTC.getInstance();
Endpoint source = infobipRTC.getActiveCall().source()
Returns the endpoint which received the call.
none
-
Endpoint
- Endpoint which received the call
InfobipRTC infobipRTC = InfobipRTC.getInstance();
Endpoint destination = infobipRTC.getActiveCall.destination()
Returns the remote endpoint which is participating in the call.
none
-
Endpoint
- Remote endpoint which is participating in the call.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
Endpoint counterpart = infobipRTC.getActiveCall.counterpart()
Controls whether the user's audio in the call should be muted after this action. Disabled by default.
-
shouldMute
:boolean
-true
if the audio should be muted, otherwisefalse
.
N/A
-
ActionFailedException
- if muting fails for any reason.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
WebrtcCall webrtcCall = (WebrtcCall) infobipRTC.getActiveCall()
webrtcCall.mute()
Returns the information whether the user's audio is muted or not.
none
-
boolean
-true
if the audio is muted, otherwisefalse
.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
WebrtcCall webrtcCall = (WebrtcCall) infobipRTC.getActiveCall()
webrtcCall.mute(!webrtcCall.muted())
Controls whether the audio should be played on the speakerphone. Disabled by default.
-
enabled
:boolean
-true
if the audio should be played on the speakerphone, otherwisefalse
.
N/A
InfobipRTC infobipRTC = InfobipRTC.getInstance();
WebrtcCall webrtcCall = (WebrtcCall) infobipRTC.getActiveCall()
webrtcCall.speakerphone(true)
Returns information whether speakerphone is enabled.
none
-
boolean
-true
if the speakerphone is enabled, otherwisefalse
.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
WebrtcCall webrtcCall = (WebrtcCall) infobipRTC.getActiveCall()
webrtcCall.speakerphone(!webrtcCall.speakerphone())
Simulates key-press by sending DTMF (Dual-Tone Multi-Frequency) entry.
-
dtmf
:String
- One of the allowed DTMF characters:- digits:
0
to9
- letters:
A
toD
- symbols:
*
and#
- digits:
N/A
-
ActionFailedException
- if sending DTMF fails for any reason.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
WebrtcCall webrtcCall = (WebrtcCall) infobipRTC.getActiveCall()
webrtcCall.sendDTMF("7")
Configures event handler for network quality events.
-
networkQualityEventListener
:networkQualityEventListener
- Interface that should be implemented in order to handle network quality events properly.
N/A
String token = obtainToken();
InfobipRTC infobipRTC = InfobipRTC.getInstance();
CallWebrtcRequest callWebrtcRequest = new CallWebrtcRequest(
token,
getApplicationContext(),
"45g2gql9ay4a2blu55uk1628",
new DefaultWebrtcCallEventListener()
);
WebrtcCall webrtcCall = infobipRTC.callWebrtc(callWebrtcRequest);
webrtcCall.setNetworkQualityEventListener(new NetworkQualityEventListener() {
@Override
public void onNetworkQualityChanged(NetworkQualityChangedEvent networkQualityChangedEvent) {
runOnUiThread(() -> {
NetworkQuality networkQuality = networkQualityChangedEvent.getNetworkQuality();
Log.d("WebRTC", String.format("Local network quality is: %s (score: %s)", networkQuality, networkQuality.getScore()));
});
}
});
Returns event handler for network quality events.
none
-
NetworkQualityEventListener
- Interface that should be implemented in order to handle network quality events properly.
String token = obtainToken();
InfobipRTC infobipRTC = InfobipRTC.getInstance();
CallWebrtcRequest callWebrtcRequest = new CallWebrtcRequest(
token,
getApplicationContext(),
"45g2gql9ay4a2blu55uk1628",
new DefaultWebrtcCallEventListener()
);
WebrtcCall webrtcCall = infobipRTC.callWebrtc(callWebrtcRequest);
NetworkQualityEventListner networkQualityEventListner = webrtcCall.getNetworkQualityEventListener()
Hangs up the call, which ends up in both parties receiving the CallHangupEvent
, after
the hangup is processed by Infobip WebRTC platform.
none
N/A
InfobipRTC infobipRTC = InfobipRTC.getInstance();
WebrtcCall webrtcCall = (WebrtcCall) infobipRTC.getActiveCall()
webrtcCall.hangup()