As given in link https://github.com/twilio/voice-quickstart-android#bullet5,
we need to create TwiML application and voice Request url should be set for e.g. https://twiliodev.mycompany.com/makeCall to make call. Then what should be written in makecall function to connect the current call because if we use Dial verb then it make another call.
Note : I am using Twilio programmable voice to connect two Android device using VOIP.
Now the question is what Twiml response should be send in MakeCall function to get call connected, because in following function if I return blank response then call didn't connect.
[HttpPost]
public ActionResult MakeCall()
{
var response = new VoiceResponse();
return TwiML(response);
}
Edit @Alan Thanks to reply. As I am using c# at server side. I have used Dial Verb as
var dial = response.Dial(callerId: from);
Which Connect call and Immediately disconnect bcoz client verb is missing. Now how to append Client verb in Dial verb, I am using Client verb as
dial.Append(client);
and Twiml response is
<Response>
<Dial callerId="client:21f421792"></Dial>
<Client>2170561
</Client>
</Response>
And Its return schema error bcoz I think correct schema is
<Response>
<Dial callerId="client:21f421792">
<Client>2170561
</Client></Dial>
</Response>
So can you please help how to add Client verb inside Call Verb.
Thanks.
Edit 2
As Suggested by @philnash this c# link is for Browser to client call and in that it uses new Dial client as
var dial = new Dial();
but I am using Android VOIP SDK to make call between two android devices. For which If I use new Dial object, it will place new Call as child call. Which I don't want to create. And As request by @philnash the complete code for makeCall function is
[HttpPost]
public ActionResult MakeCall()
{
var response = new VoiceResponse();
string from,to;
if (Request.HttpMethod == HttpMethod.Post.Method)
{
from = Request.Form["From"];
to = Request.Form["To"];
}
else
{
from = Request.QueryString["From"];
to = Request.QueryString["To"];
}
var dial = response.Dial(callerId: from);
var client = new Client(to);
dial.Append(client);
return TwiML(response);
}
Edit 3
<?xml version="1.0" encoding="utf-8"?>
<Response>
<Dial>
<Client>2170561
</Client>
</Dial>
</Response>
As I have Noticed for VOIP call if Client xml tag is inside Dial tag then it successfully connect but it counts two legs for each call and charge for two calls. Is it the default behaviour of Twilio to leg two calls in each call when one device want to call to another device or Am I getting wrong ?
Again please note I am talking about two android device VOIP connection via Twiml request url to our server.