2

I am following Twilio's Android quickstart tutorial for an Android app. Here is the link to the tutorial: https://www.twilio.com/docs/quickstart/php/android-client/make-outgoing-call

I am trying to make an outgoing call. I have set up a trial account with a Twiml application. I have set the URL to the token, and the URL to the /call endpoint that serves Twilio's xml.

I am receiving the token, and the Device object's status is ready.

But whenever I call Device.connect, I get the following errors: Connecting new call failed java.lang.NullPointerExpection at java util.HashMap.

Here is the code I am using:

Connection connection = device.connect(null /* parameters */, null /* ConnectionListener */);
                        if (connection == null){
                            Log.e("failed to connect", "Failed to create new connection");  
                        }
Pacemaker
  • 1,117
  • 2
  • 17
  • 36

1 Answers1

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");
    } 
vaibhav
  • 21
  • 2