1
votes

I want to create the following:

  1. A line number, let's say 741-SUPPORT (just an example), where people can call.
  2. When somebody calls, I want them to listen some text (I use <Say>) and then, forward their call to my number.
  3. When I receive the call, I want to listen to a text that announces me that this call comes from that line, and allows me to press 0 to accept de call, or any other number to reject it.
  4. In case that I accept, both calls get connected. Otherwise, the caller should be able to leave a message.

What I've done so far:

First TWIML used when the caller calls to 741-SUPPORT

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Say voice="alice" language="en-US">
        This call is being recorded.
        Please hold on, your are being connected.
    </Say>
    <Dial action="CallEnded.php" timeout="15" timeLimit="600" callerId="+1741SUPPORT" record="record-from-answer">
        <Number action="JoinCall.php">+PRIVATE NUMBER HERE</Number>
    </Dial>
</Response>

JoinCall.php

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Gather timeout="10" numDigits="1" action="CallAccepted.php">
        <Say voice="alice" language="en-US">
            You have an incomming call from 741SUPPORT.
            Press 0 to accept the call, press any other number to reject the call.
        </Say>
    </Gather>
</Response>

CallAccepted.php

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <?php if ($_POST['Digits'] == '0') { ?>
    <Say voice="alice" language="en-US">
        Call accepted.
        This call is being recorded.
    </Say>
    <?php } else { ?>
    <Say voice="alice" language="en-US">
        Call will be rejected.
    </Say>
    <Hangup/>
    <?php } ?>
</Response>

CallEnded.php

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Say voice="alice" language="en-US">
    <?php if ($_POST['DialCallStatus'] != 'completed') { ?>
        We had issues connecting the call, please try again later.
    <?php } else { ?>
        Thanks for your call. Goodbye!
    <?php } ?>
    </Say>
</Response>

So I would like to know:

  • How can I play hold music on the caller's side while all the logic is performed?
  • How can I disconnect from the call and ask the caller to leave a message?
1
Did you find a solution to this? i want to do the same exact thing and I'm not sure how to implement it using the queue.user2012677

1 Answers

1
votes

Consider using a Enqueue. So the person dials in then send them to the queue specifying the waitUrl. (Use this to play music).

When u accept the call dial the queue and pick up the call.

Off the top of my head, if you reject the call then you will have to use the rest api to redirect the call to another url that then says thank you but no thank you.