[OpenSIPS-Users] Opensips and rtpengine_play_media not absorbing ACK

Dmitry Ponomaryov iamhalje at gmail.com
Fri Nov 3 12:05:45 UTC 2023


It turns out that this is no early_media, there were simply successful 
attempts with 183 Session Progress, which is why there was such a 
misunderstanding, I’ll attach the snippet code again in plain text: 
route { if (is_method("INVITE")) { create_dialog(); route(media); exit; 
} } route[media] { if (has_body("application/sdp")) { rtpengine_offer(); 
} $json(reply) := $rtpquery; 
$var(port)=$json_pretty(reply/tags/$ft/medias[0]/streams[0]/local port); 
remove_body_part(); append_to_reply("Contact: 
<sip:$rU@$socket_in(ip):$socket_in(port);transport=udp;did=$DLG_did>\r\n"); 
append_to_reply("Content-Type: application/sdp\r\n"); $var(body) = 
$(rb{re.subst,/(IP4.).*/\1$socket_in(ip)/g}); $var(body) = 
$(var(body){re.subst,/(audio.)...../\1$var(port)/g}); 
t_reply_with_body(200, "OK", $var(body)); 
rtpengine_play_media("call-id=$ci from-tag=$ft 
file=/etc/rtpengine/media.wav"); async(sleep(10), after_media); } 
route[after_media] { if (t_was_cancelled()) { rtpengine_delete(); exit; 
} else { rtpengine_delete(); sl_send_reply(486,"Busy here"); exit; } }

and pined previous posts below :)

> ----------------------------------------------------------------------
> Message: 2
> Date: Fri, 3 Nov 2023 16:00:22 +0500
> From: Dmitry Ponomaryov<iamhalje at gmail.com>
> To:users at lists.opensips.org
> Subject: Re: [OpenSIPS-Users] Opensips and rtpengine_play_media not
> 	absorbing ACK
> Message-ID:<3971cbc2-7281-2299-4212-7f241e8b8b5a at gmail.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> Hello everyone, I would like to show my part of the code when playing
> early media after 200OK, when creating dialogs, I substituted $DLG_did
> in the contact of my dialog, and received the same $DLG_did for my
> dialog in ACK, but OpenSIPS also continued to send 200OK , despite
> having already received an ACK response.
>
> route {
>
> # initial invite
>
> if (is_method("INVITE")) {
>
> create_dialog();
>
> route(early_media);
>
> exit;
>
> }
>
> } route[early_media] { if (has_body("application/sdp")) {
> rtpengine_manage(); } $json(reply) := $rtpquery;
> $var(port)=$json_pretty(reply/tags/$ft/medias[0]/streams[0]/local port);
> remove_body_part();
>
> append_to_reply("Contact:
> <sip:$rU@$socket_in(ip):$socket_in(port);transport=udp;did=$DLG_did>\r\n");
>
> append_to_reply("Content-Type: application/sdp\r\n"); $var(body) =
> $(rb{re.subst,/(IP4.).*/\1$socket_in(ip)/g}); $var(body) =
> $(var(body){re.subst,/(audio.)...../\1$var(port)/g});
> t_reply_with_body(200, "OK", $var(body));
> rtpengine_play_media("call-id=$ci from-tag=$ft
> file=/etc/rtpengine/media.wav"); async(sleep(10), after_early_media); }
> route[after_early_media] { if (t_was_cancelled()) { rtpengine_delete();
> exit; } else { rtpengine_delete(); sl_send_reply(486,"Busy here"); exit;
> } }
>
> I don’t know if Kevin example was with creating a dialog, but I also
> noticed this problem through transaction... thanks
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:<http://lists.opensips.org/pipermail/users/attachments/20231103/059cb479/attachment-0001.html>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 2 Nov 2023 16:32:02 -0700
> From: Kevin Kennedy<kennedy4260 at gmail.com>
> To: OpenSIPS users mailling list<users at lists.opensips.org>
> Subject: [OpenSIPS-Users] Opensips and rtpengine_play_media not
> 	absorbing ACK
> Message-ID:
> 	<CABDXsRxLTp2_uEX_UPX1adg16af6gaetzJujUTPki8c7H3KKLQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I am trying to build a solution where Opensips 3.2+ with RTPengine acts as
> a UAC, answers a call with 200OK, plays media from file, and will terminate
> the call right after playing announcement.
>
> Opensips is responding with 200OK with SDP body and making the
> correct changes for the IP, but when the ACK comes back from the UAS,
> Opensips doesn't seem to absorb it and retransmits the 200OK.
>
> Code snippet handling this scenario
>
>          rtpengine_manage("from-tag=$ft replace-session-connection
> trust-address replace-origin codec-strip-g729",,$var(body));
>          append_to_reply("Contact:<sip:$socket_out>\r\n");
>          append_to_reply("Content-Type: application/sdp\r\n");
>          t_reply_with_body(200, "OK", $var(body));
>          rtpengine_play_media("from-tag=$ft
> file=/etc/rtpengine/unk_num.wav");
>          sleep(10);
>          rtpengine_delete("from-tag=$ft");
>          #t_reply(603, "Decline");
>          exit();
>
>
> What do I need to add to handle this scenario correctly?
>
> Note:  I was able to get this to work with Early Media (183
> reply_with_body, and send t_reply(603, "Decline")), but we have customers
> using late media invite as well, so the Early Media option wouldn't work in
> that case.
>
> Thank you.
>
> Kevin Kennedy
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:<http://lists.opensips.org/pipermail/users/attachments/20231102/dd52d307/attachment-0001.html>
>
> ------------------------------
>



More information about the Users mailing list