Recording of the FreeSWITCH kernel research

Source: Internet
Author: User

recording of the FreeSWITCH kernel research

First, register callback function

Application Call Switch_ivr_record_session->

Switch_core_media_bug_add registering the Mediabug interface callback function with the FS kernel Record_callback listening for streaming media (read-write mode)

second, the kernel calls the switch_core_session_read_frame to obtain the utterance tone

1. Call endpoint's Read_frame function to get endpoint's voice.

2, call the media bug callback function Record_callback notify the application to get voice data.

3, application if the channel variable Record_use_thread is set to true, the kernel turns on thread recording, the kernel buffers the recording data to Thread_buffer, and then reads the buffered write file through the thread. Otherwise, write the file directly. (If the recording loses data, it can be recorded by thread mode)

4. Kernel Write file

The kernel pre_buffer for each recording buffer pool, writes the data that needs to be written to this buffer, when the buffer data size is greater than Switch_default_file_buffer_len = 65536

, the kernel gets the data write file from the buffer pool. The application can set the size of the Switch_default_file_buffer_len by setting the channel variable enable_file_write_buffering.

third, kernel call Switch_core_session_write_frame write speech

1. Call endpoint's write_frame function to send voice to endpoint

2, call the media bug callback function Record_callback notify the application to get voice data

3, the same step two (3).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.