Asterisk undefined symbol with new module

Having this module as below:

#include <asterisk.h>
#include <time.h>
#include "asterisk/module.h"
#include "asterisk/logger.h"
#include "asterisk/res_resetqueuestats.h"

static unsigned int interval = 1;

int set_stats(const char *queuename){
    ast_log(LOG_NOTICE, "SET STATS CALLED FOR %s", queuename);
    return 0;
}

static void write_log(void)
{
   time_t now = time(NULL);
   struct tm *tm_now = localtime(&now);
   ast_log(LOG_NOTICE, "Current time interval: %02d:%02d\n", tm_now->tm_hour, tm_now- 
   >tm_min);
}

static void* log_thread(void* data)
{
  while (1) {
    time_t now = time(NULL);
    struct tm *tm_now = localtime(&now);
    if (tm_now->tm_min % interval == 0) {
        write_log();
    }
       usleep(60 * 1000 * 1000);
   }
 return NULL;
}

static int load_module(void)
{
   ast_log(LOG_NOTICE, "Loading Reset Queue Statistics module.\n");

   pthread_t thread;
   if (pthread_create(&thread, NULL, log_thread, NULL) != 0) {
      ast_log(LOG_ERROR, "Failed to create log thread.\n");
      return AST_MODULE_LOAD_FAILURE;
   }
  return AST_MODULE_LOAD_SUCCESS;
}

static int unload_module(void)
{
   ast_log(LOG_NOTICE, "Unloading Reset Queue Statistics module.\n");
   return 0;
}

AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Reset Queue Statistics");

The Header File:

#ifndef _RES_RESETQUEUESTATS_H
#define _RES_RESETQUEUESTATS_H

#include <asterisk.h>
#include <time.h>
#include "asterisk/module.h"
#include "asterisk/logger.h"

int set_stats(const char *queuename);

#endif

I am trying to call the set_stats method from app_queue.c but I get Error loading module 'app_queue.so': /usr/lib/asterisk/modules/app_queue.so: undefined symbol: set_stats error. The header file is included in app_queue.c and the module it self loads and runs correctly as I can see the log every minute as configured.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.