twilio / voice-quickstart-android

Quickstart app for the Voice Android SDK
https://www.twilio.com/docs/api/voice-sdk/android/getting-started
MIT License
189 stars 141 forks source link

outgoing side i'm not get accepted or onParticipantConnected call method on twillio. I'm call outgoing side on Call, it is allways get on Onconnected method from outgoing side and I don't get or update onconnect or onconnected and accepted or participate method method from outgoing side on Android twillio. twillio voice call.listener only get three method onfailure, connected and onDisconnected method orreride. just like in twiilo Video calling get onParticipantConnected method to esally find out both user are connected , so i have esaly start timmer or chornometer. please provide me exact solution #248

Closed lakshmansinghrathore closed 5 years ago

lakshmansinghrathore commented 5 years ago

befor i'm using implementation 'com.twilio:voice-android:2.0.4' than after implementation 'com.twilio:voice-android:2.0.7' but both do not get the exact solution.

my Android project sdk version is -

compileSdkVersion 27 defaultConfig { applicationId "project name" minSdkVersion 21 targetSdkVersion 27 versionCode 2 versionName "1.0" multiDexEnabled true

and build.gradle=>

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.1.0'

// classpath 'com.google.gms:google-services:4.0.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects { repositories { google() jcenter()

}

}

task clean(type: Delete) { delete rootProject.buildDir }

Please ensure that you are not sharing any Personally Identifiable Information(PII) or sensitive account information (API keys, credentials, etc.) when reporting an issue.

Description

need help, I want to start "chronometer" when user accepts a call or connecting call. I have to override three method - 1)onConnectFailure , 2)onConnected and 3) onDisconnected . but I'm facing problems at the outgoing calling time than connected method directly call and on connecting can not call at the call ringing time, so I'm cannot manage the programmatically start chronometer. Currently in your demo code "chronometer" start in "onConnected" method. In SDK there a Interface "InternalListener", In this interface "connecting" but it's not public so I can't access this method on Outgoing Activity class. I have not to get a suitable answer [Description of the issue]

Steps to Reproduce

  1. [Step one]
  2. [Step two]
  3. [Insert as many steps as needed]

Code

Call Listner use in Outgoing Activity => private Call.Listener callListener() { return new Call.Listener() { public ContentResolver callControlManager;

        @Override
        public void onConnectFailure(Call call, CallException error) {
            setAudioFocus(false);
            Log.e(TAG, "Connect failure");
            String message = String.format("Call Error: %d, %s", error.getErrorCode(), error.getMessage());
            Log.e(TAG, message);
            Snackbar.make(coordinatorLayout, message, SNACKBAR_DURATION).show();
        }

        @Override
        public void onConnected(Call call) {
            try {

                setAudioFocus(true);
                Log.e(TAG, "Connected");
                activeCall = call;
                Log.v(TAG, "call status=> " + call.getState());
                Log.v(TAG, "Call From" + call.getSid());
                updateCallInterface(ApiConstant.ACTION_CONNECT);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        @Override
        public void onDisconnected(Call call, CallException error) {
            Log.e(TAG, "Disconnected");
            if (error != null) {
                String message = String.format("Call Error: %d, %s", error.getErrorCode(), error.getMessage());
                Log.e(TAG, message);
                Snackbar.make(coordinatorLayout, message, SNACKBAR_DURATION).show();
            }
            updateCallInterface(ApiConstant.ACTION_DISCONNECT);

        }
    };
}

................................................... And I have to call updateCallInterface method to get current status according to start the chronometer. If I'm outgoing call at this time call directly call " connected" method so I'm starting chronometer. there is wrong programmatically because Outgoing Side timmer is started but incoming side does not accept call. OnIncomming side fine work and get all of the updated status from send to outgoing user. but incommeing status do not get on outging side.

...............................

private void updateCallInterface(String flage) {

    Log.v(TAG, "updateCallInterface Flag " + flage);
    switch (flage) {
        case ApiConstant.ACTION_PENDING:
           Glide.with(this).load(imageUrl).placeholder(R.drawable.profile_placeholder).diskCacheStrategy(DiskCacheStrategy.ALL).dontAnimate().into(imgProfile);
            tvName.setText(userName);
            audioManager.setSpeakerphoneOn(false);
            mute_action_speaker.setImageResource(R.mipmap.icon_speaker_off);
            chronometer.setVisibility(View.INVISIBLE);
            chronometer.stop();
            tvstatus.setText(FinalKeywords.RINGINNG);
            muteActionFab.setImageDrawable(ContextCompat.getDrawable(OutgoingVoiceActivity.this, R.drawable.white_icon_mic_on));
            break;

        case ApiConstant.ACTION_ACCEPT:
            Log.e(TAG, "updateCallInterface: " + "Call accept");
            //isConnected = true;

            break;
        case ApiConstant.ACTION_CONNECT:
            if (activeCall != null) {
                tvstatus.setText(FinalKeywords.CONNECTED);

            } else {
                tvstatus.setText(FinalKeywords.CONNECTING);
            }

            /*  Old Line*/
            chronometer.setVisibility(View.VISIBLE);
            chronometer.setBase(SystemClock.elapsedRealtime());
            chronometer.start();

            /*New Lines */

            callChronometerlistner();

            baseTime = SystemClock.elapsedRealtime() - stopTime;
            chronometer.setBase(baseTime);
            chronometer.setFormat("HH:MM:SS");
            Log.v(TAG, "Chronometer Time Format " + chronometer.getBase());

            Log.v(TAG, "Chronometer Base Time " + chronometer.getBase());

            break;

        case ApiConstant.ACTION_REJECT:
            chronometer.stop();
            audioManager = null;
            finish();
            tvstatus.setText("");
            setAudioFocus(false);

            break;
        case ApiConstant.ACTION_DISCONNECT:
            setAudioFocus(false);
            chronometer.stop();
            audioManager = null;
            if (activeCall != null) {
                activeCall.disconnect();
                activeCall = null;
            }
            tvstatus.setText(FinalKeywords.DISCONNECTING);
            setAudioFocus(false);
            finish();
            break;
    }
}
// Code that helps reproduce the issue

Expected Behavior

[What you expect to happen]

Actual Behavior

[What actually happens]

Reproduces How Often

[What percentage of the time does it reproduce?]

Logs

// Log output when the issue occurs

Versions

All relevant version information for the issue.

Voice Android SDK

implementation 'com.twilio:voice-android:2.0.7'

OS Version

compileSdkVersion 27 defaultConfig { applicationId "com.clinicalls" minSdkVersion 21 targetSdkVersion 27 versionCode 2 versionName "1.0" multiDexEnabled true

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Device Model

All of the types of android device

kbagchiGWC commented 5 years ago

This seems like a duplicate of https://github.com/twilio/voice-quickstart-android/issues/249. Closing it.