Accessing Custom Header in REGISTER packets
Hi All, In my REGISTER packets that's sent towards a FreeSwitch server, I am adding a custom header "X-CustomHeaderName: auth_token". The goal for my project is to access that token and conduct a verification through another API before allowing the REGISTER to pass. What's the best way to accomplish this? thanks, Miz
use xml_curl to handle the directory request, and if its not already in there, make sure the x headers get in to the directory lookup params. On Nov 12, 2013, at 6:32 PM, Mark Tsai <twkid@yahoo.com> wrote:
Hi All,
In my REGISTER packets that's sent towards a FreeSwitch server, I am adding a custom header "X-CustomHeaderName: auth_token". The goal for my project is to access that token and conduct a verification through another API before allowing the REGISTER to pass.
What's the best way to accomplish this? thanks, Miz _________________________________________________________________________ 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-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
Thanks for the quick reply. I've tried using mod_xml_curl with directory binding. My observation is that the xml fetch only happens once - when FS starts up. Is this configurable? I would need this curl fetch to happen for each REGISTER request that comes in. thanks again for the help, Miz On Thursday, November 14, 2013 5:01 AM, Michael Jerris <mike@jerris.com> wrote: use xml_curl to handle the directory request, and if its not already in there, make sure the x headers get in to the directory lookup params. On Nov 12, 2013, at 6:32 PM, Mark Tsai <twkid@yahoo.com> wrote: Hi All,
In my REGISTER packets that's sent towards a FreeSwitch server, I am adding a custom header "X-CustomHeaderName: auth_token". The goal for my project is to access that token and conduct a verification through another API before allowing the REGISTER to pass.
What's the best way to accomplish this? thanks, Miz_________________________________________________________________________ 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-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev 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-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
it is unless you use "cache" -- Seven Du http://www.freeswitch.org.cn http://about.me/dujinfang http://www.dujinfang.com Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Friday, November 15, 2013 at 7:20 AM, Mark Tsai wrote:
Thanks for the quick reply.
I've tried using mod_xml_curl with directory binding. My observation is that the xml fetch only happens once - when FS starts up. Is this configurable?
I would need this curl fetch to happen for each REGISTER request that comes in.
thanks again for the help, Miz
On Thursday, November 14, 2013 5:01 AM, Michael Jerris <mike@jerris.com (mailto:mike@jerris.com)> wrote: use xml_curl to handle the directory request, and if its not already in there, make sure the x headers get in to the directory lookup params.
On Nov 12, 2013, at 6:32 PM, Mark Tsai <twkid@yahoo.com (mailto:twkid@yahoo.com)> wrote:
Hi All,
In my REGISTER packets that's sent towards a FreeSwitch server, I am adding a custom header "X-CustomHeaderName: auth_token". The goal for my project is to access that token and conduct a verification through another API before allowing the REGISTER to pass.
What's the best way to accomplish this? thanks, Miz
_________________________________________________________________________ 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-dev mailing list FreeSWITCH-dev@lists.freeswitch.org (mailto:FreeSWITCH-dev@lists.freeswitch.org) http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org (mailto:consulting@freeswitch.org) http://www.freeswitchsolutions.com (http://www.freeswitchsolutions.com/)
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com (http://www.cudatel.com/)
Official FreeSWITCH Sites http://www.freeswitch.org (http://www.freeswitch.org/) http://wiki.freeswitch.org (http://wiki.freeswitch.org/) http://www.cluecon.com (http://www.cluecon.com/)
FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org (mailto:FreeSWITCH-dev@lists.freeswitch.org) http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org (http://www.freeswitch.org/)
_________________________________________________________________________ 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-dev mailing list FreeSWITCH-dev@lists.freeswitch.org (mailto:FreeSWITCH-dev@lists.freeswitch.org) http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
I now have the following lines added in lua.conf --- <param name="xml-handler-script" value="$${base_dir}/scripts/dir.lua"/> <param name="xml-handler-bindings" value="directory" /> dir.lua --- freeswitch.consoleLog("info", params:serialize("xml") .. "\n") // Do some api check here to decide allow REGISTER or not session:hangup(); I am able to see the custom header with the consoleLog on params but if I try to stop this incoming REGISTER request using the hangup() call I get FS complaining about "attempt to index global 'session' (a nil value)" How can I go about locating this incoming REGISTER that's not a session yet? thanks again for the help, Mark On Thursday, November 14, 2013 3:20 PM, Mark Tsai <twkid@yahoo.com> wrote: Thanks for the quick reply. I've tried using mod_xml_curl with directory binding. My observation is that the xml fetch only happens once - when FS starts up. Is this configurable? I would need this curl fetch to happen for each REGISTER request that comes in. thanks again for the help, Miz On Thursday, November 14, 2013 5:01 AM, Michael Jerris <mike@jerris.com> wrote: use xml_curl to handle the directory request, and if its not already in there, make sure the x headers get in to the directory lookup params. On Nov 12, 2013, at 6:32 PM, Mark Tsai <twkid@yahoo.com> wrote: Hi All,
In my REGISTER packets that's sent towards a FreeSwitch server, I am adding a custom header "X-CustomHeaderName: auth_token". The goal for my project is to access that token and conduct a verification through another API before allowing the REGISTER to pass.
What's the best way to accomplish this? thanks, Miz_________________________________________________________________________ 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-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev 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-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
Let me guess you’re trying accessing the session during hangup? http://wiki.freeswitch.org/wiki/Variable_session_in_hangup_hook -- Brian West brian@freeswitch.org FreeSWITCH Solutions, LLC PO BOX 2531 Brookfield, WI 53008-2531 Twitter: @FreeSWITCH_Wire , @briankwest http://www.freeswitchbook.com http://www.freeswitchcookbook.com T: +1.918.420.9001 | F: +1.918.420.9002 | M: +1.918.424.WEST iNUM: +883 5100 1420 9001 ISN: 410*543 Skype:briankwest PGP Key: http://www.bkw.org/key.txt (AB93356707C76CED) On Dec 3, 2013, at 5:07 PM, Mark Tsai <twkid@yahoo.com> wrote:
I now have the following lines added in
lua.conf --- <param name="xml-handler-script" value="$${base_dir}/scripts/dir.lua"/> <param name="xml-handler-bindings" value="directory" />
dir.lua --- freeswitch.consoleLog("info", params:serialize("xml") .. "\n") // Do some api check here to decide allow REGISTER or not session:hangup();
I am able to see the custom header with the consoleLog on params but if I try to stop this incoming REGISTER request using the hangup() call I get FS complaining about "attempt to index global 'session' (a nil value)"
How can I go about locating this incoming REGISTER that's not a session yet?
thanks again for the help, Mark
participants (4)
-
Brian West
-
Mark Tsai
-
Michael Jerris
-
Seven Du