4. Test the application

Now it's time to test the application!

Start the ngrok tunnel and update the Callback URL

First we need to open a tunnel to your local machine using ngrok and then use that URL to update the Callback URL of your Voice app on your Sinch Customer Dashboard.

  1. Open a command prompt or terminal and run this command:
    Copy
    Copied
    ngrok http 8090
    This will open an ngrok tunnel on port 8090. We are opening the tunnel on port 8090 because this is the port on which the server will run, based on the configuration in the application.yaml. If for whatever reason you need to use another port, simply update the desired port in that file, and then start the ngrok tunnel on that port instead.
  2. In the console you should see that the ngrok tunnel has started on the specified port. Take note of the Forward URL, which should look something like this:
    Copy
    Copied
    Forwarding                    https://4a61-75-118-121-186.ngrok-free.app
  3. Copy that URL and add /VoiceEvent to the end of it, resulting in something like this:
    Copy
    Copied
    https://4a61-75-118-121-186.ngrok-free.app/VoiceEvent
  4. Navigate to your Voice app and locate the Settings section.
  5. In the "Handle call events with" field, paste the URL you created. Now your Voice app will forward any call events to that URL, on which your server will be listening.

Start the server

Next we need to start the server.

  1. Open a second command prompt or terminal to the sinch-sdk-java-quickstart/tutorials/voice/capture-leads-app folder. This is where the POM file for the Java project lives.
  2. In the command prompt, run this command:
    Copy
    Copied
    mvn clean spring-boot:run
  3. You should notice in your console that Springboot is starting the server on port 8090 (or another port if you changed it), and once the server is running you should see a prompt in the console waiting for your input.
  4. Enter the phone number in E.164 format of the phone you're going to use to test this app.
  5. You should receive a phone call from your Sinch number. Follow the prompts in the IVR and you've successfully tested this app!

Next steps

Now that you know the basics of how to use an IVR, checkout the RunMenu documentation to see what other options are possible.

We'd love to hear from you!
Rate this content:
Still have a question?
 
Ask the community.