我正在使用Ozeki.VoIP.SDK来处理我们的Elastix系统中的传入VoIP呼叫。我想要做的是在我的应用程序和中读取和显示有关来电的信息,让桌面电话也响起来。
问题是,当我注册从VoIP池到Ozeki控制器的电话线时,到该线路的来电将不再在我的桌面电话上响起。但是当我不注册那条电话线时,当它接到电话时,我的办公桌电话就会再次响起来。
我不知道为什么Ozeki会阻止我在应用程序中看到的调用。
private ISoftPhone _softphone;
private Dictionary<string,IPhoneLine> _phoneLines;
public Softphone()
{
_softphone = SoftPhoneFactory.CreateSoftPhone(IP_ADDRESS, MIN_PORT, MAX_PORT, SIP_PORT);
_softphone.ChangeNATSettings(Ozeki.Network.Nat.NATTraversalMethodType.NONE, "", "", "");
_softphone.IncommingCall += softphone_IncommingCall;
_phoneLines = new Dictionary<string, IPhoneLine>();
}
public bool IsRegistered(string username)
{
return (_phoneLines.Keys.Contains(username));
}
public void Register(SIPAccount account)
{
if (IsRegistered(account.UserName))
{
Unregister(account);
Thread.Sleep(1000);
}
//throw new Exception(string.Format("The account with username={0} already registered.", account.UserName));
// With the SIP account and the NAT configuration, we can create a phoneline.
IPhoneLine phoneLine = _softphone.CreatePhoneLine(account);
// If our phoneline is created, we can register that.
_softphone.RegisterPhoneLine(phoneLine);
_phoneLines.Add(account.UserName, phoneLine);
}
public void Unregister(SIPAccount account)
{
IPhoneLine phoneLine = _softphone.CreatePhoneLine(account);
_phoneLines.Remove(account.UserName);
_softphone.UnregisterPhoneLine(phoneLine);
}
private void DispatchAsync(Action action)
{
var task = new WaitCallback(o => action.Invoke());
ThreadPool.QueueUserWorkItem(task);
}
private void softphone_IncommingCall(object sender, VoIPEventArgs<IPhoneCall> e)
{
DispatchAsync(() =>
{
onIncomingCall(e);
});
}
private void onIncomingCall(VoIPEventArgs<IPhoneCall> e)
{
if (IncomingCall != null)
IncomingCall(this, e);
}以前有人见过这种行为吗?毫无线索。
发布于 2017-11-19 09:37:36
在mjwills提到的链接之后,我发现这是VoIP系统的一种已知行为,它的解决方法是为每一行定义一条跟随行,并使应用程序注册仅限于跟踪行,而不是由台式电话注册的行。
https://stackoverflow.com/questions/47179157
复制相似问题