h1. Call Handler _Call Handler_ is the sequence of instruction that tell *Smartswitch* how to handle the incoming call. _Call Handlers_ are configured via Call Handler GUI with mouse drag-and-drop. !call_handler.png! The sequence of the call handling is a set of trees, each of which begins with an _Extension node_. Available _Extension elements_ are listed in [[Extensions]] chapter. [[Extensions]] define the conditions that are necessary for activation of the corresponding tree of the call handling. After entering a specific call handling tree, the system consecutively executes applications from this tree. The control path can contain conditional branches. In the simplest case the tree has only one branch. In the more advanced case a complex branching is possible. Each branch of a call handling tree has to end with _Stub node_. The following elements from [[Channel]] tab can act as _Stub nodes_: [[Hangup]] or [[Busy]]. The control path of call handling can traverse between different branches of the call handling tree, but in the end it should be terminated with any of _Stub nodes_. On completion of any of the [[Applications]] from the call handling branch, system internally checks the return code of the application. Setting the return code is described in the chapter [[Applications]]. In case if the return code: * *greater than 0*. Cycle begins to read DTMF to match the [[Pattern extension]]. * *0* The next application of the call handling branch is executed. * *less than 0* The system checks whether there was a hangup from the side of originator: * *if there was a hangup from the side of originator*. The bridged leg to the terminator is hang up too. If the originator leg is not bridged, the system just goes out of the handler. * *if there was no hangup from the side of originator*. The system goes in [[Hangup extension]] in the current call handler If there is no such extension, the system exits from the call handler. [[Обработчик вызовов|Русский перевод]]