<html>
<head>
<base href="https://wiki.asterisk.org/wiki">
<link rel="stylesheet" href="/wiki/s/en/2171/18/9/_/styles/combined.css?spaceKey=AST&forWysiwyg=true" type="text/css">
</head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
<h2><a href="https://wiki.asterisk.org/wiki/display/AST/Operators?focusedCommentId=19007747#comment-19007747">Operators</a></h2>
<h4>Page
<b>comment added</b> by <a href="https://wiki.asterisk.org/wiki/display/~lmadsen">Leif Madsen</a>
</h4>
<br/>
<div class="notificationGreySide">
<p>The answer for your syntax error has always been:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">exten => s,1,NoOp($[0${UNSET_VARIABLE} | "hello")</pre>
</div></div>
</div>
<div style="border-bottom: 1px solid #ddd; padding: 10px 20px 7px 20px;">
<strong>In reply to a comment by <a href="/wiki/display/~twilson"
class="url fn confluence-userlink" data-username="twilson"
>Terry Wilson</a>:</strong><br/>
<p>expr1 | expr2 and expr1 & expr2 documentation talks about things "evaluating to empty strings". To my knowledge, there is no such thing with Asterisk dialplan variables.</p>
<p>This will result in a syntax error:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>exten => s,1,NoOp($[${UNSET_VARIABLE} | "hello"])
</pre>
</div></div>
<p>This will result in a value of <b>""</b> being returned:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>exten => s,1,NoOp($["" | "hello"])
</pre>
</div></div>
<p>The only way I've found to actually replicate this functionality in the dialplan is via something like:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>exten => s,1,NoOp(${IF(${ISNULL(${UNSET_VARIABLE})}?hello:${UNSET_VARIABLE})}
</pre>
</div></div>
</div>
<div id="commentsSection" class="wiki-content pageSection">
<div style="float: right;" class="grey">
<a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST">Stop watching space</a>
<span style="padding: 0px 5px;">|</span>
<a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
<a href="https://wiki.asterisk.org/wiki/display/AST/Operators?focusedCommentId=19007747#comment-19007747">View Online</a>
|
<a id="reply-19007747" href="https://wiki.asterisk.org/wiki/display/AST/Operators?replyToComment=19007747#comment-19007747">Reply To This</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>