I found the answer myself: The hostname has to be 'any', since something is evaluated on it. What exactly hostname it refers to I don't know, but 'any' makes it take...any.

--Anders

On Sun, Oct 21, 2012 at 2:16 PM, Anders Sonderkjaer <betterzystems@gmail.com> wrote:
Hi,

I cannot get fetch the data in db_data from the dialplan. The ODBC is running and has been tested. 

I have not found any documentation on what the 'hostname' column in the db_data table should be - so I just put what the server has right now ('freeswitch01') - is that ok?

This is what I am doing in the dialplan:

   <extension name="incoming_did">
      <condition field="${sip_received_ip}" expression="^1.2.3.\d+$"/>
      <condition field="destination_number" expression="^(\d+)$">
         <action application="info"/>
         <action application="set" data="sip_to_user=${db(select/forward/${sip_to_user})}"/>
         <action application="bridge" data="sofia/gateway/main_trunk/9999$1"/>
      </condition>
   </extension>

1.2.3 are the first four digits of the IP address I get the call from - this works, have tested it with a hardcoded forward.

The call sent to FS has the To User set to 2000000. I use this to identify the user sending the call, and then want to look in db_data to find out which number the call should be forwarded to. So 2000000 would be the data_key and the value/data is the number to forward to. 
What I want to get out of it, is that a bridge is made to sofia/gateway/main_trunk/9999forward_number, where the forward_number is the value/data retrieved from db_data, and 9999 is the prefix for the termination partner (this works, has been tested).

Input would really be appreciated!

Thanks,
A.