Asterisk recording can use monitor and mixmonitor. The difference is that monitor records a single channel and mixmonitor records a dual channel,
Process: Specify the recording file name and format when you call monitor. Mount the file to the channel and call ast_read to read the RTP stream at the beginning of connection. If the protocol stack supports callback, call the READ function provided by the protocol stack, such as sip. sip_read function, sip_read internally calls RTP interface function, sip_rtp_read, sip_rtp_read also calls rtp engine function ast_rtp_read, ast_rtcp_read, receives frame data, the ast_rtp_read function calls the recvfrom UDP sockt function to read the UDP packet and parse the packet to the RTP structure of the channel.
Finally, the __ast_read function calls ast_writestream to write frame data to the recording file, and ends ..