Asterisk BLF Not Working: Trace the Broken Link Fast
Asterisk BLF not working almost always comes down to one broken link: phone SUBSCRIBE, hint lookup in the subscriber's context, state calculation, or NOTIFY delivery. Check each with core show hints and pjsip set logger on.
- BLF is a separate SIP subscription (SUBSCRIBE, Event: dialog) from registration, so a registered phone can still have dead lamps.
- A 404 reply to SUBSCRIBE means no hint exists in the subscribing endpoint's context, and 489 means the event package or exten_state modules are missing.
- Run core show hints first: if the hint is missing or shows Unavailable or NotFound, the problem is on the PBX, not the phone.
- A key set to Speed Dial type never has a lamp, so confirm the key type is BLF or BLF List before debugging anything else.
- NAT, SIP ALG and ACLs can stop NOTIFY from reaching the phone even when the SUBSCRIBE gets a 200 OK.
How does BLF work in Asterisk, end to end?
BLF (busy lamp field) is a publish/subscribe system layered on SIP. The phone sends a SUBSCRIBE with Event: dialog for the number on the key. Asterisk looks that number up as a hint in the dialplan, computes the state of the devices behind it, and sends a NOTIFY with an application/dialog-info+xml body each time the state changes.
The subscription is independent of registration. A phone can register fine and still fail to subscribe, and subscriptions expire (commonly 3600 seconds, often shorter on phones) and must be refreshed. If the phone reboots or its subscription lapses, lamps go dark until it re-subscribes.
That gives five links to test in order: phone configuration, SUBSCRIBE reaching the PBX, hint found, state computed, NOTIFY delivered and understood. Debugging out of order wastes time.
Why is Asterisk BLF not working? Symptom to cause table
When Asterisk BLF is not working, match what you see to the likely cause before touching configuration.
| Symptom | Likely cause | Where to look |
|---|---|---|
| No SUBSCRIBE in the trace | Key is Speed Dial type, wrong line, or no BLF value | Phone key config |
| SUBSCRIBE gets 404 | No hint in the subscriber's context | dialplan show 101@ext-local, endpoint context |
| SUBSCRIBE gets 489 Bad Event | Event package unsupported or modules not loaded | module show like exten_state |
| SUBSCRIBE gets 403 | ACL or identification failure | acl settings on the endpoint |
| SUBSCRIBE gets 401 repeatedly | Phone not sending credentials for the subscription | Phone auth name and password |
| 200 OK but lamp never changes | NOTIFY not reaching phone (NAT, ALG, wrong Contact) | pjsip set logger on, firewall |
| Lamp stuck on one state | Hint shows Unavailable or NotFound | core show hints |
| Never turns red on calls | device_state_busy_at or call counting issue | pjsip show endpoint |
| NOTIFY sent but lamp dark | Body state is terminated, or wrong event package for vendor | Capture the NOTIFY body |
How do I write the hint correctly in the dialplan?
The hint extension must equal the number the key monitors, and it must exist in the context used for the subscription lookup. For PJSIP that is the context option of the subscribing endpoint, not the monitored one. On FreePBX, hints for extensions are generated automatically in ext-local, so you rarely edit them.
Use the & separator to watch several devices, and Custom: hints for virtual states such as DND or speed dial targets. The Custom name is case sensitive, and it must match exactly in devstate change.
[from-internal]
exten => 101,hint,PJSIP/101
exten => 102,hint,PJSIP/102&PJSIP/102b
exten => *76101,hint,Custom:DND101
exten => 5551234,hint,Custom:SPEED1
; reload after any edit
; asterisk -rx "dialplan reload"What PJSIP settings affect BLF?
The subscribing endpoint needs allow_subscribe=yes (the default) and a context that contains the hints. If phones use a context without hints, you get 404. The subscription also needs the res_pjsip_exten_state and res_pjsip_pubsub modules loaded, otherwise you see 489.
device_state_busy_at sets how many calls make the endpoint report Busy; with 0 (the default) no limit is applied and a second call is not reported busy. Setting it to 1 makes a single call report the endpoint as Busy. notify_early_inuse_ringing and notifycid affect whether ringing and caller ID details appear in NOTIFY bodies.
Also check the transport. If the phone subscribes over TCP or TLS, the endpoint must accept that transport and NOTIFY goes back over the same connection. For FreePBX, BLF works out of the box for extensions but needs a custom hint for any non-extension target such as an external number or a queue status.
[101]
type=endpoint
context=from-internal
allow_subscribe=yes
device_state_busy_at=1
rewrite_contact=yes
direct_media=no
acl=acl_internal
; verify
; module show like exten_state
; module show like pubsub How do I troubleshoot BLF from the Asterisk CLI?
Work through the commands in order. Each one proves or eliminates one link in the chain.
Understand core show hints states. Idle means all devices are free. InUse means at least one call. Busy means the busy threshold was reached. Ringing means an incoming call is alerting. Hold means a call is held. Unavailable means the endpoint has no registered contact or a qualify failure. NotFound means the device name in the hint does not resolve.
- Run core show hints and confirm 101 appears with the right context and state.
- Run core show hint 101 and dialplan show 101@ext-local (or your context) to confirm the exact lookup.
- Run pjsip show endpoint 101 to check context, allow_subscribe and ACLs, and pjsip list contacts to confirm the phone is reachable.
- Run pjsip set logger on, then reboot or re-save the phone to force a new SUBSCRIBE and read the response code.
- Run pjsip list subscriptions inbound (or pjsip show subscriptions inbound) to confirm the subscription exists, then place a test call and watch for NOTIFY.
- If you edit anything, run dialplan reload and make the phone resubscribe.
asterisk -rvvv
core show hints
core show hint 101
dialplan show 101@ext-local
pjsip show endpoint 101
pjsip list contacts
pjsip list subscriptions inbound
module show like exten_state
pjsip set logger on
dialplan reloadWhat should a healthy BLF exchange look like?
A working trace shows SUBSCRIBE, a 200 OK with an Expires header, an immediate NOTIFY with the current state, and a 200 OK from the phone. After that, every call event produces another NOTIFY.
The state element in the body maps to the lamp: terminated with no dialog is Idle (green or off, depending on the phone), early is Ringing (flashing), and confirmed is InUse (solid red). If the body shows terminated while the extension is on a call, the problem is state computation, not delivery.
SUBSCRIBE sip:101@pbx SIP/2.0
Event: dialog
Accept: application/dialog-info+xml
Expires: 3600
SIP/2.0 200 OK
Expires: 3600
NOTIFY sip:phone SIP/2.0
Event: dialog
Subscription-State: active;expires=3599
Content-Type: application/dialog-info+xml
<dialog-info state="full" entity="sip:101@pbx">
<dialog id="abc"><state>confirmed</state></dialog>
</dialog-info> Why do BLF keys fail on specific phones, networks and targets?
Key type matters. Speed Dial keys only dial; BLF keys give a lamp and pickup. On Yealink, set the key type to BLF, value to the extension, and fill Pickup Code (*8 on many Asterisk systems, ** on FreePBX) and BLF List Code only if you use a list URI. Cisco SPA and Polycom need the dialog event package, not presence.
NAT is the usual cause of 200 OK with no lamp. SIP ALG rewrites headers and breaks Contact addresses, so disable it on routers. Use rewrite_contact=yes, direct_media=no, and local_net with external_signaling_address on the transport. NOTIFY must reach the phone's registered contact, so firewalls must permit replies on UDP 5060 or the registered TCP or TLS connection.
Remote BLF across a trunk does not work unless the far peer supports presence subscriptions, so monitor remote users with a custom hint driven by your own logic.
To use a BLF key for an external number, create a custom hint and update it with devstate change Custom:SPEED1 INUSE. A toggle can read DEVICE_STATE(Custom:SPEED1) and flip it.
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
local_net=192.168.1.0/24
external_signaling_address=203.0.113.10
external_media_address=203.0.113.10
; CLI
; devstate change Custom:SPEED1 INUSE
; core show hint 5551234Common questions
Why is my FreePBX BLF not lighting up?
Check that Apply Config was run, that the extension appears in core show hints under ext-local, and that the phone key type is BLF. For non-extension targets FreePBX needs a custom hint.
What is the difference between a BLF key and a speed dial key?
A speed dial key only dials a number. A BLF key subscribes to the target's state, shows a lamp and usually performs call pickup when the target rings.
Does chan_sip BLF work the same way?
Legacy chan_sip uses subscribecontext, allowsubscribe, notifyringing, notifyhold, callcounter=yes and limitonpeers=yes. Without callcounter there is no INUSE state. chan_sip is removed in Asterisk 21, so migrate to PJSIP.
How long does a BLF subscription last?
It lasts as long as the Expires value negotiated in the 200 OK, and the phone must refresh it. If refresh fails, lamps stop updating.
Can I monitor an extension on another PBX?
Only if the other side accepts SUBSCRIBE over the trunk and shares presence. Otherwise use a custom hint with your own devstate updates.