Asterisk 11 – BLF On Custom Devices

In testing Asterisk 11, I’ve found that Asterisk doesn’t seem to be sending BLF updates to SIP peers that have subscribed to a hint looking at a Custom device if that Custom device state is RINGING or RING_INUSE. All other states seem to be working correctly.

The hint section of the dialplan is:
[hints]
exten => _3XX,hint,Custom:${EXTEN}

Console shows the following for core show hints with no calls:
-= Registered Asterisk Dial Plan Hints =-
_3XX@hints : Custom:${EXTEN} State:Idle Watchers 0
302@hints : Custom:302 State:Idle Watchers 2
303@hints : Custom:303 State:Idle Watchers 2
301@hints : Custom:301 State:Idle Watchers 2

And with a ringing call (301 calling 302):
-= Registered Asterisk Dial Plan Hints =-
_3XX@hints : Custom:${EXTEN} State:Idle Watchers 0
302@hints : Custom:302 State:Ringing Watchers 2
303@hints : Custom:303 State:Idle Watchers 2
301@hints : Custom:301 State:InUse Watchers 2

And after 302 picks up (301 and 302 on a call):
-= Registered Asterisk Dial Plan Hints =-
_3XX@hints : Custom:${EXTEN} State:Idle Watchers 0
302@hints : Custom:302 State:InUse Watchers 2
303@hints : Custom:303 State:Idle Watchers 2
301@hints : Custom:301 State:InUse Watchers 2

And after 303 tries to call 302 while 301 & 302 are still on a call (301 & 302 on a call, plus 303 calling 302):
-= Registered Asterisk Dial Plan Hints =-
_3XX@hints : Custom:${EXTEN} State:Idle Watchers 0
302@hints : Custom:302 State:InUse&Ringing Watchers 2
303@hints : Custom:303 State:InUse Watchers 2
301@hints : Custom:301 State:InUse Watchers 2

But despite the above, the BLF fields on my phones (Cisco SPA 509G for all 3 extensions) only update for Idle or InUse – they do not show the Ringing or InUse&Ringing statuses. I have verified the SPA phones BLFs do still show the correct Ringing and InUse&Ringing statuses if they subscribe directly to a SIP device’s state with the hint – the issue only seems to be effecting Custom devices. Can anyone think of anything else I should check?

Thank you,

Noah Engelberth MetaLINK Technologies

6 Responses to “Asterisk 11 – BLF On Custom Devices”

  1. Phil Frost said:

    Aug 20, 12 at 4:29 pm

    I’d do a packet capture — ideally from the phone, or using your switch to mirror the phone’s port — and look for a SIP NOTIFY. Then we can know if a NOTIFY is not being sent, or if it’s just not being processed as desired by your Cisco SPA 509G. If it’s not there, do the same on your asterisk server, and if we see it on the asterisk server but not at the endpoint, we can suspect network configuration.

    You can also get some more detail about what endpoints are subscribed with “sip show subscriptions” in the asterisk console, but since it says
    “Watchers 2″, that suggests the subscription has been made. I’d just verify that specifically the device you are using for testing is subscribed.

    Also, I know if you turn the verbosity up high enough (core set verbosity 3) you will get messages in the console about notifications sent. You can also “set sip debug on” or something along those lines and have Asterisk print all the SIP traffic it’s attempting to send. Should help you narrow the possible causes.

  2. Noah Engelberth said:

    Aug 21, 12 at 1:57 pm

    Here’s the sequence I’m seeing with a packet capture from the Asterisk server:

    - 301 calls 302. The INVITE from 301 hits Asterisk. Asterisk sends back 100 Trying, and then a NOTIFY to 302 and 303 (which are both subscribed to 301, and they see 301 change to “in use”). 302 and 303 send back 200 OK for the NOTIFYs.

    - Asterisk sends the INVITE to 302. 302 sends back 100 Trying and then 180 Ringing. After the 180 Ringing, Asterisk sends a NOTIFY to 301 (which I have subscribed to hint 305, which is mapped to SIP/ corresponding to the one I have logged in as 302). No other NOTIFY updates are sent at this time.

    - I pick up on 302. 302 sends a 200 OK with session description to Asterisk. Asterisk ACKs this 200 and then sends 2 NOTIFYs to 301 (which is subscribed to both the 302 “Custom device” hint and the 305 “SIP Physical device” hint), and also sends 1 NOTIFY to 303 (which is only subscribed to the 302 “Custom device” hint).

    - While 301 and 302 are still “on the call”, 303 calls 302. The INVITE from 303 hits Asterisk. Asterisk sends back 100 Trying, and then a NOTIFY to 302 (subscribed to the “Custom device” hint for 303) and 2 NOTIFYs to 301 (subscribed to both the “Custom device” and “SIP Physical device” hints).

    - Asterisk sends the INVITE to 302. 302 sends back 100 Trying and then 180 Ringing. After the 180 Ringing, Asterisk sends a NOTIFY to 301 (which updates the “SIP Physical device” hint). No other NOTIFY updates are sent at this time.

    - 303 cancels the call and sends a CANCEL to Asterisk. Asterisk responds with 200 OK, sends a NOTIFY to 301, sends a CANCEL to 302, and then sends another NOTIFY to 301. 303 then ACKs Asterisk’s SIP 487, and Asterisk sends 1 additional NOTIFY to 302 and 301.

    - 301 and 302 finish their call. Asterisk sends a total of 1 NOTIFY to 302 (the status for “Custom device” 301), 2 NOTIFYs to 303 (the status for “Custom device” 301 and 302), and 2 NOTIFYs to 301 (the status for “Custom device” 302 and “Physical Device” 302).

    So, it looks to me like I’m missing NOTIFYs for RINGING or RING_INUSE events on Custom devices.

    (Slightly sanitized) Verbose 3 output is pastebin’d: http://pastebin.com/q51XUeHe

    The short of the output is – there is no console output showing == Extension Changed 302[hints] new state on the Ringing or InUse&Ringing events – only on InUse or Idle events (which matches what I’m seeing on the phones).

    Thank you,

    Noah Engelberth

    MetaLINK Technologies

  3. Phil Frost said:

    Aug 21, 12 at 2:19 pm

    Weird. I just did a test on my production system, 1.8.11.1 (from digium repository) on Debian Squeeze and a Snom 870 running firmware 8.4.35. I
    had the verbosity set to 3, and I manually changed the devstate in the console with “devstate change 207-support-agent RINGING”. I got a message:

    Extension Changed 207-support-agent[employees] new state Ringing for Notify User pfrost

    and my phone updated its interface to reflect the change. Tested also with INUSE, NOT_INUSE, and RINGINUSE and all resulted in a NOTIFY being sent to the handset. Though the Snom 870 doesn’t distinguish between RING and RINGINUSE, it did change from displaying “talking” to “idle” or
    “ringing”. So, at least with my environment, asterisk is capable and successful at sending SIP NOTIFY for custom devstates.

    I’ve no idea why you’d get updates for NOT_INUSE and INUSE but none of the other states. It looks like your dialplan logic is complex enough that I’m having a hard time following it and understanding what should be happening, so I’d suggest testing twiddling the device states through the console and see if that generates NOTIFYs. If not, I’d verify that something is actually subscribed with “sip show subscriptions”. If something is subscribed and a NOTIFY isn’t generated, I’d suspect a bug. If you do get NOTIFYs when changing the devstate in the console but not when making calls, then maybe something in your dialplan logic is wrong, and I’d say simplify it until the problem is found, or it’s simple enough to re-ask on the list.

  4. Noah Engelberth said:

    Aug 21, 12 at 2:30 pm

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] The short of the output is – there is no console output showing == Extension Changed 302[hints] new state on the Ringing or InUse&Ringing events – only on InUse or Idle events (which matches what I’m seeing on the phones).

    Weird. I just did a test on my production system, 1.8.11.1 (from digium repository) on Debian Squeeze and a Snom 870 running firmware 8.4.35. I had the verbosity set to 3, and I manually changed the devstate in the console with “devstate change 207-support-agent RINGING”. I got a message:

    Extension Changed 207-support-agent[employees] new state Ringing for Notify User pfrost

    and my phone updated its interface to reflect the change. Tested also with INUSE, NOT_INUSE, and RINGINUSE and all resulted in a NOTIFY being sent to the handset. Though the Snom 870 doesn’t distinguish between RING and RINGINUSE, it did change from displaying “talking” to “idle” or “ringing”. So, at least with my environment, asterisk is capable and successful at sending SIP NOTIFY for custom devstates.

    I’ve no idea why you’d get updates for NOT_INUSE and INUSE but none of the other states. It looks like your dialplan logic is complex enough that I’m having a hard time following it and understanding what should be happening, so I’d suggest testing twiddling the device states through the console and see if that generates NOTIFYs. If not, I’d verify that something is actually subscribed with “sip show subscriptions”. If something is subscribed and a NOTIFY isn’t generated, I’d suspect a bug. If you do get NOTIFYs when changing the devstate in the console but not when making calls, then maybe something in your dialplan logic is wrong, and I’d say simplify it until the problem is found, or it’s simple enough to re-ask on the list.

    Changing the Custom devstate from the CLI generates “Extension Changed for Notify User” messages when I change to INUSE or NOT_INUSE, but not when I change to RINGING or RINGINUSE. If I change from NOT_INUSE to RINGING and then back to NOT_INUSE, no notify messages are being generated.

    core show hints does show the correct state for 301@hints when I make the manual change to RINGINUSE (or RINGING). sip show subscriptions does show 2 subscriptions (1 each from 302 and 303) for 301@hints.

    Thank you,

    Noah Engelberth MetaLINK Technologies

  5. said:

    Aug 21, 12 at 3:31 pm

    She’s talking about asterisk 11 not asterisk 1.8.11

    —–Original Message—

  6. Olivier said:

    Sep 13, 12 at 3:25 am

    2012/8/21

    In the first place, are we certain Custom Device States includes RINGING, for instance ?
    To me INUSE or NOT_INUSE are acceptable values but RINGING, I’m not sure about that.