4

Android 用の Twilio SDK を正常に統合しましたが、それを使用して呼び出しを行うと、接続されず、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]
4

1 に答える 1