About FreeSWITCHFirst partNumbering plan
So, FreeSWITCH can tweak a lot of settings, but the main action will take place in the number plan. The number plan is located in conf / dialplan / *. As usual, preprocessing collects all files from this folder into one. The numbering plan is divided into contexts. That is, following the settings in the SIP profile, user settings, the appropriate context is selected and the call is processed in accordance with the modules (extension, translated into Russian as an “extension number”, but does not correspond to the meaning).
')
Create conf / dialplan / simple.xml, put there an example of a simple NP context:
<?xml version="1.0" encoding="utf-8"?> <include> <context name="simple"> <extension name="unloop"> <condition field="$${unroll_loops}" expression="^true$"/> <condition field="${sip_looped_call}" expression="^true$"> <action application="deflect" data="${destination_number}"/> </condition> </extension> <extension name="testplay"> <condition field="destination_number" expression="^7878$"> <action application="answer"/> <action application="sleep" data="1000"/> <action application="playback" data="/opt/freeswitch/sounds/site/nikogo_net_doma.wav"/> <action application="hangup"/> </condition> </extension> </context> </include>
Edit the conf / directory / 1000.xml file, and set user_context to simple. This will tell FreeSWITCH that calls from user 1000 should be handled according to the context simple. Register on the server with username 1000, password 1234 and as the realm and server address set the IP address of the server. Try calling 7878 (you should put the wav file at the appropriate address, otherwise you will not hear anything).
Playback is one of the possible numbering applications. Full list of possible actions
on the project wiki .
Bridge
A very important application is the bridge. With it, you can establish a connection with the gateway, another user. General form:
<action application = "bridge" data = "sofia / cip profile name / number @ address or server domain" />
You can call to type several addresses at the same time:
<action application = "bridge" data = "sofia / internal / 1000 @ $$ {domain}, sofia / internal / 1000 @ $$ {domain}" />
Consistently:
<action application = "bridge" data = "sofia / internal / 1000 @ $$ {domain} | sofia / internal / 1000 @ $$ {domain}" />
Using the “set” application, you can set the call_timeout variable, which will limit the time of the dialing attempt.
Now, armed with this knowledge, we can write another extension module for calls to local users:
<extension name="testcall"> <condition field="destination_number" expression="^(10[01][0-9])$"> <action application="bridge" data="user/$1@$${domain}"/> <action application="hangup"/> </condition> </extension>
Here we see the parameter of the bridge application - user / $ 1 @ $$ {domain}. Let us examine in more detail, $ 1 is the result of evaluating a regular expression in the condition, namely the contents of the first brackets. user - the standard destination point (endpoint) that serves to call registered users, requires the indication of the correct domain.
Besides the user’s destination, the main point is sofia. The syntax is: sofia / profile / number @ node_address. The profile parameter specifies the virtual SIP server from the address and port of which the call will be made.
The second way to use sofia is to send a call through the gateway: sofia / gateway / gateway_name / number. For example, the module for a call to Moscow via sipnet:
<extension name="moskow"> <condition field="destination_number" expression="^(8495\d{7})])$"> <action application="bridge" data="sofia/gateway/sipnet/$1"/> <action application="hangup"/> </condition> </extension>
That's all for now. Explore the numbering plan in the kit, read the wiki, but for now I’ll think about the continuation.