The <Hangup> element ends a call. If used as the first verb in a RESTXML response, it simply hangs up the call and prevents further processing.
Element Attributes
The <Hangup> element supports the following attributes that modify its behavior:
| Attribute Name | Allowed Values | Default Value |
|---|---|---|
reason |
rejected, busy | none |
schedule |
integer > 0 (in seconds) | none |
- If the element’s
reasonattribute is specified, the call is hungup with a status ofrejectedorbusy. - When the element’s
scheduleattribute is set, it will schedule the call for hangup at a future point in time.
Examples
Example 1
The following code tells Plivo to answer the call and hang up immediately.
1 2 3 4 | <?xml version="1.0" encoding="UTF-8"?> <Response> <Hangup /> </Response> |
Example 2: Reject a call with a busy signal
1 2 3 4 | <?xml version="1.0" encoding="UTF-8"?> <Response> <Hangup reason="busy" /> </Response> |
- When receiving a Plivo request to an ‘action’ URL within
<GetDigits>,<Record>or<Dial>, you can return a response containing the<Hangup>verb to end the current call.
Example 3: Schedule hangup
This example demonstrates using the <ScheduleHangup> element to hang up a call after 10 minutes.
1 2 3 4 5 | <?xml version="1.0" encoding="UTF-8" ?> <Response> <Hangup schedule="600" /> <Speak loop="0">This is Plivo Framework. This announcement will loop continuously.</Speak> </Response> |
