Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated beta5 readme document. #32708

Draft
wants to merge 1 commit into
base: callautomation/release/beta5
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions sdk/communication/communication-call-automation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ To use this client library in the browser, first you need to use a bundler. For
| CallRecording | `CallRecording` can be used to do recording related actions, such as `startRecording`. This can be retrieved from `CallAutomationClient`. |
| Callback Events | Callback events are events sent back during duration of the call. It gives information and state of the call, such as `CallConnected`. `CallbackUrl` must be provided during `createCall` and `answerCall`, and callback events will be sent to this url. You can use `callAutomationEventParser` to parse these events when it arrives. |
| Incoming Call Event | When incoming call happens (that can be answered with `answerCall`), incoming call eventgrid event will be sent. This is different from Callback events above, and should be setup on Azure portal. See [Incoming Call][incomingcall] for detail. |
| CallAutomationEventProcessor | `CallAutomationEventProcessor` is a convinient way to handle mid-call callback events such as `CallConnected`. This will ensure correlation between call and events more easily. See below example for its usage.|

## Examples
### Initialize CallAutomationClient
Expand Down Expand Up @@ -74,33 +73,6 @@ const myFile: FileSource = { uri: "https://<FILE-SOURCE>/<SOME-FILE>.wav" }
const response = callConnection.getCallMedia().playToAll(myFile);
```

### Handle Mid-Connection callback events
To easily handle mid-connection events, Call Automation's SDK provides easier way to handle these events. Take a look at CallAutomationEventProcessor. This will ensure correlation between call and events more easily.
```JavaScript
const eventProcessor: CallAutomationEventProcessor = await callAutomationClient.getEventProcessor();
eventProcessor.processEvents(incomingEvent);
```
ProcessEvents is required for EventProcessor to work. After event is being consumed by EventProcessor, you can start using its feature.

See below for example: where you are making a call with CreateCall, and wait for CallConnected event of the call.
```JavaScript
// send out the invitation, creating call
const callInvite = new CallInvite(target);
const callbackUrl = "https://<MY-EVENT-HANDLER-URL>/events";
const callResult = callAutomationClient.createCall(callInvite, callbackUrl);

// giving 30 seconds timeout for waiting on createCall's event, 'CallConnected'
const createCallEventResult : CreateCallEventResult = await callResult.waitForEventProcessor(undefined, 30000);
// once this returns, call is now established!

// check if it was successful
if (createCallEventResult.isSuccess)
{
// work with callConnected event
const callConnectedEvent : CallConnected = createCallEventResult.successResult!;
}
```

## Troubleshooting

## Next steps
Expand Down
Loading