XML
XML is widely used in FS (FreeSwitch). dialplan is a very important and fast content. The following describes the statements in XML execution:
<Action application = "set" data = "$1"/>
How to associate it with its implementation? Where can I see its implementation? What is its implementation?
Next let's take a look at how FS is done! The preceding XML statement is used as an example.
1. How to associate with its implementation
When the channel of FS is in the EXCUTE state: Execute the code based on the application and data read on XML and call the callback function. The example above is as follows: application is set, data is $1 (1234, the parsed result passed in here)
The call process is as follows:
Switch_core_standard_on_execute->
Switch_core_session_execute_application->
Switch_core_session_execute_application_get_flags->
Switch_core_session_exec: application_interface-> application_function (session, expanded );
Application_function is the callback function.
The specific execution function is the application that will be loaded during system initialization and assigned to the function pointer. Therefore, when the above blue-labeled callback function is executed, the corresponding application on each module of FS will be executed.
2. Specific implementation
For example, set is registered on mod_dptool. (How do we know where to register? When FS is started, the registration information of application is displayed in the information printed in the window, so that you can know the implementation in that module .)
Set implementation:
SWITCH_STANDARD_APP (set_function) // This is macro-defined
{
Base_set (session, data, SWITCH_STACK_BOTTOM );
}
Open the DEBUG log to view the following logs:
01:29:55. 013184 [DEBUG] mod_dptools.c: 1373 sofia/internal/1001@192.168.152.129 SET [1234] = [UNDEF]
3. Implement Functions
According to the above analysis, we can conclude that the implementation of each application is different. For specific implementation, see the specific code. I will not analyze it here.
Note: The Conversion Relationship Between the application name and the function name in xml is application_function. The specific call conditions are not described.