TCX.PBXAPI.PBXIsNotConnected

Discussion in '3CX Phone System - General' started by bertyhell, Jul 17, 2012.

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

    Joined:
    Jul 17, 2012
    Messages:
    1
    Likes Received:
    0
    I'm trying to make a call from one extension to another using the 3CX Call Control API

    evrytime i run my application i get this error:
    Code:
    Unexpected Exception: TCX.PBXAPI.PBXIsNotConnected: An exception has occured of the type:  TCX.PBXAPI.PBXIsNotConnected.
       at TCX.PBXAPI.PBXConnection..ctor(String pbxSLHost, Int32 pbxSLPort, String
    pbxSLuser, String pbxSLpassword)
       at TestCSharp.Program.Main(String[] args) in ...\3CXCallControlAPI_v10\TestAPI\Program. 38
    the code looks like this:
    Code:
                PBXConnection Pbx = new PBXConnection("127.0.0.1", 5485, "admin", "0109Smart1910");
    
                Console.WriteLine("created PBXConnection object");
    
                while (true)
                {
                    try
                    {
                        Pbx.MakeCall("201", "202");
                    }
                    catch (Exception E)
                    {
                        Console.WriteLine(E.ToString());
                    }
                    Console.WriteLine("done");
                    Console.ReadKey();
                }

    I adjusted the 3cxPhoneSystem.ini file like this:
    Code:
    [General]
    AppPath=C:\Program Files\3CX PhoneSystem\
    WebServer=""
    pbxSLNIC=127.0.0.1
    FirstRun=False
    LogLevel=2
    ;msNoRTPFilter=0
    ;Msusetickcount=1
    PBXUser=myusername
    PBXPass=mypassword
    [ConfService]
    AppName=DBProvider
    ConfPort=5485
    DBPort=5480
    confUser=myotherusername
    dbUser=phonesystem
    DBHost=localhost
    DBName=phonesystem
    DefFile=Objects.cls
    confNIC=0.0.0.0
    confPass=myotherpassword
    dbPassword=mythirdpassword
    PhoneSystem.ApplicationName="TestCSharp"
    [MediaServer]
    Any ideas what i'm doing wrong?
     
  2. craigreilly

    craigreilly Well-Known Member

    Joined:
    Feb 1, 2012
    Messages:
    3,424
    Likes Received:
    278
    Why not use the CallNotifier instead?
    It requires MyPhone to be installed... I use a few registry keys to determine 32 or 64 bit installations then the location of the CallNotifier program.

    Here's my code:

    Code:
     Try
                Dim CallNotifierPath As String = ""
                Dim regkey As Microsoft.Win32.RegistryKey
    
                If Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Hardware\Description\System\CentralProcessor\0").GetValue("Identifier").ToString.Contains("x86") Then
                    regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\3CX\MyPhone", False)
                    CallNotifierPath = regkey.GetValue("CallNotifier")
    
                Else
                    regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Wow6432Node\3CX\MyPhone", False)
                    CallNotifierPath = regkey.GetValue("CallNotifier")
    
                End If
    
                If CallNotifierPath = "" Then
                    MsgBox("MyPhone must be installed locally to use this feature. Contact your helpdesk for support.", MsgBoxStyle.OkOnly, "Error")
                    Exit Sub
                Else
                    Shell(CallNotifierPath & " -cmd makecall:" & number, AppWinStyle.Hide, True)
    
                End If
    
    
                'Shell()
            Catch ex As Exception
                LogException("MAKE CALL: " & vbCrLf & ex.ToString)
            End Try
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. mji2010

    Joined:
    Feb 11, 2010
    Messages:
    1
    Likes Received:
    0
    Are there any answers to the original question? I have tried everything and can't get it to work. TCX.PBXAPI.PBXIsNotConnected
     
Thread Status:
Not open for further replies.