0
votes

Situation

I use Twilio iOS SDK for my iOS Voip application.

I'm trying to call from my Voip application to any numbers I stacked in some points though.

I already confirmed that Http request is sent to my app request url which I set on the url both when I make outgoing call from my Voip application and when get incoming call to my Voip application.

In short, below is the flow which I think it true when I call from my Voip application

type the number and call (iOS Voip Application ) -> the request url is called and returns TwiML to call number I typed(my server side) -> call to the number(Twilio Service) -> get call(phone)

Question

  1. What is the best practice to call from Voip to any numbers?

    • can I set different request url for incoming and outgoing call separately in one application on the Twilio console, or we have a way to judge if it's incoming or outgoing call by parameter?
  2. What kind of TwiML I should return when I want to make an outgoing call from my Voip Application to the phone?

    • My server side script returns <Response><Dial><Number>090xxxxxxxxx</Number></Dial></Response> when the request url which I set was called to call from my Voip application, but it failed unfortunately and recorded not as outgoing call but as incoming call on Twilio call logs. I know I should return <Response><Dial><Client>name</Client></Dial></Response> when it comes to get an incoming call I think it's not appropriate for outgoing one though.

Kind Regards.

Edit

Below is the request I got for incoming call from any phone numbers to my Twilio number and the TwiML I return to call my Twilio number in Voip application. It's working well.

[request]
<QueryDict: {u'FromZip': [u''], u'From': [u'+8190xxxxxxxx'], u'FromCity': [u''], u'ApiVersion': [u'2010-04-01'], u'ApplicationSid': [u'AP192f34d8a08f17592163af2c6cxxxxxx'], u'To': [u'+8150xxxxxxxx'], u'ForwardedFrom': [u'050xxxxxxxx'], u'CallStatus': [u'ringing'], u'CalledState': [u''], u'FromState': [u''], u'Direction': [u'inbound'], u'ToCity': [u''], u'ToZip': [u''], u'CallerCity': [u''], u'FromCountry': [u'JP'], u'CalledCity': [u''], u'CalledCountry': [u'JP'], u'Caller': [u'+8190xxxxxxxx'], u'CallerZip': [u''], u'AccountSid': [u'AC41ebdf749095141bfdb182fbd8fxxxxx'], u'CalledVia': [u'050xxxxxxxx'], u'Called': [u'+8150xxxxxxxx'], u'CallerCountry': [u'JP'], u'CalledZip': [u''], u'CallSid': [u'CA7afa3aae965d9207b7e8b065e9dxxxxx'], u'CallerState': [u''], u'ToCountry': [u'JP'], u'ToState': [u'']}>

[TwiML]
<?xml version="1.0" encoding="UTF-8"?><Response><Dial><Client>name</Client></Dial></Response>

While the incoming call does work well, below is the debugged outgoing call request from my Voip application to any phone numbers via my server and the TwiML I returned. It has failed to call and I confirmed the Twilio call log shows no 'To' number while 'From' number is my client name which I used for capability.allow_client_incoming(my client name). [request]

[TwiML]
<?xml version="1.0" encoding="UTF-8"?><Response><Dial><Number>090xxxxxxxx</Number></Dial></Response>
1

1 Answers

1
votes

Twilio developer evangelist here.

If I were you, I would go through the Twilio Client quick start for iOS which will show you various ways you can build this.

To answer your questions.

  1. You can't set different request URLs for inbound and outbound using the same number with Twilio Client, but you can tell whether it is inbound or outbound by checking the direction parameter.

  2. You should use <Dial> and <Number> when going outbound VOIP to numbers. I don't know why that would fail. Could you possibly share more information on the error?