<p></p>
<h3>Description</h3>
<p>alias_db_lookup is returning <code>-1</code> if result is not found.  The documentation says "The function returns TRUE if R-URI is alias and it was replaced by user's SIP uri."  The implication is that it should return FALSE if that is not the case.  Sample code:</p>
<pre><code>$vn(init_ruri)   = $ru;
$vn(alias_found) = alias_db_lookup("DbAliases");
xlogl("L_NOTIFY", "$$vn(alias_found) is [$vn(alias_found)]\n");
if ( !$vn(alias_found) ) {
    xlogl("L_NOTIFY", "No alias found for [$vn(init_ruri)]\n");
    return;
}

xlogl("L_NOTIFY", "Found alias [$ru] for [$vn(init_ruri)]\n");
</code></pre>
<p>The value for $vn(alias_found) is -1 if there is no alias, and thus the  condition never occurs. "Found alias" line always occurs, even if there is no record in the DB.</p>
<p>I think this should probably be considered a documentation issue, but I'm not sure what the other possible values are for return and their meanings.  Maybe there's a different value if an alias is found but not updated, etc?</p>
<h3>Troubleshooting</h3>
<p>Example above</p>
<h4>Reproduction</h4>
<p>Example above.</p>
<h4>Debugging Data</h4>
<p>Not applicable</p>
<h4>Log Messages</h4>
<p>N/A</p>
<h4>SIP Traffic</h4>
<p>N/A</p>
<h3>Possible Solutions</h3>
<p>Probably best to update documentation.  The statement,  "The function returns TRUE if R-URI is alias and it was replaced by user's SIP uri." implies that if that does not happen, then the return would be FALSE.</p>
<h3>Additional Information</h3>
<p><code>5.4.1</code></p>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<p>Debian 10</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2517">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZI27VYSBMSE72QATLLSLSA55ANCNFSM4SWQJ5GA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZOZYQACMVHSNKRKZETSLSA55A5CNFSM4SWQJ5GKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4KZUZEOQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2517",
"url": "https://github.com/kamailio/kamailio/issues/2517",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>