Monday, June 28, 2010

HTML 5 Web Sockets

HTML 5 WebSockets

The HTML 5 specification introduces the Web Socket interface, which defines a full-duplex communications channel that operates over a single socket and is exposed via a JavaScript interface in HTML 5 compliant browsers.

Unlike Comet and Ajax, Web Socket is native to the browser, and only requires a single connection to maintain both upstream and downstream data to and from the browser. Note, that to support streaming over HTTP, Comet requires a long-lived connection, which is often severed by proxies and firewalls. In addition, few Comet solutions support streaming over HTTP, employing a low performance technique called "long-polling" instead.

By moving to a single, streaming channel of communications, we can overcome the inadequacies of techniques such as long-polling and "forever frames," and as a result further reduce latency.

[Constructor(in DOMString url)]
interface WebSocket {
readonly attribute DOMString URL;
// ready state
const unsigned short CONNECTING = 0;
const unsigned short OPEN = 1;
const unsigned short CLOSED = 2;
readonly attribute int readyState;
// networking
attribute EventListener onopen;
attribute EventListener onmessage;
attribute EventListener onclosed;
void postMessage(in DOMString data);
void disconnect();
};

To connect to an end-point, just create a new Web Socket instance, providing the new object with a URL that represents the end-point to which you wish to connect (See listing 2). Note that a ws:// and wss:// prefix indicate a Web Socket and a secure Web Socket connection, respectively. A Web Socket connection is established by upgrading from the HTTP protocol to the Web Socket protocol during the initial handshake between the client and the server, over the same underlying TCP/IP connection. Once established, Web Socket data frames can be sent back and forth between the client and the server in full-duplex mode. The connection itself is exposed via the onMessage and postMessage methods defined by the Web Socket interface.

var myWebSocket = new WebSocket("ws://www.websocket.org");

Before connecting to an end-point and sending a message, you can associate a series of event listeners to handle each phase of the connection life-cycle.

myWebSocket.onopen = function(evt) { alert("Connection open ..."); };
myWebSocket.onmessage = function(evt) { alert( "Received Message: " + evt.data); };
myWebSocket.onclose = function(evt) { alert("Connection closed."); };

To send a message to the server, simply call postMessage and provide the content you wish to deliver. After sending the message, call disconnect to terminate the connection.

myWebSocket.postMessage("Hello Web Socket! Goodbye Comet!");
myWebSocket.disconnect();

Firewalls and Proxies? No Problem

One of the more unique features Web Socket provides is its ability to traverse firewalls and proxies, a problem area for many Comet-enabled applications. Comet-style applications typically employ long-polling as a rudimentary line of defense against firewalls and proxies. The technique is effective, but is not well suited for applications that have sub-500 millisecond latency or high throughput requirements. Plugin-based technologies such as Adobe Flash, also provide some level of socket support, but have long been burdened with the very proxy and firewall traversal problems that Web Sockets now resolve.

A Web Socket detects the presence of a proxy server and automatically sets up a tunnel to pass through the proxy. The tunnel is established by issuing an HTTP CONNECT statement to the proxy server, which requests for the proxy server to open a TCP/IP connection to a specific host and port. Once the tunnel is set up, communication can flow unimpeded through the proxy. Since HTTP/S works in a similar fashion, secure Web Sockets over SSL can leverage the same HTTP CONNECT technique.

Any RIA, Any Time

In addition, the Web Socket protocol can be used to support a diverse set of clients (e.g. JavaScript, Adobe Flex, JavaFX, Microsoft Silverlight, etc.). However, the HTML 5 specification only defines support for JavaScript, which is limited to text-based protocols. To serve other client-types and support binary protocols you will need to look to vendor offerings.

Tuesday, June 22, 2010

SIP DTMF Signalling - voip-info.org

SIP DTMF Signalling - voip-info.org

There are 3 common ways of sending DTMF on SIP calls:
- SIP INFO packets
- As specially marked events in the RTP stream
- As normal audio tones in the RTP stream with no special coding or markers.

RFC-2833 defines signalling for various events:
- DTMF tones
- Fax-related tones
- Standard subscriber line tones
- Country-specific subscriber line tones
- Trunk events

NTE means Named Telephony Events. These are the events and their encoding:

Event (0-9) - encoded as 0-9 decimal
Event (*) - encoded as 10 decimal
Event (#) - encoded as 11 decimal
Event (A-D) - encoded as 12-15 decimal
Event (Flash) - encoded as 16 decimal

Etc...


DTMF delivery options in SIP


With in a VoIP conversation, DMTF tones are delivered either in-band (as a beep), or out-of-band via SIP or RTP signaling messages. 3CX Phone System supports both

In-band

Incoming stream delivers DTMF signals in-audio independently of codecs – in this case the 3CX Phone System Media Server listens to the audio stream, and will detect DTMF signals.

  1. Delivery to DR or VM: Efficiency of DTMF detection depends on audio quality. Dropped packets will also reduce audio quality.
  2. Delivery to some external party (typically via gateway or provider): DTMF strokes are recognized from the in-audio stream, and delivered to the external party in 2 forms – in-audio (leaving audio content unchanged) and additionally via RFC2833.
  3. Delivery to MS Exchange 2007 IVR: DTMF strokes are recognized from the in-audio stream, and delivered to the external party in 2 forms – in-audio (leaving audio content unchanged) and additionally via RFC2833. Please note that since MS Exchange 2007 IVR does not provide in-audio recognition, it will only use RFC2833 delivery mechanism.

Out-of-band

Incoming stream delivers DTMF signals out-of-audio using either SIP-INFO or RFC-2833 mechanism, independently of codecs – in this case the DTMF signals are sent separately from the actual audio stream.

  1. Delivery to DR or VM: These are passed through as received.
  2. Delivery to some external party (typically via gateway or provider): These are passed through as received. The external party must support the corresponding delivery mechanism if DTMF strokes are to be recognized. Effectively this means that if DTMF is received with SIP-INFO, it is forwarded also as SIP-INFO. If your VoIP Provider requires RFC2833 DTMF delivery, then it will be necessary to ensure all SIP Phones are configured to deliver DTMF using RFC2833.
  3. Delivery to MS Exchange 2007 IVR: These are passed through as received.

Note:

SIP-INFO is not recommended for DTMF delivery, since it cannot deliver strokes synchronously with the audio stream, introducing timing artifacts (mainly because it’s delivered using SIP, which is not a real-time mechanism for delivering media). It is very common for public services to NOT support SIP INFO, and it seems unlikely that such services will improve support for this delivery mechanism.

Cisco and RFC-2833

The following Cisco’s IP phones do not support RFC2833 DTMF-Relay:

• 7902
• 7905
• 7910
• 7912
• 7940
• 7960

All digits are sent out of band in either SCCP or SIP signaling packets depending on the phone firmware. These phones are referred to as Type A phones in the Cisco Unified Communications Manager 6.x SRND (Solution Reference Network Design) guide available at www.cisco.com/go/srnd.

New Cisco phones support RFC2833 DTMF Relay when registered with Cisco Unified Call Manager versions 5.0 and later. These phones include the following:

• 7906
• 7911
• 7941
• 7942
• 7945
• 7961
• 7962
• 7965
• 7970
• 7971
• 7975

SIP trunks in Cisco Call Manager 5.0 supports RFC2833 DTMF-Relay. RFC2833 supports is very important for multi-vendor interoperability since this is the preferred way of exchanging DTMF digits between vendors.

Call Manager 4.x used MTP (Media Termination Point) media resources to convert out of band SIP Notify DTMF messages into RFC2833 in-band (RTP) messages.

Note that Cisco's JTAPI connections used for CTI ports in CUCM only support out of band DTMF messages.

Wednesday, June 16, 2010

Gzip and Tar

Gzip:

  1. Gzip is used to compress a file. To zip "thisfile", type gzip thisfile. You'll get a file named thisfile.gz.
  2. $gzip thisfile
  3. $thisfile.gz
  4. To unzip thisfile.gz, type gunzip thisfile.gz.
  5. $gunzip thisfile.gz
  6. Gzip supports 9 levels of compression; 1 being the fastest and least compressed; 9 being the slowest and most compressed; 6 being the default. To get the best compression, use the command: gzip -9 readme

Tar:

  1. Tar is used to pack the entire contents of a directory or directories into a single file called a tarball.
  2. Tar preserves the entire directory organization including file ownership, permissions, links, and the directory structure.
  3. The most commonly used tar functions are:

  • c - create an archive
  • x - extract files from an archive
  • t - list the contents of an archive
  • v - verbose
  • f filename - use the specified file
  • z - gzip/gunzip

Examples: Back |up the contents of the home directory for gemini (/home/gemini) in a tarball called a.tar on a floppy disk.


  1. mount /floppy
    cd /home
    tar -cvf /floppy/a.tar gemini


    Explanation:
    • Change to the parent of the /home/gemini directory.
    • Create a backup of gemini in the file /floppy/a.tar.
  2. Now, check the contents of the tarball that you just created.

    cd /floppy
    tar -tvf a.tar

  3. Back |up the contents of the etc directory in an archive called etc.tar . Make sure that the archive is created in your own home directory.

    cd /
    tar -cvf ~/etc.tar etc


    Explanation:
    • Change to the parent of the /etc directory.
    • Create a backup of etc in the file ~/etc.tar
  4. Back |up and compress the contents of the home directory into the tarball home.tgz on a floppy disk.

    mount /floppy
    cd /
    tar -cvzf /floppy/home.tgz home


    Explanation:
    • change to the parent of the /home directory
    • Create a compressed backup of home in the file /floppy/home.tgz.
  5. Now check the contents of the archive that you just created.

    cd /floppy
    tar -tvzf home.tgz

  6. Unpack the archive home.tgz on your floppy.

    cd /floppy
    tar -xvzf home.tgz


    Explanation:
    • change to the /floppy directory
    • unpack and unzip the tarball home.tgz

Thursday, June 10, 2010

The four principles

(1) Don’t build features that nobody needs right now
(2) Don’t write more specs than you can code
(3) Don’t write more code than you can test
(4) Don’t test more code than you can deploy

Basic principles of copyright law

Under the laws of the United States and most European countries, copyright is automatically attached to every novel expression of an idea, whether through text, sounds, or imagery. For example, your diary entries, personal letters, song lyrics, and drawings, even if they are only done in the most casual of circumstances.

Say, for example, you doodle a drawing of a fish on a piece of napkin. That drawing is copyrighted simultaneously with its creation and is your property. Your drawing cannot be copied, displayed, or exploited by any person other than you for the life of the copyright. In addition, no person other than you can create "derivative works" from the original drawing.

Note that copyright law does not protect any particular idea, just the expression of that idea. Your particular drawing of fish does not limit others to create their own expression of "fish", whether through drawing or other media.

Saturday, June 5, 2010

The web and video

A key factor in the web’s success is that its core technologies such as HTML, HTTP, TCP/IP, etc. are open and freely implementable. Though video is also now core to the web experience, there is unfortunately no open and free video format that is on par with the leading commercial choices. To that end, Google is introducing WebM, a broadly-backed community effort to develop a world-class media format for the open web.

So you have HTML5, VP8 for codec, etc...

Personal Learning Environment and CloudCourse

CloudCourse is a course-scheduling tool, fully integrated with Google Calendar. CloudCourse also features approval processes, wait list management, as well as room and user profile information and can be further customized to sync the data with other internal systems.

Moodle is another Course Management System (CMS), also known as a Learning Management System (LMS) or a Virtual Learning Environment (VLE). It is a Free web application that educators can use to create effective online learning sites.

PLE is a new term that describes how we learn in the Web 2.0 context. What do mean by that? What does Web 2.0 have anything to do with PLE? Let's pause for a second to think about this.