Skip to main content
skill

azure-communication-callautomation-java — Claude Code skill: call

Java SDK skill for Azure Communication Services Call Automation: outbound calls, IVR, recording, DTMF and speech recognition.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add microsoft/skills --skill azure-communication-callautomation-java -a claude-code
Open on GitHub

What azure-communication-callautomation-java does

This skill hands the agent working code patterns for server-side call automation with the Java SDK com.azure:azure-communication-callautomation. It covers client creation, outbound PSTN calls, answering incoming calls from Event Grid, playing text and audio files, DTMF and speech recognition, recording, adding a participant and transferring a call.

The client is built either through CallAutomationClientBuilder with an endpoint and credential, or from a connection string. Local examples use DefaultAzureCredentialBuilder and require the AZURE_TOKEN_CREDENTIALS variable; production code points at a specific credential such as ManagedIdentityCredentialBuilder. If Azure authentication is not set up, the client will not build at all — worth checking before you run anything.

The Maven dependency is com.azure:azure-communication-callautomation version 1.6.0. ACS events are parsed with CallAutomationEventParser inside your webhook endpoint, and a recording is pulled down with downloadTo after the RecordingFileStatusUpdated event.

What it helps with

  • build an IVR menu that collects DTMF key presses
  • answer an incoming call and attach an event handler
  • play a greeting via text-to-speech or from a file
  • record a conversation and download the file afterwards
  • transfer a call to another participant or phone number

Example prompts for the agent

  • Create an outbound call to +14255551234 with CallAutomationClient
  • Set up DTMF recognition with five tones and pound as the stop tone
  • Add MP4 call recording and download it after the RecordingFileStatusUpdated event

How to install azure-communication-callautomation-java

1Skills CLI (Vercel)

npx skills add microsoft/skills --skill azure-communication-callautomation-java -a claude-code

2Manually: put the files in place

~/.claude/skills/azure-communication-callautomation-java/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/azure-communication-callautomation-java/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about azure-communication-callautomation-java

How do I install azure-communication-callautomation-java in Claude?

Run npx skills add microsoft/skills --skill azure-communication-callautomation-java -a claude-code. The skill lands in ~/.claude/skills/azure-communication-callautomation-java/SKILL.md.

What does azure-communication-callautomation-java do?

It shows the agent how to write server-side Java call automation: outbound calls, answering incoming ones, playing audio, DTMF and speech recognition, recording and transfers.

What do I need for this skill to work?

A Java project with the com.azure:azure-communication-callautomation 1.6.0 dependency and access to an Azure Communication Services resource. The examples build the client from an endpoint plus credential or from a connection string.

Source text

SKILL.md · MIT
---
name: azure-communication-callautomation-java
description: Build call automation workflows with Azure Communication Services Call Automation Java SDK. Use when implementing IVR systems, call routing, call recording, DTMF recognition, text-to-speech, or AI-powered call flows.
license: MIT
metadata:
  author: Microsoft
  version: "1.0.0"
  package: com.azure:azure-communication-callautomation
---

# Azure Communication Call Automation (Java)

Build server-side call automation workflows including IVR systems, call routing, recording, and AI-powered interactions.

## Installation

```xml
<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-communication-callautomation</artifactId>
    <version>1.6.0</version>
</dependency>
```

## Client Creation

```java
import com.azure.communication.callautomation.CallAutomationClient;
import com.azure.communication.callautomation.CallAutomationClientBuilder;
import com.azure.core.credential.TokenCredential;
import com.azure.identity.AzureIdentityEnvVars;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.identity.ManagedIdentityCredentialBuilder;

// Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=<specific_credential>
TokenCredential credential = new DefaultAzureCredentialBuilder()
    .requireEnvVars(AzureIdentityEnvVars.AZURE_TOKEN_CREDENTIALS)
    .build();
// Or use a specific credential directly in production:
// See https://learn.microsoft.com/java/api/overview/azure/identity-readme?view=azure-java-stable#credential-classes
// TokenCredential credential = new ManagedIdentityCredentialBuilder().build();

// With DefaultAzureCredential
CallAutomationClient client = new CallAutomationClientBuilder()
    .endpoint("https://<resource>.communication.azure.com")
    .credential(credential)
    .buildClient();

// With connection string
CallAutomationClient client = new CallAutomationClientBuilder()
    .connectionString("<connection-string>")
    .buildClient();
```

## Key Concepts

| Class | Purpose |
|-------|---------|
| `CallAutomationClient` | Make calls, answer/reject incoming calls, redirect calls |
| `CallConnection` | Actions in established calls (add participants, terminate) |
| `CallMedia` | Media operations (play audio, recognize DTMF/speech) |
| `CallRecording` | Start/stop/pause recording |
| `CallAutomationEventParser` | Parse webhook events from ACS |

## Create Outbound Call

```java
import com.azure.communication.callautomation.models.*;
import com.azure.communication.common.CommunicationUserIdentifier;
import com.azure.communication.common.PhoneNumberIdentifier;

// Call to PSTN number
PhoneNumberIdentifier target = new PhoneNumberIdentifier("+14255551234");
PhoneNumberIdentifier caller = new PhoneNumberIdentifier("+14255550100");

CreateCallOptions options = new CreateCallOptions(
    new CommunicationUserIdentifier("<user-id>"),  // Source
    List.of(target))                                // Targets
    .setSourceCallerId(caller)
    .setCallbackUrl("https://your-app.com/api/callbacks");

CreateCallResult result = client.createCall(options);
String callConnectionId = result.getCallConnectionProperties().getCallConnectionId();
```

## Answer Incoming Call

```java
// From Event Grid webhook - IncomingCall event
String incomingCallContext = "<incoming-call-context-from-event>";

AnswerCallOptions options = new AnswerCallOptions(
    incomingCallContext,
    "https://your-app.com/api/callbacks");

AnswerCallResult result = client.answerCall(options);
CallConnection callConnection = result.getCallConnection();
```

## Play Audio (Text-to-Speech)

```java
CallConnection callConnection = client.getCallConnection(callConnectionId);
CallMedia callMedia = callConnection.getCallMedia();

// Play text-to-speech
TextSource textSource = new TextSource()
    .setText("Welcome to Contoso. Press 1 for sales, 2 for support.")
    .setVoiceName("en-US-JennyNeural");

PlayOptions playOptions = new PlayOptions(
    List.of(textSource),
    List.of(new CommunicationUserIdentifier("<target-user>")));

callMedia.play(playOptions);

// Play audio file
FileSource fileSource = new FileSource()
    .setUrl("https://storage.blob.core.windows.net/audio/greeting.wav");

callMedia.play(new PlayOptions(List.of(fileSource), List.of(target)));
```

## Recognize DTMF Input

```java
// Recognize DTMF tones
DtmfTone stopTones = DtmfTone.POUND;

CallMediaRecognizeDtmfOptions recognizeOptions = new CallMediaRecognizeDtmfOptions(
    new CommunicationUserIdentifier("<target-user>"),
    5)  // Max tones to collect
    .setInterToneTimeout(Duration.ofSeconds(5))
    .setStopTones(List.of(stopTones))
    .setInitialSilenceTimeout(Duration.ofSeconds(15))
    .setPlayPrompt(new TextSource().setText("Enter your account number followed by pound."));

callMedia.startRecognizing(recognizeOptions);
```

## Recognize Speech

```java
// Speech recognition with AI
CallMediaRecognizeSpeechOptions speechOptions = new CallMediaRecognizeSpeechOptions(
    new CommunicationUserIdentifier("<target-user>"))
    .setEndSilenceTimeout(Duration.ofSeconds(2))
    .setSpeechLanguage("en-US")
    .setPlayPrompt(new TextSource().setText("How can I help you today?"));

callMedia.startRecognizing(speechOptions);
```

## Call Recording

```java
CallRecording callRecording = client.getCallRecording();

// Start recording
StartRecordingOptions recordingOptions = new StartRecordingOptions(
    new ServerCallLocator("<server-call-id>"))
    .setRecordingChannel(RecordingChannel.MIXED)
    .setRecordingContent(RecordingContent.AUDIO_VIDEO)
    .setRecordingFormat(RecordingFormat.MP4);

RecordingStateResult recordingResult = callRecording.start(recordingOptions);
String recordingId = recordingResult.getRecordingId();

// Pause/resume/stop
callRecording.pause(recordingId);
callRecording.resume(recordingId);
callRecording.stop(recordingId);

// Download recording (after RecordingFileStatusUpdated event)
callRecording.downloadTo(recordingUrl, Paths.get("recording.mp4"));
```

## Add Participant to Call

```java
CallConnection callConnection = client.getCallConnection(callConnectionId);

CommunicationUserIdentifier participant = new CommunicationUserIdentifier("<user-id>");
AddParticipantOptions addOptions = new AddParticipantOptions(participant)
    .setInvitationTimeout(Duration.ofSeconds(30));

AddParticipantResult result = callConnection.addParticipant(addOptions);
```

## Transfer Call

```java
// Blind transfer
PhoneNumberIdentifier transferTarget = new PhoneNumberIdentifier("+14255559999");
TransferCallToParticipantResult result = callConnection.transferCallToParticipant(transferTarget);
```

## Handle Events (Webhook)

```java
import com.azure.communication.callautomation.CallAutomationEventParser;
import com.azure.communication.callautomation.models.events.*;

// In your webhook endpoint
public void handleCallback(String requestBody) {
    List<CallAutomationEventBase> events = CallAutomationEventParser.parseEvents(requestBody);
    
    for (CallAutomationEventBase event : events) {
        if (event instanceof CallConnected) {
            CallConnected connected = (CallConnected) event;
            System.out.println("Call connected: " + connected.getCallConnectionId());
        } else if (event instanceof RecognizeCompleted) {
            RecognizeCompleted recognized = (RecognizeCompleted) event;
            // Handle DTMF or speech recognition result
            DtmfResult dtmfResult = (DtmfResult) recognized.getRecognizeResult();
            String tones = dtmfResult.getTones().stream()
                .map(DtmfTone::toString)
                .collect(Collectors.joining());
            System.out.println("DTMF received: " + tones);
        } else if (event instanceof PlayCompleted) {
            System.out.println("Audio playback completed");
        } else if (event instanceof CallDisconnected) {
            System.out.println("Call ended");
        }
    }
}
```

## Hang Up Call

```java
// Hang up for all participants
callConnection.hangUp(true);

// Hang up only this leg
callConnection.hangUp(false);
```

## Error Handling

```java
import com.azure.core.exception.HttpResponseException;

try {
    client.answerCall(options);
} catch (HttpResponseException e) {
    if (e.getResponse().getStatusCode() == 404) {
        System.out.println("Call not found or already ended");
    } else if (e.getResponse().getStatusCode() == 400) {
        System.out.println("Invalid request: " + e.getMessage());
    }
}
```

## Environment Variables

```bash
AZURE_COMMUNICATION_ENDPOINT=https://<resource>.communication.azure.com  # Required for all auth methods
AZURE_COMMUNICATION_CONNECTION_STRING=endpoint=https://...;accesskey=...  # Alternative to Entra ID auth
CALLBACK_BASE_URL=https://your-app.com/api/callbacks  # Required for webhook callbacks
AZURE_TOKEN_CREDENTIALS=prod  # Required only if DefaultAzureCredential is used in production
```

## Trigger Phrases

- "call automation Java", "IVR Java", "interactive voice response"
- "call recording Java", "DTMF recognition Java"
- "text to speech call", "speech recognition call"
- "answer incoming call", "transfer call Java"
- "Azure Communication Services call automation"

© Microsoft · MIT · microsoft/skills

Similar skills

Everything for Cloud: AWS, Azure, GCP →

From the same set64

The whole set →
azure-enterprise-infra-planner The skill plans enterprise Azure infrastructure from a workload description and generates Bicep or Terraform. Useful when you need a landing zone, hub-spoke network or DR topology. ★ 3,148repo stars azure-app-onboard Takes a business idea or existing codebase to a running Azure deployment: picks services, estimates cost, writes IaC. ★ 3,148repo stars azure-monitor-ingestion-java Tells the agent how to ship custom logs to Azure Monitor from Java using the Logs Ingestion API, DCR and DCE. ★ 3,148repo stars azure-eventhub-java A skill for the Azure Event Hubs SDK for Java: producers, consumers, batching, partitions, checkpoints. Useful when you build event streaming apps. ★ 3,148repo stars azure-ai-vision-imageanalysis-java A skill for the Azure AI Vision SDK for Java. It feeds the agent ready code for captions, OCR, object detection, tagging and smart cropping. ★ 3,148repo stars azure-resource-manager-redis-dotnet A skill for provisioning and managing Azure Cache for Redis through Azure Resource Manager in .NET: caches, firewall rules, access keys, geo-replication. ★ 3,148repo stars azure-mgmt-apimanagement-dotnet A skill for management plane operations on Azure API Management in .NET: creating services, APIs, products, subscriptions and policies via Azure Resource Manager. Use it when APIM infrastructure should be provisioned from code. ★ 3,148repo stars azure-local-multi-rack A skill for planning and running multi-rack Azure Local deployments: aggregation rack, compute racks, Network Fabric Controller, SAN storage. ★ 3,148repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor