Using XML CURL for LRN queries
Good day, I have a web server that I can request as following: http://192.168.1.2/pqrs/route?tn=4165555555 And it will respond with xml containing LRN which looks like this: <pqrsd> <api>pqrsd</api> <operation>route</operation> <status>success</status> <tn>4165555555</tn> <region>canada</region> * <rn>4160000001</rn>* <spid/> <spName/> <routedBy>none</routedBy> </pqrsd> Can I use mod_xml_curl to make LRN queries from XML dialplan and put LRN from the response into a channel variable? Is it suitable for such real-time queries? If so, how should I setup mod_xml_curl? WiKi mostly goes over standard stuff such as getting directory, dialplan, ACL etc Thank you, -Victor
Victor, What would you do with the LRN response once received? Is the use case where a user wants to dial 4165555555, and you want fs to bridge to 4160000001? If this is the case, I think you have two approaches. You could maintain your current dialplan strategy and call a script from the dialplan (but not xml_curl) which performs your LRN lookup. The better approach seems to be to replace your current 'manual' dialplan for this case with an xml_curl dialplan. This way FS will invoke your xml_curl server, tell you a user wants to dial 4165555555, then you can natively call your LRN service (pqrs/route), and respond with the set/bridge commands to connect to the appropriate endpoint (in this case 4160000001). You can leave everything else in your manual dialplan if you wish. Ian. On Mon, May 12, 2014 at 2:09 PM, Victor Chukalovskiy < victor.chukalovskiy@gmail.com> wrote:
Good day,
I have a web server that I can request as following: http://192.168.1.2/pqrs/route?tn=4165555555
And it will respond with xml containing LRN which looks like this:
<pqrsd> <api>pqrsd</api> <operation>route</operation> <status>success</status> <tn>4165555555</tn> <region>canada</region> * <rn>4160000001</rn>* <spid/> <spName/> <routedBy>none</routedBy> </pqrsd>
Can I use mod_xml_curl to make LRN queries from XML dialplan and put LRN from the response into a channel variable? Is it suitable for such real-time queries? If so, how should I setup mod_xml_curl? WiKi mostly goes over standard stuff such as getting directory, dialplan, ACL etc
Thank you, -Victor
_________________________________________________________________________ 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
XML curl is to "take over" the dialplan, with your own code providing the dialplan XML. I don't think that's what you want at all. Sounds like you just want to get the response information, that's something small -- an embedded lua <https://wiki.freeswitch.org/wiki/Lua> script to set a channel var, or even a system<http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_system>call -- just beware initialization time. If you had the information directly (or JSON?), you could simply use mod_curl <https://wiki.freeswitch.org/wiki/Mod_curl> but I don't think that will parse this for you. Actually, you could use mod_curl to save to a variable, and then use regex<http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_regex>to pull out the part you want (see last example). -Avi Marcus BestFone On Mon, May 12, 2014 at 9:09 PM, Victor Chukalovskiy < victor.chukalovskiy@gmail.com> wrote:
Good day,
I have a web server that I can request as following: http://192.168.1.2/pqrs/route?tn=4165555555
And it will respond with xml containing LRN which looks like this:
<pqrsd> <api>pqrsd</api> <operation>route</operation> <status>success</status> <tn>4165555555</tn> <region>canada</region> * <rn>4160000001</rn>* <spid/> <spName/> <routedBy>none</routedBy> </pqrsd>
Can I use mod_xml_curl to make LRN queries from XML dialplan and put LRN from the response into a channel variable? Is it suitable for such real-time queries? If so, how should I setup mod_xml_curl? WiKi mostly goes over standard stuff such as getting directory, dialplan, ACL etc
Thank you, -Victor
_________________________________________________________________________ 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
Alright, that clarifies. Thank you. So, I'll do a LUA script & static dial-plan for prototyping...xml_curl I'll re-visit once ready for dynamic dial-plan. On 14-05-12 02:59 PM, Avi Marcus wrote:
XML curl is to "take over" the dialplan, with your own code providing the dialplan XML. I don't think that's what you want at all.
Sounds like you just want to get the response information, that's something small -- an embedded lua <https://wiki.freeswitch.org/wiki/Lua> script to set a channel var, or even a system <http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_system> call -- just beware initialization time.
If you had the information directly (or JSON?), you could simply use mod_curl <https://wiki.freeswitch.org/wiki/Mod_curl> but I don't think that will parse this for you. Actually, you could use mod_curl to save to a variable, and then use regex <http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_regex> to pull out the part you want (see last example).
-Avi Marcus BestFone
On Mon, May 12, 2014 at 9:09 PM, Victor Chukalovskiy <victor.chukalovskiy@gmail.com <mailto:victor.chukalovskiy@gmail.com>> wrote:
Good day,
I have a web server that I can request as following: http://192.168.1.2/pqrs/route?tn=4165555555
And it will respond with xml containing LRN which looks like this:
<pqrsd> <api>pqrsd</api> <operation>route</operation> <status>success</status> <tn>4165555555 <tel:4165555555></tn> <region>canada</region> * <rn>4160000001</rn>* <spid/> <spName/> <routedBy>none</routedBy> </pqrsd>
Can I use mod_xml_curl to make LRN queries from XML dialplan and put LRN from the response into a channel variable? Is it suitable for such real-time queries? If so, how should I setup mod_xml_curl? WiKi mostly goes over standard stuff such as getting directory, dialplan, ACL etc
Thank you, -Victor
_________________________________________________________________________ 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
_________________________________________________________________________ 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
Just to clarify ... you only need to implement what you want in xml_curl (dialplan) and can leave leave the rest static (it is not an all or nothing proposition). Going lua in this case seems right for a single purpose function (especially if you are good at lua or python, etc), unless you are already versed in writing web services in another language (i.e. java), and want to code your LRN scenario in that instead.
participants (3)
-
Avi Marcus
-
Ian McMaster
-
Victor Chukalovskiy