我正在尝试使用 c# 构建一个简单的 VoIP 应用程序,所以我发现这Ozeki SDK是一种简单的方法,但是当我尝试使用我本地的SIPAccount类注册 SIP 帐户时,它总是失败,这就是代码Ozeki SDKIP
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ozeki.VoIP;
using Ozeki.VoIP.SDK;
namespace SIP_R
{
class Program
{
private static ISoftPhone softphone; // softphone object
private static IPhoneLine phoneLine; // phoneline object
private static void Main(string[] args)
{
// 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)
var registrationRequired = true;
var userName = "1000";
var displayName = "1000";
var authenticationId = "1000";
var registerPassword = "1000";
var domainHost = SoftPhoneFactory.GetLocalIP().ToString();
var domainPort = 9000;
var account = new SIPAccount(registrationRequired, displayName, userName, authenticationId, registerPassword, domainHost, domainPort);
// Send SIP regitration request
RegisterAccount(account);
// Prevents the termination of the application
Console.ReadLine();
}
static void RegisterAccount(SIPAccount account)
{
try
{
phoneLine = softphone.CreatePhoneLine(account);
phoneLine.RegistrationStateChanged += sipAccount_RegStateChanged;
softphone.RegisterPhoneLine(phoneLine);
}
catch (Exception ex)
{
Console.WriteLine("Error during SIP registration: " + ex);
}
}
static void sipAccount_RegStateChanged(object sender, RegistrationStateChangedArgs e)
{
if (e.State == RegState.Error || e.State == RegState.NotRegistered)
Console.WriteLine("Registration failed!");
if (e.State == RegState.RegistrationSucceeded)
Console.WriteLine("Registration succeeded - Online!");
}
}
}
所以请任何关于做什么的帮助提前非常感谢任何帮助..
尝试使用 Ozeki SDK 和本地 IP 进行软电话呼叫时,会出现错误NatType:UDPBlocked