ODBC Directory Search (V14SP2)

Discussion in '3CX Phone System - General' started by richardwvm, Feb 18, 2016.

Thread Status:
Not open for further replies.
  1. richardwvm

    Joined:
    Dec 21, 2015
    Messages:
    27
    Likes Received:
    1
    Hope someone can help me out here please. After much faffing I now have a situation where 3CX is performing the ODBC lookup when a call is answered and I can verify the result of the query returns a database entry.

    It would seem however, that nothing is done with this data such that it is used for CID on the second call. Consequently, I don't see the returned result in the 'Company Phonebook' and the database is queried again when the second call is answered, even though it's already been done and should be cached already.

    Have I missed something? Should I expect to see the result imported into the 'Company Phonebook'?

    Regards,

    Richard.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,246
    Likes Received:
    61
  3. richardwvm

    Joined:
    Dec 21, 2015
    Messages:
    27
    Likes Received:
    1
    Hi Nick,

    Yes I read that thread, but this is different. I understand that the name won't be cached and appended to CID until the second call, which I referred to in my original post.

    The problem appears to be that the result of the first lookup after the first call is answered, doesn't get cached anywhere to be used the second time around. It just performs the same lookup after the second call is answered and doesn't append the name to the CID.

    Presumably the result from the first lookup should be added to the 3CX 'Company Phonebook'? Mine is still empty despite the database being successfully queried after every answered call.

    Hope that makes sense?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,246
    Likes Received:
    61
    In order to see what exactly is happening you would have to set a specially logging level so that the queries get logged by the phone system as well. To do this you must do:
    1) Go to Troubleshooting / Activity Log / Logging, set the logging level to Verbose, and press OK.
    2) Go in C:\Program Files\3CX Phone System\Instance1\Bin\3CXCallHistoryService.exe.config
    Comment out lines :
    <add key="Log_Level" value="255" />
    <add key="Log_Severity" value="Critical Error Except" />

    like this:
    <!--<add key="Log_Level" value="255" />
    <add key="Log_Severity" value="Critical Error Except" />-->

    3) Restart all services.
    4) Review the instance callhistory log file which is located in C:\ProgramData\3CX\Instance1\Data\Logs\CallHistoryService.log

    I can't remember the exact log lines, but I think it is pretty easy to read through the related logs.
     
  5. richardwvm

    Joined:
    Dec 21, 2015
    Messages:
    27
    Likes Received:
    1
    Hi Nick,

    Problem solved. It would seem that 3CX can't cope with any fields returning DBNull, so just had to wrap everything like this:
    Code:
    ISNULL(directory.FirstName, '') AS [FirstName]
    Now works as expected! Incidentally you only need to restart the Call History service to see the change in log level, which is more convenient in a production environment.

    Ta muchly, Richard.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. richardwvm

    Joined:
    Dec 21, 2015
    Messages:
    27
    Likes Received:
    1
    Suggested bug fix in CompanyDirectoryService.OdbcReaderMapping:

    Code:
            public string Get(string field)
            {
                int num;
                if (!this._mapping.TryGetValue(field, out num))
                {
                    return string.Empty;
                }
                object value = this._reader.GetString(num);
                return value == DBNull.Value ? string.Empty : value.ToString();
            }
    HTH, Richard.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Thread Status:
Not open for further replies.