Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

209 lines (130 sloc) 11.573 kB
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Cracker Snack</title>
<link href="http://www.crackersnack.com/atom.xml" rel="self"/>
<link href="http://www.crackersnack.com/"/>
<updated>2011-09-07T08:13:55-06:00</updated>
<id>http://www.crackersnack.com/</id>
<author>
<name>Josh Robinson</name>
</author>
<entry>
<title>Telephony On The Web</title>
<link href="http://www.crackersnack.com/blog/2010/02/24/telephony-on-the-web-an-intro-to-voip/"/>
<updated>2010-02-24T00:00:00-07:00</updated>
<id>http://www.crackersnack.com/blog/2010/02/24/telephony-on-the-web-an-intro-to-voip</id>
<content type="html">&lt;p&gt;Telephony is awesome. Why is it awesome? The telephone system is something that has been around longer than all/most of us have been alive. It has been 95 years since the first US coast-to-coast call was made in 1915. Yet right now the technology behind telephony is going through a major paradigm shift that puts developers in control.&lt;/p&gt;
&lt;p&gt;Telephones are moving from giant switches that filled entire buildings to data networks and soft-switches. The important thing about this change is that when a call becomes data it is just another piece of software. Soft-switches make it telephony accessible to anyone who has a desire to tinker.&lt;/p&gt;
&lt;p&gt;We are going to start off with some terminology, a crash course in the basics of telephony and what kind of setup is needed to start playing. Next we will go into a couple different ways web technologies can be used to take control of a telephone system.&lt;/p&gt;
&lt;h3&gt;A SIP of what?&lt;/h3&gt;
&lt;p&gt;The common term for making calls over a data network is Voice over IP or VoIP. VoIP is made possible by SIP. SIP is a protocol like HTTP and is in fact based on HTTP. So you have very familiar messages like 200 OK and 404 Not Found. It also uses an address format we will all recognize. For example if Joe has a phone registered to &lt;a href=&quot;http://teliax.com&quot;&gt;Teliax&lt;/a&gt; his address would be joe@teliax.com. I will go into more details on phones and registrations in a second. The point is the address is exactly the same as an email address. It contains a user followed by an @ and ends with the domain.&lt;/p&gt;
&lt;p&gt;To make or receive calls you need an end-point. An end point can be a SIP phone, VoIP adapter or soft-phone. Put simply an end-point is a network client that speaks the SIP protocol. To be useful these end-points register to a switch and tell the switch where they are located. This allows other people to send calls to the switch and the switch deal with trying to find the right end-point. The switch is also where we can do all the fun stuff. Before we go into detail on a switch lets go over some of the end-point options.&lt;/p&gt;
&lt;h4&gt;SIP Phone&lt;/h4&gt;
&lt;p&gt;A SIP phone looks just like a regular phone but it plugs into a data network instead of a normal phone network. It acts as any other client on the network, with its own ip address and everything. Sip phones start at under $100 for a basic &lt;a href=&quot;http://www.8774e4voip.com/Aastra_6730i_p/aastra-6730i.htm&quot;&gt;Aastra 6730i&lt;/a&gt; to over $400 for an awesome multi-line touch-screen &lt;a href=&quot;http://www.8774e4voip.com/Aastra_6739i_p/aastra-6739i.htm&quot;&gt;Aastra 6739i&lt;/a&gt;. And yes I like and recommend both Aastra and &lt;a href=&quot;http://www.8774e4voip.com/&quot;&gt;e4voip&lt;/a&gt;.&lt;/p&gt;
&lt;h4&gt;VoIP Adapter&lt;/h4&gt;
&lt;p&gt;This is the type of thing you would get from Vonage. It just turns a regular phone into a SIP Phone. It has a phone jack, or two, a network jack and a power cord. Pretty simple little devices. The usually start at $50 for a two line ATA. There are some really fancy ones that have anywhere from 8 to 24 and more lines.&lt;/p&gt;
&lt;p&gt;A VoIP adapter is a good option if you have a lot of legacy phones that you want to keep around or are plugging a legacy telephone system into new cool VoIP stuff.&lt;/p&gt;
&lt;p&gt;When looking for a VoIP adapter you want to make sure not to use one from Vonage or some other VoIP provider that locks their equipment. You can only use them with that provider. It is best to buy them somewhere like &lt;a href=&quot;http://www.8774e4voip.com/&quot;&gt;e4voip&lt;/a&gt; where you know they will come unlocked.&lt;/p&gt;
&lt;h4&gt;Soft-Phone&lt;/h4&gt;
&lt;p&gt;A soft-phone is just a piece of software you run on your computer. They are the easiest and cheapest way to get started but don't always give you the same quality or nice feel of a real phone. Soft-phones are available for every major OS and most smart phones. On OS X I like to use the open source &lt;a href=&quot;http://code.google.com/p/telephone/&quot;&gt;Telephone&lt;/a&gt;. &lt;a href=&quot;http://www.sjlabs.com/sjp.html&quot;&gt;SJPhone&lt;/a&gt; is available on OS X, Linux and Windows but isn't as nice.&lt;/p&gt;
&lt;h3&gt;Switch it up!&lt;/h3&gt;
&lt;p&gt;The switch is responsible for routing calls from one person to another and inserting all sorts of fun things in the middle. This is where we can plug in to control where a call goes or make an interactive system with prompts and live data and other coolness.&lt;/p&gt;
&lt;p&gt;In the next couple articles I will go into the different ways we can plug into these switches and make them do what we want using XML and our favorite tools for generating said XML.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Announcing The Currencies Gem</title>
<link href="http://www.crackersnack.com/blog/2010/02/19/announcing-the-currencies-gem/"/>
<updated>2010-02-19T00:00:00-07:00</updated>
<id>http://www.crackersnack.com/blog/2010/02/19/announcing-the-currencies-gem</id>
<content type="html">&lt;p&gt;If you are tracking any kind of assets the currencies gem is for you. It contains every currency in the ISO 4217 standard and allows you to add your own as well. So if you decide to take sparkly buttons as a form of payment you can use currencies to display the shiny button unicode symbol ☼ (disclaimer: ☼ may not look like a shiny button to everyone.) when used with something like the money gem. Speaking of the money gem, currencies gives you an ExchangeBank that the money gem can use to convert from one currency to another. There are plans to have ExchangeRate provider plugin system. Right now the rates are either set manually or pulled from Yahoo Finance.&lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;Currencies is hosted on GemCutter, so simply run the following:&lt;/p&gt;
&lt;p&gt;``` ruby&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gem sources -a http://gemcutter.org
sudo gem install currencies
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;h2&gt;Basic Usage&lt;/h2&gt;
&lt;p&gt;There are two ways to get a currency object. The first is to simply make it.&lt;/p&gt;
&lt;p&gt;``` ruby&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Currency.new('USD', :name =&amp;gt; 'Dollars', :symbol =&amp;gt; '$', :exchange_rate =&amp;gt; 1)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;p&gt;Or you can lookup a currency by its ISO 4217 code using the &lt;em&gt;from_code&lt;/em&gt; method.&lt;/p&gt;
&lt;p&gt;``` ruby&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Currency.from_code('USD')
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;p&gt;Once you have a Currency instance you can get basic information about it.&lt;/p&gt;
&lt;p&gt;``` ruby&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;currency = Currency.from_code('USD')
currency.code #=&amp;gt; &quot;USD&quot;
currency.name #=&amp;gt; &quot;Dollars&quot;
currency.symbol #=&amp;gt; &quot;$&quot;
currency.exchange_rate #=&amp;gt; 1.0
currency.exchange_currency #=&amp;gt; &quot;USD&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;h2&gt;Adding Currencies&lt;/h2&gt;
&lt;p&gt;Currencies keeps an internal list of currencies for use in the ExchangeBank and to be looked up with the &lt;em&gt;from_code&lt;/em&gt; method. By default this list contains all the currencies in the ISO 4217 standard. A custom currency can be added using the &lt;em&gt;add&lt;/em&gt; class method.&lt;/p&gt;
&lt;p&gt;``` ruby&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;shiny_button = Currency.new('SBTTN', :name =&amp;gt; 'Buttons', :symbol =&amp;gt; '☼', :exchange_rate =&amp;gt; 1000)
Currency.add(shiny_button)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;p&gt;To do a massive addition of currencies you can load a yaml file using the &lt;em&gt;load_file&lt;/em&gt; class method.&lt;/p&gt;
&lt;p&gt;``` ruby&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Currency.load_file('custom_currency.yaml')
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;p&gt;And the yaml file should look like ...&lt;/p&gt;
&lt;p&gt;``` ruby&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SBTTN:
name: Buttons
symbol: ☼
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;h2&gt;Defaults&lt;/h2&gt;
&lt;p&gt;You can set the base currency by using the &lt;em&gt;base_currency&lt;/em&gt; class method. This defaults to 'USD'.&lt;/p&gt;
&lt;p&gt;``` ruby&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Currency.base_currency =&amp;gt; 'GBP'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;p&gt;The exchange rate is either set manually or if nil looked up on Yahoo Finance and cached. If you want to disable looking up the currency set the &lt;em&gt;import_exchange_rates&lt;/em&gt; class method to false.&lt;/p&gt;
&lt;p&gt;``` ruby&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Currency.import_exchange_rates = false
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;h2&gt;Money Gem&lt;/h2&gt;
&lt;p&gt;To use with the money gem you just set the default bank to the currencies bank.&lt;/p&gt;
&lt;p&gt;``` ruby&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Money.default_bank = Currency::ExchangeBank.new
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;p&gt;The Currencies ExchangeBank works the same as the one in the money gem except that if an exchange rate isn't set by default it uses what is set in the currencies gem.&lt;/p&gt;
&lt;h2&gt;ToDo&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Plugin exchange rate things&lt;/li&gt;
&lt;li&gt;Add some to_currency methods&lt;/li&gt;
&lt;li&gt;Add more ways to find a currency&lt;/li&gt;
&lt;li&gt;Make the ExchangeBank accept Currency objects&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Sponsored By&lt;/h2&gt;
&lt;p&gt;This gem is sponsored by &lt;a href=&quot;http://teliax.com&quot;&gt;Teliax&lt;/a&gt;. &lt;a href=&quot;http://teliax.com&quot;&gt;Teliax&lt;/a&gt; makes business class Voice, &lt;a href=&quot;http://en.wikipedia.org/wiki/Centrex&quot;&gt;Centrex&lt;/a&gt;(Including Hosted: IVRs, Ring Groups, Extensions and Day Night Mode) and Data services accessible to anyone. You don't have to be a fortune 500 to sound big!&lt;/p&gt;
&lt;h2&gt;Note on Patches/Pull Requests&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Fork the project.&lt;/li&gt;
&lt;li&gt;Make your feature addition or bug fix.&lt;/li&gt;
&lt;li&gt;Add tests for it. This is important so I don't break it in a
future version unintentionally.&lt;/li&gt;
&lt;li&gt;Commit, do not mess with rakefile, version, or history.
(if you want to have your own version, that is fine but
bump version in a commit by itself I can ignore when I pull)&lt;/li&gt;
&lt;li&gt;Send me a pull request. Bonus points for topic branches.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Copyright&lt;/h2&gt;
&lt;p&gt;Copyright (c) 2010 hexorx. See LICENSE for details.&lt;/p&gt;
</content>
</entry>
</feed>
Jump to Line
Something went wrong with that request. Please try again.