Documentation:
7.3. is_in_profile(profile,[value])
Checks if the current dialog belongs to a profile. If the profile supports values, the check can be reinforced to take into account a specific value, if the dialog was inserted into the profile for a specific value. **If no value is passed, only the membership of the dialog in the profile per se is checked.** Note that if the profile does not support values, the value parameter will be silently discarded.
Code:
``` static int w_is_in_profile_helper(sip_msg_t *msg, struct dlg_profile_table *profile, str *value) { if (profile->has_value) { if (value==NULL || value->len<=0) { LM_ERR("invalid value parameter\n"); return -1; } return is_dlg_in_profile( msg, profile, value); } else { return is_dlg_in_profile( msg, profile, NULL); } } ```
Expected result: Documentation should be corrected, or even better, code should be updated to perform as documented.
After looking at code and its history, likely the description was made wrong. I pushed a patch to reflect properly the code behaviour in the docs.
On the other hand, it could be useful to add a function with more flexible matching of the profile, where to have something like:
``` dlg_match_profile("profilename", "regex", ".*") ``` to return true for matching any value. The second param to be the operator to use, like "equal", "starts_with", "regex" ...
If anyone needs something like this, then open a feature request. I am closing this issue.
Closed #1320.