File upload - mod_curl
Hi Please let me know how can I upload a file from fs_cli using curl or other http application of FreeSWITCH.
From Linux command prompt
SUCCESS curl -F file=@/tmp/log/callcontrol.log http://192.168.9.152/upload
From fs_cli
curl http://192.168.9.152/upload post file=%40%2Ftmp%2Flog%2Fcallcontrol.log curl http://192.168.9.152/upload post -F file=%40%2Ftmp%2Fccv5%2Flog%2Fcallcontrol.log curl http://192.168.9.152/upload post -F file=@/tmp/log/callcontrol.log<mailto:file=@/tmp/log/callcontrol.log> curl http://192.168.9.152/upload post file=@/tmp/log/callcontrol.log<mailto:file=@/tmp/log/callcontrol.log> All the above results in <html> <head><title>415 Unsupported Media Type</title></head> <body bgcolor="white"> <center><h1>415 Unsupported Media Type</h1></center> <hr><center>nginx/1.2.0</center> </body> </html> FreeSWITCH version FreeSWITCH Version 1.1.beta1 (git-65c4f76 2012-04-25 17-58-41 +0000) Thanks RaviRaj.
For example , you can to launch some lua script from FS dialplan and invoke linux command from lua via io.popen()http://wiki.freeswitch.org/wiki/Mod_lua#Run_a_shell_command From: rml@tollfreeforwarding.com To: freeswitch-users@lists.freeswitch.org Date: Fri, 27 Apr 2012 00:01:30 +0000 Subject: [Freeswitch-users] File upload - mod_curl Hi Please let me know how can I upload a file from fs_cli using curl or other http application of FreeSWITCH. From Linux command prompt SUCCESScurl -F file=@/tmp/log/callcontrol.log http://192.168.9.152/upload From fs_cli curl http://192.168.9.152/upload post file=%40%2Ftmp%2Flog%2Fcallcontrol.logcurl http://192.168.9.152/upload post -F file=%40%2Ftmp%2Fccv5%2Flog%2Fcallcontrol.logcurl http://192.168.9.152/upload post -F file=@/tmp/log/callcontrol.logcurl http://192.168.9.152/upload post file=@/tmp/log/callcontrol.log All the above results in <html><head><title>415 Unsupported Media Type</title></head><body bgcolor="white"><center><h1>415 Unsupported Media Type</h1></center><hr><center>nginx/1.2.0</center></body></html> FreeSWITCH versionFreeSWITCH Version 1.1.beta1 (git-65c4f76 2012-04-25 17-58-41 +0000) ThanksRaviRaj. _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
In my use I am using outbound socket for FAX After receiving a 'CUTOM - spandsp::rxfaxresult ' event , I need to call curl/http application to upload the received fax from remote FreeSWITCH to storage. I want to run the file upload process in background - bgapi curl http://192.168.9.152/upload post -F file=@/tmp/log/callcontrol.log<mailto:file=@/tmp/log/callcontrol.log>. Regards RaviRaj. From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Yuriy Nasida Sent: Friday, April 27, 2012 11:57 AM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] File upload - mod_curl For example , you can to launch some lua script from FS dialplan and invoke linux command from lua via io.popen() http://wiki.freeswitch.org/wiki/Mod_lua#Run_a_shell_command ________________________________ From: rml@tollfreeforwarding.com<mailto:rml@tollfreeforwarding.com> To: freeswitch-users@lists.freeswitch.org<mailto:freeswitch-users@lists.freeswitch.org> Date: Fri, 27 Apr 2012 00:01:30 +0000 Subject: [Freeswitch-users] File upload - mod_curl Hi Please let me know how can I upload a file from fs_cli using curl or other http application of FreeSWITCH.
From Linux command prompt
SUCCESS curl -F file=@/tmp/log/callcontrol.log<mailto:file=@/tmp/log/callcontrol.log> http://192.168.9.152/upload
From fs_cli
curl http://192.168.9.152/upload post file=%40%2Ftmp%2Flog%2Fcallcontrol.log curl http://192.168.9.152/upload post -F file=%40%2Ftmp%2Fccv5%2Flog%2Fcallcontrol.log curl http://192.168.9.152/upload post -F file=@/tmp/log/callcontrol.log<mailto:file=@/tmp/log/callcontrol.log> curl http://192.168.9.152/upload post file=@/tmp/log/callcontrol.log<mailto:file=@/tmp/log/callcontrol.log> All the above results in <html> <head><title>415 Unsupported Media Type</title></head> <body bgcolor="white"> <center><h1>415 Unsupported Media Type</h1></center> <hr><center>nginx/1.2.0</center> </body> </html> FreeSWITCH version FreeSWITCH Version 1.1.beta1 (git-65c4f76 2012-04-25 17-58-41 +0000) Thanks RaviRaj. _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org<mailto:consulting@freeswitch.org> http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
you can try to launch such lua script via bgapi. Also you can send variables you need via args.bgapi lua scriptname.lua arg1 arg2 etc... From: rml@tollfreeforwarding.com To: freeswitch-users@lists.freeswitch.org CC: nasida@live.ru Subject: RE: [Freeswitch-users] File upload - mod_curl Date: Fri, 27 Apr 2012 19:18:07 +0000 In my use I am using outbound socket for FAXAfter receiving a ‘CUTOM - spandsp::rxfaxresult ’ event , I need to call curl/http application to upload the received fax from remote FreeSWITCH to storage.I want to run the file upload process in background – bgapi curl http://192.168.9.152/upload post -F file=@/tmp/log/callcontrol.log. RegardsRaviRaj. From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Yuriy Nasida Sent: Friday, April 27, 2012 11:57 AM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] File upload - mod_curl For example , you can to launch some lua script from FS dialplan and invoke linux command from lua via io.popen()http://wiki.freeswitch.org/wiki/Mod_lua#Run_a_shell_command From: rml@tollfreeforwarding.com To: freeswitch-users@lists.freeswitch.org Date: Fri, 27 Apr 2012 00:01:30 +0000 Subject: [Freeswitch-users] File upload - mod_curlHi Please let me know how can I upload a file from fs_cli using curl or other http application of FreeSWITCH. From Linux command prompt SUCCESScurl -F file=@/tmp/log/callcontrol.log http://192.168.9.152/upload From fs_cli curl http://192.168.9.152/upload post file=%40%2Ftmp%2Flog%2Fcallcontrol.logcurl http://192.168.9.152/upload post -F file=%40%2Ftmp%2Fccv5%2Flog%2Fcallcontrol.logcurl http://192.168.9.152/upload post -F file=@/tmp/log/callcontrol.logcurl http://192.168.9.152/upload post file=@/tmp/log/callcontrol.log All the above results in <html><head><title>415 Unsupported Media Type</title></head><body bgcolor="white"><center><h1>415 Unsupported Media Type</h1></center><hr><center>nginx/1.2.0</center></body></html> FreeSWITCH versionFreeSWITCH Version 1.1.beta1 (git-65c4f76 2012-04-25 17-58-41 +0000) ThanksRaviRaj. _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Yes, I understand and agree we can run a lua script for the file upload in background. This requires mod_lua and writing a lua script for the upload. I want to refrain from doing so as all our call control logic resides on a Java server we are developing. We want to make clever use of mod_curl to upload a file using multipart FORM data and HTTP POST method. There is no documentation @ http://wiki.freeswitch.org/wiki/Mod_http how to achieve this. Regards RaviRaj. From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Yuriy Nasida Sent: Friday, April 27, 2012 12:40 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] File upload - mod_curl you can try to launch such lua script via bgapi. Also you can send variables you need via args. bgapi lua scriptname.lua arg1 arg2 etc... ________________________________ From: rml@tollfreeforwarding.com<mailto:rml@tollfreeforwarding.com> To: freeswitch-users@lists.freeswitch.org<mailto:freeswitch-users@lists.freeswitch.org> CC: nasida@live.ru<mailto:nasida@live.ru> Subject: RE: [Freeswitch-users] File upload - mod_curl Date: Fri, 27 Apr 2012 19:18:07 +0000 In my use I am using outbound socket for FAX After receiving a 'CUTOM - spandsp::rxfaxresult ' event , I need to call curl/http application to upload the received fax from remote FreeSWITCH to storage. I want to run the file upload process in background - bgapi curl http://192.168.9.152/upload post -F file=@/tmp/log/callcontrol.log<mailto:file=@/tmp/log/callcontrol.log>. Regards RaviRaj. From: freeswitch-users-bounces@lists.freeswitch.org<mailto:freeswitch-users-bounces@lists.freeswitch.org> [mailto:freeswitch-users-bounces@lists.freeswitch.org]<mailto:[mailto:freeswitch-users-bounces@lists.freeswitch.org]> On Behalf Of Yuriy Nasida Sent: Friday, April 27, 2012 11:57 AM To: freeswitch-users@lists.freeswitch.org<mailto:freeswitch-users@lists.freeswitch.org> Subject: Re: [Freeswitch-users] File upload - mod_curl For example , you can to launch some lua script from FS dialplan and invoke linux command from lua via io.popen() http://wiki.freeswitch.org/wiki/Mod_lua#Run_a_shell_command ________________________________ From: rml@tollfreeforwarding.com<mailto:rml@tollfreeforwarding.com> To: freeswitch-users@lists.freeswitch.org<mailto:freeswitch-users@lists.freeswitch.org> Date: Fri, 27 Apr 2012 00:01:30 +0000 Subject: [Freeswitch-users] File upload - mod_curl Hi Please let me know how can I upload a file from fs_cli using curl or other http application of FreeSWITCH.
From Linux command prompt
SUCCESS curl -F file=@/tmp/log/callcontrol.log<mailto:file=@/tmp/log/callcontrol.log> http://192.168.9.152/upload
From fs_cli
curl http://192.168.9.152/upload post file=%40%2Ftmp%2Flog%2Fcallcontrol.log curl http://192.168.9.152/upload post -F file=%40%2Ftmp%2Fccv5%2Flog%2Fcallcontrol.log curl http://192.168.9.152/upload post -F file=@/tmp/log/callcontrol.log<mailto:file=@/tmp/log/callcontrol.log> curl http://192.168.9.152/upload post file=@/tmp/log/callcontrol.log<mailto:file=@/tmp/log/callcontrol.log> All the above results in <html> <head><title>415 Unsupported Media Type</title></head> <body bgcolor="white"> <center><h1>415 Unsupported Media Type</h1></center> <hr><center>nginx/1.2.0</center> </body> </html> FreeSWITCH version FreeSWITCH Version 1.1.beta1 (git-65c4f76 2012-04-25 17-58-41 +0000) Thanks RaviRaj. _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org<mailto:consulting@freeswitch.org> http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Not sure if it is possible. I had some issue with mod_curl in the past. I needed to set max time for curl request but mod_curl had not it. That is why i used linux curl via lua. I mean that mod_curl can be insufficiently flexible for your goal. However it is only my assumption. For full understanding, you need to read source code of this module or wait for other advise. From: rml@tollfreeforwarding.com To: freeswitch-users@lists.freeswitch.org CC: nasida@live.ru Subject: RE: [Freeswitch-users] File upload - mod_curl Date: Fri, 27 Apr 2012 23:23:24 +0000 Yes, I understand and agree we can run a lua script for the file upload in background.This requires mod_lua and writing a lua script for the upload. I want to refrain from doing so as all our call control logic resides on a Java server we are developing.We want to make clever use of mod_curl to upload a file using multipart FORM data and HTTP POST method.There is no documentation @ http://wiki.freeswitch.org/wiki/Mod_http how to achieve this. RegardsRaviRaj. From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Yuriy Nasida Sent: Friday, April 27, 2012 12:40 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] File upload - mod_curl you can try to launch such lua script via bgapi. Also you can send variables you need via args.bgapi lua scriptname.lua arg1 arg2 etc... From: rml@tollfreeforwarding.com To: freeswitch-users@lists.freeswitch.org CC: nasida@live.ru Subject: RE: [Freeswitch-users] File upload - mod_curl Date: Fri, 27 Apr 2012 19:18:07 +0000In my use I am using outbound socket for FAXAfter receiving a ‘CUTOM - spandsp::rxfaxresult ’ event , I need to call curl/http application to upload the received fax from remote FreeSWITCH to storage.I want to run the file upload process in background – bgapi curl http://192.168.9.152/upload post -F file=@/tmp/log/callcontrol.log. RegardsRaviRaj. From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Yuriy Nasida Sent: Friday, April 27, 2012 11:57 AM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] File upload - mod_curl For example , you can to launch some lua script from FS dialplan and invoke linux command from lua via io.popen()http://wiki.freeswitch.org/wiki/Mod_lua#Run_a_shell_command From: rml@tollfreeforwarding.com To: freeswitch-users@lists.freeswitch.org Date: Fri, 27 Apr 2012 00:01:30 +0000 Subject: [Freeswitch-users] File upload - mod_curlHi Please let me know how can I upload a file from fs_cli using curl or other http application of FreeSWITCH. From Linux command prompt SUCCESScurl -F file=@/tmp/log/callcontrol.log http://192.168.9.152/upload From fs_cli curl http://192.168.9.152/upload post file=%40%2Ftmp%2Flog%2Fcallcontrol.logcurl http://192.168.9.152/upload post -F file=%40%2Ftmp%2Fccv5%2Flog%2Fcallcontrol.logcurl http://192.168.9.152/upload post -F file=@/tmp/log/callcontrol.logcurl http://192.168.9.152/upload post file=@/tmp/log/callcontrol.log All the above results in <html><head><title>415 Unsupported Media Type</title></head><body bgcolor="white"><center><h1>415 Unsupported Media Type</h1></center><hr><center>nginx/1.2.0</center></body></html> FreeSWITCH versionFreeSWITCH Version 1.1.beta1 (git-65c4f76 2012-04-25 17-58-41 +0000) ThanksRaviRaj. _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
RaviRaj Mulasa
-
Yuriy Nasida