Syncing Cisco 8865 as-feature-event DND to Show Busy/In-Use in FreePBX

I am trying to integrate the DND button on Cisco CP-8865 3PCC phones with FreePBX (v16, Asterisk 19) to properly reflect the extension’s Busy/In-Use state.

Here’s what I have observed:

  1. DND Behavior on Cisco 8865:
  • Pressing the DND button on the phone sends a SUBSCRIBE request with Event: as-feature-event.
  • This request does not seem to be handled by Asterisk, resulting in:

vbnet

Copy code

WARNING[571261]: res_pjsip_pubsub.c:803 subscription_get_handler_from_rdata: No registered subscribe handler for event as-feature-event from 402
SIP/2.0 489 Bad Event
  1. Vertical Service Codes Issue:
  • When using Vertical Service Codes (*78 for DND ON and *79 for DND OFF), DND works locally on the phone but:
    • Feature Sync on the phone stops sending the as-feature-event. when turned off.
  • If I remove the *78/*79 codes from the Vertical Service configuration:
    • The phone handles DND server side
    • There is no local DND indication on the phone.
  1. SIP Traffic:
  • OPTIONS requests and SUBSCRIBE with as-feature-event are visible in SIP logs.
  • Example:

plaintext

Copy code

SUBSCRIBE sip:402@192.168.1.243 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.204:5060;branch=z9hG4bK-f7cfd2cf
From: "Albert" <sip:402@192.168.1.243>;tag=3c339d3174afe9f
To: <sip:402@192.168.1.243>
Call-ID: b24945d8-d0266592@192.168.1.204
CSeq: 21143 SUBSCRIBE
Max-Forwards: 70
Contact: "Albert" <sip:402@192.168.1.204:5060>
Event: as-feature-event
Content-Length: 0

Goal:

I want to achieve the following:

  • Pressing the DND button on the Cisco phone should:
    1. Reflect DND locally on the phone (e.g., via the phone’s DND indicator).
    2. Update the extension’s BLF hint in Asterisk to reflect InUse or Busy.
  • Avoid relying solely on *78/*79 if possible.

Questions:

  1. How can I configure Asterisk/FreePBX to handle the as-feature-event subscription from the Cisco 8865?
  2. Is there a way to map as-feature-event to a specific action in Asterisk, such as toggling DND or updating the DEVICE_STATE?
  3. Would upgrading FreePBX/Asterisk versions help with better handling of as-feature-event?
  4. If native support for as-feature-event is not possible, is there a recommended workaround to synchronize DND state while maintaining local DND functionality?

Environment:

  • FreePBX Version: 16.0.40.11
  • Asterisk Version: 19.0
  • Cisco Phone Model: CP-8865 3PCC
  • Firmware Version: 12.0.6
  • SIP Transport: UDP

What I’ve Tried:

  1. Enabling Feature Key Sync and Feature Code Sync on the phone.
  2. Using custom dialplans to update DEVICE_STATE based on incoming SIP requests.
  3. Inspecting SIP traffic for relevant headers or body content indicating DND status.

SIP Logs:

  • Example of SUBSCRIBE request:

plaintext

Copy code

SUBSCRIBE sip:402@192.168.1.243 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.204:5060;branch=z9hG4bK-f7cfd2cf
From: "Albert" <sip:402@192.168.1.243>;tag=3c339d3174afe9f
To: <sip:402@192.168.1.243>
Call-ID: b24945d8-d0266592@192.168.1.204
CSeq: 21143 SUBSCRIBE
Max-Forwards: 70
Contact: "Albert" <sip:402@192.168.1.204:5060>
Event: as-feature-event
User-Agent: Cisco-CP-8865-3PCC/12.0.6
Content-Length: 0

There is no support for “as-feature-event”, someone else may have input on synchronizing state.

1 Like

Everything works as it should with these Cisco 8800 3pcc’s with the exception of synchronized DND. I might reach out to Cisco TAC to see if they can implement the correct SIP handlers in a feature update. There should be an option to send “Publish” instead of “as-feature-event”

It wouldn’t be on Cisco to implement. The functionality just doesn’t exist in Asterisk. Asterisk doesn’t even itself have the concept of DND built in.

“It doesn’t have to be explicitly recognized by Asterisk as DND. The goal is for the phone to update its presence state to inuse or busy, which Asterisk already understands. If the phone could send a standard PUBLISH message for presence, similar to other phones that correctly reflect their DND status on Asterisk, this would achieve the desired functionality without requiring additional DND-specific handling in Asterisk.”

Asterisk doesn’t support that either.

Then how does BLF status update when a phone is in use or on a call? If Asterisk can interpret a phone’s state as inuse or busy during an active call, couldn’t a similar mechanism be applied when the phone sends an updated presence state for DND? Could this be something considered for a feature update in Asterisk to provide better presence handling and interoperability?

Asterisk internally calculates/determines the state and sends it to all subscribed to it. It does not allow an endpoint to push such information into it. Code is code, so someone could potentially write it of course. Feature requests can be submitted here[1].

[1] Issues · asterisk/asterisk-feature-requests · GitHub

1 Like

Thanks for the clarification! I don’t think this would involve directly ‘pushing’ to Asterisk per se. Instead, the phone would simply update its state (e.g., inuse or busy) via a PUBLISH message. Asterisk could then process this using existing presence mechanisms or through a simple extension of current functionality. Below is an example of how this might be implemented:


Conceptual Flow:

  1. The phone sends a PUBLISH message indicating its state (DND, inuse, busy, etc.).
  2. Asterisk’s SIP stack captures the PUBLISH message.
  3. A custom module or enhancement to the res_pjsip_pubsub module processes the PUBLISH message to update the corresponding BLF hint or presence state.
  4. Other subscribed devices receive the updated presence state.

Example Code (Conceptual)

Here’s an example of how the handling might look in Asterisk:

#include "asterisk.h"
#include "res_pjsip_pubsub.h"
#include "res_pjsip_presence.h"

// Handler function for processing PUBLISH events
static int handle_publish_state(struct ast_sip_pubsub *pubsub, pjsip_rx_data *rdata) {
    const char *entity = rdata->msg_info.msg->line.req.uri->vptr;
    const char *new_state;

    // Extract state from PUBLISH body (simplified example)
    if (strstr(rdata->msg_info.msg->body->data, "DND")) {
        new_state = "busy";  // Map DND to 'busy'
    } else {
        new_state = "available"; // Default state
    }

    // Update the device state in Asterisk
    ast_presence_state_update(entity, AST_PRESENCE_UNKNOWN, new_state);

    // Send a 200 OK response
    pjsip_tx_data *tdata;
    pjsip_endpt_create_response(ast_sip_get_endpoint(), rdata, 200, NULL, &tdata);
    pjsip_endpt_send_response(ast_sip_get_endpoint(), tdata, NULL, NULL);

    return 0;
}

// Register the handler
static struct ast_sip_pubsub_handler publish_handler = {
    .type = AST_SIP_PUBSUB_PUBLISH,
    .handler = handle_publish_state,
};

// Module load
static int load_module(void) {
    ast_sip_register_pubsub_handler(&publish_handler);
    return AST_MODULE_LOAD_SUCCESS;
}

// Module unload
static int unload_module(void) {
    ast_sip_unregister_pubsub_handler(&publish_handler);
    return 0;
}

AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Custom PUBLISH handler");

How It Works:

  1. The phone sends a PUBLISH message with its state (e.g., DND).
  2. The above handler processes the message and updates the Asterisk presence state using ast_presence_state_update().
  3. Asterisk propagates the updated state to all subscribers via its internal BLF hint system.

This approach wouldn’t require Asterisk to natively understand DND; it just interprets the PUBLISH state as a change in presence (e.g., busy or inuse), similar to how it handles calls.

If this aligns with how presence and hints currently work, I’d be happy to explore submitting this as a feature request or proof-of-concept.

It doesn’t work like that. Presence state is not sent to any device except for Sangoma phones in a custom format at this time. You also can’t update a BLF hint directly. The most you could do is update a custom devstate using the dialplan function.

It’s up to you what you want to do.

Thank you for clarifying. I’ve implemented a similar setup for extensions trunked from a Nortel system. While this approach doesn’t reflect proper BLF functionality, it allows these extensions to always show as green (idle) instead of red (busy) when used as speed dials.

Here’s an example of the dialplan configuration I use for those extensions:

; BCM Internal Extensions (220-299)
exten => 221,hint,PJSIP/221@BCM_Internal
exten => 222,hint,PJSIP/222@BCM_Internal
exten => 223,hint,PJSIP/223@BCM_Internal
exten => 224,hint,PJSIP/224@BCM_Internal
...
exten => 236,hint,PJSIP/236@BCM_Internal

; BCM Extensions (300-332)
exten => 300,hint,PJSIP/300@BCM_Internal
exten => 301,hint,PJSIP/301@BCM_Internal
exten => 302,hint,PJSIP/302@BCM_Internal
exten => 303,hint,PJSIP/303@192.168.3.2
...
exten => 332,hint,PJSIP/332@BCM_Internal

For the Cisco 8800 series and DND, I’m exploring whether a similar approach could be used to achieve synchronized DND functionality. Specifically:

  • When the phone sends an as-feature-event, could a dialplan or custom mechanism be used to update the devstate for the extension as INUSE or BUSY?
  • For example, intercept the as-feature-event and use it to force the hint or state for the extension to update in Asterisk.

Would it be feasible to create a custom patch, module, or dialplan function to handle this, or is this outside the current capabilities of Asterisk? I’d appreciate any guidance or input on this approach.

It’s feasible in the sense that code could be written, yes.

1 Like

Thank you, I appreciate the input!

That is pushing.

I feel compelled to point out that DND was implemented and working in the “enterprise” firmware on these phones (not the 3PCC firmware) with chan_sip and the usecallmanager patch a number of years ago.

Plus the 8865 with enterprise firmware are a heck of a lot cheaper on the secondary market than with 3PCC

Ted

I tried using the usecallmanager patch, but I couldn’t get auto-answer intercom or paging to work—it just rang the phones. I found a great deal on brand-new 3PCC models with VID-KEMs, and now I’m debating whether to stick with 3PCC or switch back to the enterprise firmware with the patch.

I’ve also been experimenting with FusionPBX, which supports the as-feature-event for DND. However, while it successfully activates DND at the dashboard level, it doesn’t send the NOTIFY to other extensions to update their BLFs. In contrast, Asterisk/FreePBX is much simpler to configure, but FusionPBX offers more flexibility for scripting and customization.
With the 3PCCs, all I’m missing is proper DND BLF functionality.

Once I resolve the DND/BLF issue, I plan to focus on setting up paging and implementing a feature where dialing * or lifting the handset during a page would escalate it to a private two-way call—similar to what the old Panasonic Hybrid systems could do.

If Asterisk is committed to fully transitioning from chan_sip to pjsip, it should consider implementing as-feature-event and other SIP events to enhance compatibility with modern phones and advanced features.

Asterisk is an open source project, so if someone were to propose implementing such a thing and submit a PR then it would be reviewed and possibly included like any other thing.

The PJSIP architecture was purposely written so that in tons of cases this can be done in an isolated fashion to reduce potential regressions for other code, making it easier to implement and review.

1 Like

Intercom on the usecallmanager patch works but it only works for audio calls, the firmware in the videophones like the 8865 have intercoming disabled. If you set it up to make an audio only call and configure the 8865 to handle an audio only call then intercoming does work.

This is something to my intense disgust I found out whan I had hoped to use video intercoming to access a camera on the phone remotely.

Cisco turned this off “for privacy concerns” because of the claim that people would use video intercoming to “spy” on people. Apparently, it’s OK to “spy” on people’s conversations but not actually see them. Never mind that the phone rings during an intercom.

You have to keep in mind Cisco products are ultimately designed for people who don’t know a lot. So they have a lot of “Mommie knows best” features in them. Most Mommie features can be shut off by configuration directives, but this one can’t.

Oh man that sucks. I was planning on using the video intercom to view doorphone calls. Video intercom works on the 3pcc 8865’s but server side DND XML feature events don’t, the only feature I’m missing on the 3pcc’s. The phone will send out the event but asterisk won’t accept it and sends back bad event. I’m trying to figure out a way for the XML events to be accepted by asterisk. Looks like I’m going to deploy the 3pcc’s and wait for a fix for DND

Fix implies a bug, but this would be treated as a feature request. Someone will need to submit that feature request before it even gets considered.