Я работаю с Twilio android SDK, когда я нажимаю на кнопку зависания, всегда получаю сообщение об ошибке? Не удается отключить вызов после набора номера?

Я успешно интегрировал Twilio SDK для Android, но когда я пытаюсь позвонить с ним, он не подключается и показывает сообщение об ошибке в logcat, я получаю следующие ошибки:

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. 

////// Чтобы звонить

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"); 
} 

// Отключить телефон

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

и на моем событии 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]

Ответы на вопрос(1)

Ваш ответ на вопрос