LUA execute response question
I am developing a Freeswitch/LUA script. From the script, I have a requirement to retrieve information via HTTP from an app server. I have utilized the HTTP application from the Freeswitch CLI. It works great. My question is how can I call the "http get http://www......." from within the LUA script and retrieve the HTTP response? Is this feasible? Or is there a way to make an HTTP request directly from LUA? Jonathan
you can execute the freeswitch api command like any other api command or use any loadable lua module available to do this. Mike On Dec 30, 2008, at 3:36 PM, jonathan augenstine wrote:
I am developing a Freeswitch/LUA script. From the script, I have a requirement to retrieve information via HTTP from an app server. I have utilized the HTTP application from the Freeswitch CLI. It works great. My question is how can I call the "http get http:// www......." from within the LUA script and retrieve the HTTP response? Is this feasible? Or is there a way to make an HTTP request directly from LUA?
Mike, I executed the following:
From CLI: http get http://www.google.com {}
This comes back with the HTTP response and prints it to the console. I tried to execute the following: response = session:execute("http", "get http://www.google.com {}"); What I am unable to figure out how to do is retrieve HTTP response. That is my dilemma. Jonathan On Tue, Dec 30, 2008 at 12:57 PM, Michael Jerris <mike@jerris.com> wrote:
you can execute the freeswitch api command like any other api command or use any loadable lua module available to do this.
Mike
On Dec 30, 2008, at 3:36 PM, jonathan augenstine wrote:
I am developing a Freeswitch/LUA script. From the script, I have a requirement to retrieve information via HTTP from an app server. I have utilized the HTTP application from the Freeswitch CLI. It works great. My question is how can I call the "http get http://www......." from within the LUA script and retrieve the HTTP response? Is this feasible? Or is there a way to make an HTTP request directly from LUA?
_______________________________________________ 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
session:execute runs a freeswitch app, you want to be executing the fsapi command using API:execute Mike On Dec 30, 2008, at 4:16 PM, jonathan augenstine wrote:
Mike,
I executed the following:
From CLI: http get http://www.google.com {}
This comes back with the HTTP response and prints it to the console. I tried to execute the following:
response = session:execute("http", "get http://www.google.com {}");
What I am unable to figure out how to do is retrieve HTTP response. That is my dilemma.
Jonathan
On Tue, Dec 30, 2008 at 12:57 PM, Michael Jerris <mike@jerris.com> wrote: you can execute the freeswitch api command like any other api command or use any loadable lua module available to do this.
Mike
On Dec 30, 2008, at 3:36 PM, jonathan augenstine wrote:
I am developing a Freeswitch/LUA script. From the script, I have a requirement to retrieve information via HTTP from an app server. I have utilized the HTTP application from the Freeswitch CLI. It works great. My question is how can I call the "http get http:// www......." from within the LUA script and retrieve the HTTP response? Is this feasible? Or is there a way to make an HTTP request directly from LUA?
Mike, Thank you. I was confused and it is working now. Jonathan On Tue, Dec 30, 2008 at 1:40 PM, Michael Jerris <mike@jerris.com> wrote:
session:execute runs a freeswitch app, you want to be executing the fsapi command using API:executeMike
On Dec 30, 2008, at 4:16 PM, jonathan augenstine wrote:
Mike,
I executed the following:
From CLI: http get http://www.google.com {}
This comes back with the HTTP response and prints it to the console. I tried to execute the following:
response = session:execute("http", "get http://www.google.com {}");
What I am unable to figure out how to do is retrieve HTTP response. That is my dilemma.
Jonathan
On Tue, Dec 30, 2008 at 12:57 PM, Michael Jerris <mike@jerris.com> wrote:
you can execute the freeswitch api command like any other api command or use any loadable lua module available to do this.
Mike
On Dec 30, 2008, at 3:36 PM, jonathan augenstine wrote:
I am developing a Freeswitch/LUA script. From the script, I have a requirement to retrieve information via HTTP from an app server. I have utilized the HTTP application from the Freeswitch CLI. It works great. My question is how can I call the "http get http://www......." from within the LUA script and retrieve the HTTP response? Is this feasible? Or is there a way to make an HTTP request directly from LUA?
_______________________________________________ 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)
-
jonathan augenstine
-
Michael Jerris