Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dialog doc does not match code #1320

Closed
dryvoip opened this issue Nov 18, 2017 · 1 comment
Closed

dialog doc does not match code #1320

dryvoip opened this issue Nov 18, 2017 · 1 comment

Comments

@dryvoip
Copy link

dryvoip commented Nov 18, 2017

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.

miconda added a commit that referenced this issue Nov 22, 2017
@miconda
Copy link
Member

miconda commented Nov 22, 2017

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.

@miconda miconda closed this as completed Nov 22, 2017
miconda added a commit that referenced this issue Nov 27, 2017
miconda added a commit that referenced this issue Dec 18, 2017
- reported by GH #1320

(cherry picked from commit d319c44)
(cherry picked from commit 89bdf5e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants