This guide provides a basic overview for handling call events and performing various actions (e.g., hangup) on calls.
The digium.event function is key to working with calls. When you register for an event that has to do with call creation, an eventData object is passed to your handler that provides a variety of information. Most important is the callHandle. Here is an example of the eventData from an incoming call.
The digium.phone function provides a set of useful methods for working with calls. You can do things such as answer, hangup, and dial. Dial is used for starting a call, and the rest can be used to handle an existing call. The following example shows the process of observing a call, handling the response, and performing actions on the call itself.