Problems using object model API - TCX.PBXAPI.PBXConnection

Status
Not open for further replies.

ShaunO

Joined
Sep 11, 2012
Messages
2
Reaction score
0
Hey guys, just been writing C# code based off the samples provided for the object model API.

I've sucessfully connected to the configuration server using:

Code:
            Random a = new Random(Environment.TickCount);
            PhoneSystem.ApplicationName = PhoneSystem.ApplicationName + a.Next().ToString();
            PhoneSystem.CfgServerHost = "127.0.0.1";
            PhoneSystem.CfgServerPort = 5485;
            PhoneSystem.CfgServerUser = "DBServ";
            PhoneSystem.CfgServerPassword = "pass";
            DN[] ps = PhoneSystem.Root.GetDN();

With that I'm getting a list of extensions (not 100% sure on what "DN" is an abbreviation of). I'm also a little confused about the significance of the ApplicationName, how unique does it need to be, why does the sample use a random number?

So with that working, I'm trying to now use the PBXConnection portion of the API, I have this simple code:

Code:
                var conn = new PBXConnection("127.0.0.1", 5482, "231", "1bk875m");
                conn.MakeCall("231", myNumber);

However no matter what I try, I can't get this connected, I keep running into the TCX.PBXAPI.PBXIsNotConnected exception.

I've tried ports 5485 (config server port, 3CXSLDBServ.exe), 5482 (3CXPhoneSystem.exe), I've tried using my extension name as the username along with the password, I've tried the web interface username/password (admin password), I've tried the config server username and password (DBServ/pass, out of the INI file) and nothing seems to work. When I use port 5482 I get a log entry in the server stating:

Code:
10:13:31.540  [EC000001]: Authentication failed:
      application:MPI-PHONE:0/CFGManager1693193895
      local:127.0.0.1:5482
      remote:127.0.0.1:59816

So not sure what to put in here for the user/pass so I can programatically make calls?

I also noticed that the sample references configs that don't exist in my .INI - PBXUser, PBXPass, CMHost and CMPort.

Any help is appreciated.

Thanks.
 
Re: Problems using object model API - TCX.PBXAPI.PBXConnecti

I also have this issue and have tried all of the different settings that ShaunO did. If anyone could please help with this issue it would be amazing!
 
Re: Problems using object model API - TCX.PBXAPI.PBXConnecti

I would like to recommend more simple approach to study how the Object model works. It is Iron Python 2.7.3
It supports .NET and allows to make experiments interactively
 
Re: Problems using object model API - TCX.PBXAPI.PBXConnecti

I don't think that answers the question. We are wondering what to pass into new PBXConnection() to make it so it authenticates properly.
 
Re: Problems using object model API - TCX.PBXAPI.PBXConnecti

Re: Problems using object model API - TCX.PBXAPI.PBXConnecti

Unread postby SY » Fri Sep 14, 2012 6:16 am
I would like to recommend more simple approach to study how the Object model works. It is Iron Python 2.7.3
It supports .NET and allows to make experiments interactively

I'm not sure what you mean here?

Anyway I changed some configs on the 3CXPhoneSystem.ini

Adding the following lines to the [General] section allowed successful connection

Code:
CMHost=localhost
CMPort=5482
PBXUser=pbxuser
PBXPass=pbxpass

Code:
                var conn = new PBXConnection("127.0.0.1", 5482, "pbxuser", "pbxpass");

Unfortunately it got an error on the MakeCall method but we had other issues due to the config change that required a revert of the config.

I also updated these lines to allow remote connections

Code:
pbxSLNIC=0.0.0.0
confNIC=0.0.0.0

Both of which were originally 127.0.0.1

Unfortunately after rebooting the server, the 3CX web interface would no longer reach the login screen (perpetual loading) and we had issues with receiving calls, I reverted the config and haven't touched it since. Will do some more testing around these configs to reach a stable environment but would you have any ideas what could've caused the issues and which config lines are not necessary perhaps?
 
Re: Problems using object model API - TCX.PBXAPI.PBXConnecti

PBXConnection does not work in free edition.
OMSamples project (see article about Call Control API for v11 in blog) shows correct implementation of the initialization procedure
OMSamples works on any PBX host.
 
Re: Problems using object model API - TCX.PBXAPI.PBXConnecti

So, after talking with a representative from 3cx about this (thank you 3cx for caring!) I went a and downloaded the api examples again from the API page. I ran the MakeCallSample.Run() method again which uses the PBXConnection that we have been having issues with, and it just worked. So I compared the code to the example I had downloaded a little while back and the only difference was that this line of code in Program.cs:

DN[] ps = PhoneSystem.Root.GetDN(); //Access PhoneSystem.Root to initialize ObjectModel

Was not commented out in the example I just downloaded. After reading the comment attached to it I can see why it wasn't working for me. So this resolved my issues.
 
Status
Not open for further replies.

Forum statistics

Threads
111,846
Messages
589,344
Members
164,681
Latest member
JV J