Load new module in Kamailio

7.2k views Asked by At

I would like to ask, how can I load new module in Kamailio 4.1.2? Actually, I have an issue, when I tried to compile my kamaiio.cfg I've got error:

root@kamailio:/usr/local/# kamailio -c kamailio.cfg
loading modules under /usr/local/lib64/kamailio/modules/
 0(25392) ERROR: <core> [sr_module.c:587]: load_module(): ERROR: load_module: could not find module <websocket> in </usr/local/lib64/kamailio/modules/>
 0(25392) : <core> [cfg.y:3408]: yyerror_at(): parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 323, column 12-25: failed to load module
 0(25392) ERROR: <core> [cfg.y:3272]: yyparse(): cfg. parser: failed to find command ws_handle_handshake
 0(25392) : <core> [cfg.y:3411]: yyerror_at(): parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 1083, column 27: unknown command, missing loadmodule?

ERROR: bad config file (2 errors)

when I look physically to the /usr/local/lib64/kamailio/modules/ there is some modules, but websocket.so is missing. So, how can I get and load module in Kamailio?

Thank you for help!

2

There are 2 answers

3
miconda On BEST ANSWER

You haven't installed the module websocket. Edit modules.lst file in the source code directory and add websocket to include_modules variable. If you don't have modules.lst, just do:

make cfg

Alternative is to do:

make cfg include_modules="websocket"

By default, the build system for kamailio compiles and install only the modules that have the same dependencies as the core of the application. For websocket you need to install libunistring and openssl (libssl) devel packages.

0
ARUNBALAN NV On

Steps to load new module to Kamailio server. (Try if above answer is not working for you)

  1. Check the modules is exist in the default module directly /usr/local/lib64/kamailio/modules.
    If found, add loadmodule "module_name.so" in load module section in kamailio.cfg file.
  2. If the module is not found in default module directory, you can check for the source code of that module in the default module source code directory /usr/local/src/kamailio-4.4/kamailio/modules.
  3. If source code found, enter to the module directory. Then create modules' shared object file(.so) by following commands.

    ./configure
    make
    make test
    make install

  4. Then you will get a shared object file(.so). Copy that file into the default module directory. and load this module from the kamailio.cfg file as mentioned in step 1.

  5. If module source code does not exist in the default source code directory, You need to download the source code from the web. And follow step 3 and 4.