Skip to content

Commit

Permalink
Merge pull request #475 from opentok/develop
Browse files Browse the repository at this point in the history
Merge to master for modal fix and switch to Nexmo for SIP
  • Loading branch information
rhainer authored Aug 24, 2018
2 parents 16e1c65 + d215b16 commit 358e6aa
Show file tree
Hide file tree
Showing 10 changed files with 11,202 additions and 13,819 deletions.
2 changes: 0 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ module.exports = function(grunt) {
[
'grunt-autoprefixer',
'grunt-contrib-clean',
// 'grunt-contrib-compress',
// 'grunt-contrib-connect',
'grunt-contrib-less',
'grunt-contrib-watch',
'grunt-mocha-test', // Server side test runner
Expand Down
57 changes: 9 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,72 +254,33 @@ repo on GitHub.

The app can dial out and add a phone-based end user to the OpenTok session, using the OpenTok
[SIP API](https://tokbox.com/developer/rest/#sip_call). This app uses
[Plivo](https://www.plivo.com/) as the SIP application that connects
[Nexmo](https://www.nexmo.com/) as the SIP application that connects
to OpenTok. (You can also use the OpenTok SIP API to connect to other SIP endpoints.)

To enable this feature:

1. Sign up for a [Plivo](https://www.plivo.com/) account.
1. Sign up for a [Nexmo](https://www.nexmo.com/) account.

2. Create a new Plivo [application](https://manage.plivo.com/app/). Make the following application
settings:

* *Application Name* -- Specify a unique identifying name. (This will only be used by your
server code.)

* *Answer URL* -- Add the public address for the /forward endpoint of your OpenTok demo server.
This is the webhook callback URL that Plivo calls when a call starts. (In response, the OpenTok
Demo server responds with XML that includes the phone number to dial.) You must run OpenTok
Demo on a publicly available URL -- you cannot test the dial-out code using localhost. For
example, set this URL to `https://yourappdomain.com/forward`.

* *Answer Method* -- Set this to GET.

* *Hangup URL* -- Add the public address for the /hang-up endpoint of your OpenTok demo server.
This is the webhook callback URL that Plivo calls when a call ends. You must run OpenTok
Demo on a publicly available URL -- you cannot test the dial-out code using localhost. For
example, set this URL to `https://yourappdomain.com/hang-up`.

* *Hangup Method* -- Set this to GET.

4. Create a new Plivo [endpoint](https://manage.plivo.com/endpoint/). Assign it a username and
password, and assign the endpoint to the Plivo application you created.

3. Edit config/config.json file in this application, and add the following properties:
2. Edit config/config.json file in this application, and add the following properties:

* `SIP.enabled` -- Set this to `true`.

* `SIP.uri` -- Set this to a URL of the following form:

"sip:[email protected]"

Replace `your-endpoint-username` with the username for the Plivo endpoint you created.
See https://manage.plivo.com/endpoint/.

* `SIP.username` -- Set this to the username for the Plivo endpoint you created.

* `SIP.password` -- Set this to the password for the Plivo app you created.

* `Plivo.authId` -- Set this to Auth Id for the Plivo account you created.
* `SIP.username` -- Set this to the apiKey for the Nexmo account you created.

* `Plivo.authToken` -- Set this to the Auth Token for the Plivo account you created.
* `SIP.password` -- Set this to the apiSecret for the Nexmo account you created.

* `SIP.requireGoogleAuth` -- See [Google Authentication for Phone dial-out](#google-authentication-for-phone-dial-out) for instructions on how to limit this functionality to users authenticated by their google account.

For example, the new lines in the config.json file should look like this:
```json
"SIP": {
"sipUri" : "sip:[email protected].com",
"sipUsername" : "[email protected]",
"sipPassword" : "sip:yourpassword",
"sipUri" : "sip:[email protected].com",
"sipUsername" : "nexmoApiKey",
"sipPassword" : "nexmoApiSecret",
"requireGoogleAuth": false
},
"Plivo": {
"authId": "yourAuthId",
"authToken": "yourAuthToken"
}
```
You can also add these settings as `SIP_ENABLED`, `SIP_URL`, `SIP_USERNAME`, `SIP_PASSWORD`, `PLIVO_AUTH_ID`, `PLIVO_AUTH_TOKEN` and `SIP_REQUIRE_GOOGLE_AUTH` environment variables (instead of config.json settings).
You can also add these settings as `SIP_ENABLED`, `SIP_URL`, `SIP_USERNAME`, `SIP_PASSWORD` and `SIP_REQUIRE_GOOGLE_AUTH` environment variables (instead of config.json settings).

#### Google Authentication for Phone dial-out

Expand Down
49 changes: 0 additions & 49 deletions api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,56 +302,7 @@ paths:
description: Unauthorized, problem with authentication credentials.
'403':
description: Forbidden. Operation not valid for user token with this domain.
'/forward':
get:
summary: Call answer webhook for the SIP service
x-implemented-in: getForward
produces:
- text/xml
description: Starts dialing a phone via a SIP gateway.
parameters:
- name: CallStatus
in: path
description: Name of the room.
required: true
type: string
- name: CallUUID
in: path
description: Name of the room.
required: true
type: string
- name: From
in: path
description: Name of the room.
required: true
type: string
responses:
'200':
description: Information about the SIP call
'/hang-up':
get:
summary: Call hang-up webhook for the SIP service
x-implemented-in: getHangUp
description: Called when a call has ended in the SIP gateway.
parameters:
- name: CallStatus
in: path
description: Name of the room.
required: true
type: string
- name: CallUUID
in: path
description: Name of the room.
required: true
type: string
- name: From
in: path
description: Name of the room.
required: true
type: string
responses:
'200':
description: Indicates acknowledgement
post:
summary: Call hang-up callback for web client (to disconnect SIP connection)
x-implemented-in: postHangUp
Expand Down
9 changes: 2 additions & 7 deletions config/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,9 @@
},
"SIP": {
"enabled": false,
"uri": "sip:[email protected]",
"username": "username",
"password": "password"
"username": "nexmoApiKey",
"password": "nexmoApiSecret"
},
"Plivo": {
"authId": "yourId",
"authToken": "yourToken"
},
"Google": {
"clientId": "yourClientId.apps.googleusercontent.com",
"hostedDomain": "yourhosteddomain.com"
Expand Down
Loading

0 comments on commit 358e6aa

Please sign in to comment.