0

Our usecase in simplified manner: 1) Custom come to our website 2) he see a list of phone numbers 3) he click on a phone number to call.

For above i am reading https://www.twilio.com/docs/quickstart/java/client/outgoing-calls

Our plan is to give this call functionality as a added feature where we will charge end customer what twilio charges us.

Now i need to keep trace of number of call/min each of our customer used. so that i can charge him for the same.

What are the way i can keep track of min/call by each of our customer?

Edit: Is there any api/webhock that can be used to keep track of when a particular call started and ended so that we can save the duration of call and charge for the same.

Bhuvan
  • 4,028
  • 6
  • 42
  • 84
  • The question is quite broad and you provide no code or output. You're not even stating which language you're using or am I overlooking something? (I assume it's Java because of the twilio link but who knows?) You got to give people something to work with if you want meaningful advice. – jDo Mar 11 '16 at 14:58
  • @jDo this question doesnt require a specific langauge or code.. the question is, is there something which twilio provide to track it. i have added some extra info – Bhuvan Mar 11 '16 at 15:48
  • Good. Simply by writing *"(...) is there something which **twilio** provide to track it."*, you narrow down the scope considerably. Apparently, you're looking for some features in the twilio API if they exists. Without that, you could've been asking for some SQL database solution, a Java function or whatever. – jDo Mar 11 '16 at 16:08

1 Answers1

1

Twilio developer evangelist here.

Good news! There are a couple of ways for you to find out this information.

Firstly, you can set a StatusCallback URL that receives webhook information about calls. You can either set this on the level of the number, using the phone numbers section of the Twilio portal. Or you can set a StatusCallback parameter when you create calls using the REST API. Or you can set a StatusCallback attribute when creating calls using the <Number> noun in TwiML.

Either way you set the callback, you will get a webhook back to the URL you set when the call is over. That webhook will include a CallDuration parameter with the duration of the call in seconds.

For more accurate price reporting, you can actually query the REST API. Call instance resources have a Price property. The only drawback here is that the Price property may not immediately be available. So you may need to schedule jobs to check for the price after a call is complete.

Let me know if this helps at all.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • this is great.. will try it out.. also there is concept of subaccounts which is also great but has a limit of 1000 – Bhuvan Mar 19 '16 at 06:51
  • It does have a limit, but if you think you will need more then you should talk to sales about getting that limit lifted. – philnash Mar 19 '16 at 08:36