TaCode Tuesdays: Call Forwarding App Made Easy

Posted by Pedram Mohammadi on August 23, 2016

tacode-tues-blog-wk9

Welcome back to TaCode Tuesdays! This is the only place you can find snippets of code for use in your very own text/voice apps, along with a weekly dose of taco puns. I’m a developer here at Zang and not only am I a big fan of tacos (if that wasn’t already apparent), I’m also a fan of open source. My goal is to share a new app idea each week that you're free to use “as is” or modify and use as the basis for your next app—no coding ability required.

Last week I outlined a piece of code for creating a conference call application—you can check that out here, and as always, if you’d like to learn how to get started on Zang, take a look at our very first post.

This week I’m going to show off how you can make a simple call forwarding app. The point of this app is to redirect phone calls when you're not in the office or at home. A customer or friend could call your Zang number, which directs the call to one number and if you don't pick up at that location, it'll redirect the call to a secondary number.

But before I move on to the code, below you’ll find your taco tip for the week.

This week's taco tip is the most important taco tip of all!

Experiment. Eat. Modify. Repeat.

The great thing about tacos is that, unless you're going for authenticity, they can be anything you'd like. If you want tacos for breakfast, dessert, or some type of fusion, then why not try it out? And if you've been eating tacos as long as I have, it always helps to mix it up!

Let’s Taco ’Bout the App

You’ll need to have a Zang number in order for the app to work. If you’d like to learn how to set up your Zang number and the two documents that’ll house the code, check out our first ever post.

So, before we start, here’s how the app works:

  1. A person calls your Zang number.
  2. The call is directed to your first device (maybe a deskphone, home number or cellphone).
  3. If you don't pick up your first device, the call gets forwarded to your second device.

Let's begin with creating the 2nd document, then work our way backwards—it's a little easier this way. Anyways, let's call this document "Call Forwarding App - Part 2". Check out the code below:

<Response>
    <Dial >XXXXXXXXXXX</Dial> <!--Enter the second phone number that you'd like your incoming calls to be directed -->
</Response>
 
Before we move onto the next document, make sure you copy the Public URL of the document you've just created. We'll need to add it to our next document in two places—we'll call this next document "Call Forwarding App - Part 1".
 
<Response>
    <Dial action="Enter the Public URL for the 'Call Forwarding App - Part 2' script" method="GET" ifMachine='redirect' ifMachineUrl="Enter the Public URL for the 'Call Forwarding App - Part 2' script">XXXXXXXXXXX <!--Enter the first phone number that you'd like your incoming calls to be directed-->
    </Dial>
</Response>
 

There you have it! A call forwarding app that redirects callers if you're not able to pick up at your first location/number. If you’d like more info on our dialing capability, check out our documentation—that should give you some ideas on how to expand on what we've just made.

Again, if you'd like to learn how to get this fully functionality, then check out our first blog post here. It outlines some additional steps that you'll have to perform after you get these documents created.

Well, that’s it for this week! If you have any thoughts about the app or just want to share your own taco-related thoughts, you can comment below. If you want a reminder, sign up to get notifications of new blog posts. I’ll be back next week with a new post of “TaCode Tuesday,” where I’ll be highlighting even more free code and apps.

Topics: Communication Apps, Ideas, TaCode Tuesday, cPaaS