QUOTE() on Empty String

Hey all,

Running into a small issue using the QUOTE() function and wondering if there’s a way around this.

We have lines in a format like this, where we want to run the quote function only if the string isn’t empty:

exten => s,n,ExecIf($["${Example}"!=""]?Set(Example=${QUOTE(${Example})}))

However when the string is empty, it results in us getting warnings due to the empty string, ex:

[2024-11-19 11:58:15.556] WARNING[2568772][C-0002d5f7] func_strings.c: No argument specified!

My understanding is that the quote function is running regardless of the result of the ExecIf which is causing the problem. Is there a way to re-structure this so that the quote only runs if the string isn’t empty? Or a way to have it just not throw a warning about the empty string?

Use GoToIf, and have the Set as a separate priority.

Use exten => s,n,ExecIf($["x${Example}"!="x"]?Set(Example=${QUOTE(${Example})}))

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.