Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Linphone核心侦听器未接收传入呼叫_Android_Voip_Sip Server - Fatal编程技术网

Android Linphone核心侦听器未接收传入呼叫

Android Linphone核心侦听器未接收传入呼叫,android,voip,sip-server,Android,Voip,Sip Server,我尝试使用linphone sdk添加sip传入呼叫,注册成功,我可以发出传出呼叫,呼叫状态按预期记录,但我无法接收传入呼叫。我正在使用intent服务处理连接 这是我的密码: protected void onHandleIntent(Intent intent) { String sipAddress = intent.getStringExtra("address"); String password = intent.getStringExtra("pas

我尝试使用linphone sdk添加sip传入呼叫,注册成功,我可以发出传出呼叫,呼叫状态按预期记录,但我无法接收传入呼叫。我正在使用intent服务处理连接

这是我的密码:

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();
        }
    }

我的代码出了什么问题?

正如IntentService文档()所述:

该服务根据需要启动,使用工作线程依次处理每个意图,并在工作结束时自行停止


我认为你不应该把听众放在一个意向服务中。相反,把它放在一个长时间运行的服务中,这样侦听器就可以一直呆在那里接收事件

(专业提示:我们更喜欢技术性的写作风格。我们不鼓励打招呼,希望你能帮忙,谢谢,提前感谢,感谢信,问候,亲切的问候,签名,请你帮忙,聊天材料和缩写txtspk,恳求,你被困多久了,投票建议,元评论等等。请解释你的问题em,并展示您的尝试、您的期望以及实际发生的情况。)