Bhuvan
Bhuvan

Reputation: 4187

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

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.

Upvotes: 0

Views: 52

Answers (1)

philnash
philnash

Reputation: 73075

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.

Upvotes: 1

Related Questions