Re: [EXTERNAL] Re: Best Practice for Real-Time Media Forking/SIPREC in an Inline B2BUA Hairpin Setup (KEMI/Python)

Richard Fuchs via sr-users <[email protected]> Wed, 1 Jul 2026 07:33:57 -0400
Newsgroups gmane.comp.voip.ser
Organization Sipwise GmbH
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============1346823832==
Content-Type: multipart/alternative;
 boundary="------------Z307Ai3QgLePvDNVrYK09Htp"
Content-Language: en-CA, de-DE

This is a multi-part message in MIME format.
--------------Z307Ai3QgLePvDNVrYK09Htp
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Alternatively you could talk to rtpengine directly, using one of the 
subscribe/connect methods, to get a copy of the RTP media itself 
delivered somewhere, without the need for a full SIP exchange.

Cheers


On 01/07/2026 06.44, Henning Westerholt via sr-users wrote:
>
> Hello,
>
> have a look to this function: 
> https://www.kamailio.org/docs/modules/devel/modules/rtpengine.html#rtpengine.f.start_forwarding
>
> There is also some support for SIPREC, just look to the linked module 
> documentation.
>
> Cheers,
>
> Henning
>
> -- 
>
> Henning Westerholt
>
> Kamailio services – https://gilawa.com <https://gilawa.com/>
>
> *From:*Kidas Developer via sr-users <[email protected]>
> *Sent:* Mittwoch, 1. Juli 2026 10:10
> *To:* [email protected]
> *Cc:* Kidas Developer <[email protected]>
> *Subject:* [SR-Users] Best Practice for Real-Time Media Forking/SIPREC 
> in an Inline B2BUA Hairpin Setup (KEMI/Python)
>
> 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!
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions [email protected]
> To unsubscribe send an email [email protected]
> Important: keep the mailing list in the recipients, do not reply only to the sender!
--------------Z307Ai3QgLePvDNVrYK09Htp
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Alternatively you could talk to
      rtpengine directly, using one of the subscribe/connect methods, to
      get a copy of the RTP media itself delivered somewhere, without
      the need for a full SIP exchange.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Cheers</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 01/07/2026 06.44, Henning Westerholt
      via sr-users wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:AS8PR07MB7221955248C33E4DC54475B4BFF62@AS8PR07MB7221.eurprd07.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator"
        content="Microsoft Word 15 (filtered medium)">
      <style>@font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;}@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
	{font-family:Aptos;}p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:12.0pt;
	font-family:"Aptos",sans-serif;}h4
	{mso-style-priority:9;
	mso-style-link:"Heading 4 Char";
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	font-size:12.0pt;
	font-family:"Aptos",sans-serif;
	font-weight:bold;}a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#467886;
	text-decoration:underline;}code
	{mso-style-priority:99;
	font-family:"Courier New";}span.Heading4Char
	{mso-style-name:"Heading 4 Char";
	mso-style-priority:9;
	mso-style-link:"Heading 4";
	font-family:"Times New Roman",serif;
	color:#0F4761;
	mso-ligatures:none;
	mso-fareast-language:EN-GB;
	font-style:italic;}span.EmailStyle21
	{mso-style-type:personal-reply;
	font-family:"Aptos",sans-serif;
	color:windowtext;}.MsoChpDefault
	{mso-style-type:export-only;
	font-size:11.0pt;
	mso-fareast-language:EN-US;}div.WordSection1
	{page:WordSection1;}ol
	{margin-bottom:0cm;}ul
	{margin-bottom:0cm;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">Hello,<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">have a look to this function:
          <a
href="https://www.kamailio.org/docs/modules/devel/modules/rtpengine.html#rtpengine.f.start_forwarding"
            moz-do-not-send="true" class="moz-txt-link-freetext">
https://www.kamailio.org/docs/modules/devel/modules/rtpengine.html#rtpengine.f.start_forwarding</a><o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">There is also some support for SIPREC, just
          look to the linked module documentation.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Cheers,<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Henning
          <o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">--
          <o:p></o:p></p>
        <p class="MsoNormal">Henning Westerholt<o:p></o:p></p>
        <p class="MsoNormal">Kamailio services –
          <span lang="DE"><a href="https://gilawa.com/"
              moz-do-not-send="true"><span lang="EN-GB"
                style="color:#0563C1">https://gilawa.com</span></a></span><o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div
style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
          <div>
            <div
style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm;font-size:pt">
              <p class="MsoNormal"><b><span
                    style="font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span
                  style="font-family:&quot;Calibri&quot;,sans-serif">
                  Kidas Developer via sr-users
                  <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a>
                  <br>
                  <b>Sent:</b> Mittwoch, 1. Juli 2026 10:10<br>
                  <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a><br>
                  <b>Cc:</b> Kidas Developer
                  <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a><br>
                  <b>Subject:</b> [SR-Users] Best Practice for Real-Time
                  Media Forking/SIPREC in an Inline B2BUA Hairpin Setup
                  (KEMI/Python)<o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <div>
            <p>Hello Kamailio Community,<o:p></o:p></p>
            <p>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.<o:p></o:p></p>
            <h4>Our Environment<o:p></o:p></h4>
            <ul type="disc">
              <li style="mso-list:l0 level1 lfo1"><b>OS:</b> Ubuntu
                24.04 LTS<o:p></o:p></li>
              <li style="mso-list:l0 level1 lfo1"><b>Kamailio Version:</b>
                6.1.3 (x86_64/Linux) running the Python KEMI engine (<code>kamailio.py</code>)<o:p></o:p></li>
              <li style="mso-list:l0 level1 lfo1"><b>RTPEngine Version:</b>
                26.2.0.0+0~mr26.2.0.0<o:p></o:p></li>
            </ul>
            <h4>Our Scenario<o:p></o:p></h4>
            <p>We have a fully working signaling hairpin configuration
              handled inside <code>kamailio.py</code>. A call arrives
              from our carrier gateway, loops through our proxy
              framework, and terminates to the customer gateway, with
              media successfully anchored via RTPEngine.<o:p></o:p></p>
            <h4>The Objective<o:p></o:p></h4>
            <p>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.<o:p></o:p></p>
            <h4>Our Questions:<o:p></o:p></h4>
            <ol start="1" type="1">
              <li style="mso-list:l1 level1 lfo2"><b>RTPEngine Network
                  Replication:</b> 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 (<code>IP:Port</code>)?<o:p></o:p></li>
              <li style="mso-list:l1 level1 lfo2"><b>Kamailio Native
                  Alternatives:</b> 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?<o:p></o:p></li>
            </ol>
            <p>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.<o:p></o:p></p>
            <p>Thank you for your time!<o:p></o:p></p>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre wrap="" class="moz-quote-pre">__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
To unsubscribe send an email to <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
</pre>
    </blockquote>
  </body>
</html>

--------------Z307Ai3QgLePvDNVrYK09Htp--

--===============1346823832==
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!

--===============1346823832==--