Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android SIP registration failed (-9 IN_PROGRESS)

Here is my registration code:

    protected void initializeManagerOpen(){
    consoleWrite("initializeOpen");
    if(mSipManager==null) {
        return;
    }
    SipProfile.Builder builder;
    try {
        builder = new SipProfile.Builder("13", "10.0.0.4");
        builder.setPassword("13");
        builder.setPort(5062);
        builder.setProtocol("UDP");
        mSipProfile = builder.build();

        try {
            Intent intent = new Intent();
            intent.setAction("android.SipDemo.INCOMING_CALL");
            PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, Intent.FILL_IN_DATA);
            mSipManager.open(mSipProfile, pendingIntent, null);

            mSipManager.setRegistrationListener(mSipProfile.getUriString(), new SipRegistrationListener() {

                public void onRegistering(String localProfileUri) {
                    mNotificationTask.endNotification();
                    mNotificationTask.createNotification(R.drawable.ic_stat_connecting,"Test","Connecting");

                    consoleWrite("Registering with SIP Server...");
                }

                public void onRegistrationDone(String localProfileUri, long expiryTime){
                    mNotificationTask.endNotification();
                    mNotificationTask.createNotification(R.drawable.ic_stat_connected,"Test","Connected");

                    consoleWrite("Ready");
                }

                public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage){
                    mNotificationTask.endNotification();
                    mNotificationTask.createNotification(R.drawable.ic_stat_disconnected,"Test","Failed to connect:"+errorCode);

                    consoleWrite("Registration failed.  Please check settings.");
                    consoleWrite(""+errorCode);
                    consoleWrite(errorMessage);
                }

            });
        } catch (SipException e) {
            e.printStackTrace();
        }
    } catch (ParseException e) {
        e.printStackTrace();
    }
}

Though sometimes it registered successfully, most time I got a error code -9:

Registration failed.  Please check settings.
-9
0

I found this description on reference site:

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

What does it means exactly? I don't have any other SIP application running on my phone.

PS. First time when i am trying to connect, it is working. But second time it returns -9. Maybe i not close connection correctly? I think i have problem because i am trying to close connection but it is not closing...

public void closeLocalProfile() {
    if(mSipManager==null){
        return;
    }
    try{
        if(mSipProfile!=null){
            mSipManager.close(mSipProfile.getUriString());

            consoleWrite("mSipManager Closed - "+mSipProfile.getUriString());
        }
    }catch(Exception e){
        consoleWrite("Failed to close local profile. - "+e);
    }
}
like image 807
VoW Avatar asked Dec 15 '13 11:12

VoW


1 Answers

Delete all SIP account from Call Parameter and retry :

Call App->Parameter->Call account internet Delete all account

PS: Sorry for the name menu, my phone isn't in english

like image 120
zicos22 Avatar answered Oct 15 '22 19:10

zicos22