Change or Reset NT passwords

May 26th, 2008

This article is a bit off topic on this blog but I found the tool so powerful and easy to use that I wanted to share this.

I needed to start a computer running Windows XP SP2. The former user had a password on his account (account with admin rights) and I had no way to contact him.

I used a tool which allows editing or resenting the password of any of the user account on the computer.
That doesn’t recover the password (at least I don’t think so), that allows to reset or to allocate a new one. According to their website it works for Windows NT versions : 2000, XP, Vista.

Here is the link: http://home.eunet.no/~pnordahl/ntpasswd/

Basically you simply need to

  • Download the CD image (.iso file) and burn is as an image on a CD (or DVD) (it also work with a floppy disk)
  • Boot from that CD (you may need to modify the boot sequence in the Bios)
  • You will be asked a few question like which partition is Windows installed on, where is the registery with the SAM file … (some value are added by default and if your configuration is “classic”, they will be the correct ones)
  • Change or reset the password for a user (you can retreive the list of users)
  • Save the changes and restart the computer

You need less that 10 minutes all together. That’s brillant.

That also makes you realise a few security threats on a windows computer : get the boot sequence to start from the hard drive first (that will prevent anyone trying to boot your computer with that kind of software and change your password) and also lock the Bios changes with a password so that anyone cannot change the boot sequence.

Guillaume

Inbound calls management with Ruby Dial plans in My SIP Switch

May 21st, 2008

Ruby dial plan within My SIP Switch can really prove to be powerful. They turned My SIP Switch into an easily customizable webPBX. This article aims at providing an introduction (definitely not an overview!) to inbound call management using MySIPSwitch Ruby Dial Plan.

Since programming is involved, non-technical users will need to start with the basis and then do some tweaking. More technically advanced people can really create powerful rules to block calls, to forward calls, to create some backup routes in case of call failure (busy, not available, …) with timers….

A good place to get information on ruby dial plans is the sticky thread on My SIP Switch forum: Ruby Dial Plans.

In this article, I’ll focus on the dial plan side and I consider that some SIP providers have been set up to receive calls.


1. Structure of the Ruby Dial Plan

Here is an example of empty Ruby dial plan:

#Ruby
sys.Log(”call from #{req.Header.From.FromURI.ToString()} to #{req.URI.User}.”)
if sys.In then
# Inbound rules here
else
# Outbound rules here
end

The 1st thing to mention is that the Ruby dial plan must start by “#Ruby”, that allows My SIP Switch to know that your dial plan is using Ruby and not the old syntax.

Then, the command sys.Log(”bla”), allows to leave some logs (ie: some debugging or informative comments) that will be displayed on the monitoring page. That’s a handy tool to use when testing.

sys.In (or sys.Out) are Booleans (true or false) that tell you if the present call is an incoming call or an outgoing call.

Note that any line starting by # will be considered as a comment and therefore won’t be interpreted.


2. Example of Inbound call management

Here is a simple example with some comment afterwards:

1) # INBOUND CALLS
2) if sys.In then
3) sys.Log(”Inbound call from : #{req.Header.From.FromURI.User.ToString()}”)
4)
5) inboundnb = req.Header.From.FromURI.User
6)
7) case inboundnb
8 ) when /^0034/ then sys.Dial(”0039051xxxxxx@provider1″)
9) when /^0123456789/ then sys.Dial(”300@blueface”)
10) when /^0987654321/ then sys.Dial(”00393xxxxxx@provider2″)
11) else sys.Dial(”#{sys.Username}@local”)
12) end
13)
14) # OUTBOUND CALLS
15) else
16) # outbound call rules
1st tip: I clearly commented the 2 main sections of the dial plan: the inbound and the outbound section. Since the screen to edit the dial plan is a bit small that allows finding quicker each section.

Line 3: I added a log with the 2 parties of the inbound call. That is handy to know what’s going on when you are creating your dial plan.

Line 5: That’s a variable allocation. I store the phone number of the person calling me into the variable “inboundnb”, since using all the time “req.Header.From.FromURI.User” is not that handy.

Line 7: I created a “Switch”, it looks at the value of the variable, in this case “inboundnb”, and then will match the corresponding line. For instance:

case red
when blue then “go blue”
when green then “go green”
when red then “go red”
else “go whatever”
end

Here the “switch” will match the 3rd line. If “red” was not stated in the “when” cases, then, the last line, else, would match. Adding a default line is often useful!
Don’t forget the “end” to close the switch; otherwise, you will trigger an error!

Line 8: /^0034/ will match any number starting by 0034. If someone calls me from Spain (Spain’s international prefix is 0034), I forward the call to my Italian landline since I know the call won’t be for me. The call forwarded will be billed via my provider: provider1.

Line 9: If I don’t want to talk to the owner of the phone number: 012456789, then I forward it to 300@blueface, he will hear some monkeys; more seriously, I could send a message:
sys.Respond(480, “Not available”)

Line 10: 0987654321 is that really important potential customer and I really don’t want to miss his call, so I forward it to my mobile, just in case I’m in the train or in coffee break when he calls. Note that this time I’ll use provider2 to bill that call, he has better rates than provider1 for my mobile number.

Line 11: If the dial plan didn’t match any of the previous lines, then the last one with “else” will be interpreted and in that case, the phone which will ring is the one I have registered with My SIP Switch.


3. Going further with inbound call management

- Multiple forwarding with timers :

sys.Dial(”#{sys.Username}@local”, 10)
sys.Dial(”00390xxxx@blueface”, 12)
sys.Dial(”00393xxxxx@blueface”, 15)
sys.Respond(404, “No forwards answered”)

When I receive a call, My SIP Switch will 1st try to contact the phone I have registered with it, after 10 seconds, if I don’t pick it up, then this phone stops ringing and my landline starts ringing, and if after 12 seconds, I don’t pick up the call, my mobile will ring and if I don’t reply to my mobile and then the caller will hear a recorded message saying that I’m not available.

Note that the timers start when the call is attempted, so when it starts ringing a couple of seconds can be gone already (especially for mobiles!).

Another possibility is to make 2 phones ring at the same time :
sys.Dial(”#{sys.Username}@local&mycolleaguenumber@blueface”)

Both phone will start ringing at the same time and the 1st to pick up will get the call and the other one will stop ringing.

- Availability checker

The following piece of code can prove to be very handy:

sys.Log(”isavailable=#{sys.IsAvailable().ToString()}.”)
if sys.IsAvailable()
sys.Dial(”#{sys.Username}@local”)
else
sys.Dial(”mymobile@provider”)
end

sys.IsAvailable is a Boolean : true or false. If true, then my phone will ring, if not (my internet connection died, I ran out of battery, …) then I forward the call to my mobile.

- Time management

Here is a quick example, showing that you can also route the call depending the on the time of day:

t = Time.now
timezoneoffset = -1
if (t.hour >= 18+timezoneoffset )
sys.Dial(”…”)
else
sys.Dial(”…”)
end

First : Note that Time.Now will be at GMT since My SIP Switch server is based in Dublin

One trick to cope with that is to set a variable with the time different between your zone and GMT, for instance, I’m based in Italy (GMT+1), so I need to substract 1 from the time I want my rule to match.

Here is a good page with references about Time management in Ruby : http://www.ruby-doc.org/core/classes/Time.html

That’s it for the introduction!
If you want to go further you can combine bits from the different examples I explained here and/or discuss this on My SIP Switch’s forum with other users.

How To compose a Transparent Dialplan

May 13th, 2008

A simple dialpan rule may look like this:

exten => _X.,1,Switch(VOIPBUSTER)

or:

exten => _X.,1,Switch(${EXTEN}@VOIPBUSTER)

(to set other $ and {EXTEN} values)

(at the bottom of this blog, you’ll find a Ruby translation)

This will dial all you dial (exactly) with provider VOIPBUSTER or any other, which you gave that name, When you registered that provider, with that particular “Provider Name”

But this would mean, you only can make a phonecall, when you dialed the complete International dialing sequence, also for someone that lives in your own city, that’s a bit clumbsy,

and you have to “instruct” the other people using your phone system, So, you want to overcome this, and it can !

Here comes the “transparent” part !

Say, you always have to dial: (i’m living in the Netherlands) 0031 for the Netherlands, and 020 for Amsterdam, and 1234567 for the subscriber, what should be dialed is: 0031201234567 (notice the first 0 of the city dial code should not be dialed, when dialing internationaly) Your dialplan rule could look like this:

exten => _ZX.,1,Switch(003120${EXTEN}@VOIPBUSTER)

The first part in the dialplan detects you are not dialing a zero, (expression letter is used, for a value in the 1 - 9 range) see the dialplan expressions list below.

Now, this will be dialed by MySIPSwitch: 003120 + what you have dialed in the first place.. For dialing nationaly/internationaly, you can figure out in the same way a “plan” detecting te amount of zero’s depending how “far” the call will go, nationaly:

exten => _0ZX.,1,Switch(0031${EXTEN:1}@VOIPBUSTER)

or internationaly:

exten => _0032X.,1,Switch(${EXTEN}@VOIPCHOICE)

and according to the country code, which provider you want to use for that destination, that is the cheapest way to do so…. you use one of the Provider (Name)’s, you have registered.

btw. keep in mind you ‘re using your dialplan at MySIPSwitch, so you do not do this in your ATA or SIP phone, these settings should be completely transparent, and accept all combinations, and do nothing with it, just pass it through, otherwise your dialplan at MySIPSwitch will not respond like here is mentioned.

A Ruby translation for outgoing only:

when /^06/ then sys.Dial(”00316${dst:2}@INTERVOIP”)

in the above sample, you see 06 is detected, 00316 plus what’s keyed in, minus the first two digits that where keyed in.  >  dst:2 with the INTERVOIP provider,  06 are the first digits dialed in the Netherlands, to dial a mobile phone, nationally, 0031 is the international code needed for VoIP, and the first zero shouldn’t be dialed, just like with the city dial code. you can edit this rule to your likings, edit the “06″ edit or remove the “00316″ or edit or remove the “:2″

TheFug.

btw: some dialplan expressions:

X - any digit from 0-9

Z - any digit from 1-9

N - any digit from 2-9

[1235-9] any digit in the brackets

. wildcard, matches anything remaining

Tips to install your own My SIP Switch application

May 7th, 2008

Since December 07, My SIP Switch can be installed on your own server or local computer with .Net (ie: Mono for Linux or Windows XP or Vista)

The news was given by Aaron on My SIP Switch forum : Local version of My SIP Switch

Here are a few tips to install it on Windows

You can download the zip file here :

http://www.mysipswitch.com/downloads/sipswitch-v0.2.zip

To check for newer versions, please, refer to the news section of My SIP Switch forum

The 1st thing to mention is that there is a readme file inside the zip with already many information about the installation and configuration.

The aim of this article is to provide further help for less technical people.

You’ll see that there are 2 ways of using My SIP Switch on your own : directly in the Windows command (console app) or as a Windows service.


CONSOLE:

The console application is probaby easier to put in place but if you close the window then My SIP Switch stops … so that can be unconveniant. That can be a 1st step in order to test and to get more familiar with My SIP Switch.

You simply need to edit the XML configuration files and the sipswitchconsole.exe.config file.

You need to modify the local loop IP (127.0.0.1) by your server IP (it can be a private IP, for instance, 192.168.1.1). Note that for localsipsockets and registrarrealms I also used my private IP.


SERVICE:

If you want to install it as a Windows service, you’ll find information in the readme file. Here are a few tips that came to my mind when I tried to install it myself on my laptop, running Windows XP:

Installation :

InstallUtil.exe is not in the system32 directory, so you’ll need to specify its path when trying to install the service; for instance:
E:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe “C:\_PATH_\sipswitchservice.exe”
Replace “C:\_PATH_” by the complete path to the .exe to install.

If after the installation you don’t see it in the list of windows service; look at the installation logs. If you have an error like : ” The inner exception System.ComponentModel.Win32Exception was thrown with the following error message: Access Denied”.  Make sure you have admin rights on your computer.  If the error persists, try to install it on a different directory (a simpler one, for instance : C:\Program Files\mysipswicth)

Configuration:
You need to modify the local loop IP (127.0.0.1) by your server IP (it can be a private IP, for instance, 192.168.1.1). Note that for localsipsockets and registrarrealms I also used my private IP.

Database / XML files :

You can use either of these technologies to store your data. Although note that XML are much simpler to edit (you simply need a text editor) than the DB (where you’ll need a PostgreSQL application such as PGAdminlll)

If you prefer to use a DB, then you can use the .sql file in the zip. Remember to uncomment the database related lines in the config file and to comment the lines related to XML files.

Then, to start the service: go to Start > right click on “My Compter” > Manage > Services and Applications. Select My SIP Switch and right-click to open the properties.

In the tab called “Connexion”, you need to make sure that the account using the service as administrator rights : either enter the admin login / password or use the “local system” if you are the admin your computer. If you don’t set this you’ll notice strange error messages when you’ll try to run the service saying that the connection to such or such address:port was not granted because of insuffisant rights.

All these should help you to get started properly

If you need further help, please, do not hesitate to post in My SIP Switch forum : http://www.mysipswitch.com/forum/index.php

By Guillaume

Siemens C450IP configuration guide for MySIPSwitch

May 6th, 2008

Hi,

Here is a quick configuration guide for the IP Phone : Siemens C450IP.

Important : Note that there maybe differences in naming or on the path to reach such or such screen depending on the firmware of your phone.

Siemens C450 IP

1. Get the connected physically

1st connect the phone to your router and then connect the power cable. This phone is simple so nothing tricky there.

Your phone must get an IP address, so if you are not using a DHCP, make sure to allocate an IP to your phone.





2. Get the phone’s IP address

Go to Menu > Settings > Base > Local Network (or VoIP and then Local Network, depending on your firmware) > Enter the system PIN (default is 0000) > IP Address

3. Connect the the web configuration interface

Open your favorite web browser and in the address bar enter the IP address of your phone

Write down the IP address of your phone and press enter.

Ip Address

You should see the interface below:

Web interface of C450IP





4. Enter the system pin

Click on “Settings”.

In IP configuration, by default, you won’t need to change anything. If you are not using a DHCP, then make sure your phone will always get its IP otherwise, you may encounter problems …

5. Telephony settings:

Select “Telephony”, and you should see the screen below:

Web interface of C450IP

In “Dial Plans”, you should not have anything to change (since you can handle that better with My SIP Switch).

In “Advanced Settings”, you may want to change things, but later : DTMF options especially (they should NOT be set as “Inband” if you want to use it with My SIP Switch)

Click on “Connections” and then “Edit”

You should see an interface containing the screen below:

SIP settings

Replace yourMSSusername by your actual MySIPSwitch username and edit your password.

Domain and registrar server should be sip.mysipswitch.com

Then press “Set” at the bottom.

If you go back to the page “Connections”, you should see the status as “Registered” (it may take up to 30 seconds)

5. Testing

Now that the phone is registered, you test incoming and outgoing calls.

If you don’t have sound or if the sound is only 1-way. That is more than likely a NAT problem. The 1st thing to try there is to add a STUN server in the configuration of your IP Phone, there are many free ones on the market. One I recommand often is : stun.xten.com

If you need further help, please, post on My SIP Switch’s forum

By Guillaume





Fritz!Box 7170

May 5th, 2008

Is SIP/VoIP easy ? depends…. most of the time with the common “Betamax providers” it is,

You should have not much problems, due to standard port addresses, etc… but when you do run into trouble, do you know where to look ? Should you search forever ? No, big chance your router is out of date, and your ATA isn’t the problem, and you then ask yourself, what should I set and where ? Upgrading your (modem)router is a good idea, big chance the new one has allready the “NAT things” set good at its default values, but if you have to set things for another sip-provider or a different setup, it starts all over again, so what did I recently do ? I ….bought the …. Fritz!Box 7170 !

Fritzbox

Also because I heard a lot of good things about this one, by users and also as a “by ISP provided device” (snooping around in the webinterface, I now see the point of that) (voip over ADSL…)

Follow the paperguide, that comes with the Fritz! (7170) and look for your “situation”

The box uses a weird looking cable to connect to your splitter, (or other if appropiate) it’s a ‘Y’ cable, that puts your telephone line connection and ADSL connection to one connector, that goes into the Fritz!Box, so you must read this carefully…but everything is marked…

Dont get confused because the landline connector gets mentioned seperately in “the story”‘,

I guess this makes the Fritz!box also compatible in other configurations…. once the hardware is installed, you put in the disc that comes with the Fritz! in your pc drive, and fill in your ADSL inlog info…and the …MySipSwitch inlog account info at “Internet Telephony provider, and you’re up and running,

All phone calls will now go through the internet, exept the emergency numbers.

After this the real fun starts…and you can make it very fancy ! :) if you want to go that far,

But i guess most of it you will manage from MySIPSwitch,

Use your dialplan settings as always, at MySipSwitch.

Set the Fritz! in “Expert Mode” to see all features and settings, you now should snoop around in the Fritz! web interface, and use the help function, to see what’s possible with that particular function…It’s all reasonably clear to use unlike with the SPA3102, which i found “a bit tricky”

By TheFug

X-Lite 3.0 Configuration for My SIP Switch

May 4th, 2008

Here is a quick, getting started guide for X-Lite 3.0 for WIndows XP.

1. After the installation, you should have the following screen:

No SIP Account are Enabled

2. Click on the small white arrow which says “Show Menu” and then select : “SIP Accounts Settings”

Edit SIP Account

3. Click on “Add”

Add a SIP Account

4. Now, you need to register your My SIP Switch account settings:

Display name : your name, for instance Joe Bloggs

Username : it is your My SIP Switch username

Password : your My SIP Switch password

Domain : sip.mysipswitch.com

Register with Domain and receive incoming calls must be ticked

Send outbound via : Proxy : sip.mysipswitch.com

Edit SIP Account settings

Press “Apply” and the OK.

You notice that X-Lite is trying to register and upon success will display “Ready” and “Your username is …”.

Once this registration is fine you can start making test calls.

Read the rest of this entry »

Quick and Dirty Code Overview

April 17th, 2008

I’ve had a request to provide some documentation for the code used for the mysipswitch service (downloadable from CodePlex) however there is no documentation. We’ve focused on getting a usable service up and running and providing new features rather than a concentrating too much on a developer friendly code base. The reasoning behind that approach is that there are more people interested in using the software than there are developing with it (plus I am absolutely terrible at providing external documentation for code. UML diagrams and code commenting fine but external reference documents are like pulling teeth). This post is a designed to provide a very very brief overview of the code used in the development of the sipswitch to provide a starting point.

The code is written in C# and uses Microsoft’s .Net Framework v3 libraries. It is possible to disable one part of the sipswitch (Sys.Http which provides web services from the SIP Server) and run it on Linux but for full functionality Windows is required. The main assemblies are:

  • BlueFace.Sys - General purpose assembly that contains commonly used functionality such as database access, cryptographic initialisation, string formatting etc,
  • BlueFace.VoIP.Net - The engine room of the SIP functionality. This assembly handles all the parsing and processing of SIP Transactions, SIP Requests and SIP Responses and all the pieces within them such as SIP URIs, SIP Headers, SIP Parameters etc. The intention is that this assembly implements the SIP RFC however at 269 pages in length it’s a serios RFC with lots of side references and conformance is guaranteed to be incomplete,
  • BlueFace.VoIP.Net.App - This assembly contains more specialised functionlaity that builds on top of the SIP stack in BlueFace.VoIP.Net or compliments it. Most of the functionality in this assembly is incomplete and is either a placeholder or minimum functionality to achieve a specific task. An example is the SDP.cs class which partially implements a Session Description Protocol parser. To date the only information that has been needed from the SDP has been the IP address and port number so no real effort has been put into parsing all the other information in an SDP message,
  • BlueFace.VoIP.SIPServerCores - This assembly implements the different SIP Servers in use by mysipswitch which are:
    • SIP Registrar
    • SIP Registration Agent (client to register with 3rd party SIP Providers)
    • SIP Stateful Proxy
    • Telnet Monitoring Console
    • STUN Server
    • NAT KeepAlive Server
  • SIPSwitch.Service - The Windows Service (can also be compiled as a Console application) that is the mysipswitch dameon and which controls the starting and wiring up of each of the individual servers.

That’s the main assemblies described. The simplest type of SIP Server is a stateless SIP Proxy and the SIP stack makes this a very easy job. I’ll aim to provide some example code for that in the next post as it’s also a good way to demonstrate the use of the code without requiring an in depth understanding of the inner workings which is of course what all time strapped developers are after!

Regards,

Aaron