Freeswitch basic

From 탱이의 잡동사니
Jump to navigation Jump to search

Overview

Freeswitch basic 내용 정리.

Extensions, Contexts and Profiles

In FreeSWITCH 'extension is an immaterial concept. It can be understood as 'a group of instructions into a context'. A context is a named collection of extensions.

Freeswitch has "profiles". A profile is a collection of configurations that is related to a specific IP address and port couple. For example, 192.168.1.12:5060 is a profile, 192.168.1.13:5060 is another profile, 192.168.1.12:5061 is a third profile. Each one profile can contains configurations that are completely different from that of other profiles. One very important such configuration contained in a profile is to which context the incoming call will go. A call is always incoming to a profile, eg, to an address:port couple. So, let's say the address:port couple is the enter gate to a specific profile. Once the call has entered the profile, first thing Freeswitch do is to look up in that profile the configuration that defines which context the call must to into.

Let's say the call is incoming at 192.168.1.12:5060. We called this profile "myprofile", and in the XML configuration of that profile is defined that the context to be used is "mycontext". This means that the incoming call will only be processed by the extensions (instructions sets) contained in the "mycontext" extensions collection (context). That is, the incoming call will go in the context defined in the profile, and it has no way to access anything that is outside that context.

The context is the jail of the call. This has obvious security, logical,and practical advantages: for example the calls that are incoming to a profile that is accessible by our coworkers from the internal LAN will be directed to a context that gives the feature of internal office call, and allows also for reaching the PSTN, because we want our coworkers to be authorized to place national and international calls. On the other hand, the calls that are incoming to a profiles with a public Internet address, that is the calls that are reaching us passing through the router from the outside of our internal LAN, those calls are directed to a context that only allows for the call to be connected to one of our coworker's phone. This specific profile will ha ve only the feature to allow for external incoming calls to reach an internal phone, without any possibility to originate PSTN calls. That is, strangers cannot use our paid gateway to reach the PSTN.