Pages

Tuesday, 25 September 2012

C# Tutorial for absolute beginners

If you are new to programming and want to learn C#, you can learn programming fundamentals here. Very good resource for new learners…

Stay tuned on Channel 9, as they promised to add concepts applicable to video games, mobile and client application.

Monday, 24 September 2012

VMware– Host only access not working

I have VM running Windows Server 2003 configured to use ‘Host-Only’ network connection. After upgrading from VMware player to workstation, I can no longer communicate between the host and the VM. I googled around for this issue and found simple solution as below

  • Go to Edit-> Virtual Network Editor

network editor

  • Select VMnet1 , uncheck ‘Connect a host virtual adapter to this network’ and click ‘Apply’
  • Check ‘Connect a host virtual adapter to this network’ (basically adding it again…) and click ‘Apply’

 

That’s it. VMnet1 gets static IP address and issue is resolved..

Sunday, 23 September 2012

Calculate MD5 hash from a string

It is a common practice to store passwords in databases using a hash. MD5 (defined in RFC 1321) is a common hash algorithm, and using it from C# is easy.

Here’s an implementation of a method that converts a string to an MD5 hash, which is a 32-character string of hexadecimal numbers.

public string CalculateMD5Hash(string input)
{
// step 1, calculate MD5 hash from input
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);

// step 2, convert byte array to hex string
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}

An example call:

string hash = CalculateMD5Hash("abcde123");

…returns a string like this:

C3FCD3D76192E4007DFB496CCA67E13B

To make the hex string use lower-case letters instead of upper-case, replace the single line inside the for loop with this line:

sb.Append(hash[i].ToString("x2"));

The difference is the ToString method parameter.

Monday, 10 September 2012

SIP Tutorial Part 3 – Commands

  • INVITE :Invites a user to a call
  • ACK : Acknowledgement of the request.
  • BYE :Terminates a connection between users
  • CANCEL :Terminates a request, or search, for a user.
  • OPTIONS :Solicits information about a server's capabilities.
  • REGISTER :Registers a user's current location
  • INFO :Used for mid-session signalling

It would be easy to understand the above commands with an example and will cover this in next blog

Wednesday, 5 September 2012

SIP Tutorial Part 2– Components

SIP elements are as below

User Agent: The user agent resides in every SIP end station. It acts in two roles:

    • User Agent Client (UAC): Issues SIP requests
    • User Agent Server (UAS): Receives SIP requests and generates a response that accepts, rejects, or redirects the request

Examples:  Softphone application, Messaging Client

Redirect Server: The redirect server is used during session initiation to determine the address of the called device. The redirect server returns this information to the calling device, directing the UAC to contact an alternate Universal Resource Identifier (URI). A URI is a generic identifier used to name any resource on the Internet. The URL used for Web addresses is a type of URI. See RFC 2396 [1] for more detail.

 

Proxy Server: The proxy server is an intermediary entity that acts as both a server and a client for the purpose of making requests on behalf of other clients. A proxy server primarily plays the role of routing, meaning that its job is to ensure that a request is sent to another entity closer to the targeted user. Proxies are also useful for enforcing policy (for example, making sure a user is allowed to make a call). A proxy interprets, and, if necessary, rewrites specific parts of a request message before forwarding it.

 

Registrar: A registrar is a server that accepts REGISTER requests and places the information it receives (the SIP address and associated IP address of the registering device) in those requests into the location service for the domain it handles.

 

Location Service: A location service is used by a SIP redirect or proxy server to obtain information about a callee's possible location(s). For this purpose, the location service maintains a database of SIP-address/ IP-address mappings.

 

In the next tutorial, we will review SIP command requests with more detail.

Monday, 3 September 2012

SIP Tutorial for beginners – Part I

SIP (Session Initiation Protocol) is a signalling protocol used to create, manage and terminate sessions in an IP based network.  SIP makes it possible to implement services like phone call, click-to-dial  or instant messaging in an IP based environment.  Please note that SIP is used only for signalling and session control and actual data exchanges are handled by other protocols like RTP (Real-time transmission protocol).

SIP provides capabilities to

  • determine the location of end points
  • determine the media capabilities using SDP and negotiates services between end points
  • determine the status of end point – available/busy etc..
  • establishes session between end points
  • call management – hold, release, transfer etc. For transfer, it simply establishes session with new end point with the transferee and terminates session with transferring party