OnCaller
  • OnCaller Developer Document
  • API
    • Authentication
    • Blacklist Number Management
    • Business Hour Management
    • Caller Setting
    • Call Actions
    • Call Logs
  • SDK
    • Javascript SDK
      • OnCallerCall
      • OnCallerCallState
      • OnCallerClient
      • OnCaller Error Code
      • Example
    • OnCaller Call Widget
    • Android SDK
    • iOS SDK
    • React Native SDK
    • Cordova/IONIC SDK
Powered by GitBook
On this page
  • Constructors
  • Properties
  • Methods
  • Events

Was this helpful?

  1. SDK
  2. Javascript SDK

OnCallerCall

Represents a voice.Used to capture an audio stream from the device's microphone for use to make or answer a call. Create a OnCallerCall instance by calling the OnCallerCall constructor.

PreviousJavascript SDKNextOnCallerCallState

Last updated 4 years ago

Was this helpful?

You can use our latest SDK version at:

Constructors

OnCallerCall(client, fromNumber, toNumber, isVideoCall)

Creates a new OnCallerCall instance to make a call.

Parameters

Description

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

Properties

Description

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.

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

Method

Description

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'

Events

Event

Description

addlocalstream

Event fire on add local stream

addremotestream

Event fire on add remote stream

mediastate

Media state

otherdevice

Action on other device

error

On error event

signalingstate

https://cdn.oncaller.asia/assets/js/sdk/v1.0/oncaller.latest.sdk.bundle.min.js
OnCallerCall State