PhoneSystem doesn't returned any data

Status
Not open for further replies.

FIKRAT

Customer
Joined
Jul 30, 2018
Messages
9
Reaction score
1
Hi,

I'm using 3CX V16 and trying to use API to retrieve all the information from the server, but API doesn't return anything.

C#:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using TCX.Configuration;

namespace _3cxApiTest
{
    class Program
    {
        public static bool Stop { get; private set; }

        static void Main(string[] args)
        {
            DisplayAllInfo();

            Console.ReadLine();
        }

        static void DisplayAllInfo()
        {

            bool configSrvConn = false;
            int checkCount = 0;
            var a = new Random(Environment.TickCount);

            PhoneSystem.ApplicationName = "TestApi" + a.Next().ToString();

            var ps = PhoneSystem.Reset(
                PhoneSystem.ApplicationName + new Random(Environment.TickCount).Next().ToString(),
                "127.0.0.1", 5485, "cfguser_default", "7f33hcpyurap");

            Console.WriteLine(PhoneSystem.ApplicationName);

            do
            {
                try
                {
                    configSrvConn = PhoneSystem.Root.Connected;
                }
                catch (Exception exc)
                {
                    Console.WriteLine("Configuration server not connected. Waiting 10 seconds to retry: " + exc.Message);
                    Thread.Sleep(10000);
                    checkCount++;
                }
            } while (!configSrvConn && checkCount < 6);


            Console.WriteLine("Connected to PBX: " + configSrvConn.ToString());

            Console.BackgroundColor = ConsoleColor.DarkBlue;

            try
            {
                Console.WriteLine("Parameters:");
                foreach (Parameter p in ps.GetParameters())
                {
                    Console.WriteLine("\t" + p.ToString());
                }
                Console.WriteLine("Codecs:");
                foreach (Codec c in ps.GetCodecs())
                {
                    Console.WriteLine("\t" + c.ToString());
                }
                Console.WriteLine("Conditions:");
                foreach (RuleCondition rc in ps.GetRuleConditions())
                {
                    Console.WriteLine("\t" + rc.ToString());
                }
                Console.WriteLine("RuleHours:");
                foreach (RuleHours rh in ps.GetRuleHourTypes())
                {
                    Console.WriteLine("\t" + rh.ToString());
                }
                Console.WriteLine("RuleCalltype:");
                foreach (RuleCallType rct in ps.GetRuleCallTypes())
                {
                    Console.WriteLine("\t" + rct.ToString());
                }
            }

            catch (Exception e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("ERROR: ");
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write(e.ToString());
            }

            Console.Write("Press enter to Continue!");
            Console.ReadLine();
        }
    }
}

Here is a result

Code:
TestApi9002804421087552196
Connected to PBX: True
Parameters:
Codecs:
Conditions:
RuleHours:
RuleCalltype:
Press enter to Continue!

Please help me to solve this. I don't why result is an empty :(
 
I've tried to get deep into details a little bit, and observed the following:

1. 3CX PhoneSystem Database Server service is not started and failed to start when attempt to do it manually.

2. in EventViewer I can see the following error:
Code:
Faulting application name: pg_ctl.exe, version: 9.6.9.18127, time stamp: 0x5af118d8
Faulting module name: MSVCR120.dll, version: 6.3.9600.18821, time stamp: 0x59ba86db
Exception code: 0xc0000135
Fault offset: 0x00000000000ece70
Faulting process id: 0x864
Faulting application start time: 0x01d51e30f768c34f
Faulting application path: C:\Program Files\3CX Phone System\Bin\pgsql\bin\pg_ctl.exe
Faulting module path: MSVCR120.dll
Report Id: 351d278b-8a24-11e9-80c6-005056951b02
Faulting package full name:
Faulting package-relative application ID:

3. Next I looked into the ConfigServer log file of 3CX, found the following:
Code:
    Line 83361: 23:28:13.754|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:promptlang
    Line 83364: 23:28:14.757|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:provider
    Line 83367: 23:28:15.768|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:queue
    Line 83370: 23:28:16.778|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:queue2dn
    Line 83373: 23:28:17.782|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:queue2managerdn
    Line 83376: 23:28:18.786|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:ringgroup
    Line 83379: 23:28:19.791|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:ringgroup2dn
    Line 83382: 23:28:20.795|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:rule2grp
    Line 83385: 23:28:21.797|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:rule2line
    Line 83388: 23:28:22.801|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:rulecalltype
    Line 83391: 23:28:23.806|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:rulecondition
    Line 83394: 23:28:24.816|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:rulehours
    Line 83397: 23:28:25.822|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:specialmenu
    Line 83400: 23:28:26.820|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:tenant
    Line 83403: 23:28:27.827|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:tenantprop
    Line 83406: 23:28:28.840|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:users
    Line 83409: 23:28:29.849|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:voicemail
    Line 83418: 23:28:30.856|000010c4|Error|dbprovpostgress.cpp(1720): LOAD IDs FAILED:routepoint
    Line 83420: 23:28:31.860|000010c4|Error|dbprovpostgress.cpp(2111): GetConstraints:vmboxinfo. Transaction has failed to Start

Is this issue can be related to the fact that database server is not running? I notice that service startup is configured to be Automatically started, but it didn't.
 
Issue is solved!

The problem was a 3CX PhoneSystem Database Server was not running. When I tried to run the server I got not a clear error. I've copied execution path from the service itself and tried to run it in a console window, after that I could clearly identify the error:
MSVCR120.dll Missing

I've installed the following C++ Redistributable packages to be able to run the 3cx database server service.

10931

Now 3CX PhoneSystem Database Server service is running and 3CX API is working and returning required data.

Thanks.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,324
Messages
591,897
Members
165,475
Latest member
lastshadow