Skip to content

Writing custom modules to interface with baresip? #2932

Answered by aonoa
nonibytes asked this question in Q&A
Discussion options

You must be logged in to vote

Using curl to access APIs

find_package(CURL)
if(NOT CURL_FOUND)
  return()
endif()
#include <curl/curl.h>

#define URL    "127.0.0.1:8888/file?filename=%s/dump-test%d.pcm"

static CURL *curl = NULL;
static int module_init(void)
{
        ....
        curl = curl_easy_init();
        if (!curl)
        {
                fprintf(stderr,"curl init failed\n");
                return -1;
        }

        return 0;
}
static int decode(struct aufilt_dec_st *st, struct auframe *af)
{
        ....
        // send filename
        char url[255]={0};
        (void)re_snprintf(url, sizeof(url),
                          URL,
                          file_path,
                          (sf->num…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@nonibytes
Comment options

Answer selected by nonibytes
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2931 on February 28, 2024 09:17.