[asterisk-dev] Problem developing asterisk module with libcurl

David david_psg1 at hotmail.com
Sun Dec 14 13:23:17 CST 2014


Hello

I've created an Asterisk module following this tutorial--> 
http://blog.russellbryant.net/2008/06/19/how-to-write-an-asterisk-module-part-1/
Following this part and parts 2 
<http://blog.russellbryant.net/2008/06/20/how-to-write-an-asterisk-module-part-2/> 
and 3 
<http://blog.russellbryant.net/2008/06/30/how-to-write-an-asterisk-module-part-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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20141214/850263fe/attachment.html>


More information about the asterisk-dev mailing list