当应用长时间保持活动状态时,有时会出现此异常。
谁能说出什么问题?
通话失败
java.lang.IllegalArgumentException: Account SID cannot be null when making a call
at com.twilio.client.impl.MakeCallCommand.<init>(MakeCallCommand.java:33)
at com.twilio.client.impl.CallControlManager.makeCall(CallControlManager.java:423)
at com.twilio.client.impl.InternalConnectionImpl.connect(InternalConnectionImpl.java:212)
at com.twilio.client.impl.DeviceImpl$2.onCompletion(DeviceImpl.java:339)
at com.twilio.client.impl.MediaManager.onPlayComplete(MediaManager.java:279)
at com.twilio.client.impl.MediaManager.queueSound(MediaManager.java:173)
at com.twilio.client.impl.DeviceImpl.connect(DeviceImpl.java:335)
at com.lola.activities.CallingActivity.connect(CallingActivity.java:199)
at com.lola.activities.CallingActivity.onCreate(CallingActivity.java:92)
at android.app.Activity.performCreate(Activity.java:5122)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
at android.app.ActivityThread.access$600(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
**编辑:**这是单击“呼叫按钮”时调用的connect()方法:
public void connect(String fromMobileNo, String phoneNumber)
{
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("frommobileno", fromMobileNo);
parameters.put("mobileno", phoneNumber);
Log.d("parameters", parameters + "");
Log.d(TAG, "device :" + device);
Log.d(TAG, "device :" + device);
if(device == null)
{
Toast.makeText(getApplicationContext(),"Sorry from our side.Please try again.",Toast.LENGTH_LONG).show();
finish();
}
else{
connection = device.connect(parameters, (Controller)getApplication()/* ConnectionListener */);
if (connection == null && ((Controller)getApplication()).basicConnectionListener != null)
((Controller)getApplication()).basicConnectionListener.onConnectionFailedConnecting(new Exception("Couldn't create new connection"));
}
if (connection != null){
Controller.setConnection(connection);
}else {
Log.w(TAG, "Failed to create new connection");
}
}
最佳答案
能力令牌具有生命周期。它在它过期后过期。我认为,此问题与您的功能令牌到期有关。
因此,请更新您的功能令牌以解决此问题。
Check out this
请按照以下步骤解决此问题
步骤1:在拨打电话之前,请先尝试检查设备的状态。
Check device state
步骤2:如果您的设备处于离线状态,请尝试更新令牌。如果准备就绪,请致电。如果忙,不要打电话。
Device State Values
关于android - Twilio-出现错误:拨打电话时帐户SID不能为空,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34690759/