You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Phone number hooks allow you to configure actions that will be performed when specific events occur during a call. Currently, hooks support the `call.ringing` event (which is triggered when a call is ringing).
8
+
Phone number hooks allow you to configure actions that will be performed when specific events occur during a call.
9
+
10
+
Supported events:
11
+
12
+
-`call.ringing`: Triggered when a call is ringing
13
+
-`call.ending`: Triggered when a call is ending (supports filters for assistant-request failures)
9
14
10
15
## Usage
11
16
12
17
Hooks are defined in the `hooks` array of a phone number. Each hook consists of:
13
18
14
-
-`on`: The event that triggers the hook (supports `call.ringing`)
15
-
-`do`: The actions to perform when the hook triggers (supports `transfer` and `say`)
19
+
-`on`: The event that triggers the hook (supports `call.ringing`, `call.ending`)
20
+
-`do`: The action(s) to perform when the hook triggers
21
+
-`filters` (for `call.ending` only): Optional conditions for when the hook should trigger. Filters for phone numbers are restricted to assistant-request related ended reasons on `call.endedReason`.
22
+
23
+
<Note>
24
+
For `call.ending` on phone numbers, the filter key is fixed to `call.endedReason` and the values are limited to assistant-request related reasons.
25
+
</Note>
26
+
27
+
<Info>
28
+
When `do` includes a transfer, the destination can be a phone `number` or a `sip` URI. See the API reference for destination options.
29
+
</Info>
30
+
31
+
## Example: Transfer on Call Ending (assistant-request failures)
32
+
33
+
Transfer the call immediately to a fallback number if the assistant request fails or returns an error/invalid/no assistant:
0 commit comments