Open source Software Architecture Summary--asterisk (DSL, Component, multithreading)

Source: Internet
Author: User

Asterisk 1 is an open-source telephony Application platform based on the GPLV2 protocol. To put it simply, this is a server-side program that handles dial-out, access, and custom processes for phones .

A person uses phone A to call another person who uses phone B. In this scenario, there are two telephone terminals connected to the asterisk system, thus allocating two channels (1.2).

Figure 1.2 Two channels represent two call lines

Media Transfer uses a peer-to-peer approach!

Figure 1.3 Dedicated bridging instance

Figure 1.4 Channel technology layer and abstract channel layer

Asterisk component Abstraction

The asterisk is a highly modular piece of software. Its kernel program can be constructed from the source code of the main/directory on the source tree. But the kernel program itself is not very useful, because its main function is to register the module. The system also has some code that is responsible for connecting all the abstract interfaces so that the phone calls work. The specific implementations of these interfaces are registered at runtime by some of the loading modules.

By default, when the main program starts,asterisk will find all modules in a pre-specified module directory on the filesystem and load them . Choosing this default method is for simplicity's sake. However, there is a configuration file that can be changed to specify which modules to load and the order in which they are loaded . The system configuration becomes somewhat complex, but it can be specified that the modules that are not needed are not loaded. The main benefit of this is to reduce the memory footprint of the program, but there are some security benefits. If a module can accept a connection from the network, but does not actually need it, it is better not to load it.

After the module is loaded, it registers the implementation of all its component abstractions in the asterisk kernel program. The interfaces that can be implemented by the module and registered in the asterisk kernel are varied. The system allows modules to register as many types of interfaces as possible. Usually similar functions are composed of a separate module.

The asterisk administrator uses the asterisk dial plan (stored in the/etc/asterisk/extensions.conf file) to set up the call routing table. A dial plan is made up of a series of call rules called extended rules. When there is a phone call to access, the system uses the called number to find the extension rule in the dial plan to handle this call. ( essence: DSL!) Before we give an example, let's look at a asterisk dial plan syntax, which is used to process calls to number 1234. Note that this number is 1234-A-line. A total of 3 dialer is called: First, answer the call; second, play back the audio file; Finally, hang up the call.

; define The rules for What happens when someone dials 1234.exten => 1234,1,answer ()  same => N,playback ( Span class= "PLN" >demo-congrats)  same Span class= "pun" >=> N,hangup ()    


Most threads of asterisk can be categorized as network monitoring threads or channel threads(sometimes also referred to as a PBX thread because its primary purpose is to run a user-level switch PBX on the channel).

Figure 1.7 assembly diagram for normal call bridging

So far, the structure of Asterisk has a history of more than ten years. However, while the industry is evolving, some of the things that asterisk, such as the basic concept of channels, flexible call handling using dial plans, still support the development of complex telephony systems. there is one area where the asterisk architecture has not been handled too well, that is, how to make the system scalable across multiple servers. The asterisk development community is developing a partner project called the Asterisk SCF (Scalable communications framework) to address scalability issues.

Reference: http://www.ituring.com.cn/article/13057#

Open source Software Architecture Summary--asterisk (DSL, Component, multithreading)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.