Last active
June 15, 2024 07:08
-
-
Save jmadden/a886deb7607756a6a85d53da70445d0e to your computer and use it in GitHub Desktop.
TwiML Incoming Calls - Forward call to numbers in order. Fire off VMail and send SMS on no answer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Response> | |
<!-- Forward to first number and if no answer, action URL points to second number to try --> | |
<Dial timeout="15" action="forward_to_second_number.xml"> | |
<Number url="whisper_instructions.xml">+15554441212</Number> | |
</Dial> | |
</Response> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Response> | |
<!-- Forward to second number and if no answer, action URL points to voice mail. --> | |
<Dial timeout="15" action="vmail.xml"> | |
<Number url="whisper_instructions.xml">+15554449898</Number> | |
</Dial> | |
</Response> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- Use this when you need a value for the action URL, but you don't need it to actually do anything." --> | |
<Response /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Response> | |
<Say> | |
You have reached the voice mail of <your name here>. | |
Please leave a message at the beep. | |
Press the star key when finished. | |
</Say> | |
<Sms to="+14442228989"> <!-- Your mobile number goes here --> | |
You missed a call from {{From}}. | |
</Sms> | |
<Record | |
<!-- response.xml is used to prevent Twilio from requesting the current document URL. --> | |
action="response.xml" | |
method="GET" | |
maxLength="20" | |
finishOnKey="*" | |
/> | |
<Say>I did not receive a recording</Say> | |
</Response> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Response> | |
<!-- response.xml is used in the action URL below so the gather doesn't go into an endless loop. --> | |
<Gather timeout="5" numDigits="1" action="response.xml"> | |
<Say> | |
You have an incoming call. | |
Press 1 to accept. | |
</Say> | |
</Gather> | |
</Response> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The call flow works well but I found another issue I can't seem to solve.
If the original caller doesn't hang up after being connected to one of the forwarded calls, the flow will proceed to the next action in the sequence. I know, we'd assume that once both parties say goodbye, they'd each hang up. Nonetheless, if the original caller does not hang up, even after talking to someone, they will eventually land on the voicemail. Do you have any ideas about how to add a hangup verb to this sequence without compromising the overall flow you made?