Skip to end of metadata
Go to start of metadata

Asterisk includes the concepts of Device State , Extension State and Presence State which together allow Asterisk applications and interfaces to receive information about the state of devices, extensions and the users of the devices.

As an example, channel drivers like chan_sip or res_pjsip/chan_pjsip may both provide devices with device state, plus allow devices to subscribe to hints to receive notifications of state change. Other examples would be app_queue which takes into consideration the device state of queue members to influence queue logic or the Asterisk Manager Interface which provides actions for querying extension state and presence state.

Additionally, modules exist for Corosync and XMPP PubSub support to allow device state to be shared and distributed across multiple systems.

The sub-sections here describe these concepts, point to related module specific configuration sections and discuss Querying and Manipulating State information.

The figure below may help you get an idea of the overall use of states and presence with the Asterisk system. It has been simplified to focus on the flow and usage of state and presence. In reality, the architecture can be a bit more confusing. For example a module could both provide subscription functionality for a subscriber and be the same module providing the devices and device state on the other end.


  • No labels


  1. Can these states be published and subscribed to via the ARI? I imagine an ARI client application requesting these states and then registering callbacks against those events like so (using ari-py):

    client.on_event("EndpointStateChanged", myOwnCallbackForHandlingEndpointChange)

    If such a feature already exists, can I have the events for multiple endpoints? E.g., I want the states of all the endpoints declared in pjsip.conf to report endpoint state change to the ARI application

  2. It took me a while, but I figured it out. Here's an example of how to do this for PJSIP/alice:


    #!/usr/bin/env python

    #needs ari-py

    import ari

    import logging


    client=ari.connect(http://localhost:8080, "username", "password")

    postResponse=client.applications.subscribe (applicationName=["NameOfARIAppThatShouldBeCapturingThisEventThisAppShouldBeRunning"], eventSource="endpoint:PJSIP/alice")

    print postResponse


    Hope this helps someone.