[asterisk-users] Dynamic hint from db?

Roland asterisk at rolandow.com
Wed Mar 28 03:19:12 CDT 2012


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.




On Tue, Mar 27, 2012 at 1:25 PM, Roland <asterisk at rolandow.com> wrote:

> 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?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120328/eb605d1f/attachment.htm>


More information about the asterisk-users mailing list