2

ここに私の登録コードがあります:

SipProfile.Builder builder = new SipProfile.Builder(username, ip);
builder.setPort(Integer.parseInt(port));
builder.setPassword(password);
builder.setSendKeepAlive(true);
builder.setAutoRegistration(true);
sipProfile = builder.build();

Intent i = new Intent();
i.setAction(ACTION);
PendingIntent pi = PendingIntent.getBroadcast(this, 0, i,
        Intent.FILL_IN_DATA);
sipManager.open(sipProfile, pi, null);
sipManager.setRegistrationListener(sipProfile.getUriString(),
        new SipRegistrationListener() {
            public void onRegistering(String localProfileUri) {
                Log.e("SipService",
                        "Registering with SIP Server...\n"
                                + localProfileUri);
            }

            public void onRegistrationDone(String localProfileUri,
                    long expiryTime) {
                Log.e("SipService", "Ready: " + localProfileUri);
            }

            public void onRegistrationFailed(
                    String localProfileUri, int errorCode,
                    String errorMessage) {
                Log.e("SipService", "Error: " + errorCode + " " + rorMessage);
                Handler handler = new Handler(Looper
                        .getMainLooper());
                handler.post(new Runnable() {
                    @Override
                    public void run() {

                    Toast.makeText(SipService.this,
                        R.string.sip_registration_error,
                                Toast.LENGTH_LONG).show();
                    }
                });
            }
        });

正常に登録されることもありましたが、ほとんどの場合、エラー コード -9 が表示
10-08 14:49:53.389: E/SipService(5793): Error: -9 0
されました。参照サイトで次の説明を見つけました。

public static final int IN_PROGRESS
    The client is in a transaction and cannot initiate a new one.
    Constant Value: -9 (0xfffffff7)

正確にはどういう意味ですか?電話機で他の SIP アプリケーションを実行していません。

4

1 に答える 1

0

同様の問題と思われるものがありました。公式の Android SIP チュートリアルに基づいた例によく似たコードを使用すると、2 つの登録の失敗が同時に発生し、そのうちの 1 つがエラー -9 を返しました。時々、エラー -10、DATA_CONNECTION_LOST も発生しました。

インテントを作成した後、短時間スリープすることで両方を解決できました。

Intent intent = new Intent();
intent.setAction("my.package.name.INCOMING_CALL");
SystemClock.sleep(1000);
PendingIntent pendingIntent = PendingIntent.getBroadcast(parent, 0, intent, Intent.FILL_IN_DATA);
sipManager.open(mySipProfile, pendingIntent, null);
sipManager.setRegistrationListener(mySipProfile.getUriString(), new SipRegistrationListener() { ... }

提案どおり: SIP:ERROR DATA_CONNECTION_LOST

于 2015-12-06T05:38:37.903 に答える