{"templateId":"markdown","versions":[{"version":"1.0","label":"1.0","link":"/docs/voice/sdk/java/1.0/syntax-reference","default":false,"active":true,"folderId":"de15244a"},{"version":"2.0","label":"2.0","link":"/docs/voice/sdk/java/syntax-reference","default":true,"active":false,"folderId":"de15244a"}],"sharedDataIds":{"sidebar":"sidebar-docs/voice/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["partial","admonition"]},"product":"Voice","type":"markdown"},"seo":{"title":"Java SDK Reference | Voice API | Sinch","siteUrl":"https://developers.sinch.com","llmstxt":{"title":"Sinch Developer Documentation","description":"LLMs.txt containing a map of all the documentation files for Sinch.","sections":[{"title":"Numbers API","description":"The Numbers API enables you to search for, view, and activate numbers. It's considered a precursor to other APIs in the Sinch product family. The numbers API can be used in tandem with any of our APIs that perform messaging or calling.","includeFiles":["docs/numbers/**/*.md","docs/numbers/**/*.yaml"],"excludeFiles":["docs/numbers/index.md"]},{"title":"Conversation API","description":"Send and receive messages globally on many popular channels with ease and confidence when using Sinch's Conversation API. Conversation API is the preferred API for sending mobile messages on SMS and other social channels with Sinch. It is a simple API with unified error messages, consistent request payloads, and common webhook payloads that are channel-agnostic.","includeFiles":["docs/conversation/**/*.md","docs/conversation/**/*.yaml"],"excludeFiles":["docs/conversation/index.md"]},{"title":"Voice API","description":"The Voice API works as a big telephony switch. The Voice API handles incoming phone calls (also known as incoming call “legs”), sets up outgoing phone calls (or outgoing call “legs”), and bridges the two. The incoming call leg may come in over a data connection (from a smartphone or web application using the Sinch SDKs) or through a local phone number (from the PSTN network). Similarly, the outgoing call leg can be over data (to another smartphone or web application using the Sinch SDKs) or the PSTN network.","includeFiles":["docs/voice/**/*.md","docs/voice/**/*.yaml"],"excludeFiles":["docs/voice/index.md"]},{"title":"Verification API","description":"The Verification API is a platform for phone number verification. It consists of the API and different software development kits (the Sinch SDKs) that you integrate with your smartphone or web application and cloud based back-end services. Together they enable SMS, Flashcall, Phone Call and Data verification in your application.","includeFiles":["docs/verification/**/*.md","docs/verification/**/*.yaml"],"excludeFiles":["docs/verification/index.md"]},{"title":"Provisioning API","description":"Provisioning API allows you to programmatically set up your senders, accounts and templates on your favorite messaging platforms on the Conversation API. For now, you can create your first WhatsApp channel through Meta's Embedded sign up, you can configure your first SMS App and configure your webhooks. As development continues, we will be adding the most commonly used channels.","includeFiles":["docs/provisioning-api/**/*.md","docs/provisioning-api/**/*.json"],"excludeFiles":["docs/provisioning-api/index.md"]},{"title":"Elastic SIP Trunking API","description":"With Elastic SIP Trunking you can create and manage your SIP trunks and phone numbers programmatically.","includeFiles":["docs/est/**/*.md","docs/est/**/*.yaml"],"excludeFiles":["docs/est/index.md"]},{"title":"Fax API","description":"Send and receive HIPAA compliant faxes on our modern fax platform using our developer-friendly API.","includeFiles":["docs/fax/**/*.md","docs/fax/**/*.yaml"],"excludeFiles":["docs/fax/index.md"]},{"title":"In-app Voice and Video SDK","description":"The In-app Voice and Video SDK enables you to add voice and video calling capabilities directly into your mobile or web application using the Sinch SDKs.","includeFiles":["docs/in-app-calling/**/*.md"],"excludeFiles":["docs/in-app-calling/index.md"]},{"title":"Number Lookup API","description":"The Number Lookup API is designed to provide in-depth information about phone numbers, helping enterprises enhance their communication strategies and prevent fraud. By identifying the type of phone line (for example, mobile, landline, VoIP) and the associated carrier, the API allows businesses to optimize routing, reduce unnecessary costs, and improve customer engagement.","includeFiles":["docs/number-lookup-api-v2/**/*.md","docs/number-lookup-api-v2/**/*.yaml"],"excludeFiles":["docs/number-lookup-api-v2/index.md"]},{"title":"Functions","description":"Serverless compute for voice and messaging. Deploy your code and Sinch routes live calls and messages to it — no infrastructure to run.","includeFiles":["docs/functions/functions/**/*.md","docs/functions/concepts/**/*.md","docs/functions/reference/**/*.md"],"excludeFiles":["docs/functions/functions/index.md"]},{"title":"CLI","description":"One command line for every Sinch API and the full Functions lifecycle — scaffold, run locally, deploy, and manage.","includeFiles":["docs/functions/cli/**/*.md"],"excludeFiles":["docs/functions/cli/index.md"]}]},"description":"Learn the syntax of the Sinch Java SDK for Voice API."},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"sinch-java-sdk-for-voice","__idx":0},"children":["Sinch Java SDK for Voice"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Sinch Java SDK allows you to quickly interact with the ","Voice API"," from inside your Java applications. When using the Java SDK, the code representing requests and queries sent to and responses received from the ","Voice API"," are structured similarly to those that are sent and received using the ","Voice API","."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The fastest way to get started with the SDK is to check out our ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/getting-started/java-sdk/make-call"},"children":["getting started"]}," guides. There you'll find all the instructions necessary to download, install, set up, and start using the SDK."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note:"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also view the generated JavaDocs for the Java SDK ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/java-sdk/apidocs/com/sinch/sdk/domains/voice/package-summary.html"},"children":["here"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"syntax","__idx":1},"children":["Syntax"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide describes the syntactical structure of the Java SDK for the Voice API, including any differences that may exist between the API itself and the SDK. For a full reference on Voice API calls and responses, see the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice"},"children":["Voice API Reference"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The code sample below is an example of how to use the Java SDK to make a text to speech phone call to phone number using the Java SDK and the Voice API. We've also provided an example that accomplishes the same task using the REST API."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"SDK","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"file":"/code-snippets/java-sdk/voice/gs/make-call.sample.java","language":"java","title":"Snippet.java","header":{"title":"Snippet.java","controls":{"copy":{}}},"lang":"java","source":"/**\n * Sinch Java Snippet\n *\n * <p>This snippet is available at https://github.com/sinch/sinch-sdk-java\n *\n * <p>See https://github.com/sinch/sinch-sdk-java/blob/main/examples/snippets/README.md for details\n */\npackage voice.callouts;\n\nimport com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.domains.voice.api.v1.CalloutsService;\nimport com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestTTS;\nimport com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn;\nimport com.sinch.sdk.models.Configuration;\nimport java.util.logging.Logger;\nimport utils.Settings;\n\npublic class Call {\n\n  private static final Logger LOGGER = Logger.getLogger(Call.class.getName());\n\n  public static void main(String[] args) {\n\n    String applicationKey = Settings.getApplicationKey().orElse(\"MY_APPLICATION_KEY\");\n    String applicationSecret = Settings.getApplicationSecret().orElse(\"MY_APPLICATION_SECRET\");\n\n    // The phone number you want to call, in E.164 format (e.g., +12025550123)\n    String recipientPhoneNumber = \"RECIPIENT_PHONE_NUMBER\";\n    String textToSpeech = \"Hello, this is a call initiated from Sinch Java SDK. Goodbye.\";\n\n    Configuration configuration =\n        Configuration.builder()\n            .setApplicationKey(applicationKey)\n            .setApplicationSecret(applicationSecret)\n            .build();\n\n    SinchClient client = new SinchClient(configuration);\n\n    CalloutsService calloutsService = client.voice().v1().callouts();\n\n    LOGGER.info(String.format(\"Calling phone number '%s'\", recipientPhoneNumber));\n\n    CalloutRequestTTS request =\n        CalloutRequestTTS.builder()\n            .setDestination(DestinationPstn.from(recipientPhoneNumber))\n            .setText(textToSpeech)\n            .build();\n\n    String response = calloutsService.call(request);\n\n    LOGGER.info(\"Response: \" + response);\n  }\n}\n"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"REST API","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"file":"/code-snippets/java/voice/make-call.sample.java","language":"java","title":"App.java","header":{"title":"App.java","controls":{"copy":{}}},"lang":"java","source":"package app;\n\nimport java.net.*;\nimport java.net.http.*;\nimport java.util.*;\n\npublic class App {\n  private static final String key = \"\";\n  private static final String secret = \"\";\n  private static final String fromNumber = \"\";\n  private static final String to = \"\";\n  private static final String locale = \"\";\n\n  public static void main(String[] args) throws Exception {\n    var httpClient = HttpClient.newBuilder().build();\n\n    var payload = String.join(\"\\n\"\n      , \"{\"\n      , \" \\\"method\\\": \\\"ttsCallout\\\",\"\n      , \" \\\"ttsCallout\\\": {\"\n      , \"  \\\"cli\\\": \\\"\" + fromNumber + \"\\\",\"\n      , \"  \\\"destination\\\": {\"\n      , \"   \\\"type\\\": \\\"number\\\",\"\n      , \"   \\\"endpoint\\\": \\\"\" + to + \"\\\"\"\n      , \"  },\"\n      , \"  \\\"locale\\\": \\\"\" + locale + \"\\\",\"\n      , \"  \\\"text\\\": \\\"Hello, this is a call from Sinch. Congratulations! You made your first call.\\\"\"\n      , \" }\"\n      , \"}\"\n    );\n\n    var host = \"https://calling.api.sinch.com\";\n    var pathname = \"/calling/v1/callouts\";\n    var request = HttpRequest.newBuilder()\n      .POST(HttpRequest.BodyPublishers.ofString(payload))\n      .uri(URI.create(host + pathname ))\n      .header(\"Content-Type\", \"application/json\")\n      .header(\"Authorization\", \"Basic \" + Base64.getEncoder().encodeToString((key + \":\" + secret).getBytes()))\n      .build();\n\n    var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());\n\n    System.out.println(response.body());\n  }\n}"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example highlights the following required to successfully make a Voice API call using the Sinch Java SDK:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#client"},"children":["Client initialization"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#voice-domain"},"children":["Voice domain"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#endpoint-categories"},"children":["Endpoint usage"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#request-and-query-parameters"},"children":["Field population"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"client","__idx":2},"children":["Client"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When using the Sinch Java SDK, you initialize communication with the Sinch backend by initializing the Java SDK's main client class. This client allows you to access the functionality of the Sinch Java SDK."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"initialization","__idx":3},"children":["Initialization"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To start using the SDK, you need to initialize the main client class and create a configuration object to connect to your Sinch account and Voice app. You can find all of the credentials you need on your Sinch ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/voice/apps"},"children":["dashboard"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"import com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.models.Configuration;\n\npublic class App {\n    \n    public static void main(String[] args) {\n        SinchClient client = new SinchClient(Configuration.builder()\n                                    .setApplicationKey(\"YOUR_application_key\")\n                                    .setApplicationSecret(\"YOUR_application_secret\")\n                                    .build());\n    }\n}\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For testing purposes on your local environment it's fine to use hardcoded values, but before deploying to production we strongly recommend using environment variables to store the credentials."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"voice-domain","__idx":4},"children":["Voice domain"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Sinch Java SDK organizes different functionalities in the Sinch product suite into domains. These domains are accessible through the client. For example, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client.voice().[endpoint_category()].[method()]"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"endpoint-categories","__idx":5},"children":["Endpoint categories"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the Sinch Java SDK, Voice API endpoints are accessible through the client. The naming convention of the endpoint's representation in the SDK matches the API:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().callouts()"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().calls()"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().conferences()"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().applications()"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var response = client.voice()\n                    .callouts()\n                    .textToSpeech(CalloutRequestParametersTTS\n                                .builder()\n                                .setDestination(DestinationNumber.valueOf(\"YOUR_phone_number\"))\n                                .setText(\"Thank you for calling Sinch. This call will now end.\")\n                                .build());\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"voicecallouts-endpoint-category","__idx":6},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().callouts()"]}," endpoint category"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().callouts()"]}," category of the Java SDK corresponds corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/callouts/"},"children":["callouts"]}," endpoint. The mapping between the API operations and corresponding Java methods are described below:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"API operation"},"children":["API operation"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK method"},"children":["SDK method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"JavaDocs entry"},"children":["JavaDocs entry"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/callouts/callouts#callouts/callouts/request"},"children":["Makes a Text-to-speech callout"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["textToSpeech()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/api/v1/CalloutsService.html#textToSpeech(com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestTTS)"},"children":["textToSpeech"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/callouts/callouts#callouts/callouts/request"},"children":["Makes a Conference callout"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["conference()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/CalloutsService.html#conference(com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference)"},"children":["conference"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/callouts/callouts#callouts/callouts/request"},"children":["Makes a Custom callout"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Custom()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/CalloutsService.html#custom(com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersCustom)"},"children":["custom"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"voicecalls-endpoint-category","__idx":7},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().calls()"]}," endpoint category"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().calls()"]}," category of the Java SDK corresponds corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/calls/"},"children":["calls"]}," endpoint. The mapping between the API operations and corresponding Java methods are described below:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"API operation"},"children":["API operation"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK method"},"children":["SDK method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"JavaDocs entry"},"children":["JavaDocs entry"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/calls/calling_getcallresult"},"children":["Get information about a call"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["get()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/CallsService.html#get(java.lang.String)"},"children":["get"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/calls/calling_managecallwithcallleg"},"children":["Manage call with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["callLeg"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["manageWithCallLeg()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/CallsService.html#manageWithCallLeg(java.lang.String,com.sinch.sdk.domains.voice.models.CallLegType,com.sinch.sdk.domains.voice.models.svaml.SVAMLControl)"},"children":["manageWithCallLeg"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/calls/calling_updatecall"},"children":["Updates a call in progress"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["update()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/CallsService.html#update(java.lang.String,com.sinch.sdk.domains.voice.models.svaml.SVAMLControl)"},"children":["update"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"voiceconferences-endpoint-category","__idx":8},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().conferences()"]}," endpoint category"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().conferences()"]}," category of the Java SDK corresponds corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/conferences/"},"children":["conferences"]}," endpoint. The mapping between the API operations and corresponding Java methods are described below:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"API operation"},"children":["API operation"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK method"},"children":["SDK method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"JavaDocs entry"},"children":["JavaDocs entry"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/callouts/callouts#callouts/callouts/t=request&path=&d=0/conferencecallout"},"children":["Makes a conference callout"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["call()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ConferencesService.html#call(com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference)"},"children":["call"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/conferences/calling_getconferenceinfo"},"children":["Get information about a conference"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["get()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ConferencesService.html#get(java.lang.String)"},"children":["get"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/conferences/calling_manageconferenceparticipant"},"children":["Manage a conference participant"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["manageParticipant()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ConferencesService.html#manageParticipant(java.lang.String,java.lang.String,com.sinch.sdk.domains.voice.models.requests.ConferenceManageParticipantRequestParameters)"},"children":["manageParticipant"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/conferences/calling_kickconferenceparticipant"},"children":["Remove a participant from a conference"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kickParticipant()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ConferencesService.html#kickParticipant(java.lang.String,java.lang.String)"},"children":["kickParticipant"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/conferences/calling_kickconferenceall"},"children":["Remove all participants from a conference"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kickAll()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ConferencesService.html#kickAll(java.lang.String)"},"children":["kickAll"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"voiceapplications-endpoint-category","__idx":9},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().applications()"]}," endpoint category"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().applications()"]}," category of the Java SDK corresponds corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/applications/"},"children":["configuration"]}," endpoint. The mapping between the API operations and corresponding Java methods are described below:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"API operation"},"children":["API operation"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK method"},"children":["SDK method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"JavaDocs entry"},"children":["JavaDocs entry"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/applications/configuration_getnumbers"},"children":["Return all the numbers assigned to an application"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["listNumbers()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ApplicationsService.html#listNumbers()"},"children":["listNumbers"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/applications/configuration_updatenumbers"},"children":["Assign a number or list of numbers to an application"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["assignNumbers()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ApplicationsService.html#assignNumbers(com.sinch.sdk.domains.voice.models.requests.ApplicationsAssignNumbersRequestParameters)"},"children":["assignNumbers"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/applications/configuration_unassignnumber"},"children":["Unassign a number from an application"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["unassignNumber()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ApplicationsService.html#unassignNumber(com.sinch.sdk.models.E164PhoneNumber,java.lang.String)"},"children":["unassignNumber"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/applications/configuration_getcallbackurls"},"children":["Return the callback URLs for an application"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["getCallbackUrls()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ApplicationsService.html#getCallbackUrls(java.lang.String)"},"children":["getCallbackUrls"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/applications/configuration_updatecallbackurls"},"children":["Update the callback URL for an application"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["updateCallbackUrls()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ApplicationsService.html#updateCallbackUrls(java.lang.String,com.sinch.sdk.domains.voice.models.CallbackUrls)"},"children":["updateCallbackUrls"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/voice/api-reference/voice/applications/calling_querynumber"},"children":["Returns information about a number"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["queryNumber()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/ApplicationsService.html#queryNumber(com.sinch.sdk.models.E164PhoneNumber)"},"children":["queryNumber"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"voicewebhooks-endpoint-category","__idx":10},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().webhooks()"]}," endpoint category"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice().webhooks()"]}," category of the Java SDK are helper methods designed to assist in serializing/deserializing requests from and responses to the Sinch servers, as well as validate that the requests coming from the Sinch servers are authentic."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK method"},"children":["SDK method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"JavaDocs entry"},"children":["JavaDocs entry"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["validateAuthenticatedRequest()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Validates if the request is authentic. It is a best practice to evaluate if a request is authentic before performing any business logic on it."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/WebHooksService.html#validateAuthenticatedRequest(java.lang.String,java.lang.String,java.util.Map,java.lang.String)"},"children":["validateAuthenticatedRequest"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["serializeVerificationResponse()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Serializes a SVAMLControl response into a JSON string. You must serialize the response before returning it because the Sinch servers expect a JSON response."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/WebHooksService.html#serializeWebhooksResponse(com.sinch.sdk.domains.voice.models.svaml.SVAMLControl)"},"children":["serializeWebhooksResponse"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["unserializeVerificationEvent()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Deserializes a JSON response into a Voice event class. You can use this method to handle different event types and write logic for different events."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/voice/WebHooksService.html#unserializeWebhooksEvent(java.lang.String)"},"children":["unserializeWebhooksEvent"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"request-and-query-parameters","__idx":11},"children":["Request and query parameters"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Requests and queries made using the Java SDK are similar to those made using the Voice API. Many of the fields are named and structured similarly."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Many fields in the Java SDK are rendered as enums in data models."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"nested-objects","__idx":12},"children":["Nested objects"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When making calls directly to the API, we use JSON objects, including (in some cases) nested JSON objects. When using the Java SDK, we use Java data models instead of nested JSON objects. For example, consider the Voice configuration objects below. One is represented in JSON, the other as a Java object:"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"SDK","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"Java","header":{"controls":{"copy":{}}},"source":"CalloutRequestParametersTTS.builder()\n                          .setDestination(DestinationNumber.valueOf(\"YOUR_phone_number\"))\n                          .setText(\"Thank you for calling Sinch. This call will now end.\")\n                          .build()\n","lang":"Java"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"JSON","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"method\": \"ttsCallout\",\n  \"ttsCallout\": {\n    \"destination\": {\n      \"type\": \"number\",\n      \"endpoint\": \"YOUR_phone_number\"\n    },\n    \"text\": \"Thank you for calling Sinch. This call will now end.\"\n  }\n}\n","lang":"JSON"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Note that in the Java SDK you would use a specific helper class for the type of Voice call you want to make and a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder()"]}," method to construct the appropriate data model in the correct structure."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"responses","__idx":13},"children":["Responses"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response fields match the API responses. They are delivered as Java objects."]}]},"headings":[{"value":"Sinch Java SDK for Voice","id":"sinch-java-sdk-for-voice","depth":1},{"value":"Syntax","id":"syntax","depth":2},{"value":"Client","id":"client","depth":2},{"value":"Initialization","id":"initialization","depth":3},{"value":"Voice domain","id":"voice-domain","depth":2},{"value":"Endpoint categories","id":"endpoint-categories","depth":2},{"value":"voice().callouts() endpoint category","id":"voicecallouts-endpoint-category","depth":3},{"value":"voice().calls() endpoint category","id":"voicecalls-endpoint-category","depth":3},{"value":"voice().conferences() endpoint category","id":"voiceconferences-endpoint-category","depth":3},{"value":"voice().applications() endpoint category","id":"voiceapplications-endpoint-category","depth":3},{"value":"voice().webhooks() endpoint category","id":"voicewebhooks-endpoint-category","depth":3},{"value":"Request and query parameters","id":"request-and-query-parameters","depth":2},{"value":"Nested objects","id":"nested-objects","depth":2},{"value":"Responses","id":"responses","depth":2}],"frontmatter":{"seo":{"title":"Java SDK Reference | Voice API | Sinch","description":"Learn the syntax of the Sinch Java SDK for Voice API."},"product":"Voice API"},"lastModified":"2026-03-24T21:51:31.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/voice/sdk/java/1.0/syntax-reference","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}