예제 #1
0
static void radius_log(struct ast_event *event)
{
	int result = ERROR_RC;
	VALUE_PAIR *send = NULL;
	struct ast_cel_event_record record = {
		.version = AST_CEL_EVENT_RECORD_VERSION,
	};

	if (ast_cel_fill_record(event, &record)) {
		return;
	}

	if (build_radius_record(&send, &record)) {
		ast_debug(1, "Unable to create RADIUS record. CEL not recorded!\n");
		goto return_cleanup;
	}

	result = rc_acct(rh, 0, send);
	if (result != OK_RC) {
		ast_log(LOG_ERROR, "Failed to record Radius CEL record!\n");
	}

return_cleanup:
	if (send) {
		rc_avpair_free(send);
	}
}
예제 #2
0
static int radius_log(struct ast_cdr *cdr)
{
	int result = ERROR_RC;
	VALUE_PAIR *send = NULL;

	if (build_radius_record(&send, cdr)) {
		if (option_debug)
			ast_log(LOG_DEBUG, "Unable to create RADIUS record. CDR not recorded!\n");
		return result;
	}
	
	result = rc_acct(rh, 0, send);
	if (result != OK_RC)
		ast_log(LOG_ERROR, "Failed to record Radius CDR record!\n");

	return result;
}
예제 #3
0
static int radius_log(struct ast_cdr *cdr)
{
	int result = ERROR_RC;
	VALUE_PAIR *tosend = NULL;

	if (build_radius_record(&tosend, cdr)) {
		ast_debug(1, "Unable to create RADIUS record. CDR not recorded!\n");
		goto return_cleanup;
	}

	result = rc_acct(rh, 0, tosend);
	if (result != OK_RC) {
		ast_log(LOG_ERROR, "Failed to record Radius CDR record!\n");
	}

return_cleanup:
	if (tosend) {
		rc_avpair_free(tosend);
	}

	return result;
}
예제 #4
0
파일: cel_radius.c 프로젝트: cfhb/vlink-cti
static void radius_log(struct ast_event *event)
{
	int result = ERROR_RC;
	VALUE_PAIR *send = NULL;
	int ret = 0;
	char cdr_full_path[256];
	struct ast_cel_event_record record = {
		.version = AST_CEL_EVENT_RECORD_VERSION,
	};

	if (ast_cel_fill_record(event, &record)) {
		return;
	}
	if (build_radius_record(&send, &record)) {
		ast_debug(1, "Unable to create RADIUS record. CEL not recorded!\n");
		goto return_cleanup;
	}

	result = rc_acct(rh, 0, send);
	if (result != OK_RC) {
		ast_log(LOG_ERROR, "Failed to record Radius CEL record! unique_id=%s\n", record.unique_id);
        	/* file name */
        	if(record.unique_id && (!ast_strlen_zero(record.unique_id))){
            		snprintf(cdr_full_path,sizeof(cdr_full_path),"%s/%s",cdr_dir_tmp,record.unique_id);
			/* write cdr to file if rc_acct failed */
			ret = save_avp_to_file(cdr_full_path,record.unique_id,send);
			if(!ret){
				ast_log(LOG_ERROR,"Failed to write cdr to file! unique_id=%s\n", record.unique_id);
			}
        	}
		goto return_cleanup;
	}

return_cleanup:
	if (send) {
		rc_avpair_free(send);
	}
}