Skip to content

Commit

Permalink
registrar docs: Fix misleading $(ct[1]) example input
Browse files Browse the repository at this point in the history
The $(ct[1]) value is actually a full Contact header body, not just the
URI.  This, in turn, leads to a silent failure of
is_contact_registered() even on the happy path, which can be
time-consuming to debug...

Credits to Bogdan Iancu for spotting this!
  • Loading branch information
liviuchircu committed Jan 28, 2025
1 parent 5f8376d commit 8232ff0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modules/registrar/doc/registrar_admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -894,17 +894,17 @@ if (is_registered("location",$fu)) {
<title><function>is_contact_registered</function> usage</title>
<programlisting format="linespecific">
...
/*let's say you want to block users that are not registered*/
/* block users which are not registered... */
if (is_method("INVITE")) {
if (!is_contact_registered("location")) {
sl_send_reply(401, "Unauthorized");
...
...
}
}
/* you want to check the second contact from the message whether it is
registered or not */
if(is_method("INVITE")) {
if (is_contact_registered("location",$fu,$(ct[1]),))

/* ... or check whether the 2nd Contact URI is registered or not */
if (is_method("INVITE")) {
if (is_contact_registered("location", $fu, $(ct.fields(uri)[1])))
xlog("caller is registered\n");
}
...
Expand Down

0 comments on commit 8232ff0

Please sign in to comment.