0

I have a master account and a sub account. Let's say a caller calls a number in the sub account. The sub account will process this call by outputting some TwiMl and based on some business rules it might need to redirect the flow of this call to the master account (for accounting purposes).

An easy way to do this is simply to dial a number belonging to the master account. This will transfer the call flow from the sub account to the master account. No complications there...

However, in order for me to identify what client this call belongs to on the master account I need to have some unique identifier. When I receive this call on the master account I have to way to match it to a client. Ideally I would like to get the initial CallSid the one originated on the sub account but it seems like that is not possible. So I was looking into passing custom parameters but no luck there either.

It only makes sense that you should be able to somehow link data from sub account to master account. Any ideas on how to accomplish this?

ecorvo
  • 3,559
  • 4
  • 24
  • 35
  • Hey, Twilio Developer Evangelist here. Before I go ahead and try to answer your question, i must confirm something. When you say "for accounting purposes" are you aware that accounts and sub-accounts are funded the same way? Regardless of whether a call is made from the master account or sub-account, the money will always come out of the master account. You can obviously tell which account is using what though. – Marcos Placona Aug 06 '15 at 17:14
  • Yes, I am aware of that. It is complicated to explain the full reason behind it, it is more of a business rule and internal accounting. I rather not get into the nitty gritty of this since it is not the real problem. Basically I need a way to identify a call from a sub account when dialing into the master account. – ecorvo Aug 06 '15 at 18:06

1 Answers1

0

Twilio Developer Evangelist here.

I don't know what you have tried so far, but I think you will find the Call Tracking article useful for what you're trying to do.

The idea here is that you can still use TwiML, but pass the call sid as an action like so:

<Response>
    <Dial action="track_call.php?call_sid=<?php echo(call_sid);?>" method="GET"><?php echo(PHONE_NUMBER);?></Dial>
</Response>

Then on track_call.php you would receive this call sid as an argument. Through the API you can then get all the information you need from the call sid, which will hopefully let you track it all.

Let me know if you need any more clarification, or if you're having issues with anything in particular.

Marcos Placona
  • 21,468
  • 11
  • 68
  • 93
  • But wouldn't the action URL be executed on the Sub Account side? The master account would have no reference to call_sid param – ecorvo Aug 07 '15 at 14:00
  • The action url is executed in your server. The moment a call is started you get access to the sid of that call. The master account itself doesn't care about the sid, but at this point you have the sid and can do whatever you like with it. Unless I misunderstood you, this should solve your problem. – Marcos Placona Aug 07 '15 at 15:42
  • You are not understanding the question. The master account needs to know who is calling in so based on that it will route the call. So without any unique identifier the master account doesn't know where to route the incoming call. Does that makes sense? – ecorvo Aug 07 '15 at 16:06
  • Ok, do you wanna send me an email on marcos @ twilio explaining what you're trying to do? I think I still don't get it. – Marcos Placona Aug 07 '15 at 16:22
  • Its OK Marcos. I appreciate you trying to help but I already got this resolved with someone at Twilio. It is not possible to send POST custom params but we took a different approach. – ecorvo Aug 13 '15 at 14:17
  • Cool, glad you solved it. Maybe it would be a good idea for you to post an answer of what you did and mark that as the answer for future reference. – Marcos Placona Aug 13 '15 at 14:20