Another Open Source Example: Call Forwarding

October 10, 2013

We have created another sample code for PHP developers.

Call Forwarding is a simple app to forward calls received on your Hoiio number to another phone number.

It is very similar to Auto Attendant, which is another sample code for company extensions. In fact, call forwarding is a simpler app of auto attendant.

Go ‘grab’ your copy now, at

Tags: ,
Posted by:

Call Me Back – Chrome Extension

December 13, 2012

Have you ever wanted to talk to a friend about a very important matter, but your mobile phone ran out of money?

Not a problem anymore.

Try out this new Chrome Extension: Call Me Back

Call me back

Image this scenario. You recalled something very important, and you wanted to call your friend/colleague/family immediately. You pick up the phone, dial the number, make the call, but unfortunately, your mobile phone has ran out of money..

What can you do?

No need for panic.

With Call Me Back, you can ask your friend/colleague/family to call you back (assuming it is free for you to receive incoming calls).

How to use?

1. Click here to install Call Me Back for your Chrome browser.

2. Once installed, click on the icon that is added to Chrome, and click on Settings. Enter your Hoiio API credentials in settings.

hoiio app id

3. Click on the icon, enter your friend’s phone number and a message, then Send.

4. (Optional) If it is very urgent, you can enable Voice Message. Instead of sending an SMS, a phone call will be made to your friend!

This could very well save your day?

Add this extension to your chrome , and let us know if you have any comments!

Tags: , , ,
Posted by:

Setup Your Company Directory with the free Google App Engine

November 05, 2012

Following our last PHP sample code, this time we are publishing a sample code using Java on Google App Engine.

Company Directory is a telephony application that let callers connect to company phones by keying an extension. You can find the full source code on github:

A screenshot of how you can configure your company directory after setting up:

Company Directory Webpage

We are using the awesome + free + reliable Google App Engine (Java) as the web server. Also Twitter Bootstrap. And of course Hoiio API.

Go ahead and fork the repository, and perhaps add new features such as Voicemail.

But if all seems too troublesome, how about trying Hoiio Main Line app for $5?

Tags: , ,
Posted by:

An Open Source Example: Auto Attendant

October 29, 2012

We have created an example app with PHP:

With Auto Attendant, you could dictate how your Hoiio number works when it is being called.

For example, with the following configuration,

$directory = array(
    '1'=>array('+6560001111',   "for sales enquiry"),
    '2'=>array('+6560002222',   "for technical support"),
    '3'=>array('+6560003333',   "to speak to our customer care officer"),
    '0'=>array('VOICEMAIL',     "to leave a voicemail message"),

The voice menu will be read over the phone call, and when the caller press “1″, it will transfer the call to the sales enquiry department. Or press “0″, it will record a voicemail message.

This example is fully open source, and we will be very happy if you fork it, and extended to suit your voice app. Let us know if you did something awesome!

Photo Credits: Jim Elyot’s Blog

Tags: ,
Posted by:

Hoiio API Example: WeatherByPhone

February 17, 2012

Another simple yet interesting example was developed using Hoiio API.

This example let you check the weather of your location by using your mobile phone. It makes use of Yahoo weather API.

Application flow:

The app requires the WOEID code which is introduced by Yahoo to uniquely identify any location on Earth. To find the WOEID of your location, you can find by browser/search from the Yahoo weather homepage. The WOEID is in the URL for the forecast page for that city. For example, if you search for Singapore on the Weather home page, the forecast page for that city is The WOEID is 1062617.

The response user will hear is “It is currently 28 degrees celsius and partly cloudy in Singapore“. The application will keep asking the user until he/she hangs up the phone.

Let’s look closer into the code:

  1. Global variables: we define all global variables like appId, accessToken,…
    $appId       = "[Your appId]";
    $accessToken = "[Your accessToken]";
    $server      = "";
    $myUrl       = "[Your notify URL address]";
    1. The appId and accessToken are generated for you when you create an application in the developer portal
    2. The notify URL is the address that Hoiio will notify developer after each step to ask for the next step (or next building block)
  2. The controller: maintain the state of the call to do correct actions
    if ($_POST['call_state'] == "ringing") {
    else if ($_POST['call_state'] == "ongoing") {
    	switch ($_POST['tag']) {
    		case "askZip":
    		case "playMessage":
    else if ($_POST['call_state'] == "ended") {
    	// Call has ended, can do anything here
  3. The askZip() function: send a Gather API to ask for the WOEID codes
    $data = http_build_query(
    	 array(	"app_id" 		=> $GLOBALS['appId'],
    			"access_token" 	=> $GLOBALS['accessToken'],
    			"tag"		=> "askZip",
    			"session"	=> $_POST['session'],
    			"msg"		=> "Please enter your W-O-E-I-D code.",
    			"max_digits"	=> "9",
    			"notify_url" 	=> $GLOBALS['myUrl']));
    do_post_request($GLOBALS['server']."/ivr/middle/gather", $data);
  4. The checkDigitPressed() function:
    $zip = $_POST['digits'];
    // Checks the zip code
    if (strpos($zip, '*') !== false) {
    	playMessage("You have entered an invalid W-O-E-I-D code");
    else {
    	// Get the forecast
    	$forecastStr = do_get_request("" . $zip . "&u=c");
    	if (strpos($forecastStr, "City not found")) {
    		playMessage("You have entered an invalid W-O-E-I-D code");
    	} else {
    		// Extract the temperature info
    		$rss = new SimpleXMLElement($forecastStr);
    		$temp = $rss->channel->item->children('yweather', true)->condition->attributes()->temp;
    		$condition = $rss->channel->item->children('yweather', true)->condition->attributes()->text;
    		$location = $rss->channel->children('yweather', true)->location->attributes()->city;
    		playMessage("It is currently ". $temp ." degrees celsius and ". $condition ." in ". $location .".");

    This function verifies the code then send the http request to Yahoo to get the weather information of that location. If the response is “City not found”, it asks again for the WOEID code.

  5. The playMessage() function: play the result to the user
    $data = http_build_query(
    	array(	"app_id" 		=> $GLOBALS['appId'],
    			"access_token" 	=> $GLOBALS['accessToken'],
    			"tag"			=> "playMessage",
    			"session"		=> $_POST['session'],
    			"msg"			=> $msg,
    			"notify_url" 	=> $GLOBALS['myUrl']));
    do_post_request($GLOBALS['server']."/ivr/middle/play", $data);

That’s it! It’s simple and straight forward and you can do it in less than 30 minutes.


The source code you can download here.

Tags: , ,
Posted by:

Play MP3 Over A Phone Call With Custom Recordings

December 05, 2011

We have released yet another new feature!

Now, you can play custom recordings in .mp3, .wav or .gsm format. This means you can record your own voice, or sing a wonderful song, and play them over a phone call.

How to use

All “msg” parameter now accepts a URL, using a <url> markup. This affects all IVR APIs that have “msg” parameter, such as Play.

You can also mix URL with text. For example, the following will play the text (synthesized to speech), followed by the MP3.

Hello Jane! I am dedicating this song to you. Merry Christmas! <url></url>

You can also throw in Chinese or Japanese text!

Posted by:

Mashup: Google Spreadsheet + SMS API

August 08, 2011

If you do bulk SMS marketing, and stores all the mobile numbers in an excel spreadsheet, then this mashup app would be very useful for you.

SMS Spreader

With this spreadsheet, you can easily manage your SMS marketing, and send them out right from the Google spreadsheet!

To use, open this Google spreadsheet template and make a copy (File > Make a copy). As this mashup uses our SMS API, you have to create an app, obtain your app ID & access token, then plug them into the Settings sheet.


How was this mashup created?

This mashup was created using 2 APIs:

  1. Google Spreadsheet – Every SMS message can be added into the spreadsheet (each row is 1 SMS). Using Google Apps Script (a server side Javascript technology), every row is read, processed and a SMS sent out. The delivery status of the SMS is then retrieved using a cron job, and the status is updated automatically.
  2. Hoiio API – Hoiio provides the SMS API. Sending SMS is simply making a HTTP request using UrlFetch Services.

The code is open sourced and can be accessed by Tools > Script editor (see screenshot below). The code is categorized into:

  • Hoiio API – functions for hoiioSendSms and hoiioCheckSmsStatus
  • Template – boilderplate code for replacing eg. ${“NAME”} in the Message cell with the value in Name cell
  • App – Application specific logics. The functions for the menu “Send SMS” and “Update Status” are written here. It includes reading the Settings sheet for configuration, and reading every row for the SMS to send.

Download SMS Spreader


Tags: , , , ,
Posted by: