AT TOP LEVEL: //-- declare our thread variables static pthread_t worker_cdr_thread; AST_MUTEX_DEFINE_STATIC(worker_cdr_lock); ast_cond_t worker_cdr_cond; IN LOAD MODULE: //-- Create worker thread to post CDR records if (ast_pthread_create(&worker_cdr_thread, NULL, voctel_queue_worker, NULL)) { ast_log(LOG_ERROR, "VocTelCDR: Unable to create CDR worker thread\n"); return -1; } IN voctel_queue_worker: //-- ast_log(LOG_DEBUG, "VocTelCDR: Queue Worker thread has started\n");