All pastes #41296 Raw Edit

Anonymous

public text v1 · immutable
#41296 ·published 2006-02-12 17:23 UTC
rendered paste body
		//-- allocate a CDR queue
		if ((q = malloc(sizeof(cdr_queue))) == NULL) {
			ast_log(LOG_WARNING, "VocTelCDR: Unable to initialize CDR queue - out of memory\n");
			return -1;
		}
	
		q->next = NULL;

		q->cdr_insert_length = asprintf(&q->cdr_insert_query, "INSERT INTO cdr_voctel (uniqueid, accountcode, userfield, callerid, startdate, answerdate, enddate, src, srcchannel, dst, dstchannel, dstcontext, lastapp, lastdata, duration, billsec, disposition, amaflag) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %i, %i, %i, %i)", uniqueid, accountcode, userfield, callerid, starttime, answertime, endtime, src, srcchannel, dst, dstchannel, dstcontext, lastapp, lastdata, cdr->duration, cdr->billsec, cdr->disposition, cdr->amaflags);

		//-- lock shared data
		ast_mutex_lock(&worker_cdr_lock);

		//-- only add to queue if we are below threshold
		if (queue_length < CDR_THRESHOLD_DROP) {
			//-- append CDR entry to queue
			if (queue_tail != NULL)
				queue_tail->next = q;
			
			queue_tail = q;

			if (queue_head == NULL)
				queue_head = q;