twilio / voice-quickstart-server-node

voice quickstart server example in node
MIT License
24 stars 37 forks source link

Error - 12100 in placeCall #9

Open alexanderkhitev opened 6 years ago

alexanderkhitev commented 6 years ago

I try SwiftVoiceQuickstart when I call from the first device to the second one, after I heard the welcome phrase on the first device, on the second I see Alert with the ability to answer the call, but the first device receives Error - 12100 if the second device answers the call , then I hear the phrase with congratulations. I use node.js server. Please, tell me, how can I fix this?

async function placeCall(request, response) {
  // The recipient of the call, a phone number or a client
  var to = null;
  var from = null;
  if (request.method == 'POST') {
    to = request.body.to;
      from = request.body.from;
  } else {
    to = request.query.to;
      from = request.query.from;
  }
  console.log(to);
  // The fully qualified URL that should be consulted by Twilio when the call connects.
  var url = request.protocol + '://' + request.get('host') + '/incoming';
  console.log(url);
  const accountSid = process.env.ACCOUNT_SID;
  const apiKey = process.env.API_KEY;
  const apiSecret = process.env.API_KEY_SECRET;
  const client = require('twilio')(apiKey, apiSecret, { accountSid: accountSid } );

  if (!to) {
    console.log("Calling default client:" + defaultIdentity);
    call = await client.api.calls.create({
      url: url,
      to: 'client:' + defaultIdentity,
      from: 'client:' + from,
    });
  } else if (isNumber(to)) {
    console.log("Calling number:" + to);
    call = await client.api.calls.create({
      url: url,
      to: to,
      from: callerNumber,
    });
  } else {
    console.log("Calling client:" + to);
    call =  await client.api.calls.create({
      url: url,
      to: 'client:' + to,
        from: 'client:' + from,
    });
  }
  console.log(call.sid)
  //call.then(console.log(call.sid));
  return response.send(call.sid);
}

My goal is to make a full-fledged call between two users.

bobiechen-twilio commented 6 years ago

Hi @alexanderkhitev

When making direct call between clients you will not need the url parameter in the client.api.calls.create method call. The 12100 error code usually means something incorrect with the TwiML response. Could you help us check the Programmable Voice Dashboard and see what is the error being logged when you see the error?

Thanks -bobie

alexanderkhitev commented 6 years ago

Hi @bchen-twilio

Error - 12100

Document parse failure

Twilio was unable to parse the provided XML Document.

Msg ""
parserMessage "Error on line 1 of document : Content is not allowed in prolog. "
ErrorCode "12100"
LogLevel "ERROR"
kbagchiGWC commented 6 years ago

@alexanderkhitev

Have you created an application sid and followed the instructions provided https://github.com/twilio/voice-quickstart-swift#11-make-client-to-client-call?

When you make a call using the voice-quickstart-server-node server code, https://github.com/twilio/voice-quickstart-server-node/blob/master/src/server.js#L88 should print the TwiML the server is generating in the console. Can you share that here? It should look something like this if you are calling a client device2.

<?xml version="1.0" encoding="UTF-8"?>
    <Response>
        <Dial callerId="client:quick_start">
            <Client>device2</Client>
        </Dial>
    </Response>
AntonAdamkovich commented 4 years ago

@kbagchiGWC am I right6 that If i want to make call between 2 clients I need to delete url parameter to stop invoke incoming() function image Or i have to implement connection between 2 clients inside this function?

kbagchiGWC commented 4 years ago

@AntonAdamkovich To be able to make client to client calls - you can follow the code in makeCall function.

You are correct the required params to make client to client calls are to and callerid, url is not required.

placeCall function uses Twilio REST API to make calls where url param is required. This endpoint is used in our mobile quickstart README to demonstrate incoming push notification.

wertpoiu commented 3 years ago
Msg ""
parserMessage "Error on line 1 of document : Content is not allowed in prolog. "
ErrorCode "12100"
url "http://fbdb80f65544.ngrok.io/placeCall"
LogLevel "ERROR"
wertpoiu commented 3 years ago

Msg "" parserMessage "Error on line 1 of document : Content is not allowed in prolog. " ErrorCode "12100" url "http://fbdb80f65544.ngrok.io/placeCall" LogLevel "ERROR"

I am getting this error. no twiml in response.

wertpoiu commented 3 years ago

Msg "" parserMessage "Error on line 1 of document : Content is not allowed in prolog. " ErrorCode "12100" url "http://fbdb80f65544.ngrok.io/placeCall" LogLevel "ERROR"

fixed this error, but not getting below error

<!doctype html5>