使用Sipek Voip SDK接收呼叫
本文关键字:呼叫 SDK Sipek Voip 使用 | 更新日期: 2023-09-27 18:06:06
我一直在玩Sipek Voip SDK,我在接听电话时遇到了麻烦。
网上的教程帮助不大,我想知道这里是否有人在过去使用过它?我可以注册和拨打电话,但我不知道如何处理甚至在这一点上接到一个电话。我将粘贴我的代码下面。谢谢!
这是我的主类,我在其中保留了回调的接口。
public partial class MainWindow
{
#region Properties
// Get call manager instance
CCallManager CallManager
{
get { return CCallManager.Instance; }
}
private PhoneConfig _config = new PhoneConfig();
internal PhoneConfig Config
{
get { return _config; }
}
private IStateMachine _call = null;
#endregion
#region Constructor
public MainWindow()
{
InitializeComponent();
// register callbacks
CallManager.CallStateRefresh += new DCallStateRefresh(CallManager_CallStateRefresh);
pjsipRegistrar.Instance.AccountStateChanged += new Sipek.Common.DAccountStateChanged(Instance_AccountStateChanged);
// Inject VoIP stack engine to CallManager
CallManager.StackProxy = pjsipStackProxy.Instance;
// Inject configuration settings SipekSdk
CallManager.Config = Config;
pjsipStackProxy.Instance.Config = Config;
pjsipRegistrar.Instance.Config = Config;
// Initialize
CallManager.Initialize();
// register accounts...
pjsipRegistrar.Instance.registerAccounts();
}
#endregion
#region Callbacks
void Instance_AccountStateChanged(int accountId, int accState)
{
this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, (ThreadStart)delegate
{
OnRegistrationUpdate(accountId, accState);
});
}
void CallManager_CallNotification(int sessionId)
{
}
void CallManager_CallStateRefresh(int sessionId)
{
this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, (ThreadStart)delegate
{
OnStateUpdate(sessionId);
});
}
#endregion
public void OnRegistrationUpdate(int accountId, int accState)
{
authenticationStatus_Text.Text = accState.ToString();
}
public void OnStateUpdate(int sessionId)
{
callStatus_Text.Text = CallManager.getCall(sessionId).StateId.ToString();
}
private void release_Button_Click(object sender, RoutedEventArgs e)
{
dial_Text.Clear();
CallManager.onUserRelease(_call.Session);
}
private void dial_Button_Click(object sender, RoutedEventArgs e)
{
_call = CallManager.createOutboundCall(dial_Text.Text);
}
}
解决了我自己的问题。我使用的是旧版本的dll,它似乎不支持来电回调。