diff --git a/modules/ims_charging/Ro_data.c b/modules/ims_charging/Ro_data.c index 801a358a269..63a1f5d02ca 100644 --- a/modules/ims_charging/Ro_data.c +++ b/modules/ims_charging/Ro_data.c @@ -180,9 +180,15 @@ Ro_CCR_t * new_Ro_CCR(int32_t acc_record_type, str * user_name, ims_information_ mem_new(x, sizeof (Ro_CCR_t), pkg); - str_dup(x->origin_host, cfg.origin_host, pkg); - str_dup(x->origin_realm, cfg.origin_realm, pkg); - str_dup(x->destination_realm, cfg.destination_realm, pkg); + if (cfg.origin_host.s && cfg.origin_host.len > 0) + str_dup(x->origin_host, cfg.origin_host, pkg); + + if (cfg.origin_realm.s && cfg.origin_realm.len >0) + str_dup(x->origin_realm, cfg.origin_realm, pkg); + + if (cfg.destination_realm.s && cfg.destination_realm.len > 0) + str_dup(x->destination_realm, cfg.destination_realm, pkg); + x->acct_record_type = acc_record_type; if (user_name) { diff --git a/modules/ims_charging/ccr.c b/modules/ims_charging/ccr.c index 99ab727cf45..a2fa489e362 100644 --- a/modules/ims_charging/ccr.c +++ b/modules/ims_charging/ccr.c @@ -208,10 +208,18 @@ AAAMessage * Ro_write_CCR_avps(AAAMessage * ccr, Ro_CCR_t* x) { if (!ccr) return 0; - if (!cdp_avp->base.add_Origin_Host(&(ccr->avpList), x->origin_host, 0)) goto error; - if (!cdp_avp->base.add_Origin_Realm(&(ccr->avpList), x->origin_realm, 0)) goto error; - if (!ro_add_destination_realm_avp(ccr, x->destination_realm)) goto error; - + if (x->origin_host.s && x->origin_host.len > 0) { + if (!cdp_avp->base.add_Origin_Host(&(ccr->avpList), x->origin_host, 0)) goto error; + } + + if (x->origin_realm.s && x->origin_realm.len > 0) { + if (!cdp_avp->base.add_Origin_Realm(&(ccr->avpList), x->origin_realm, 0)) goto error; + } + + if (x->destination_realm.s && x->destination_realm.len > 0) { + if (!ro_add_destination_realm_avp(ccr, x->destination_realm)) goto error; + } + if (!cdp_avp->base.add_Accounting_Record_Type(&(ccr->avpList), x->acct_record_type)) goto error; if (!cdp_avp->base.add_Accounting_Record_Number(&(ccr->avpList), x->acct_record_number)) goto error; diff --git a/modules/ims_charging/mod.c b/modules/ims_charging/mod.c index ecc6d4bbfda..34035d872dd 100644 --- a/modules/ims_charging/mod.c +++ b/modules/ims_charging/mod.c @@ -55,9 +55,9 @@ int ro_db_mode = DB_MODE_NONE; char *domain = "location"; -client_ro_cfg cfg = { str_init("scscf.ims.smilecoms.com"), - str_init("ims.smilecoms.com"), - str_init("ims.smilecoms.com"), +client_ro_cfg cfg = { str_init(""), + str_init(""), + str_init(""), 0 }; @@ -67,8 +67,6 @@ struct dlg_binds dlgb; cdp_avp_bind_t *cdp_avp; struct tm_binds tmb; -char* rx_dest_realm_s = "ims.smilecoms.com"; -str rx_dest_realm; /* Only used if we want to force the Ro peer usually this is configured at a stack level and the first request uses realm routing */ //char* rx_forced_peer_s = ""; str ro_forced_peer;