0

**

<Response>
    <Dial record="true" timeout="15" timeLimit="4257" callerId="+14589775871" action="http://demo.com/CallCharge.php?rid=81;4260" >
        <Number  url="http://demo.com/CallReceiver.php?name=Deval">+14582783238                </Number>
    </Dial>
</Response>

**

In the above twiml,

*I call to 14582783238 number from this twilio number 14589775871

Receiver (14582783238) decline the call but it still it connected the called by 14589775871*

As per twilio rule

1) if receiver pickup the Call than it will go to this url "http://demo.com/CallReceiver.php?name=Deval" say message

2) if receiver decline the Call than it will not got to this url "http://demo.com/CallReceiver.php?name=Deval" but it will happen over their.

In second point, Twilio call not properly handle it or i doing somthing wrong here?

Please let me know as soon as possible about this matter.

1 Answers1

1

http://demo.com/CallCharge.php is called at the end of the call, be it after a call or on hang-up.

Twilio will automatically pass the DialCallStatus, DialCallSid, DialCallDuration and RecordingUrl request parameters to your action URL.

<?php

/* CallCharge.php */

$DialCallStatus = isset($_REQUEST['DialCallStatus']) ? $_REQUEST['DialCallStatus'] : "";
$DialCallDuration = isset($_REQUEST['DialCallDuration']) ? $_REQUEST['DialCallDuration'] : "";

if($DialCallStatus != "completed") {
  // Don't charge
} else {
  // Charge $DialCallDuration
}

https://www.twilio.com/docs/api/twiml/dial

aergistal
  • 29,947
  • 5
  • 70
  • 92