我一直在用 c# 开发一个 Softphone 项目,并且一直在使用 Ozeki VoIP SDK。
到目前为止,我已经成功注册了软电话并拨打了外线电话。但是,我听不到被叫方的声音,但他们可以听到我的声音。(我是软电话,被叫方是 Cisco SPA504G 电话)
使用其他应用程序(例如 X-Lite)时,2 路音频很好
SIP 跟踪显示我正在发送但未接收任何 RTP 包,这是我在代码中做错了什么(见下文)还是 PBX 端的问题。(三线 PBX)
void CreateCall()
{
string numberToDial = txtNum.Text;
logOutput("Call " + numberToDial);
txtLog.ScrollToCaret();
call = softphone.CreateCallObject(phoneLine, numberToDial);
call.CallStateChanged += call_CallStateChanged;
call.Start();
}
private void SetupDevices()
{
connector.Connect(microphone, mediaSender);
connector.Connect(mediaReceiver, speaker);
mediaSender.AttachToCall(call);
mediaReceiver.AttachToCall(call);
microphone.Start();
speaker.Start();
}
void call_CallStateChanged(object sender, CallStateChangedArgs e)
{
if (e.State == CallState.Answered)
{
WireUpCallEvents();
}
if (e.State == CallState.Completed)
{
WireDownCallEvents();
}
logOutput("Call state: " + e.State);
}
private void WireUpCallEvents()
{
call.CallStateChanged += (call_CallStateChanged);
SetupDevices();
}
private void WireDownCallEvents()
{
call.CallStateChanged -= (call_CallStateChanged);
}