# Make a call with Java SDK You can quickly see how the Voice API works by calling yourself using the API and the Java SDK. Note: Before you can get started, you need the following already set up: - Set all Voice API [configuration settings](/docs/voice/getting-started). - [JDK 8 or later](https://www.oracle.com/java/technologies/downloads/) and a familiarity with how to create a new Java application. - [Apache Maven](https://maven.apache.org/install.html) and a familiarity with how to use the Maven CLI. ## Step 1. Set up your Java application To quickly get started setting up a simple client application using the Java SDK: 1. If you haven't already, clone the [sinch-sdk-java-quickstart](https://github.com/sinch/sinch-sdk-java-quickstart) repository. 2. Navigate to the `sinch-sdk-java-quickstart/getting-started/voice/make-a-call/client/src/main/resources` folder. 3. Open the `config.properties` [file](https://github.com/sinch/sinch-sdk-java-quickstart/blob/main/getting-started/voice/make-a-call/client/src/main/resources/config.properties). Using the [Voice app credentials](https://dashboard.sinch.com/voice/apps) from your Sinch Build Dashboard, uncomment the following fields and populate them with your values: | Field | Description | | --- | --- | | APPLICATION_API_KEY | The unique ID of your application. | | APPLICATION_API_SECRET | The secret for your application. | 1. Save the file. ### Modify the application Navigate to the `getting-started/voice/make-a-call/client/src/main/java/voice` folder and open the `Snippet.java` [file](https://github.com/sinch/sinch-sdk-java-quickstart/blob/main/getting-started/voice/make-a-call/client/src/main/java/voice/Snippet.java). The code provided in **Snippet.java** contains some placeholder values. You'll need to update the parameters detailed in the following subsections with your values. Snippet.java // Use this code to make a phone call using the Voice API and the Java SDK. package voice; import com.sinch.sdk.domains.voice.api.v1.CalloutsService; import com.sinch.sdk.domains.voice.api.v1.VoiceService; import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestTTS; import com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; import java.util.logging.Logger; public class Snippet { private static final Logger LOGGER = Logger.getLogger(Snippet.class.getName()); public static String execute(VoiceService voiceService) { CalloutsService calloutsService = voiceService.callouts(); String phoneNumber = "YOUR_phone_number"; String message = "Hello, this is a call from Sinch. Congratulations! You made your first call."; LOGGER.info("Calling '" + phoneNumber + '"'); CalloutRequestTTS parameters = CalloutRequestTTS.builder() .setDestination(DestinationPstn.from(phoneNumber)) .setText(message) .build(); String callId = calloutsService.textToSpeech(parameters); LOGGER.info("Call started with id: '" + callId + '"'); return callId; } } #### Set your phoneNumber parameter In this example you want to call a phone number. Change the value of the `phoneNumber` parameter to the phone number you verified in your [dashboard](https://dashboard.sinch.com) in [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) format. Note: When your account is in trial mode, you can only call your [verified numbers](https://dashboard.sinch.com/numbers/verified-numbers). If you want to call any number, you need to upgrade your account! Save the file. ## Step 2. Package the application Now that you've modified the application, you need to use the Maven CLI to create a package that you can then execute. Open a command prompt or terminal to the `sinch-sdk-java-quickstart/templates/client` folder and run the following command: ```Shell shell command mvn package ``` This command creates the `target` folder and application. ## Step 3. Make your first call Now you can execute the code and make your text-to-speech call. Run the following command: ```Shell shell command java -jar target/sinch-java-sdk-client-application-1.0-SNAPSHOT-jar-with-dependencies.jar ``` You should receive a phone call to the number you called with the message "Hello, this is a call from Sinch. Congratulations! You made your first call." Additionally you should see the response with the `callId` in the console. ## Next steps Now that you know how to make a call, learn how to [handle an incoming call](/docs/voice/getting-started/java-sdk/incoming-call). ## Additional resources - [API specification](/docs/voice/api-reference/voice)