Hi,

Well, that's a coincidence.. I've been busy trying to figure out that same problem the entire weekend :-)

FS needs to know where to lookup the registered user, by indeed setting a dialstring. The dialstring is described in the wiki page that's mentioned, but there's something more:

It says on that page that you should set a param in your user like this:

<param name="dial-string" value="${sofia_contact(${dialed_us...@$ {dialed_domain})}"/>

You can also test it in your cli like this:

expand echo ${sofia_contact(usern...@domainname)}

This will reply with:
error/facility_not_subscribed

sofia_contact will search your db in sip_registrations for all registered users. The actual arguments that can be given to the function are:

profilename/usern...@domainname/arguments

If you leave out the profilename, it will put your domainname there.

The function then checks whether a *profile* exists with that name, and then lookup the entries in the db and then returns them. This can be fixed in two ways: either you specify the correct profilename (where the users are registered) with the sofia_contact function, or you alias the domainname to the profile where the user is registered in your sip profile.

The alias can be set in your profile like this:

<aliases><alias name="domainname"/></alias>

or automatically like this:

<domains><domain name="domainname" alias="true" parse="false"/></ domains>
(where domainname can also be "all" to alias all domain names)

But this presents another problem: The domain names that are aliased in the last way are retrieved from the database at startup of mod_sofia, and it is done through a directory lookup with purpose=gateways, even though the parse attribute - which is for getting gateways - is set to false !! (took me some time to figure that one out)

So, I rewrote the mod_xml_odbc a bit so the set-channel-variables function does expansion on all attributes (from-name, from-value, to- name, to-value), and wrote the following template:

<include>
<!-- purpose=gateways is not only called for getting gateways, but also for getting a list of domains that will be aliased to a profile if <domain .. alias="true"/> is set -->
  <template name="directory-gateways">
    <document type="freeswitch/xml">
      <section name="directory">
<xml-odbc-do name="set-event-header" to-name="where-clause" to-value="`${key_name}`='${key_value}'"/> <xml-odbc-do name="set-event-header" if-name="where-clause" if- value="``=''" to-value="1"/>
        <xml-odbc-do name="query" on-empty-result-break-to="not-found"
value="SELECT name AS domain_name FROM dir_domains WHERE ${where-clause};">
          <domain name="${domain_name}"/>
<!-- select all gateways of users within this domain_name here, to make parse=true working -->
        </xml-odbc-do>
      </section>
    </document>
  </template>
</include>

This will simply return a list of all domains if no key_name and key_value were specified in the lookup, or list one domain if that is requested.

The updated mod_xml_odbc and the directory-gateways.conf.xml template are in svn trunk contrib.

This does work for me now but still some things feel a bit strange to me (perhaps someone can explain?):

For examplle, right now, when I have two profiles where users can register with the same domain (for example one with a v4 and one with a v6 address), what should I do ? I can't alias the same domain to two profiles, so that means I have to call sofia_contact twice, once for each profile ?

regards,

Leon



On Sep 6, 2009, at 6:08 AM, mayamatakeshi wrote:


On Sat, Sep 5, 2009 at 5:36 PM, Juan Backson <juanback...@gmail.com> wrote:
Hi,

I am getting no dial-string available error when using xml_odbc module to bridge a call. How can I resolve this problem?

Hello,
I never tried the mod_xml_odbc.
But as the message says, you are not providing a dial-string.
I believe your template is incomplete.
Read about the dial-string here:
http://wiki.freeswitch.org/wiki/XML_User_Directory_Guide#Dial_String


EXECUTE sofia/internal/180...@192.168.1.130 bridge(user/180001)
2009-09-05 16:31:29.853456 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [key_value]=[192.168.1.134] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [key_name]=[name] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [tag_name]=[domain] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [section]=[directory] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [Event-Name]=[REQUEST_PARAMS] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [Core- UUID]=[f649cdfd-3715-4d18-94d9-417aa7e26873] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [FreeSWITCH-Hostname]=[server] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [FreeSWITCH-IPv4]=[192.168.1.134] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [FreeSWITCH-IPv6]=[::1] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [Event-Date-Local]=[2009-09-05 16:31:29] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [Event-Date-GMT]=[Sat, 05 Sep 2009 08:31:29 GMT] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [Event-Date-Timestamp]=[1252139489853456] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [Event-Calling-File]=[mod_dptools.c] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [Event-Calling- Function]=[user_outgoing_channel] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [Event-Calling-Line-Number]=[2365] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [as_channel]=[true] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [key]=[id] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [user]=[180001] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:401 DEBUG in xml_odbc_search, header [domain]=[192.168.1.134] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:319 DEBUG GOING TO RENDER TEMPLATE [default] 2009-09-05 16:31:29.854400 [INFO] mod_xml_odbc.c:214 DEBUG Performing Query: SELECT enabled, sip_password, account_id FROM agent WHERE sip_user = 180001 2009-09-05 16:31:29.855416 [INFO] mod_xml_odbc.c:214 DEBUG Performing Query:
SELECT sip_password FROM agent WHERE sip_user = 180001
2009-09-05 16:31:29.855416 [INFO] mod_xml_odbc.c:417 Debug dump of generated XML:
<document type="freeswitch/xml">
  <section name="directory">
    <domain name="192.168.1.134">
      <user id="180001">
        <params>
          <param name="password" value="111111"></param>
        </params>
        <variables>
          <variable name="account_id" value="18"></variable>
        </variables>
      </user>
    </domain>
  </section>
</document>
2009-09-05 16:31:29.856442 [CONSOLE] mod_xml_odbc.c:457 Generated XML is in [/tmp/16d2f01a-4332-43ff-9535-5615a192b40e.tmp.xml] 2009-09-05 16:31:29.856442 [ERR] mod_dptools.c:2430 No dial-string available, please check your user directory. 2009-09-05 16:31:29.856442 [ERR] switch_ivr_originate.c:1527 Cannot create outgoing channel of type [user] cause: [MANDATORY_IE_MISSING]


_______________________________________________
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


_______________________________________________
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

_______________________________________________
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

Reply via email to