gpt4 book ai didi

Android Linphone 无法注册

转载 作者:行者123 更新时间:2023-11-29 20:26:55 25 4
gpt4 key购买 nike

我在 android 应用程序中使用 SIP,但我当前的库无法为我提供某些功能。所以我尝试使用 android-linphone lib 并感到有些困惑。我不明白如何使用这个库在 Asterisk 上进行注册。 native 库加载良好

I/LinphoneCoreFactoryImpl﹕ Trying to load liblinphone for armeabi-v7a
I/LinphoneCoreFactoryImpl﹕ Loading done with armeabi-v7a
Has neon: true
Has ZRTP: true

我正在尝试按照此页面上的说法创建用户 liblinphone-javadoc

在我的代码示例中 Activity 实现 LinphoneCoreListener

LinphoneCoreListener linphoneCoreListener = this;

try {
mLinphoneCore = LinphoneCoreFactoryImpl.instance().createLinphoneCore(this, this);
mLinphoneCore.setNetworkReachable(true);
} catch (LinphoneCoreException e) {
System.out.println("LinphoneCoreException " + e.toString());
}

LinphoneProxyConfig proxy_cfg;
LinphoneAuthInfo info;

info = LinphoneCoreFactory.instance().createAuthInfo(mUserName, mUserName, mUserPass, null, null, mDomain); /*create authentication structure from identity*/
mLinphoneCore.addAuthInfo(info); /*add authentication info to LinphoneCore*/

/*create proxy config*/
try {
proxy_cfg = mLinphoneCore.createProxyConfig(mSipUser, mDomain, mDomain, true);
proxy_cfg.setIdentity(mSipUser); /*set identity with user name and domain*/
proxy_cfg.setProxy(mDomain); /* we assume domain = proxy server address*/
proxy_cfg.enableRegister(true); /*activate registration for this proxy config*/
mLinphoneCore.addProxyConfig(proxy_cfg); /*add proxy config to linphone core*/
mLinphoneCore.setDefaultProxyConfig(proxy_cfg); /*set to default proxy*/
mLinphoneCore.addListener(linphoneCoreListener);
proxy_cfg.done();

System.out.println("Proxy state is = " + proxy_cfg.getState());/*23838-23838/com.myapplication I/System.out﹕ Proxy state is = RegistrationNone*/
} catch (LinphoneCoreException e) {
System.out.println(e.toString());
}

LinphoneCoreListener 消息

I/System.out﹕ globalState Starting up
I/System.out﹕ configuringStatus null
I/System.out﹕ displayStatus Ready
I/System.out﹕ globalState Ready

在文档中说 configuringStatus message 如果 state == Failed 是错误消息,但没有关于 null 的信息。

如果能为这个库提供帮助,我将非常感激。

最佳答案

配置完成后,您必须定期循环调用LinphoneCore.iterate()。这是主应用程序循环。例如,来自 Linphone 应用程序源:

    mLc = LinphoneCoreFactory.instance().createLinphoneCore(...);

TimerTask lTask = new TimerTask() {
@Override
public void run() {
UIThreadDispatcher.dispatch(new Runnable() {
@Override
public void run() {
if (mLc != null) {
mLc.iterate();
}
}
});
}
};
mTimer = new Timer("Linphone scheduler");
mTimer.schedule(lTask, 0, 20);

关于Android Linphone 无法注册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32412806/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com