Example #1
0
/**
 * retrieves the ims charging id, also named as ICID, from the request or reply
 * if the P-Charging-Vector SIP header is not included in the request or reply, it might be stored internally
 * the returned icid is allocated in the pkg memory, do not forget to free after use
 * retrieves also the originating/terminating inter-operator identifier, for the moment not stored in pkg memory
 * @param req - the SIP request
 * @param reply - the SIP reply
 * @param icid - the ICID
 * @param orig_ioi - the ORIGinating IOI if contained in the P-Charging-Vector
 * @param term_ioi - the TERMinating IOI if contained in the P-Charging-Vector
 */
int get_ims_charging_info(struct sip_msg *req, 
			struct sip_msg * reply,
			int dir,
			str * icid, 
			str * orig_ioi, 
			str * term_ioi,
			uint32_t * rating_group){

	str callid = {0,0};

	LOG(L_DBG, "get ims charging info\n");
	if(req)
		cscf_get_p_charging_vector(req, icid, orig_ioi, term_ioi);
	if(reply)
		cscf_get_p_charging_vector(reply, icid, orig_ioi, term_ioi);

	if(req)
		callid = cscf_get_call_id(req, 0);
	if((!callid.len || !callid.s) && reply)
		callid = cscf_get_call_id(reply, 0);
		
	if(!callid.len || !callid.s)
		return 1;
	if(!icid->len || !icid->s){
		if(!get_ims_charg_info(callid, dir, icid, rating_group))
			return 0;
	}else
		if(!get_ims_charg_info(callid, dir, NULL, rating_group))
			return 0;


	return 1;
}
Example #2
0
int get_ims_charging_info(struct sip_msg *req, struct sip_msg * reply, str * icid, str * orig_ioi, str * term_ioi) {

    LM_DBG("get ims charging info\n");
    if (req)
        cscf_get_p_charging_vector(req, icid, orig_ioi, term_ioi);
    if (reply)
        cscf_get_p_charging_vector(reply, icid, orig_ioi, term_ioi);

    return 1;
}