Ejemplo n.º 1
0
static int w_is_in_profile(struct sip_msg *msg, char *profile, char *value) {
    pv_elem_t *pve;
    str val_s;

    pve = (pv_elem_t *) value;

    if (pve != NULL && ((struct dlg_profile_table*) profile)->has_value) {
        if (pv_printf_s(msg, pve, &val_s) != 0 ||
                val_s.len == 0 || val_s.s == NULL) {
            LM_WARN("cannot get string for value\n");
            return -1;
        }
        return is_dlg_in_profile(msg, (struct dlg_profile_table*) profile,
                &val_s);
    } else {
        return is_dlg_in_profile(msg, (struct dlg_profile_table*) profile,
                NULL);
    }
}
Ejemplo n.º 2
0
static int w_is_in_profile(struct sip_msg *msg, char *profile, char *value)
{
	struct dlg_cell *dlg;
	pv_elem_t *pve = (pv_elem_t *)value;
	str val_s;

	if ( (dlg=get_current_dialog())==NULL ) {
		LM_CRIT("BUG - setting profile from script, but no dialog found\n");
		return -1;
	}

	if ( pve!=NULL && ((struct dlg_profile_table*)profile)->has_value) {
		if ( pv_printf_s(msg, pve, &val_s)!=0 ||
		val_s.len == 0 || val_s.s == NULL) {
			LM_WARN("cannot get string for value\n");
			return -1;
		}
		return is_dlg_in_profile( dlg, (struct dlg_profile_table*)profile,
			&val_s);
	} else {
		return is_dlg_in_profile( dlg, (struct dlg_profile_table*)profile,
			NULL);
	}
}