Suggestions

close search

StringeeCall

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.

Constructors


StringeeCall(client, fromNumber, toNumber, isVideoCall)

Creates a new StringeeCall instance to make a call.

Parameters
client

The client who wants to make or answer a call.

fromNumber

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

toNumber

The user id of the callee.

isVideoCall

true = Video call
false = Audio call

Properties


client

The client who wants to make or answer a call.

fromNumber

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

toNumber

The user id of the callee.

custom

This data comes with fromNumber, toNumber is sent to Your Server via the project's answer_url.
For more details, visit https://developer.stringee.com/docs/server/event-url-and-answer-url

customDataFromYourServer

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

fromAlias

The alias of the caller.

toAlias

The alias of the callee.

fromInternal

Check whether the call is a phone-to-app call.
TRUE = call in
FALSE = call out

answeredOnAnotherDevice

Check whether the call is handled on another device.
TRUE = answered
FALSE = not yet answer

isVideoCall

Whether the call is a video call:
TRUE = video call
FALSE = audio call

isIncomingCall

Check whether the call is an incoming call
TRUE = incomming call
FALSE = not incomming call

isAnswered

Check whether the call is answered
TRUE = answered
FALSE = not yet answer

ended

Check whether the call is ended
TRUE = ended
FALSE = not yet ended

callId

The call's id

localVideoEnabled

Check whether the local video is displayed
TRUE = display
FALSE = no display

videoResolution

The resolution of video
- {width: 480, height: 640}
- {width: 1280, height: 720}

Methods


makeCall(callback)

Make a call with a callback.
- r = 0: Make call successfully
- r = 1: Make call failed. Answer url is empty
- r = 2: Make call failed. Answer url scco incorrect format
- r = 3: Make call failed. To type is not internal or external
- r = 4: Make call failed. From number not found
- r = 5: Make call failed. From number not belong your account
- r = 6: Make call failed. Sip truck not found
- r = 7: Make call failed. Sip truck not belong your account
- r = 8: Make call failed. Not enough money

answer(callback)

Answers a call and starts the conversation with a callback.
- r = 0: Answer call successfully
- r = 1: Answer call failed. The call is not exist
- r = 2: Answer call failed. The call was controlled from other device
- r = 3" Answer call failed. Call data is not exist

reject(callback)

Rejects an incoming call with a callback
- r = 0: Reject call successfully.
- r = 1: Reject call failed. The call is not exist.
- r = 2: Reject call failed. The call answered on another device.

ringing(callback)

Send "Ringing" to the caller.

hangup(callback)

Terminates a call with a hangup. This method must be called when you hangs up to release resources. Otherwise, the memory is leaked. - r = 0: Hangup call successfully.
- r = 1: Hangup call failed. The call is not exist.
- r = 2, Hangup call failed. The call answered on another device.

sendInfo(info, callback)

Sends any data in JSON format to other clients.

- info(JSON Object): any data JSON Object
- sample: {infoA: '1', infoB: 2, test: true}
sendDtmf(digits, callback)

Sends number of press button to server

- digits(String): is the key that customers press.
- sample: '1'
hold()

Hold call

unhold()

UnHold call

sendTransfer(userId, callback)

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

- userId(String): The user's id to transfer the call to.
- sample: 'userid1'