[Home]

Summary:ASTERISK-14977: [patch] Incorrect parsing of 'hint' extensions
Reporter:Dave Reeve (bzing2)Labels:
Date Opened:2009-10-12 11:34:42Date Closed:2009-11-24 10:21:43.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/PBX
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk-1.6.1.6.hints.patch
( 1) asterisk-svn223910.hints.patch
Description:pbx_load_config in pbx/pbx_config.c incorrectly searches for 'appdata' in a hint extension makeing it impossible to use fuctions expansions.

****** ADDITIONAL INFORMATION ******

Its should be possible to create hint extensions that contain function expansions (in addition to variable expansions, see 7776).  A good example would be:

exten => _XXXX,hint,${REALTIME(hints,exten,${EXTEN})}

Unfortunatly once this has been parsed everything to the right of the opening paren is stripped off.  The following shows the output from "dialplan show".

[ Context 'subscriptions' created by 'pbx_config' ]
 '_XXXX' =>        hint: ${REALTIME                              [pbx_config]
Comments:By: Elazar Broad (ebroad) 2009-10-12 13:26:28

Per Corydon76-lap in IRC:

<bzing2> sure but if you place a '(' in the hint then the stuff after gets parsed as app data
<bzing2> which of course it does not have...
<Corydon76-lap> Ah, okay
...
<Corydon76-lap> Yes, it's a legitimate bug.

By: Dave Reeve (bzing2) 2009-10-13 05:48:36

Ok, I believe I have found (and fixed) the offending parsing code.  The same bug was also present in the CLI.  Two patches are attached; one against the trunk (revision 223910), and the other against release 1.6.1.6.  Both have been tested, the release version is now in production (well for me anyway).

For reference my setup is as follows:

== MySQL ==
select * from hints;
+-------+---------------+
| exten | channels      |
+-------+---------------+
|  1234 | SIP/test-set1 |
+-------+---------------+

== extconfig.conf ==
hints => mysql,asterisk,hints

== extensions.conf ==
[subscriptions]
exten => _XXXX,hint,${CUT(REALTIME(hints,exten,${EXTEN},:,:),:,4)}

== Resulting contents of subscriptions after SUBSCRIBE ==
[ Context 'subscriptions' created by 'pbx_config' ]
 '1234' =>         hint: SIP/test-set1
 '_XXXX' =>        hint: ${CUT(REALTIME(hints,exten,${EXTEN},:,:),:,4)}

By: Tilghman Lesher (tilghman) 2009-11-24 10:21:43.000-0600

Better fix in ASTERISK-15064