Description

alias_db_lookup is returning -1 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:

$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");

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.

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?

Troubleshooting

Example above

Reproduction

Example above.

Debugging Data

Not applicable

Log Messages

N/A

SIP Traffic

N/A

Possible Solutions

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.

Additional Information

5.4.1

Debian 10


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.