我正在Xamarin.forms项目中使用Linphone SDK进行Sip调用。我可以使用以下代码建立连接:
var authInfo = Factory.Instance.CreateAuthInfo(username.Text,
null, password.Text, null, null,domain.Text);
LinphoneCore.AddAuthInfo(authInfo);
String proxyAddress ="sip:"+username.Text+"@192.168.1.180:5160";
var identity = Factory.Instance.CreateAddress(proxyAddress);
var proxyConfig = LinphoneCore.CreateProxyConfig();
identity.Username = username.Text;
identity.Domain = domain.Text;
identity.Transport = TransportType.Udp;
proxyConfig.Edit();
proxyConfig.IdentityAddress = identity;
proxyConfig.ServerAddr = domain.Text + ":5160;transport=udp";
proxyConfig.Route = domain.Text;
proxyConfig.RegisterEnabled = true;
proxyConfig.Done();
LinphoneCore.AddProxyConfig(proxyConfig);
LinphoneCore.DefaultProxyConfig = proxyConfig;
LinphoneCore.RefreshRegisters();
成功连接后,我正在使用代码放置代码。
if (LinphoneCore.CallsNb == 0)
{
string phoneCall = "sip:"+address.Text+ "@192.168.1.180:5160";
var addr = LinphoneCore.InterpretUrl(phoneCall);
LinphoneCore.InviteAddress(addr);
}
else
{
Call call = LinphoneCore.CurrentCall;
if (call.State == CallState.IncomingReceived)
{
LinphoneCore.AcceptCall(call);
}
else
{
LinphoneCore.TerminateAllCalls();
}
}
正在监听呼叫状态更改事件的监听器为:
private void OnCall(Core lc, Call lcall, CallState state, stringmessage)
{
call_status.Text = "Call state changed: " + state;
if (lc.CallsNb > 0)
{
if (state == CallState.IncomingReceived)
{
call.Text = "Answer Call (" + lcall.RemoteAddressAsString + ")";
}
else
{
call.Text = "Terminate Call";
}
if (lcall.CurrentParams.VideoEnabled) {
video.Text = "Stop Video";
} else {
video.Text = "Start Video";
}
}
else
{
call.Text = "Start Call";
call_stats.Text = "";
}
}
呼叫状态为“内部服务器错误”。我可以在代码中使用Linphone或X-lite Soft Phone接听电话,但无法发出电话。我不知道此问题与服务器有关还是与我的代码有关。请提出建议。
答案 0 :(得分:0)
内部服务器错误(HTTP Status code 500)表示服务器上发生了意外错误。因此,我怀疑问题出在哪里,而不是应用程序的代码。
500 -常见错误消息,当遇到意外情况且没有更具体的消息时给出。
您的请求可能无法满足您正在调用的端点的期望,但是即使那样,服务器仍然应该响应比500崩溃的错误更有意义的错误。