Q-Can you tell me how the switch is set or decides where to send the records or which company will bill the calls?
A-First you have to remember that modern switches are just very complex computers. Second, while this response generally describes U.S. networks, those in other parts of the world perform similar tasks as required. In addition to the embedded manufacturer's software, each modern, electronic switch has local software tables (often called translations) that contain information identifying how each type of call is to be routed.
The first test is to identify calls it can deliver without handing off to another switching center-for example, 845-123-4567 calling 845-123-9876. Then it checks for calls to destinations other than the 845-123 exchange within the same local market. Each of these other destination switches will be reached via dedicated "trunk groups" or "routes" owned by the same local exchange carrier. In a large city, the call may traverse multiple switching centers before reaching the distant end office. Each call or attempt is recorded and passed to the billing system of the local telephone company.
If the destination switch is not within the Local Access Transport Area (LATA), it usually must be handed off to a long distance carrier. In "equal access" markets-and most markets in the United States are equal access now-the first step is to see if the subscriber has entered a dial-around code to route the call to a specific long-distance operator (more on dial-around below).
If a dial-around code is not detected, the calling subscriber's switch record is accessed to obtain the Pre-selected Inter-exchange Carrier Code, or PIC code, that identifies the long-distance carrier chosen by the subscriber at some prior time. In some states, subscribers are allowed to select one carrier for intrastate calls and another for interstate calls. In these cases, separate indicators are maintained for each option. The PIC code is used to route the call to the pre-subscribed long-distance carrier. In most cases today, the long-distance carrier will record and bill for any completed calls handed off to it this way. It may invoice the call itself, or hand the call back to the local telephone company for billing. While less common than a few years ago, some local telephone companies record, rate and bill on behalf of long-distance companies.
The use of PIC codes can be overridden if the subscriber elects to enter an alternate carrier code for specific calls. Commonly called "dial-around codes," currently they are the ones that require the first dialed digits to be "101." That is a signal to the switch not to use the subscriber's PIC code, but rather to use the dial-around code that follows the digits 101.
Here's an example. The calling subscriber is pre-subscribed to Sprint for interstate long-distance calls. The PIC code normally used to reach Sprint in the subscriber's switch record is 10333. For this call, the subscriber elects to use AT&T. The PIC for AT&T is 10288. To reach AT&T for this call, the subscriber dials "1010288," followed by the destination telephone number. The call will be routed to AT&T via an access tandem switch. It's up to AT&T whether to accept this call. If it does, the call will usually appear on the subscriber's local telephone bill after being rated by AT&T and passed to the local telephone company for billing on behalf of AT&T.
Behind all this in the North American network are huge regional databases that have been set up to deal with verifying numbers and routing them to the correct receiving switch. Before Local Number Portability started, a Line Identification Data Base, or LIDB, was accessed to verify numbers, calling cards, etc. With number portability, additional systems and databases have had to be developed. If a number is ported from an incumbent LEC to a competitive LEC that operates its own local switch, the line number has to be separated from the traditional destination switch and related to the switch operated by the CLEC.
That process is handled by regional Number Portability Administration (or Access) Center (NPAC) databases. NPAC databases interact with the Local Service Order Administration (LSOA) systems of carriers to keep track of "what number is where" in the network. Any more detail than that will get us into the murky depths of networks.