Hi Michael,

Thanks very much for your help,

Now I have my FS up & running with a directory working via LUA scripting.


Thanks
Jaime


On Tue, Jun 23, 2015 at 12:14 PM, Michael Jerris <mike@jerris.com> wrote:
also check what code you are running.  There was a bug with this in master last week that has been fixed.


On Tuesday, June 23, 2015, Roman Dissauer <roman@dissauer.net> wrote:
first did you restart freeswitch after configuring lua xml_handler?
If yes, check the debug string in fs_cli created by the lua script:

„ Debug from catch-event-directory, generated XML: …“

If you don’t find this string in you console, lua xml_handler is not configured properly. If you find this debug string check if there is your user id=„600300"

Am 23.06.2015 um 06:28 schrieb Jaime Cruz <jaimecm@gmail.com>:

Hi all,

I'm working to configure Freeswith directory users on the fly using
the xml-handler-script option in the autoload_configs/lua.conf.xml configuration file
using the followin option:
    <param name="xml-handler-script" value="catch-event-directory.lua"/>
    <param name="xml-handler-bindings" value="directory"/>

But I'm get the following error:
   2015-06-23 01:09:23.717880 [WARNING] sofia_reg.c:2827 Can't find user [600300@voip.hablaip.com] from X.X.X.X
You must define a domain called 'test.com' in your directory and add a user with the id="600300" attribute
and you must configure your device to use the proper domain in it's authentication credentials.

Also with a local created user in xml files the FS autenticate fine, but with a user created by the directory handler script it fail.

Any help will be apreciated.

The FS version is 1.4.19~64bit running on Centos 6.6,

and here is the very simple lua script: catch-event-directory.lua that returns the XML_STRING variable:
==================================================================
local v_section = XML_REQUEST["section"] or ""
local v_tag_name = XML_REQUEST["tag_name"] or ""
local req_domain = params:getHeader("domain") or ""
local req_user   = params:getHeader("user") or ""
local req_context= params:getHeader("variable_user_context") or ""

if (v_section == "directory" and v_tag_name=="domain" and (req_domain) and (req_user)) then
   local password="some password"
          XML_STRING =
        [[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
        <document type="freeswitch/xml">
          <section name="directory">
            <domain name="]] .. req_domain .. [[">
              <user id="]] .. req_user .. [[">
                <params>
                  <param name="password" value="]] .. password .. [["/>
                  <param name="dial-string" value="{sip_invite_domain=${domain_name},presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}"/>
                </params>
                <variables>
                  <variable name="user_context" value="]] .. req_context .. [["/>
                  <variable name="limit_max" value="10"/>
                </variables>
              </user>
            </domain>
          </section>
        </document>]]
        -- comment the following line for production:
        freeswitch.consoleLog("notice", "Debug from catch-event-directory, generated XML:\n" .. XML_STRING .. "\n")
end


Thanks in advance.
Jaime
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.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


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.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