rem: if (db_url==0 || db_url[0]==0) { LOG(L_ERR,"ERROR:acc:mod_init: no DB_URL specified!!\n"); return -1; } if (acc_db_bind(db_url)<0){ LOG(L_ERR, "ERROR:acc:mod_init: acc_db_init: failed..."
add: if (db_url && db_url[0]) { if (acc_db_bind(db_url)<0){ LOG(L_ERR, "ERROR:acc:mod_init: acc_db_init: failed..."
context: static int mod_init( void ){#ifdef RAD_ACC	int nr_extra_rad;#endif	LOG(L_INFO,"ACC - initializing\n");	/* load the TM API */	if (load_tm_api(&tmb)!=0) {		LOG(L_ERR, "ERROR:acc:mod_init: can't load TM API\n");		return -1;	}	if (verify_fmt(log_fmt)==-1) return -1;	/* register callbacks*/	/* listen for all incoming requests  */	if ( tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, acc_onreq, 0 ) <=0 ) {		LOG(L_ERR,"ERROR:acc:mod_init: cannot register TMCB_REQUEST_IN "			"callback\n");		return -1;	}	if (multileg_enabled && (dst_avp_id==0 || src_avp_id==0) ) {		LOG(L_ERR,"ERROR:acc:mod_init: multi call-leg enabled but no src "			" and dst avp IDs defined!\n");		return -1;	}	/* init the extra engine */	init_acc_extra();	/* parse the extra string, if any */	if (log_extra_str && (log_extra=parse_acc_extra(log_extra_str))==0 ) {		LOG(L_ERR,"ERROR:acc:mod_init: failed to parse log_extra param\n");		return -1;	}#ifdef SQL_ACC	if (db_url==0 || db_url[0]==0) {		LOG(L_ERR,"ERROR:acc:mod_init: no DB_URL specified!!\n");		return -1;	}	if (acc_db_bind(db_url)<0){		LOG(L_ERR, "ERROR:acc:mod_init: acc_db_init: failed..."				"did you load a database module?\n");		return -1;	}	/* parse the extra string, if any */	if (db_extra_str && (db_extra=parse_acc_extra(db_extra_str))==0 ) {		LOG(L_ERR,"ERROR:acc:mod_init: failed to parse db_extra param\n");		return -1;	}#endif#ifdef RAD_ACC	/* parse the extra string, if any */	if (rad_extra_str && (rad_extra=parse_acc_extra(rad_extra_str))==0 ) {		LOG(L_ERR,"ERROR:acc:mod_init: failed to parse rad_extra param\n");		return -1;	}	memset(attrs, 0, sizeof(attrs));	memset(attrs, 0, sizeof(vals));	attrs[A_CALLING_STATION_ID].n			= "Calling-Station-Id";	attrs[A_CALLED_STATION_ID].n			= "Called-Station-Id";	attrs[A_SIP_TRANSLATED_REQUEST_URI].n	= "Sip-Translated-Request-URI";	attrs[A_ACCT_SESSION_ID].n		= "Acct-Session-Id";	attrs[A_SIP_TO_TAG].n			= "Sip-To-Tag";	attrs[A_SIP_FROM_TAG].n			= "Sip-From-Tag";	attrs[A_SIP_CSEQ].n				= "Sip-CSeq";	attrs[A_ACCT_STATUS_TYPE].n		= "Acct-Status-Type";	attrs[A_SERVICE_TYPE].n			= "Service-Type";	attrs[A_SIP_RESPONSE_CODE].n	= "Sip-Response-Code";	attrs[A_SIP_METHOD].n			= "Sip-Method";	attrs[A_USER_NAME].n			= "User-Name";	if (multileg_enabled) {		attrs[A_SRC_LEG].n			= "Sip-Leg-Source";		attrs[A_DST_LEG].n			= "Sip-Leg-Destination";	}	vals[V_STATUS_START].n			= "Start";	vals[V_STATUS_STOP].n			= "Stop";	vals[V_STATUS_FAILED].n			= "Failed";	vals[V_SIP_SESSION].n			= "Sip-Session";	/* add and count the extras as attributes */	nr_extra_rad = extra2attrs( rad_extra, attrs, A_MAX);	/* read config */	if ((rh = rc_read_config(radius_config)) == NULL) {		LOG(L_ERR, "ERROR: acc: error opening radius config file: %s\n", 			radius_config );		return -1;	}	/* read dictionary */	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary"))!=0) {		LOG(L_ERR, "ERROR: acc: error reading radius dictionary\n");		return -1;	}	INIT_AV(rh, attrs, A_MAX+nr_extra_rad, vals, "acc", -1, -1);	if (service_type != -1)		vals[V_SIP_SESSION].v = service_type;#endif#ifdef DIAM_ACC	/* parse the extra string, if any */	if (dia_extra_str && (dia_extra=parse_acc_extra(dia_extra_str))==0 ) {		LOG(L_ERR,"ERROR:acc:mod_init: failed to parse dia_extra param\n");		return -1;	}	if (extra2int(dia_extra)!=0) {		LOG(L_ERR,"ERROR:acc:mod_init: extar names for DIAMTER must be "			" integer AVP codes\n");		return -1;	}#endif	return 0;}