https://www.packtpub.com/product/freeswitch-cookbook/9781849515405
Internal calls
Calling local extensions is very simple once you know what needs to happen. In this case, we will review how to add a new user and make his or her phone available to be called.
Getting ready
If you are using the default configuration, then users 1000 through 1019 are pre-configured, both in the directory and the dialplan. To create a user outside this range, it is generally easiest to just run the add_user
script, found in the FreeSWITCH source directory under scripts/perl
. For example, to add the user 1020, launch this script from the FreeSWITCH source directory, specifying the user ID on the command line:
scripts/perl/add_user 1020
You can also specify a range of users:
scripts/perl/add_user –-users=1020-1029
You will see a note about how many users were added. If you have the CPAN module Regexp::Assembly
installed, then the script will also generate a 'sample regular expression pattern'. For our example, we will add a range of users 1020-1029.
How to do it...
Follow these steps:
-
Open the file
conf/dialplan/default.xml
in a text editor. Locate theLocal_Extension
entry:
-
<extension name="Local_Extension"> <condition field="destination_number"expression="^(10[01][09])$"> ...
-
Edit the expression in the
<condition>
tag to account for our new users. The expression pattern^(10[012][0-9])$
will do what we need (look closely to see the difference). The new line will be as follows: -
<condition field="destination_number" expression="^(10[012][09])$">
-
Save the file and then execute
reloadxml
from thefs_cli
.