Stuck with Android SIP for VoIP - Registration not running

眉间皱痕 提交于 2019-12-12 17:06:00

问题


I have an Elastix server, which is being used by my desktop calling app and Zoiper App perfectly for calling purposes. However my own app, which is using Android SIP is not working fine and I am unable to locate the real problem. Whenever I call for profile registration, it gets failed and error message of REGISTRATION NOT RUNNING shows in the logs.

here is my code snippet:

public void InitializeProfile()
    {
        if (mSipManager == null)
        {
            return;
        }

        if (mSipProfile != null){
            closeLocalProfile();
        }

        SipProfile.Builder builder = null;
        try {
            builder = new SipProfile.Builder(Username, Domain);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        builder.setPassword(Password);
        mSipProfile = builder.build();

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

        } catch (SipException e) {
            Log.i("open", e.toString());
            e.printStackTrace();
        }




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

                public void onRegistering(String localProfileUri) {
                   // updateStatus("Registering with SIP Server...");
                    Log.i("helloworld", "Registering with SIP Server...");

                }


                public void onRegistrationDone(String localProfileUri, long expiryTime) {
                   // updateStatus("Ready");
                    Log.i("helloworld", "Ready");
                }


                public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage) {
                   // updateStatus("Registration failed.  Please check settings.");
                    Log.i("helloworld", "Registration failed.  Please check settings."+ errorMessage+ " " + Integer.toString(errorCode));
                }
            });
        } catch (SipException e) {
            e.printStackTrace();
        }

    }

来源:https://stackoverflow.com/questions/37682947/stuck-with-android-sip-for-voip-registration-not-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!