1

I want to send the recorded file of the call session to a REST API once the call is terminated. I read through the Freeswitch docs and am able to record a call and save it to a .wav file. Now I want to POST the file to a REST API on a remote server, I think the Post Processing Recordings in the Dialplan and mod_curl will be of some help to me but I am unable to understand how I can make the two work together to achieve what I want. I am new to Freeswitch, these are the links that I am following:

https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools%3A+record_session

https://freeswitch.org/confluence/display/FREESWITCH/mod_curl

1 Answers1

2

Several approaches:

1 Write lua dualplan. Here is how to read file in lua: https://stackoverflow.com/a/11204889/827704

Then you can use mod_curl to send file from lua dialplan

2 Write service, to send file You can create simple backend service, located on the same machine as freeswitch, with API for freeswitch.

Then you call method of this local service with record name from freeswitch.

Then this new backend service processes this request loading file then calling method of target api.

so

  1. freeswitch - POST filename -> local service API
  2. local service: load file from shared with freeswitch folder
  3. local service - POST file -> target API
Artyom Chernetsov
  • 1,394
  • 4
  • 17
  • 34
  • I tried something like this: `` But the only problem is that I am unable to send large files. Small files less than 2 MBs are sent but larger files are not sent at all. Any suggestions. Thanks – user2302367 Sep 27 '17 at 12:38
  • @user2302367 there is an specific application of the module mod_curl, that you can use in the dialplan called "curl_sendfile". The "curl" application is specifically designed to query an api, and is not optimal for uploading files. Please refer to: https://freeswitch.org/confluence/display/FREESWITCH/mod_curl – tecla May 31 '18 at 04:07