Archive for June, 2009

Export your Tweets with PHP

Tuesday, June 30th, 2009

Exporting your Tweets via PHP should be simple. There are several tools that exist but they are annoying and overly complicated.  If you want to print your last 20 Tweets on your web page (like I did with the front page of blyon.com), you can now use my simple script.

The first hack at it failed quickly because Twitter actually rate limits how many times a single host can pull the XML data per-hour.  To fix the rate limit issue I added a very basic cache function to the script which limits the requests to 60 an hour.

Setup and usage is simple, you include the PHP as you always would:

include("./twitter-1.0.php");

Configure the script by editing these items:

/* define where to store the cached result */
$CACHEDIR="/tmp/";

/* define your username */
$USERNAME="BarrettLyon";

/* define the max number of tweets to output */
$MAXTWEETS=20;

/* error message when twitter fails */
$ERRORMSG="Awh... Twitter is broken/down/not working/unhappy...";


Then call twitterPrint() or just hack the script up to do what you want.

If you make changes or have improvement ideas, just comment on this posting and I will update the code.

Get the code here: twitter-1.1.php.

UPDATE: I fixed a bunch of bugs, as a result I released v1.1.

Barrett Lyon creates fun companies that do all sorts of innovative exciting things with video and security.

CDN cdn
BitGravityBitGravity Barrett Lyon
BitGravityBitGravity
Barrett Lyon
LimeLight Networks LimeLight Networks
EdgeCast EdgeCast
CDNetworks CDNetworks
Consulting Consulting
Speaker Speaking Opportunity
Speaker Speaking Opportunity
Content Delivery Network Content Delivery Network
Content Delivery Content Delivery
Flash Streaming Flash Streaming
Interactive Video Interactive Video
Live Streaming Live Streaming
Live Video Live Video
Streaming Audio Streaming Audio
Streaming Media Streaming Media
Video Delivery Video Delivery
Video Hosting Service Video Hosting
Video Podcasting Video Podcasting
Video Podcasts Video Podcasts
Video Services Video Services
Video Streaming Video Streaming
Barrett Lyon Barrett Lyon
Barrett Lyon Barrett Lyon
Barrett Lyon Barrett Lyon
Barrett Lyon Barrett Lyon
Barrett Lyon Barrett Lyon
Barrett Lyon Barrett Lyon
Barrett Lyon Barrett Lyon

Apple, Amazon, and NetFlix can save traditional media!

Tuesday, June 23rd, 2009

 

Let’s face it, average consumers are not glued to their computers. They enjoy reading books by the pool, watching programming on their TVs, and generally don’t modify their behaviors around new technology. At least, that’s what I learn from my wife. However, as technology continues to improve, helping streamline consumers’ interaction with digital media, a shift is starting to occur.  

I recently brought home a new Kindle2 and was disappointed with my wife’s lackluster excitement for the device. She quickly stated she would not trade her paperback for a new high-tech gadget. However, once she started playing with it, she actually found it very similar to a book, especially the way in which text is displayed on the electronic paper.

Aside from being user-friendly, I explained to her how the device allows me to be a responsible news reader. As newspaper subscriptions continue to decrease as more and more people get their news for free from places like Yahoo! News and Google News, the flow of cash has decreased for traditional media. Income from online ads is just not replacing the conventional full page or double-truck that used to be the staple of the print news industry. In fact, according to Hollywood Reporter, a double-truck ad in the New York Times costs $100k, much more costly than the self-service online advertising they also provide. Thus, when you read your news online, you’re hurting the very social service that we need — responsible journalism. However, when you pay for your news subscription through Amazon, you’re helping old media become new again. That’s why the Kindle is such a great example of a device that not only supports the needs of consumers, but the needs of society as well. 

The same concept applies with music, which is already playing out. Take Apple for example, the iPod and iPhone are perfect devices for the non-technical and the technical alike. It adapts to the consumer and not the other way around. Music, applications, and everything that was a physical purchase is now a simple “tap” and it supports the industry that produces the media. Phil Schiller announced in his Macworld 2009 keynote speech that over 6 billion songs had been downloaded since the service first launched on April 28, 2003.

Now consider video. There are great models that support the movie and video industry: NetFlix, Apple TV, iTunes, and yes, even a set-top box, FyreTV, that caters to consumers looking for more adult-centric entertainment. As devices become available for the consumer to make their living room function as it did in the past, as an all-inclusive entertainment center, people will use it and pay for it.

What happens if Apple produces a device that’s like a large iPhone, a hybrid between a PC and a phone, and adds books and newspaper subscriptions to iTunes? That’s a game changer. Now there’s a device that allows users to do anything; scribble notes, read a book, type an email, and download a word processing application directly from Apple’s online store.

An iTablet would be an amazing change to the world’s media. Everything will be in the hands of the consumer all because a few thoughtful companies figured out how to bridge the gap between the consumer and traditional media. As a result, everyone benefits and prospers!


I wish this iTablet existed.

I’m inspired! Let’s go do it!

Let’s face it, the average consumer is not glued to their computers. They enjoy reading books by the pool, watching programming on their TVs, and generally don’t modify their behaviors around new technology. At least, that’s what I learn from my wife. However, as technology continues to improve, helping streamline consumers’ interaction with digital media, a shift is starting to occur.  
I recently brought home a new Kindle2 and was disappointed with my wife’s lackluster excitement for the device. She quickly stated she would not trade her paperback for a new high-tech gadget. However, once she started playing with it, she actually found it very similar to a book, especially the way in which text is displayed on the electronic paper.
Aside from being user-friendly, I explained to her how the device allows me to be a responsible news reader. As newspaper subscriptions continue to decrease as more and more people get their news for free from places like Yahoo! News and Google News, the flow of cash has decreased for traditional media. Income from online ads is just not replacing the conventional full page or double-truck that used to be the staple of the print news industry. In fact, according to Hollywood Reporter, a double-truck ad in the New York Times costs $100k, much more costly than the self-service online advertising they also provide. Thus, when you read your news online, you’re hurting the very social service that we need — responsible journalism. However, when you pay for your news subscription through Amazon, you’re supporting old media helping it become new again. That’s why the Kindle is such a great example of a device that not only supports the needs of consumers, but the needs of society as well. 
The same concept applies with music, which is already playing out. Take Apple for example, the iPod and iPhone are perfect devices for the non-technical and the technical alike. It adapts to the consumer and not the other way around. Music, applications, and everything that was a physical purchase is now a simple “tap” and it supports the industry that produces the media. Phil Schiller announced in his Macworld 2009 keynote speech that over 6 billion songs had been downloaded since the service first launched on April 28, 2003.
Now consider video. There are great models that support the movie and video industry: NetFlix, Apple TV, iTunes, and yes, even a set-top box, FyreTV, that caters to consumers looking for more adult-centric entertainment. As devices become available for the consumer to make their living room function as it did in the past, as an all-inclusive entertainment center, people will use it and pay for it.
What happens if Apple produces a device that’s like a large iPhone, a hybrid between a PC and a phone, and adds books and newspaper subscriptions to iTunes? That’s a game changer. Now there’s a device that allows users to do anything; scribble notes, read a book, type an email, and download a word processing application directly from Apple’s online store.
It would be an amazing change to the world’s media. Everything will be in the hands of the consumer all because a few thoughtful companies figured out how to bridge the gap between the consumer and traditional media. As a result, everyone benefits and prospers!
I’m inspired; let’s go do it!

P2P SIP URI Dialing!

Monday, June 22nd, 2009

 

There are thousands of people that operate their own Asterisk based PBX systems, yet they do not enable any method to allow for p2p sip URI dialing. These sip “targets” are very easy to enable and allow you to dial anyone that has also enabled the function. Dialing with SIP URI completely avoids toll calling and forces your Asterisk server to create P2P sip connections when you dial someone’s SIP URI. It makes a less complex phone call without a system administrator configuring a peer and best of all: It gets rid of phone numbers and your telco!

How does it work?

By creating a SRV record in DNS for your domain you can help remote PBX systems establish P2P calls for a specific extensions. For example, when someone calls me, my URI is resolved to my PBX (sip.blyon.com). When the call comes into my Asterisk box, blyon is setup as a extension, and that extension is connected to a phone or a context. As a result, if someone uses something like Xten to call blyon@blyon.com, I get a normal ring and phone call. When I use my Cisco 7960 phone and dial someone’s SIP URI it completes like a normal phone call.

Why is this cool?

This is great because it takes away any central control for locating people. The ENUM standard is nice, but gives someone else control over the mapping database and it keeps an ugly old phone numbers in place. I really don’t want to dial phone numbers 10 years from now, I much rather just give someone my email address and have that map to my phone. If I need to call a business, I much rather just call pbx@somecompany.com then find some obscure phone number.

If more people adopt this as a standard, it will be the method of choice for calling people and it puts power into the end user’s hands!

Configuring the DNS SRV Record

Much like an MX record that defines mail servers for a domain, you can use an SRV record to define your PBX server for a domain. My domain blyon.com has a PBX and I simply created the SRV record for it:

In bind it would look something like this:

_iax._udp               SRV     10 10 4569 iax2.blyon.com.
_sip._udp               SRV     10 10 5060 sip.blyon.com.

SIP and IAX2 are also host names that point to my PBX. When someone dials my URI extension@blyon.com, their client or PBX will do a DNS lookup and see that sip is available on port 5060 at sip.blyon.com.

IAX records are not needed to make SIP URI dialing work. It is listed here to show that you can use other protocols like IAX.

Create a whitepage TXT record

To make it easy on others to locate your public extensions you should also create a protocol whitepage listing. I suggesst you map your user’s email addresses to extensions. If you do enable extensions to email addresses, you will want to include “email_addr” in your TXT record. A sample in bind looks like this:

sip.whitepage		TXT	"email_addr, home, echo, pbx"

“sip.whitepage” is the SIP protocol whitepages txt record, the first “email_addr” tells people that email addresses are mapped to extensions, and other non-email address extensions are listed. You should list each extension seperated by a comma.

This TXT record is not a standard RFC, it’s something I thought would be helpful for people to establish SIP communications. This is not needed to make the system work.

Configuring Asterisk to accept inbound URI calls:

Under [general] in sip.conf make sure the following is allowed:

[general]
context=in                      ; Context for incoming calls
allowguest=yes                  ; Allow or reject guest calls (default is yes, this can also be set to 'osp'
bindport=5060                   ; UDP Port to bind to (SIP standard port is 5060)
srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls

My specific context is “in” that’s where these calls go in the extensions.conf, this is the same place that I send inbound calls from a telco or another sip peer. Under your version of the “in” context just define your username mapping:

exten => blyon,1,Macro(doDialExten,${BARRETT-VM},${BARRETT-HOME})

I have BARRETT-VM and BARRETT-HOME setup so that it rings my home office and then sends the caller to voicemail if I don’t answer. So rather than putting my extension there, I just define my username that will be picked apart by Asterisk and matched.

Configuring Asterisk to accept outbound URI calls:

When you define a sip proxy for things like a Cisco 7960 or Xten, they forward all URI calls to the proxy. Asterisk does not have any idea what to do with them so they usually 404 error and as a result you can’t make your free calls to your buddy that also set this up and operates Asterisk. There is a simple fix however, in your dial plan after you have defined your local extensions and usernames, and after your _1XXX… toll definitions simply add this uri context or the exten directly into your dialplan:

[uri]
exten => _[a-z].,1,Macro(uridial,${EXTEN}@${SIPDOMAIN})
exten => _[A-Z].,1,Macro(uridial,${EXTEN}@${SIPDOMAIN})
exten => _X.,1,Macro(uridial,${EXTEN}@${SIPDOMAIN})

Next make sure you add the macro into the extensions.conf in the area where you have your other macros defined:

[macro-uridial]
exten => s,1,NoOp(Calling remote SIP peer ${ARG1})
exten => s,n,Dial(SIP/${ARG1},120,tr)
exten => s,n,Congestion()

After local extensions are not matched and toll extensions are not matched it will then take the call and make a SIP connection and away you go! Asterisk splits everything past the “@” in the call and makes an ${EXTEN} variable and a ${SIPDOMAIN} variable. If we match an lowercase alpha character in the ${EXTEN} then we simply just dial the EXTEN@SIPDOMAIN and away you go!

Dialing with a free “Soft Phone”

Any “soft phone” that can dial sip numbers including Micscrewsoft NetMeeting can now be used to make free inbound calls to your Asterisk box. If you setup an extension called pbx that goes to your main phone tree, and someone calls pbx@yourdomain.com, they would get your main tree just as if they called via a toll system. You can also do SIP calls without any fancy DNS by specifying the full hostname to the Asterisk/PBX:

sip:exten@hostname.of.asterisk.server.com

This requires you to know the exact IP or hostname of the Asterisk PBX, rather it would be more simple to have the one time DNS record and then you can give your extension@hostname.com.

Dialing the URI with DNS is simply:

pbx@blyon.com, blyon@blyon.com, or foo@bar given there are functioning SRV records.

Use Xten without any provider or special settings to call a SIP URI

If you would like to directly dial to another URI without setting up a SIP proxy, X-Lite allows for this option. To configure the direct dialing just go to System Settings -> SIP Proxy menu:

Enabled: Choose "Yes"
Display Name: Your calling name, maybe Joe Daly's PC
Domain/Realm: Just put your ISP or local domain
Direct Dial IP: choose "Yes"

To make a call, simply specify the URI and away you go!

This works great for dialing out, I have not spent any time to figure out how to accept P2P URI calls just via a raw softphone client, but I am sure they support it. If you know how to do this email me and I will add it to this doc.

SIP URI and Vonage

When I was a vonage user people could dial me by calling: sip:{Vonage_Phone Number 10 digits}@sip.vonage.net. This is a SIP URI but it would be much more clean if they had created SRV records for vonage.com.

Dialing URI with an ATA

This is doable but a little more complex, but for a free call, who cares? The ‘@’ is dialed as “**”, and ‘.’ and ‘:’ are dialed as a ‘*’. If you were to dial 10000000000@sip.vonage.net, it would be dialed like this: 10000000000**12*144*47*38

To keep it easy we have replaced the hostname of sip.vonage.com with the IP address 12.144.47.38 (12*144*74*38). This really sucks having to dial using an IP address, so you may want to setup an exten for old phones that don’t support URI. Someone may also be kind and give us some clue on how to dial alpha with a standard phone, I am sure you can do it somehow.

To setup an exten for the URI to make it simple (if you are using Asterisk):

; Bob
exten => 1100,1,DIAL(SIP/bob@foo.com,120,tr);

Test it!!!

I have setup an echo test so you can just call into the system and see how it goes, just dial: echo@blyon.com

You can also test your SRV and TXT records by running the dig command:

# dig _sip._udp.blyon.com SRV

;; ANSWER SECTION:
_sip._udp.blyon.com.    1200    IN      SRV     10 10 5060 sip.blyon.com.

# dig sip.whitepage.blyon.com TXT

;; ANSWER SECTION:
sip.whitepage.blyon.com. 408 IN    TXT     "email_addr, home, echo, pbx"

You can also use my test form to see if your domain or others are configured for SIP URI.

I also want to thank Victor Oppleman over at Vostrom for his help and research on this fun quick project, he’s a really smart guy!

“With software anything is possible!”

Monday, June 22nd, 2009

 

When Perry Wu and I started BitGravity, we had high hopes and dreams to build technology that may someday change the Internet. The thought of someday creating technology that pushes the limits of the Internet gave me the drive to build our first server farms in my garage, design a new traffic distribution system, and eventually take our baby and scale it across the entire planet.

As the company grew from my garage and a Starbucks “office”, our views began to culminate. I began to view software as art and not merely a means to an end. I also began to view our team of technologists as wizards that could create and accomplish anything. To this day, if I were to ask one of our principle engineers Edward Crump if something were possible he would undoubtedly respond with his token mantra:

“With software anything is possible!”

The view that Internet service engineering is an art with endless possibilities has become a philosophical pillar at BitGravity and within myself. We viewed the designs on the network, servers, drivers, kernels, and everything up the stack should be done as an art, not strictly a science that results in a bottom line.

It is my view that new technology is only possible because passionate people dream of new concepts and harness their passion to drive it to completion. It’s those same people who are not afraid to answer a question that appears to be impossible to solve.

As I continue to grow as a technologist and start new companies, I always see something unexpected: my customers’ creativity is exploding and I am in awe of their accomplishments.

I am pleased to introduce my blog, ‘Verbophobia’. Here on blyon.com I will be releasing free technology, views and opinions. This will be my playful outlet for technology and philanthropy that should give back to the general community that has helped me become successful.

When Perry Wu and I started BitGravity we had high hopes and dreams to build technology that may someday change the Internet. The thought of someday creating technology that pushes the limits of the Internet gave me the drive to build our first server farms in my garage, design a new traffic distribution system, and eventually take our baby and scale it across the entire planet.
As the company grew from my garage and a Starbucks “office”, our views began to culminate. I began to view software as art and not merely a means to an end. I also began to view our team of technologists as wizards that could create and accomplish anything. To this day, if I were to ask one of our principle engineers Edward Crump if something were possible he would undoubtedly respond with his token mantra:
“With software anything is possible!”
The view that Internet service engineering is an art with endless possibilities has become a philosophical pillar at BitGravity and within myself. We viewed the designs on the network, servers, drivers, kernels, and everything up the stack should be done as an art, not strictly a science that results in a bottom line.
It is my view that new technology is only possible because passionate people dream of new concepts and harness their passion to drive it to completion. It’s those same people who are not afraid to answer a question that appears to be impossible to solve.
As I continue to grow as a technologist and start new companies, I always see something unexpected: my customers’ creativity is exploding and I am in awe of their accomplishments.
I am pleased to introduce my blog, ‘Verbophobia’. Here on blyon.com I will be releasing free technology, views and opinions. This will be my playful outlet for technology and philanthropy that should give back to the general community that has helped me become successful.