package com.nexmo.quickstart.voice;

import com.nexmo.client.NexmoClient;
import com.nexmo.client.auth.AuthMethod;
import com.nexmo.client.auth.JWTAuthMethod;
import com.nexmo.client.voice.Call;

import java.nio.file.FileSystems;

import static com.nexmo.quickstart.Util.*;

public class OutboundTextToSpeech {
    public static void main(String[] args) throws Exception {
        configureLogging();

        String NEXMO_APPLICATION_ID = envVar("APPLICATION_ID");
        String NEXMO_APPLICATION_PRIVATE_KEY = envVar("PRIVATE_KEY");
        String NEXMO_NUMBER = envVar("NEXMO_NUMBER");
        String TO_NUMBER = envVar("TO_NUMBER");

        AuthMethod auth = new JWTAuthMethod(
                NEXMO_APPLICATION_ID,
                FileSystems.getDefault().getPath(NEXMO_APPLICATION_PRIVATE_KEY)
        );
        NexmoClient client = new NexmoClient(auth);
        client.getVoiceClient().createCall(new Call(
                TO_NUMBER,
                NEXMO_NUMBER,
                "https://developer.nexmo.com/ncco/tts.json"
        ));
    }
}

@@ -268,9 +268,72 @@
 til.
-*
+configureLogging;%0Aimport static com.nexmo.quickstart.Util.envVar
 ;%0A%0Ap
@@ -693,16 +693,89 @@
 UMBER%22);
+%0A        String ANSWER_URL = %22https://developer.nexmo.com/ncco/tts.json%22;
 %0A%0A      
@@ -1041,17 +1041,8 @@
 all(
-new Call(
 %0A   
@@ -1054,16 +1054,25 @@
         
+new Call(
 TO_NUMBE
@@ -1077,98 +1077,34 @@
 BER,
-%0A                NEXMO_NUMBER,%0A                %22https://developer.nexmo.com/ncco/tts.json%22
+ NEXMO_NUMBER, ANSWER_URL)
 %0A   
@@ -1108,17 +1108,16 @@
         
-)
 );%0A    %7D

Clean up for building blocks.