a much more simple sample with IP phones
If you own an IP phone, there is the codec chip integrated and with its firmware it acts as a gateway. It looks like a usual phone but it is much more intelligent. And it needs a connection to your providers SIP or H323 server with the routing and dialing databases.
IP phone to IP phone:
Both phones must be registered in a database server (SIP server) of your VOIP service provider and both phones must know their SIP server name or address. If you have both phones on the same SIP server like our simple sample, it is the easiest to understand the function.
You touch the speaker button, dial the known number with no leading or area code and the other IP phone rings like inside the company. You must be aware of the known numbers of the database like an internal phonebook.
Your VSP keeps tracking of all registered IP phones in a keep alive list. So calling a phone, which currently is not active, you get the typical beep beep beep (in use or absent) tone.
IP phone to external PSTN (old wired) phone:
If your first number is a "0", the SIP server recognizes a call outside its environment (or its little island) like a national long distance call. Even your loval calls to the PSTN phone of your neighbourhood must contain an area code.
So calling from my IP phone any PSTN number inside Germany, I know to add any German area code, all the time. That is a feature of our provider. The gateway is in Frankfurt/Germany.
If your provider has many gateways all over the world like ours (www.ngtel.de), there is a routing table and a conversion table inside the SIP server. So after analysing the destination number, the server starts to act an provide the optimized routing an the corrected dial number. You do not recognize that. Its really fast.
For example you dial a typical UK number 0044 12345-6789, the SIP server detects the UK 0044 country code and the 12345 area code. It makes a lookup for the current routing to our London gateway and passes all information to this MAX TNT over SS7.
Sample with a PPCC (pre paid calling card)
The second sample is nearly like the first one, but the call is prepaid and taken from your credit, you did pay in advance for the card.
You are dialing a special number (printed on your card) from a public cardphone. (Special means for first, you have a pre-selected destination country.) A friendly voice is asking for the PIN. Then you are entering the PIN and the friendly voice is telling you your credit and the price per minute and you may dial the full number of the other end or hang up. For our office here in Germany this would be 0611 950310 or 611 950310.
Your first number is directed to a loval gateway and a SIP server, generating the voice from a database, the following number is checked for the routing and any mismatches and then forwarded to the destination gateway in the destination country and passed to the national PSTN telco. As lond as the called person does not answer, no session is established. Everything is negotiated on a signaling level. Even the tone after dialing is generated in your local equipment. When the called person is answering the phone, the session is established and you may talk and listen.