[Asterisk-code-review] func_lookup: Fork of HINT function (asterisk[master])

George Joseph asteriskteam at digium.com
Thu Aug 5 13:39:34 CDT 2021


Attention is currently required from: N A.
George Joseph has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/16075 )

Change subject: func_lookup: Fork of HINT function
......................................................................


Patch Set 9:

(1 comment)

File funcs/func_lookup.c:

https://gerrit.asterisk.org/c/asterisk/+/16075/comment/a32a1dab_01223648 
PS9, Line 127: /* Substitute variables now, using the location of the lookup */
             : 	/* strdupa required or we'll just overwrite what we read when we set these */
             : 	realcontext = ast_strdupa(ast_channel_context(chan));
             : 	realexten = ast_strdupa(ast_channel_exten(chan));
             : 	realpriority = ast_channel_priority(chan);
             : 	ast_channel_lock(chan);
             : 	ast_channel_context_set(chan, context);
             : 	ast_channel_exten_set(chan, exten);
             : 	ast_channel_priority_set(chan, priority);
             : 	ast_channel_unlock(chan);
             : 
> Correct... with a slight technicality.
> 
> 
> We would expect that the function returns: g

Why would anyone care about the lookup key?  I'd actually want the original extension.  The lookup key is just a side effect of using the dialplan as the storage backend.

If you really want it there are several options, none of them simple.

1.  Save EXTEN_EVAL_CONTEXT, EXTEN_EVAL_EXTEN and EXTEN_EVAL_PRIORITY to the
channel variables.  That still has the overhead of triggering AMI and ARI activity but it will work.

2.  Do your own token replacement on the extension contents before passing it to pbx_substitute_variables_helper.  Use the same EXTEN_EVAL_* variable names.  

3.  Move this into app_stack and just invoke Gosub.  Yes it does have overhead but in order to make your implementation work reliably you're going to have to duplicate much of that overhead.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16075
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Iad81019689674c9f4ac77d235f5d7234adbb1432
Gerrit-Change-Number: 16075
Gerrit-PatchSet: 9
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Sarah Autumn <sarah at endlesstemple.org>
Gerrit-Attention: N A <mail at interlinked.x10host.com>
Gerrit-Comment-Date: Thu, 05 Aug 2021 18:39:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: N A <mail at interlinked.x10host.com>
Comment-In-Reply-To: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210805/7aae8737/attachment.html>


More information about the asterisk-code-review mailing list