Best Practice for Real-Time Media Forking/SIPREC in an Inline B2BUA Hairpin Setup (KEMI/Python)
Kidas Developer via sr-users <[email protected]> Wed, 1 Jul 2026 11:09:55 +0300
| Newsgroups | gmane.comp.voip.ser |
|---|---|
| Message-ID | <CAGKbCA3HeRVzc=VqGD9gq6Vw_JRe_oakJYckDd=yi83UBMzwcg@mail.gmail.com> |
--===============0268952071== Content-Type: multipart/alternative; boundary="0000000000003c13d8065588380f" --0000000000003c13d8065588380f Content-Type: text/plain; charset="UTF-8" Hello Kamailio Community, I am looking for the best practice or native method to implement real-time media forking/forwarding directly from our proxy/media layer to an external Python/FastAPI service, keeping the architecture completely clear of any intermediary PBX engines. Our Environment - *OS:* Ubuntu 24.04 LTS - *Kamailio Version:* 6.1.3 (x86_64/Linux) running the Python KEMI engine ( kamailio.py) - *RTPEngine Version:* 26.2.0.0+0~mr26.2.0.0 Our Scenario We have a fully working signaling hairpin configuration handled inside kamailio.py. A call arrives from our carrier gateway, loops through our proxy framework, and terminates to the customer gateway, with media successfully anchored via RTPEngine. The Objective We need to passively replicate/fork a twin stream of the live full-duplex voice packets directly over the network via UDP or TCP to an asynchronous socket listener on our backend Python application. We want this to happen completely in real-time, with zero disk-spooling/file-writing dependencies. Our Questions: 1. *RTPEngine Network Replication:* Given that we are on RTPEngine 26.2, is there a native control flag or parameter inside the daemon protocol to replicate and push live UDP streams straight to an external network target ( IP:Port)? 2. *Kamailio Native Alternatives:* If RTPEngine cannot forward packets directly over the network to a raw socket, are there specific Kamailio 6.1.3 modules or KEMI-exported functions we should utilize to capture and mirror the live RTP streams down to our Python service? We are trying to keep this pipeline as lightweight and bare-metal as possible (Kamailio + RTPEngine + Python). Any guidance, architectural patterns, or module recommendations to achieve this clean proxy-to-application streaming would be immensely appreciated. Thank you for your time! --0000000000003c13d8065588380f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><p>Hello Kamailio Community,</p><p>I am looking for the be= st practice or native method to implement real-time media forking/forwardin= g directly from our proxy/media layer to an external Python/FastAPI service= , keeping the architecture completely clear of any intermediary PBX engines= .</p><h4>Our Environment</h4><ul><li><p><b>OS:</b> Ubuntu 24.04 LTS</p></li= ><li><p><b>Kamailio Version:</b> 6.1.3 (x86_64/Linux) running the Python KE= MI engine (<code>kamailio.py</code>)</p></li><li><p><b>RTPEngine Version:</= b> 26.2.0.0+0~mr26.2.0.0</p></li></ul><h4>Our Scenario</h4><p>We have a ful= ly working signaling hairpin configuration handled inside <code>kamailio.py= </code>. A call arrives from our carrier gateway, loops through our proxy f= ramework, and terminates to the customer gateway, with media successfully a= nchored via RTPEngine.</p><h4>The Objective</h4><p>We need to passively rep= licate/fork a twin stream of the live full-duplex voice packets directly ov= er the network via UDP or TCP to an asynchronous socket listener on our bac= kend Python application. We want this to happen completely in real-time, wi= th zero disk-spooling/file-writing dependencies.</p><h4>Our Questions:</h4>= <ol start=3D"1"><li><p><b>RTPEngine Network Replication:</b> Given that we = are on RTPEngine 26.2, is there a native control flag or parameter inside t= he daemon protocol to replicate and push live UDP streams straight to an ex= ternal network target (<code>IP:Port</code>)?</p></li><li><p><b>Kamailio Na= tive Alternatives:</b> If RTPEngine cannot forward packets directly over th= e network to a raw socket, are there specific Kamailio 6.1.3 modules or KEM= I-exported functions we should utilize to capture and mirror the live RTP s= treams down to our Python service?</p></li></ol><p>We are trying to keep th= is pipeline as lightweight and bare-metal as possible (Kamailio + RTPEngine= + Python). Any guidance, architectural patterns, or module recommendations= to achieve this clean proxy-to-application streaming would be immensely ap= preciated.</p><p>Thank you for your time!</p></div> --0000000000003c13d8065588380f-- --===============0268952071== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender! --===============0268952071==--