Esempio n. 1
0
int _dbg_log_assign_action_avp(struct sip_msg* msg, struct lvalue* lv)
{
	int_str avp_val;
	avp_t* avp;
	avp_spec_t* avp_s = &lv->lv.avps;
	avp = search_avp_by_index(avp_s->type, avp_s->name,
				&avp_val, avp_s->index);
	if (likely(avp)){
		if (avp->flags&(AVP_VAL_STR)){
			LM_DBG("%.*s:\"%.*s\"\n", avp_s->name.s.len, avp_s->name.s.s,
				avp_val.s.len, avp_val.s.s);
		}else{
			LM_DBG("%.*s:%d\n", avp_s->name.s.len, avp_s->name.s.s,
				avp_val.n);
		}
	}
	return 0;
}
Esempio n. 2
0
static int xl_get_avp(struct sip_msg *msg, str *res, str *hp, int hi, int hf)
{
	int_str name, val;
	struct usr_avp *avp, *lavp;
	struct search_state st;

	if(msg==NULL || res==NULL || hp==NULL)
	return -1;

	name.s=*hp;
if (0){
	lavp=NULL;
	for(avp=search_first_avp(AVP_NAME_STR, name, NULL, &st); avp; avp=search_next_avp(&st, NULL)) {
		lavp=avp;
		if (hi>0)
			hi--;
		else if (hi==0)
			break;
	}

	if (lavp && (hi<=0)) {
		get_avp_val(lavp, &val);
		*res=val.s;
		return 0;
	}
}
	if ((avp=search_avp_by_index(hf, name, &val, hi))) {
		if (avp->flags & AVP_VAL_STR) {
			*res=val.s;
		} else {
			res->s=int2str(val.n, &res->len);
		}
		return 0;
	}

	return xl_get_null(msg, res, hp, hi, hf);
}