This article is from csdn lidp http://blog.csdn.net/perfectpdl. please refer to this Article. Thank you.
I have created a freeswitch kernel research and exchange group, 45211986. Welcome to join. In addition, we provide the SIP-based communication server and client solution,
Developed for SIP/IMS video clients, supports access to sip Softswitch, IMS core network, and
Voice, video, and instant messaging functions. The video formats support h263, h264, and MPEG4 soft encoding solutions. The hardware coding/decoding interface is provided for interconnection and servers. If you are interested, contact me.
Freeswitch contains the XML format dialplan, asterisk likedialplan, and dialplan of the external language interface,
Dialplan is placed in the conf/dialplan directory and consists of three main files:
Default. XML-the primary freeswitchdialplan Configuration
Public. XML-handles callcoming in tofreeswitch from another location
Features. XML-a special context for handlingspecific dialing features
Default/-files in this directory getincluded in the default context
Public/-filesin this directory get pinned ded in the public context
In XML format, dialplan ranges from high to low: group, context, extenstion, and level. Group is a set of context,
One or more extenstion combinations in each context are logical concepts. extension is actually a logical concept. It is not a traditional PBX extension concept, an extension represents a small set of functions specified by the called number. An extension is uniquely identified by its name. The default configuration of freeswitch contains three contexts named default, public, features, and default are mainly dialplan. The opportunity for registering freeswitch is routed to this context. Most of them are implemented here. Public is implemented from external sources (not registered) or the context, features used when unauthenticated clients call freeswitch.
Context is the implementation of some call features. Each extension is a series of applications executed according to the conditions. Generally, it is based on a series of rules specified by the called number. These applications constitute the basis of programmable PBX. context, the extension and application (Action) relationships are as follows:
Every call that enters freeswitch defines its context, dialplan, and extenstion in freeswitch. These rules specify how to route the call. By default, the context of XML dialplan is default.
/Usr/local/freeswitch/CONF/dialplan/Default. xml
It is the default dialplan for freeswitch internal extension (verification), and the context name is default, which contains many examples,
This file also contains all the files in the/usr/local/freeswitch/CONF/dialplan/default/*. xml directory,
Therefore, if you want to add your dialplan under the default context, write an XML file and put it in the default directory.
In addition, if you want to add your own context, you can add an XML file in/usr/local/freeswitch/CONF/dialplan,
And default. similar to XML,/usr/local/freeswitch/CONF/dialplan/public. XML is the dialplan that is called by a terminal not registered to freeswitch. The context name is public, and the/usr/local/freeswitch/CONF/dialplan/public/directory can be added with the extension whose context is public.
The way to include files in other directories in the XML configuration file is to use a macro X-PRE-PROCESS, the following example contains all the XML files in the default directory to this XML file.
<X-PRE-PROCESS cmd = "include" Data = "default/*. xml"/>
Freeswitch provides a large number of test demos by default. The functions are as follows:
Extension: |
Function: |
1000-1019 |
Local extensions |
** + Extension number |
Intercept a ringing phone (that is, "Call pickup ") |
2000 |
Sample call group: Sales |
2001 |
Sample call group: Support |
2002 |
Sample call group: Billing |
3000-3399 |
Sample conference rooms |
4000 or * 98 |
Retrieve voicemail |
5000 |
Demo IVR |
5900 |
FIFO queue Park |
5901 |
FIFO queue retrieve |
6000 |
Valet park retrieval, manual |
6001-6099 |
Valet park/retrieval, automatic |
9178 |
Example Fax receive |
9179 |
Example Fax transmit |
9180 |
Ring test, far end generates ring tone |
9181 |
Ring test, send U. K. RING TONE |
9182 |
Ring test, Send music as ring tone |
9183 |
Answer, then send U. K. RING TONE |
9184 |
Answer, then send music as ring tone |
9191 |
Cluecon Registration |
9192 |
Information dump |
9195 |
Delayed echo test |
9196 |
Echo Test |
9197 |
Milliwatt tone (test signal quality) |
9198 |
Tetris |
9664 |
Music on hold |
The implementation of these functions is in default. xml by default.
XML dialplan uses a large number of Perl-Compatible Regular Expressions, most of which are used for comparison between $ {destination_number,
Common examples include
^ 789 -------------------------- match
789 $ --------------------------- match
\ D ------------------------------- match any number 0-9
^ \ D $ ---------------------------- starting with any number
^ \ D {3} $ --------------------- match
^ (\ D {5}) $ -------------------- match the name starting with five numbers and save the variable to $1.
^ (9 \ D {10} | 123) $ matches a string that starts with 123 or 9 and starts with 10 digits.
And so on.
In addition, freeswitch provides the console command RegEx to test whether the specified string matches a certain pattern,
Format: RegEx string | mode, for example:
Freeswitch @ internal> regex1234 | ^ \ D {4}
Returns true.