【发布时间】:2018-04-25 13:45:27
【问题描述】:
我正在尝试使用 linphone sdk 添加 sip 来电,注册成功,我可以拨打电话,并且通话状态按预期记录,但我无法接听来电。我正在使用意图服务来处理连接。
这是我的代码:
protected void onHandleIntent(Intent intent) {
String sipAddress = intent.getStringExtra("address");
String password = intent.getStringExtra("password");
final LinphoneCoreFactory lcFactory = LinphoneCoreFactory.instance();
// First instantiate the core Linphone object given only a listener.
// The listener will react to events in Linphone core.
try {
lc = lcFactory.createLinphoneCore(new LinphoneCoreListenerBase() {
@Override
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
super.callState(lc, call, state, message);
Log.i(TAG, "callState: ");
}
}, getApplication());
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
lc.setUserAgent("Test app", "1.0");
try {
LinphoneAddress address = lcFactory.createLinphoneAddress(sipAddress);
String username = address.getUserName();
String domain = address.getDomain();
if (password != null) {
lc.addAuthInfo(lcFactory.createAuthInfo(username, password, null, domain));
}
// create proxy config
LinphoneProxyConfig proxyCfg = lc.createProxyConfig(sipAddress, domain, null, true);
proxyCfg.setExpires(2000);
lc.addProxyConfig(proxyCfg); // add it to linphone
lc.setDefaultProxyConfig(proxyCfg);
running = true;
while (running) {
lc.iterate(); // first iterate initiates registration
sleep(20);
}
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
我的代码有什么问题?
【问题讨论】:
-
(专业提示:我们更喜欢这里的技术写作风格。我们不鼓励问候,希望你能帮助,谢谢,提前感谢,感谢信,问候,亲切的问候,签名, please-can-you-helps, 聊天材料和缩写 txtspk, 恳求, 你被困了多久, 投票建议, 元评论等。只需解释你的问题, 并展示你尝试过的, 你期望的,以及实际发生的事情。)
标签: android voip sip-server