Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
I have developed a winform app and used Ozeki.VoIP sdk by reading tutorials, but it does not register sip account to elastix PBX and after a moments it "time out". But I cant register account using free softphones like Expresstalk ....

I saw sip debug messages in server and see there was not request from my win app. I also added this winform app into firewall exceptions.

Would you help me please?

Here is my code:

C#
private static ISoftPhone mySoftphone;   // softphone object
        private static IPhoneLine phoneLine;   // phoneline object

        private static void Main(string[] args)
        {
            //Create a softphone object with RTP port range 5000-10000, and SIP port 5060
            //mySoftphone = SoftPhoneFactory.CreateSoftPhone(5000, 5060);
            mySoftphone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5000, 5700);

            // SIP account registration data, (supplied by your VoIP service provider)
            var registrationRequired = true;
            var userName = "100";
            var displayName = "100";
            var authenticationId = "100";
            var registerPassword = "12345rt";
            var domainHost = "192.168.150.134";
            var domainPort = 5060;

            // Send SIP regitration request
            mySoftphone_Register(mySoftphone, registrationRequired, displayName, userName, authenticationId, registerPassword,
                             domainHost, domainPort);

            // prevents the termination of the application
            while (true) Thread.Sleep(10);
        }


        static void mySoftphone_Register(ISoftPhone softphone, bool registrationRequired, string displayName, string userName,
        string authenticationId, string registerPassword, string domainHost, int domainPort)
        {
            try
            {
                var account = new SIPAccount(registrationRequired, displayName, userName, authenticationId, registerPassword, domainHost, domainPort);
                var natConfiguration = new NatConfiguration("192.168.150.1",true);

                PhoneLineConfiguration plin=new PhoneLineConfiguration(account);
                plin.NatConfig=natConfiguration;

                phoneLine = softphone.CreatePhoneLine(plin);
                phoneLine.RegistrationStateChanged += mySoftphone_PhoneLineStateChanged;
                softphone.RegisterPhoneLine(phoneLine);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error during SIP registration: " + ex.ToString());
            }
        }

        static void mySoftphone_PhoneLineStateChanged(object sender, RegistrationStateChangedArgs e)
        {
            if (e.State == RegState.NotRegistered || e.State == RegState.Error)
                Console.WriteLine("Registration failed!");

            if (e.State == RegState.RegistrationSucceeded)
                Console.WriteLine("Registration succeeded - Online!");
        }
Posted

1 solution

You've got a specific question about the functionality of an SDK. The BEST place to ask is the people who made the SDK and/or a forum dedicated to its use.

The chances of you finding someone who knows about the SDK let alone the problem your having with it here, or any other general forum, it very remote.

Ask your question here[^].
 
Share this answer
 
Comments
Member 11461441 12-Mar-15 13:25pm    
But There are bunch of tutorials and examples here in codeproject using the sdk!, I think there would be people to help
Dave Kreskowiak 12-Mar-15 14:03pm    
OK, so you're going to wait for those few people to stumble across your post? Nice strategy. Have fun waiting.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900