Estoy trabajando con Twilio android SDK. ¿Cuando hago clic en el botón de colgar siempre aparece un error? ¿No puedo desconectar la llamada después de marcar?

He integrado Twilio SDK para Android con éxito, pero cuando intento hacer una llamada con él, no se está conectando y aparece un mensaje de error en Logcat. Recibo los siguientes errores:

1) Failed to hangup call due to error code: 70015, message: pjsua_call_hangup(): Object already exists (PJ_EEXISTS) 

2) Connection disconnected with error code 31000 and message Generic error 

this both errors occurs when i am calling disconnect method if i comment this method then my calling is working fine and i make call but if i call this method phone.disconnect(), i am getting error shown as above. 

This is my methods which i am using to make calls and to disconnect the calls. 

////// Para hacer llamadas

public void connect(String phoneNumber) { 
Map parameters = new HashMap(); 
parameters.put("PhoneNumber", phoneNumber); 
connection = device.connect(parameters, null /* ConnectionListener */); 
if (connection == null) 
Log.w(TAG, "Failed to create new connection"); 
} 

// Para desconectar el teléfono

public void disconnect() { 
if (connection != null) { 
connection.disconnect(); 
connection = null; // will null out in onDisconnected() 
if (basicConnectionListener != null) 
basicConnectionListener.onConnectionDisconnecting(); 
} 
} 

y en mi evento OnClick:

public void onClick(View view) { 
if (view.getId() == R.id.dialButton) 
Toast.makeText(getApplicationContext(), "Dialing...", Toast.LENGTH_LONG).show(); 
phone.connect("PHONE NUMBER"); 
if (view.getId() == R.id.hangupButton) 
Toast.makeText(getApplicationContext(), "Call Disconnected...", Toast.LENGTH_LONG).show(); 
phone.disconnect(); 

Please suggest me and help me because i tried all possible thing for hangout but still not able to solve it.Thanks in advance. ![enter image description here][1]

Respuestas a la pregunta(1)

Su respuesta a la pregunta