Giter Club home page Giter Club logo

easyprocess's Introduction

EasyProcess source code

The easyprocess.js file contains the source code of the VoxEngine.easyProcess(call1, call2) function and helper functions: *forwardCallToPSTN *forwardCallToUser *forwardCallToUserDirect *forwardCallToSIP

You can use and modify this source code for any VoxEngine project in the Voximplant cloud.

easyprocess's People

Contributors

irbisadm avatar nikolasmelui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easyprocess's Issues

A question about terminating calls with easyProcess

Hello,

During the testing my app I found a problem with easyprocess. Let me describe it.

The purpose of my app is to accept the incoming call from one phone number (phone-number-1) to vox phone number (vox-phone-number) and to connect this call with another phone number (phone-number-2), so:

incoming call: phone-number-1 -> vox-phone-number
outgoing call: vox-phone-number -> phone-number-2

The VoxEngine.easyProcess(incomingCall, outgoingCall) works fine until I need to collect the information from both calls. The screenshot below shows the log output when phone-number-1 hangup the outgoing call.

  1. incoming CallEvents.Disconnected comes first and I can extract the event data and pass it to my API inside the terminating event
  2. Outgoing CallEvents.Failed with event data comes after I send a request to my API

Screenshot 2024-06-21 at 14 54 52

NOTE: If I hangup phone-number-2, then I will be able to get outgoing event data but incoming event data comes after the terminating event

During the investigation I got the desired behavior, instead the following code

const defaultHangupHandler = (e) => {
  JSession.close();
};

...

call1.addEventListener(CallEvents.Failed, defaultHangupHandler);
call1.addEventListener(CallEvents.Disconnected, defaultHangupHandler);
call2.addEventListener(CallEvents.Failed, defaultHangupHandler);
call2.addEventListener(CallEvents.Disconnected, defaultHangupHandler);

I use the following

let finished1 = false;
let finished2 = false;

const terminate = () => {
  if (finished1 && finished2) {
    VoxEngine.terminate()
  }
}

const call1HangupHandler = (e) => {
  finished1 = true;
  call2.hangup();
  terminate();
}

const call2HangupHandler = (e) => {
  finished2 = true;
  call1.hangup();
  terminate();
}

call1.addEventListener(CallEvents.Failed, call1HangupHandler);
call1.addEventListener(CallEvents.Disconnected, call1HangupHandler);
call2.addEventListener(CallEvents.Failed, call2HangupHandler);
call2.addEventListener(CallEvents.Disconnected, call2HangupHandler);

The questions I have are pretty simple:

  1. Is this OK solution? (during my tests it worked OK)
  2. If this solution is good enough, is there any chance to patch the lib?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.