How drachtio/drachtio-siprec-recording-server works
Project type and purpose
• This is an open-source Node.js “SIPREC recording server” that sits on top of a drachtio SIP server and routes SIPREC INVITEs to a back-end media recorder (either RTPengine or Freeswitch/Asterisk).
• Its job is to parse the multipart SIPREC INVITE, allocate media endpoints on the chosen media server, glue caller/callee media flows, and return a 200 OK to the SIPREC client so that recording begins.
File structure
• Top level:
• app.js – main entry-point, initializes drachtio SRF and connects handlers
• config/*.json – sample configs for RTPengine, Freeswitch/Asterisk, local tests
• lib/ – core modules:
– payload-parser.js, payload-combiner.js, utils.js
– freeswitch-call-handler.js (and rtpengine-call-handler.js)
– dtmf-event-handler.js
• test/ – test suite and Docker Compose testbed
• Notice two handler modules implementing the adapter pattern for each media server, and shared utility modules for SDP/XML parsing and message assembly.
Read README for additional insights
• Two mutually exclusive back-end modes: RTPengine (uses its NG control protocol over UDP, no Redis) vs Freeswitch/Asterisk (requires Redis to correlate A- and B-leg, custom dialplan for hairpin recording).
• External dependencies: drachtio SIP server, optional Redis, RTPengine or Freeswitch/Asterisk, various SBCs.
Detail
• Handler module as a sub-component under the Node app.
• Call out configuration files and how they select the media server mode.