Ozeki VoIP sdk无法正常工作 [英] Ozeki VoIP sdk does not work properly

查看:140
本文介绍了Ozeki VoIP sdk无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我开发了一个winform应用程序并通过阅读教程使用了Ozeki.VoIP sdk,但它没有将sip帐户注册到elastix PBX,过了一会儿它超时 。但我无法使用像Expresstalk这样的免费软电话注册账号....



我看到服务器中的sip调试消息,看到没有来自我的win应用程序的请求。我还将这个winform应用程序添加到防火墙例外中。



你能帮帮我吗?



这是我的代码:



  private   static  ISoftPhone mySoftphone;  //   softphone object  
private 静态 IPhoneLine phoneLine; // phoneline对象

private static void Main( string [] args)
{
// 创建一个RTP端口范围为5000的软电话对象-10000和SIP端口5060
// mySoftphone = SoftPhoneFactory.CreateSoftPhone(5000,5060) );
mySoftphone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5000 5700 < /跨度>);

// SIP帐户注册数据,(由您的VoIP服务提供商提供)
var registrationRequired = true ;
var userName = 100;
var displayName = 100;
var authenticationId = 100;
var registerPassword = 12345rt;
var domainHost = 192.168.150.134 ;
var domainPort = 5060 ;

// 发送SIP注册请求
mySoftphone_Register(mySoftphone, registrationRequired,displayName,userName,authenticationId,registerPassword,
domainHost,domainPort);

// 阻止应用程序终止
while true )Thread.Sleep( 10 ) ;
}


静态 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 (例外情况)
{
Console.WriteLine( SIP注册期间出错: + ex.ToString());
}
}

静态 void mySoftphone_PhoneLineStateChanged( object sender,RegistrationStateChangedArgs e)
{
if (e.State == RegState.NotRegistered || e.State == RegState.Error)
Console.WriteLine( 注册失败! );

if (e.State == RegState.RegistrationSucceeded)
Console.WriteLine( 注册成功 - 在线!);
}

解决方案

您有一个关于SDK功能的具体问题。最好的地方是制作SDK的人和/或专门使用它的论坛。



你找到知道SDK的人的机会让单独你在这里遇到的问题,或任何其他一般论坛,它非常遥远。



提出你的问题> [ ^ ]。

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:

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!");
        }

解决方案

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[^].


这篇关于Ozeki VoIP sdk无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆