[Home]

Summary:ASTERISK-23911: URIENCODE/URIDECODE: WARNING about passing an empty string is a bit over zealous
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2014-06-19 17:01:07Date Closed:2014-07-15 12:23:57
Priority:MajorRegression?
Status:Closed/CompleteComponents:Functions/func_uri
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:A common usage of {{URIENCODE}}/{{URIDECODE}} is to escape arguments passed to applications. This is particularly useful when said arguments contain delimeters that might otherwise be interpreted by the application itself.

Sometimes, however, the variable being escaped is empty. That isn't an error - in that case, we don't have any parameter that we want to pass to the application. However, currently when this occurs, URIENCODE complains mightily:

{code}
WARNING[4943]: func_uri.c:79 uriencode: Syntax: URIENCODE(<data>) - missing argument!
{code}

Working around this is cumbersome in the dialplan. This:

{code}
same => n,Stasis(myapp,${URIENCODE(${ARGS}))
{code}

Becomes:

{code}
same => n,GotoIf($[${LEN(${ARGS})} = 0]skip:)
same => n,Set(ARGS=${URIENCODE(${ARGS})})
same => n(skip),NoOp()
same => n,Stasis(MyApp,${ARGS})
{code}

Which is way more convoluted than just ignoring the empty string in the first place.
Comments: