2

我正在关注 Android 应用程序的 Twilio 的 Android 快速入门教程。这是教程的链接: https ://www.twilio.com/docs/quickstart/php/android-client/make-outgoing-call

我正在尝试拨出电话。我已经使用 Twiml 应用程序设置了一个试用帐户。我已将 URL 设置为令牌,并将 URL 设置为服务于 Twilio xml 的 /call 端点。

我正在接收令牌,并且设备对象的状态已准备就绪。

但是每当我调用 Device.connect 时,都会出现以下错误:在 java util.HashMap 处连接新调用失败 java.lang.NullPointerExpection。

这是我正在使用的代码:

Connection connection = device.connect(null /* parameters */, null /* ConnectionListener */);
                        if (connection == null){
                            Log.e("failed to connect", "Failed to create new connection");  
                        }
4

1 回答 1

0
I also had the same problem but by adding elements to hashmap and passing the map to connect method resolved my problem.
public void connect()
    {
        HashMap<String, String> hash=new HashMap<String, String>();
        hash.put("To", "22");
        connection=device.connect(hash, null);
        if(connection==null)
            Log.w(TAG, "Failed to create new connection");
    } 
于 2015-06-30T09:42:23.640 回答