[Freeswitch-users] Questio about directory via xml-handler-script

Jaime Cruz jaimecm at gmail.com
Tue Jun 23 08:28:36 MSD 2015


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"/>
as explain in the following url:
https://wiki.freeswitch.org/wiki/Lua_freeswitch_dbh

But I'm get the following error:
   2015-06-23 01:09:23.717880 [WARNING] sofia_reg.c:2827 Can't find user [
600300 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150623/9ea36c39/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list