Giter Club home page Giter Club logo

appinfrompstn's Introduction

AppInFromPSTN

Aside from the ususal "npm install"...

You will need to create an environment file:

.env

on your server, in the same directory as "server.js"

This will contain 5 pieces of information..

apiKey - Your Vonage API Key

apiSecret - Your Vonage API Secret

applicationId - The ApplicationID you created using this Key

privateKey -- the LOCATION of the private key file (usually "./private.key"), generated when you created the ApplicationID

number - Your Vonage Phone Number (LVN) associated with this ApplicationID

There is a file, sample_env, which shows the format/keys you will need in the .env file

You set your "local tunnel" name in the server.js at line 4:

const subdomain = 'mbphonetoapp';

The server will AUTOMATICALLY set your Vonage Voice webhooks (answer and event) based on this... NO NEED to set/change it in the dashboard!

The Server now has a "register" function. The client, when launching, will "register" their username with the server. The server will AUTOMATICALLY create the Vonage "user" (or, if it already exists, use the existing one). It will ALSO automatically create the client's JWT. This means that you DO NOT NEED to create the User OR the JWT in the Vonage CLI/Dashboard. This server code does all that automatically.

In the client, point to your backend tunnel at line 21:

const base_url = "https://mbphonetoapp.loca.lt/";

The client code is self-contained: you can just plu the file location into your browser, eg:

file:///Users/mberkeland/sandbox/demos/ecw/client.html (or whatever the path to the client file is on your system)

You will see a field for the Username.. fill it in (one word, no spaces), and hit "register" You can look at the console output to see the info you are getting back from the server. We use this info to create the client Nexmo object (using the appropriate JWT Token and DataCenter).

That's it! You can now call the number associated with the Application, and your client should receive it on the web.

appinfrompstn's People

Watchers

Oscar Rodriguez avatar Mark Berkeland avatar

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.