Skip to content

Error - 12100 in placeCall #9

@alexanderkhitev

Description

@alexanderkhitev

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.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions