Android SIP客户端多个配置文件

时间:2019-02-05 10:29:08

标签: android sip

我正在制作SIP应用程序,并且其中需要多个配置文件。

但是我只能注册1个配置文件,一旦注册了第二个配置文件,注册将失败,并且会给我SipErrorCode:-9(IN_PROGRESS)。

是否可以同时注册2个配置文件?有可能吗?

这是我注册SIP的方式:

public SipManager manager = null;
public SipProfile me = null;

/// ....

    if(manager == null) {
        manager = SipManager.newInstance(getActivity());
    }

/// ...

    try {
        SipProfile.Builder builder = new SipProfile.Builder(username, domain);
        builder.setPassword(password);
        me = builder.build();

        Intent intent = new Intent();
        intent.setAction("android.SipDemo.INCOMING_CALL");
        PendingIntent pendingIntent = PendingIntent.getBroadcast(mainActivity, 0, intent, Intent.FILL_IN_DATA);

        manager.open(me, pendingIntent, null);

        manager.setRegistrationListener(me.getUriString(), new SipRegistrationListener() {
            public void onRegistering(String localProfileUri) {
                Log.e("onRegisterR", "Registering SIP... " + localProfileUri);
            }
            public void onRegistrationDone(String localProfileUri, long expiryTime) {
                Log.e("onRegisterS", "Registration Successful! " + localProfileUri);
            }
            public void onRegistrationFailed(String localProfileUri, int errorCode,
                                             String errorMessage) {
                Log.e("onRegisterF", errorMessage);
            }
        });
    } catch (ParseException pe) {
        Log.e("ParseException", pe.getMessage());
    } catch (SipException se) {
        Log.e("SipException", se.getMessage());
    }

ps。我刚刚将该代码实现了两次,制作了2个配置文件

0 个答案:

没有答案