This example show how to use the java and BXML to implement a simple call tracking scenario. It uses Java servlets and JSP for a MVC2 approach without a frameworks.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
out
src/main
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
CreateCallTrackingNumberScreenShot.png
ISSUE_TEMPLATE.md
LICENSE
NumbersListScreenShot.png
PULLREQUEST.md
PULL_REQUEST_TEMPLATE.md
Procfile
README.md
bandwidth-call-tracking-example.iml
pom.xml
system.properties

README.md

Call Tracking Example (Java)

This example show how to use Java and BXML to implement a simple call tracking scenario. It uses Java servlets and JSP for a MVC2 approach without a third party MVC frameworks.

This app will:

  • Display a list of Calls and Numbers
  • Use the Bandwidth Java SDK to order a new phone number - just click the Create Call Tracking Number button
  • Expose an endpoint for call processing
  • Manage call flow with simple BXML

Deploy

Install / Configuration

Before installation you must have the following:

Deploy Locally

To run locally, you must have a running JEE application server. These instructions use Tomcat 8.0.26 (where TOMCAT_HOME is the directory that tomcat is installed).

Step 1 - Set the following environment variables :

  • BANDWIDTH_USER_ID (found on the account tab of the developer console)
  • BANDWIDTH_API_TOKEN (found on the account tab of the developer console)
  • BANDWIDTH_API_SECRET (found on the account tab of the developer console)
  • BANDWIDTH_APPLICATION_ID (from the application created above)

Step 2 - Build the app

Step 3 - Deploy the app

  • cp target/bandwidth-call-tracking-example-1.0-SNAPSHOT.war $TOMCAT_HOME/webapps
  • Type http:localhost:8080/bandwidth-call-tracking-example-1.0-SNAPSHOT.war/numbers in browser to see the page below.

Step 4 - Run Ngrok

  • cd NGROK_HOME
  • ./ngrok http 8080

Step 5

Deploy from IntelliJ

You can also build and run this from IntelliJ as follows (requires installation of IntelliJ 14):

  1. Create an IntelliJ project from existing source (either the pom.xml or just the source tree)
  2. Make sure that all of the dependent libraries are included in the project structure
  3. Create a Tomcat configuration. Ensure that the Web artifact is created
  4. Start Tomcat with the Run command
  5. Run ngrok from the command line
  6. Change the application url to use the ngrok url

Deploy Heroku (work in progress - still working out the dependencies with jetty annotations in a compatible way with tomcat)

This step assumes that you have the Heroku toolbelt installed and an active Heroku account From the command line run the following:

  • heroku create
  • git add .
  • git commit -m "initial deploy"
  • git push heroku master
  • heroku open

Now update the App Platform application url to point to the Heroku endpoint, e.g.

Testing the call flow

The call flow is a simple transfer operation that forwards to the business number. To see this in action enter the /numbers endpoint in a browser to see the following App screenshot

  • Create a Call Tracking Number App screenshot
  • Simply call the Call Tracking Number!