Call for Beta Testers: Object Cache edition

I’m looking for a few brave and kind souls that would like to help beta test Object Caching in OpenVBX.

The current release of OpenVBX only supports APC and it only supports it for API query results. This new build supports local memory, database (MySQL), APC & Memcache. This new build shows great performance increases when either APC or Memcache is available.

Cache is implemented in two general areas:

General Object Cache

The first is a general object cache for OpenVBX. This layer is for objects used in OpenVBX like Flows, Users, Devices and Settings. Cache settings are manually configured using a cache config file in the OpenVBX config directory.

This layer has a 3 possible modes:

  • Local (single page load memory, default). This layer is used when either APC or Memcache is not available. It will simply create an cache for the current page load. While it doesn’t provide a drastic increase in performance, it does reduce a few database hits during a single page load.
  • APC. This layer uses the standard PHP APC library (http://pecl.php.net/package/apc). This build was developed and tested using APC installed via PECL.
  • Memcache. This layer uses the PECL Memcache library (http://pecl.php.net/package/memcache not the Memcached library though support for both would be easy to add if there’s actual demand). Multiple memcache server use is supported via the config file. This build was developed and tested using Memcache installed via PECL.

API Cache

The 2nd is an API cache. At this time the API cache uses only the database to cache the results of API requests. The API Cache adds a new table to the database. Despite being named API Cache, this cache layer can be used for just about any data that should be transient in nature.

Read More »

OpenVBX 1.1 Released

openvbx phone logoAutumn has been a busy time at Twilio, and we’ve launched lots of great new features like Twilio Connect for Tenants, Client Presence and International Phone Numbers.

OpenVBX 1.1 adds support for these features plus a host of other changes and fixes around TwiML features, user management, API communications and overall usability. We’ll touch on some of the major points here.

OpenVBX 1.1 can be downloaded now via the Downloads Page. For the complete list of changes you can reference the changelog.

Read More »

Using the new Twilio Services library in a CodeIgniter Application

We are currently in the process of upgrading and testing the new Twilio Services library with OpenVBX which is built on CodeIgniter. And while we’re doing a deep integration with the library we found that it doesn’t need to be that hard to get the new Library integrated in to a CodeIgniter based application.

There are many ways that this can be done, but here we’ll illustrate a very straight forward and simple way of integrating the new library.

Read More »

jQuery 1.6 in OpenVBX

With the release of OpenVBX 1.0 we also rolled out an upgrade to jQuery and jQuery UI. OpenVBX now ships with jQuery 1.6.2 and jQuery UI 1.8.14.

This is of note because jQuery 1.6 made some significant changes that may or may not affect your OpenVBX plugins or custom developed applications.

.prop() vs. attr()

The most notable change was in how DOM Properties are handled. From the jQuery Blog:

In the 1.6 release we’ve split apart the handling of DOM attributes and DOM properties into separate methods. The new .prop() method sets or gets properties on DOM elements, and .removeProp() removes properties. In the past, jQuery has not drawn a clear line between properties and attributes. Generally, DOM attributes represent the state of DOM information as retrieved from the document, such as the value attribute in the markup <input type="text" value="abc">. DOM properties represent the dynamic state of the document; for example if the user clicks in the input element above and types def the .prop("value") is abcdef but the .attr("value") remains abc.

In a nutshell this means that when dealing with DOM Properties (also known as Boolean Attributes) the .prop() method should be used instead of .attr().

For example:

<script type="text/javascript">
	// OLD WAY
	$('.my-node').attr('checked', 'checked');
	$('.my-node').attr('checked', false);
	$('.my-node').removeAttr('checked');

	// NEW WAY
	$('.my-node').prop('checked', true);
	$('.my-node').prop('checked', false);
</script>

See these blog posts for the release notes on jQuery’s 1.6 releases:

Named Attributes in Selectors

Another notable change in newer versions of jQuery (not necessarily just in 1.6+) is how named attributes should be addressed in selectors. Older versions of jQuery would allow attribute values to be addressed without quotes but jQuery now requires these quotes to guarantee consistent behavior. For example:

<script type="text/javascript">
	// OLD WAY
	$('.my-input[name=input_name]').val();
	
	// NEW WAY
	$('.my-input[name="input_name"]').val();
</script>

Other Library Upgrades

The upgrade also meant that we needed to upgrade some other libraries as well:

So, be sure to test well with the new release before pushing to your clients. We'd all like to think that an upgrade will work right out of the box, but any time 3rd party libraries, custom development or plugins are involved there's always testing to be done 😉

OpenVBX Now Includes Twilio Client

The latest version of OpenVBX is now live, and features native integration of Twilio Client. OpenVBX users now have a sleek, intuitive interface for making and receiving calls directly in the browser to other users. Simply push a button to talk, and the dialpad slides out to enable DTMF tones, hangup, and mute.

We’ve designed OpenVBX as an open source example of what we’d love to see built using Twilio, and these latest improvements benefit the thousands of businesses who enjoy this simple, powerful virtual branch exchange phone system.
OpenVBX with Twilio ClientWhen Twilio released OpenVBX in June of last year, our goal was to make it dead-simple for anyone to build a powerful and flexible phone system for their business. Today we’re taking OpenVBX to the next level with the launch of OpenVBX 1.0 featuring Twilio Client.

OpenVBX with Twilio Client brings the power and affordability of VoIP to the VBX, all while retaining the signature elegance and ease of use of a Twilio product. OpenVBX always made it easy to build phone trees, route calls to any phone and transcribe voice messages. Now, thanks to the integration with Twilio Client, an OpenVBX implementation can make and receive calls from any modern browser.

Set Your Status

You can set your OpenVBX status to be online and available to receive calls, in which case your calls will ring in your browser. If you’re offline (or if you don’t answer from your browser) your calls will be routed to the phone numbers you’ve added on the Devices page.

Receive Phone Calls Directly to Your Browser

To receive calls in your browser you must be the recipient of a Dial applet in a Flow, either through direct selection or through a group.

Outbound Calling From the Browser

Twilio Client is now deeply integrated into OpenVBX, so you can make outbound calls from your browser at any time. Just use the call button to dial out.

These are just a few of the new features baked into OpenVBX with Twilio Client integration! It’s all open source, so you have the freedom to make it your own by installing third party plugins or building your own. So are you ready to take the new OpenVBX for a spin? Get started!

The OpenVBX + SimpleGeo Weather Plugin

OpenVBX plugins can be rich applications with robust functionality but they can also be almost amazingly simple and still pack quite a punch.  OpenVBX takes care of so much of the heavy lifting for building phone apps that you can build phone interfaces that talk to APIs with only a few lines of code.

The SimpleGeo Weather Phone

The SimpleGeo Weather plugin is an example of a very simple plugin that gives callers the weather conditions in a certain area in only a few lines of code.  SimpleGeo has a Context API that provides weather, demographics, or neighborhood data for a specific location.  It also provides map boundaries, congressional districts, sports venues and more.

What we’re using it for here is the weather.  To keep it simple, we’ll stick to the most general overview of the weather (think “cloudy”) but it gives you high and low temperatures, wind speed and direction, humidity and more.

How it Works

First, the code for the plugin is here:  so download that to your plugins directory and follow along.  It uses a slightly modified helper library that has an extra function in it for the weather interface.

The first file of interest is ui.php because it defines the User Interface.

<?php $address = AppletInstance::getValue('address', 'New York, NY'); ?>
<div>
<h2>Enter city and state here and your callers will here the current conditions there.</h2>
<p>This is brought to you by the SimpleGeo API</p>
<div><input name="address" value="<?php echo $address; ?>"></div>
</div>

and this is what it looks like when you drag it into the call flow:

By creating an input element named “address” we can refer back to the value that was entered in the form later by calling the AppletInstance::getValue() function.  Now when someone drags our applet into a call flow and creates an instance of it they can configure it with the city and state it should use to look up the weather.

The next file is twiml.php and it does all the interfacing with Twilio and it’s also pretty straightforward

<?php

   $plugin = OpenVBX::$currentPlugin;
   $info = $plugin->getInfo();
   $path = $info['plugin_path'];

   include($path . "/php-simplegeo/SimpleGeo.php");

   $client = new SimpleGeo('xxxx','xxxx');

   $address = AppletInstance::getValue('address', 'New York, NY');
   $weather = $client->WeatherAddress($address);
   $condition = $weather['weather']['conditions'];

   $response = new Response();
   $response->addSay("The weather in ${address} is ${condition}");
   $response->Respond();
?>

There’s that AppletInstance::getValue() function again and a call to the SimpleGeo API.

Try It

You can try this out right now! Call (651) 433 6297 and follow the prompts to hear the weather in Atlanta, New York, Kansas City or Austin.

What else can it do?

Since Twilio gives you the city, state and zip of the phone number that’s calling your application it could default to using that if you don’t configure an address ahead of time.  It could also prompt the user for a zip code and then give them the weather.

You could even use weather data to alter the behavior of your phone system.  For example, it’s very hot outside so your phone system reminds people to drink plenty of water while they’re waiting on hold.

The great thing about OpenVBX plugins is that you can so quickly integrate the behavior of your phone system with data from other APIs like Foursquare, SimpleGeo, Twitter, FaceBook and thousands more.