Hello
I’ve created an Asterisk module following this tutorial–> Russel Bryant blog: How to write an asterisk module
Following this part and parts 2 and 3 I have developed an asterisk module with a CLI command.
Now I want to use another c code in the module. This code uses libcurl.
What I’ve done is:
In my module res_module.c I include the header for the other code.
#include "othercode.h"
I put all the files in the same folder and compiling with:
gcc -o res_module.o -c res_module.c -MD -MT res_module.o -MF .res_module.o.d -MP -pthread -I/home/myuser/asterisk/asterisk-1.6.2.24/include -I/usr/include/libxml2 -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -march=i686 -O6 -fPIC -DAST_MODULE=\"res_module\"
gcc -o othercode.o -c othercode.c -lcurl -lcrypto -lssl -ld
gcc -o res_module.so -pthread -shared res_module.o other.o -lcurl
install -m 755 res_module.so /usr/lib/asterisk/modules
The problems are:
If I don’t include the option -lcurl in the 3rd gcc command I can not load the module because of an error: undefined symbol: curl_easy_perform
If I include the option -lcurl asterisk crashes and exits when I try to load the module.
Any help?
Thanks in advance.