Hi Matthew,
For efficiency reasons, the changes over the SIP messages are not
applied (so vizible) on the spot, but only at the end, when the SIP
message is sent out. So, shortly, you cannot see the changes done by
your script, you all the time "see" the initial received message.
Options you have here:
1) force applying the changes, see the get_updated_body_part() [1]
if (has_body("application/sdp")){
rtpengine_offer();
get_updated_body_part( "application/sdp", $var(new_sdp));
$var(mline) = $(var(new_sdp){sdp.line,m,0});
xlog("TEST $var(mline)\n");
}
2) instruct rtpengine not to change the SDP in the message, but to do
the changes over an SDP stored in a variable. And you will push the new
SDP manually in the message.
if (has_body("application/sdp")){
$var(new_sdp)= $rb;
rtpengine_offer(,,,,,$var(new_sdp));
$var(mline) = $(var(new_sdp){sdp.line,m,0});
remove_body_part("application/sdp");
add_body_part($var(new_sdp),"application/sdp");
xlog("TEST $var(mline)\n");
}
[1]
https://opensips.org/html/docs/modules/3.4.x/sipmsgops.html#func_get_updated_body_part
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
https://www.opensips-solutions.com
https://www.siphub.com
On 26.03.2024 23:17, Matthew Schumacher wrote:
Hello,
I'm trying to log the media port for another system and using this
code to grab the m line out of an SDP header:
if (has_body("application/sdp")){
rtpengine_offer();
$var(mline) = $(rb{sdp.line,m,0});
xlog("TEST $var(mline)\n");
}
The problem is that it only sees the ports for ingress SDP messages
and not egress SDP messages. What can I do to grab the SDP messages
leaving opensips?
I want to take this data and inject a firewall rule that allows the
media and remove it later because NAT helpers don't work on TLS
traffic, my system already knows what port to expect, and I don't like
having a huge pile of UDP ports allowed through.
Honestly, I'm not sure why the kernel mode forwarding in rtpengine
doesn't also allow traffic based on ports we are expecting to see
traffic from.... that's what I thought it did at first until I
realized that it's only forwarding the RTP packet through the kernel
faster without needing userspace.
Thanks,
Matt
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users