[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-d1219a90-d199-472c-9b71-86fefc0e0c8f":3,"$fi4xCQcv21Zj_DsCT_7SyUNdXW4JnUZkxjxsrAngG6YY":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"d1219a90-d199-472c-9b71-86fefc0e0c8f","azure-communication-callautomation-java","构建包括IVR系统、呼叫路由、录音和人工智能驱动的交互在内的服务器端呼叫自动化工作流程。","cat_coding_devops","mod_coding","sickn33,coding","---\nname: azure-communication-callautomation-java\ndescription: \"Build server-side call automation workflows including IVR systems, call routing, recording, and AI-powered interactions.\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# Azure Communication Call Automation (Java)\n\nBuild server-side call automation workflows including IVR systems, call routing, recording, and AI-powered interactions.\n\n## Installation\n\n```xml\n\u003Cdependency>\n    \u003CgroupId>com.azure\u003C\u002FgroupId>\n    \u003CartifactId>azure-communication-callautomation\u003C\u002FartifactId>\n    \u003Cversion>1.6.0\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\n## Client Creation\n\n```java\nimport com.azure.communication.callautomation.CallAutomationClient;\nimport com.azure.communication.callautomation.CallAutomationClientBuilder;\nimport com.azure.identity.DefaultAzureCredentialBuilder;\n\n\u002F\u002F With DefaultAzureCredential\nCallAutomationClient client = new CallAutomationClientBuilder()\n    .endpoint(\"https:\u002F\u002F\u003Cresource>.communication.azure.com\")\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .buildClient();\n\n\u002F\u002F With connection string\nCallAutomationClient client = new CallAutomationClientBuilder()\n    .connectionString(\"\u003Cconnection-string>\")\n    .buildClient();\n```\n\n## Key Concepts\n\n| Class | Purpose |\n|-------|---------|\n| `CallAutomationClient` | Make calls, answer\u002Freject incoming calls, redirect calls |\n| `CallConnection` | Actions in established calls (add participants, terminate) |\n| `CallMedia` | Media operations (play audio, recognize DTMF\u002Fspeech) |\n| `CallRecording` | Start\u002Fstop\u002Fpause recording |\n| `CallAutomationEventParser` | Parse webhook events from ACS |\n\n## Create Outbound Call\n\n```java\nimport com.azure.communication.callautomation.models.*;\nimport com.azure.communication.common.CommunicationUserIdentifier;\nimport com.azure.communication.common.PhoneNumberIdentifier;\n\n\u002F\u002F Call to PSTN number\nPhoneNumberIdentifier target = new PhoneNumberIdentifier(\"+14255551234\");\nPhoneNumberIdentifier caller = new PhoneNumberIdentifier(\"+14255550100\");\n\nCreateCallOptions options = new CreateCallOptions(\n    new CommunicationUserIdentifier(\"\u003Cuser-id>\"),  \u002F\u002F Source\n    List.of(target))                                \u002F\u002F Targets\n    .setSourceCallerId(caller)\n    .setCallbackUrl(\"https:\u002F\u002Fyour-app.com\u002Fapi\u002Fcallbacks\");\n\nCreateCallResult result = client.createCall(options);\nString callConnectionId = result.getCallConnectionProperties().getCallConnectionId();\n```\n\n## Answer Incoming Call\n\n```java\n\u002F\u002F From Event Grid webhook - IncomingCall event\nString incomingCallContext = \"\u003Cincoming-call-context-from-event>\";\n\nAnswerCallOptions options = new AnswerCallOptions(\n    incomingCallContext,\n    \"https:\u002F\u002Fyour-app.com\u002Fapi\u002Fcallbacks\");\n\nAnswerCallResult result = client.answerCall(options);\nCallConnection callConnection = result.getCallConnection();\n```\n\n## Play Audio (Text-to-Speech)\n\n```java\nCallConnection callConnection = client.getCallConnection(callConnectionId);\nCallMedia callMedia = callConnection.getCallMedia();\n\n\u002F\u002F Play text-to-speech\nTextSource textSource = new TextSource()\n    .setText(\"Welcome to Contoso. Press 1 for sales, 2 for support.\")\n    .setVoiceName(\"en-US-JennyNeural\");\n\nPlayOptions playOptions = new PlayOptions(\n    List.of(textSource),\n    List.of(new CommunicationUserIdentifier(\"\u003Ctarget-user>\")));\n\ncallMedia.play(playOptions);\n\n\u002F\u002F Play audio file\nFileSource fileSource = new FileSource()\n    .setUrl(\"https:\u002F\u002Fstorage.blob.core.windows.net\u002Faudio\u002Fgreeting.wav\");\n\ncallMedia.play(new PlayOptions(List.of(fileSource), List.of(target)));\n```\n\n## Recognize DTMF Input\n\n```java\n\u002F\u002F Recognize DTMF tones\nDtmfTone stopTones = DtmfTone.POUND;\n\nCallMediaRecognizeDtmfOptions recognizeOptions = new CallMediaRecognizeDtmfOptions(\n    new CommunicationUserIdentifier(\"\u003Ctarget-user>\"),\n    5)  \u002F\u002F Max tones to collect\n    .setInterToneTimeout(Duration.ofSeconds(5))\n    .setStopTones(List.of(stopTones))\n    .setInitialSilenceTimeout(Duration.ofSeconds(15))\n    .setPlayPrompt(new TextSource().setText(\"Enter your account number followed by pound.\"));\n\ncallMedia.startRecognizing(recognizeOptions);\n```\n\n## Recognize Speech\n\n```java\n\u002F\u002F Speech recognition with AI\nCallMediaRecognizeSpeechOptions speechOptions = new CallMediaRecognizeSpeechOptions(\n    new CommunicationUserIdentifier(\"\u003Ctarget-user>\"))\n    .setEndSilenceTimeout(Duration.ofSeconds(2))\n    .setSpeechLanguage(\"en-US\")\n    .setPlayPrompt(new TextSource().setText(\"How can I help you today?\"));\n\ncallMedia.startRecognizing(speechOptions);\n```\n\n## Call Recording\n\n```java\nCallRecording callRecording = client.getCallRecording();\n\n\u002F\u002F Start recording\nStartRecordingOptions recordingOptions = new StartRecordingOptions(\n    new ServerCallLocator(\"\u003Cserver-call-id>\"))\n    .setRecordingChannel(RecordingChannel.MIXED)\n    .setRecordingContent(RecordingContent.AUDIO_VIDEO)\n    .setRecordingFormat(RecordingFormat.MP4);\n\nRecordingStateResult recordingResult = callRecording.start(recordingOptions);\nString recordingId = recordingResult.getRecordingId();\n\n\u002F\u002F Pause\u002Fresume\u002Fstop\ncallRecording.pause(recordingId);\ncallRecording.resume(recordingId);\ncallRecording.stop(recordingId);\n\n\u002F\u002F Download recording (after RecordingFileStatusUpdated event)\ncallRecording.downloadTo(recordingUrl, Paths.get(\"recording.mp4\"));\n```\n\n## Add Participant to Call\n\n```java\nCallConnection callConnection = client.getCallConnection(callConnectionId);\n\nCommunicationUserIdentifier participant = new CommunicationUserIdentifier(\"\u003Cuser-id>\");\nAddParticipantOptions addOptions = new AddParticipantOptions(participant)\n    .setInvitationTimeout(Duration.ofSeconds(30));\n\nAddParticipantResult result = callConnection.addParticipant(addOptions);\n```\n\n## Transfer Call\n\n```java\n\u002F\u002F Blind transfer\nPhoneNumberIdentifier transferTarget = new PhoneNumberIdentifier(\"+14255559999\");\nTransferCallToParticipantResult result = callConnection.transferCallToParticipant(transferTarget);\n```\n\n## Handle Events (Webhook)\n\n```java\nimport com.azure.communication.callautomation.CallAutomationEventParser;\nimport com.azure.communication.callautomation.models.events.*;\n\n\u002F\u002F In your webhook endpoint\npublic void handleCallback(String requestBody) {\n    List\u003CCallAutomationEventBase> events = CallAutomationEventParser.parseEvents(requestBody);\n    \n    for (CallAutomationEventBase event : events) {\n        if (event instanceof CallConnected) {\n            CallConnected connected = (CallConnected) event;\n            System.out.println(\"Call connected: \" + connected.getCallConnectionId());\n        } else if (event instanceof RecognizeCompleted) {\n            RecognizeCompleted recognized = (RecognizeCompleted) event;\n            \u002F\u002F Handle DTMF or speech recognition result\n            DtmfResult dtmfResult = (DtmfResult) recognized.getRecognizeResult();\n            String tones = dtmfResult.getTones().stream()\n                .map(DtmfTone::toString)\n                .collect(Collectors.joining());\n            System.out.println(\"DTMF received: \" + tones);\n        } else if (event instanceof PlayCompleted) {\n            System.out.println(\"Audio playback completed\");\n        } else if (event instanceof CallDisconnected) {\n            System.out.println(\"Call ended\");\n        }\n    }\n}\n```\n\n## Hang Up Call\n\n```java\n\u002F\u002F Hang up for all participants\ncallConnection.hangUp(true);\n\n\u002F\u002F Hang up only this leg\ncallConnection.hangUp(false);\n```\n\n## Error Handling\n\n```java\nimport com.azure.core.exception.HttpResponseException;\n\ntry {\n    client.answerCall(options);\n} catch (HttpResponseException e) {\n    if (e.getResponse().getStatusCode() == 404) {\n        System.out.println(\"Call not found or already ended\");\n    } else if (e.getResponse().getStatusCode() == 400) {\n        System.out.println(\"Invalid request: \" + e.getMessage());\n    }\n}\n```\n\n## Environment Variables\n\n```bash\nAZURE_COMMUNICATION_ENDPOINT=https:\u002F\u002F\u003Cresource>.communication.azure.com\nAZURE_COMMUNICATION_CONNECTION_STRING=endpoint=https:\u002F\u002F...;accesskey=...\nCALLBACK_BASE_URL=https:\u002F\u002Fyour-app.com\u002Fapi\u002Fcallbacks\n```\n\n## Trigger Phrases\n\n- \"call automation Java\", \"IVR Java\", \"interactive voice response\"\n- \"call recording Java\", \"DTMF recognition Java\"\n- \"text to speech call\", \"speech recognition call\"\n- \"answer incoming call\", \"transfer call Java\"\n- \"Azure Communication Services call automation\"\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,156,1435,"2026-05-16 13:05:50",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"DevOps","devops","mdi-cog-outline","CI\u002FCD、容器化、部署运维",3,162,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"bfa7a53a-499a-46cd-8724-4aff2a41533a","1.0.0","azure-communication-callautomation-java.zip",2950,"uploads\u002Fskills\u002Fd1219a90-d199-472c-9b71-86fefc0e0c8f\u002Fazure-communication-callautomation-java.zip","53a2d9a996acab13e9f87cbf91a25df061b38a7e342c6b2640ec96e922034e52","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":8695}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]