[asterisk-dev] enhanced 'hint' functionality
Thomas Andrews
tandrews at grok.co.za
Sun Dec 10 00:32:35 MST 2006
Tilghman Lesher wrote:
>> Tilghman, I'm afraid I can't understand this patch. It dynamically
>> creates a new extension if the exten line begins with '_' Without this
>> patch however, my dialplan already accepts hints of the form:
>>
>> exten => _2XX,hint,Zap/1
>
> Do they work?
Yes, they do, but as you suggested below it is of limited value.
>> Why would one want this patch ? Sorry if I'm being dumb :p
>
> You have to understand how hints work. Each hint in the dialplan creates
> one memory structure tracking the devicestate of exactly one device. So
> if you create a pattern match, it will track the devicestate of exactly one
> device. That's not one device per matching extension; that's one device,
> period. So yes, while the example you gave above would work, extensions
> matching _2XX would all track the devicestate for "Zap/1", which is probably
> of very limited usefulness. What you probably want to do is to replace Zap/1
> with an expression, which might match multiple channels, depending upon the
> arguments. That doesn't work currently, because, as I said, each hint relates
> to exactly one devicestate. So for example, if you did:
>
> exten => _2XX,hint,SIP/${EXTEN}
>
> and then two devices subscribed to this hint, one to 201, the other to 202,
> each time EITHER SIP/201 OR SIP/202 changed state, BOTH subscribers
> would be notified of the new devicestate. That means a subscriber to SIP/201
> would see the devicestate of SIP/202 when SIP/202 changed state and a
> subscriber to SIP/202 would see the devicestate of SIP/201 when SIP/201
> changed state.
>
> That is why when dealing with pattern matches, you MUST create a new hint
> for each matching extension or else things just don't work correctly.
Thanks for your explanation Tilghman - I have a much better
understanding now. I did not realize that the patch added the ability to
have wild-cards like ${EXTEN} in the device part of the string - I
thought it was only adding wild-cards to the extension on the left.
Regards,
Thomas
More information about the asterisk-dev
mailing list