Creating C# / C++ softphone



  • Hi there,

    I'm sorry for writing in English. I'm new to .NET languages (I'm Java developer), but my new senior asked me to create a softphone in C++.

    Based on this C# softphone example I tried to implement it in C++, but something's wrong...

    Below you can see my C++ code. Can anybody help me where is the problem?

    Imports Ozeki.VoIP
    Imports Ozeki.VoIP.SDK
    
    Namespace SIP_Register
        Class Program
            Private Shared softphone As ISoftPhone
            ' softphone object
            Private Shared phoneLine As IPhoneLine
            ' phoneline object
            Private Shared Sub Main(args As String())
                ' Create a softphone object with RTP port range 5000-10000
                softphone = SoftPhoneFactory.CreateSoftPhone(5000, 10000)
    
                ' SIP account registration data, (supplied by your VoIP service provider)
                Dim registrationRequired = True
                Dim userName = "sipusername"
                Dim displayName = "sipdisplayname"
                Dim authenticationId = "authenticationid"
                Dim registerPassword = "Password"
                Dim domainHost = "pbxip.voipprovider.com"
                Dim domainPort = 5060
    
                Dim account = New SIPAccount(registrationRequired, displayName, userName, authenticationId, registerPassword, domainHost, _
                    domainPort)
    
                ' Send SIP regitration request
                RegisterAccount(account)
    
                ' Prevents the termination of the application
                Console.ReadLine()
            End Sub
    
            Private Shared Sub RegisterAccount(account As SIPAccount)
                Try
                    phoneLine = softphone.CreatePhoneLine(account)
                    AddHandler phoneLine.RegistrationStateChanged, AddressOf sipAccount_RegStateChanged
                    softphone.RegisterPhoneLine(phoneLine)
                Catch ex As Exception
                    Console.WriteLine("Error during SIP registration: " + ex)
                End Try
            End Sub
    
            Private Shared Sub sipAccount_RegStateChanged(sender As Object, e As RegistrationStateChangedArgs)
                If e.State = RegState.[Error] OrElse e.State = RegState.NotRegistered Then
                    Console.WriteLine("Registration failed!")
                End If
    
                If e.State = RegState.RegistrationSucceeded Then
                    Console.WriteLine("Registration succeeded - Online!")
                End If
            End Sub
        End Class
    End Namespace
    

  • Mod

    1. This is no C++ code
    2. This is a german Forum.
    3. Because this is a Commercial product, I am sure you get support from this company.


Anmelden zum Antworten