Reloading large number of hints

Reloading of a dial plan (static file) with a large number of hints (1000’s) takes a very long time compared to the same dial plan without any hints. Since realtime extensions do not support hints, what is the recommended way of managing a large number of hints? Without hints, reload takes a few seconds, with hints, it takes minutes depending upon number of hints in dialplan.

I don’t know if anyone will say this is recommended, but here’s how I did hints for parking spaces (10000-19999), extensions (_ZXXXX), and queues (70000-79999). If I reload sip, the phones may need to subscribe again. It’s not affected when I reload the dialplan.

exten => _ZXXXX,hint,SIP/${EXTEN}

exten    => _10XXX,hint,Custom:${EXTEN}@hints
exten    => _7XXXX,hint,Custom:${EXTEN}@hints

exten    => _10XXX,1,NoOp(Parking for ${EXTEN} State: ${DEVICE_STATE(Custom:${pos}@hints)})
same    => n,Set(lot=locallot)
same    => n,Set(pos=${EXTEN})
same    => n,Set(PARKINGEXTEN=${pos})

same    => n,GotoIf($["${DEVICE_STATE(Custom:${pos}@hints)}"="RINGING"]?pickup:park)

same    => n(park),Set(DEVICE_STATE(Custom:${EXTEN}@hints)=RINGING)
same    => n,Park(${lot})
same    => n,Hangup()

same    => n(pickup),Set(DEVICE_STATE(Custom:${pos}@hints)=INUSE)
same    => n,ParkedCall(${lot},${pos})
same    => n,Hangup()

exten    => i,1,Hangup()
exten    => t,1,Hangup()
exten    => h,1,NoOp(POS ${pos} EXTEN ${EXTEN} PICKUPMARK ${__PICKUPMARK})
same    => n,Set(DEVICE_STATE(Custom:${pos}@hints)=NOT_INUSE)
same    => n,Set(DEVICE_STATE(Custom:${ARG1}@hints)=NOT_INUSE)
same    => n,Hangup()
1 Like

Yep, wildcard hints.
You can use them for dialing and subscription.

Understand wildcard hint can be used to map multiple extensions to one device…but what about 1000’s of devices? Do they all need to be specified in the dial plan. Is the “autohint” of asterisk 14 the solution? The issue is when there are lots of hints, the time it takes to reload vs using realtime extensions where hints can’t be specified.

Wildards don’t have to match to a single device…
exten = _1XXX,hint,SIP/${EXTEN}

will map any extension that matches to a hint of the same name.
Extension 1000 will map to SIP/1000
Extension 1001 will map to SIP/1001

These will NOT show up when you do a ‘core show hints’

For subscriptions, the hint will be auto-created on the first subscribe.


@gjoseph this looks promising so far, thanks for the pointer!

@gjoseph When using PJSIP outbound-publish for presence (Asterisk 14.1.2), hints defined statically in dialplan cause SIP PUBLISH events to be published for each hint on every dialplan reload. This looks to be the underlying reason for slow diaplan reloads with large numbers of hints. I haven’t tried but I would expect the same thing with dynamic hints that have been subscribed. In our case, we are offloading subscriptions from asterisk but the flood of sip publish events causing slow dialplan reloads seems like something that could be optimized. Is this to be expected?

Right now I’m not surprised it would be doing that due to the way the PBX core works but it should be possible to optimize things. Please file an issue[1].