Dynamic hint from db?

Home » Asterisk Users » Dynamic hint from db?
Asterisk Users 1 Comment

I would like to fetch my extensions from the database. I created a dynamic
hint, but doesn’t seem to work. The BLF on my phone doesn’t change when the
state of the extension changed.

This is in my dialplan:

exten => _ZXX!,hint,${SIP_BYEXT(${EXTEN},${CONTEXT})}
exten => _ZXX!,1,Verbose(3, Search extension ${EXTEN} in context ${CONTEXT})
same => n,Set(SIP=${SIP_BYEXT(${EXTEN},${CONTEXT})})
same => n,GotoIf(${SIP}?:notFound)
same => n,SIPAddHeader(Alert-Info: internal)
same => n,Dial(${SIP})
same => n(notFound),Playback(you-dialed-wrong-number)
same => n,Hangup

Is something like this possible?

One thought on - Dynamic hint from db?

  • I’ll answer my own question for the archives… although my question maybe
    was just too obvious 😉

    The problem was, that I had put this piece of Dialplan in my
    extensions.conf like this:

    [StumpelLocal]
    exten => _ZXX!,hint,${SIP_BYEXT(${EXTEN},${CONTEXT})}
    exten => _ZXX!,1,Verbose(3, Search extension ${EXTEN} in context
    ${CONTEXT})
    same => n,Set(SIP=${SIP_BYEXT(${EXTEN},${CONTEXT})})
    same => n,GotoIf(${SIP}?:notFound)
    same => n,SIPAddHeader(Alert-Info: internal)
    same => n,Dial(${SIP})
    same => n(notFound),Playback(you-dialed-wrong-number)
    same => n,Hangup

    [StumpelZwaag]
    include => StumpelLocal

    I registered my SIP accounts in the database with context StumpelZwaag. But
    of course the hints aren’t being executed from StumpelZwaag, but probably
    from StumpelLocal (if they have a contect at all??), the lookup failed. So
    I changed the dynamic hint to:

    exten => _ZXX!,hint,${SIP_BYEXT(${EXTEN},StumpelZwaag)}
    exten => _ZXX!,1,Verbose(3, Search extension ${EXTEN} in context
    ${CONTEXT})
    same => n,Set(SIP=${SIP_BYEXT(${EXTEN},${CONTEXT})})
    same => n,GotoIf(${SIP}?:notFound)
    same => n,SIPAddHeader(Alert-Info: internal)
    same => n,Dial(${SIP})
    same => n(notFound),Playback(you-dialed-wrong-number)
    same => n,Hangup

    I hardcoded the context, so now it works.

    Also I found that “core show hints” on the CLI, also show the hints that
    were creating through this dynamic hint. So you will see the actual list of
    hints. At first I thought the dynamic hint would only be shown as
    _ZXX!@StumpelLocal : ${SIP_BYEXT(${EXTEN}
    State:Unavailable Watchers 0

    This is not the case, so you can test if your dynamic hint is working
    correctly by checking this table.

    Also my phone seems to be rather slow in processing the hint changes… so
    it may take a few minutes before the changes take effect.