I created a dummy SDP to pass to RTPEngine using the optional body
string "*body(string,
optional) - used to provide a specific body to the rtpengine_* function. If
this parameter is missing the body of the current message is used.*" and
RTPengine was able to create the response SDP.  It did, however, show me
that the ACK was still not being accepted from the original 200OK as I am
now getting the ACK for both CSeq now.  So I have two issues, the ACK is
not being accepted, and the no SDP on the late media INVITE.  Not sure what
is the best way to handle the Late Media INVITE with RTPEngine as so far it
has only worked when it receives an SDP.


This is the snippit of code that I am using for this and using the IP of
the Opensips server and an arbitrary port in the SDP creation.

                $var(newbody) = "v=0\r\no=Opensips  1 IN IP4
10.255.100.147\r\ns=-\r\nc=IN IP4 10.255.100.147\r\nt=0 0\r\nm=audio 3140
RTP/AVP 0 101\r\na=sendrecv\r\
na=rtpmap:0 PCMU/8000\r\na=rtpmap:101 telephone-event/8000\r\na=fmtp:101
0-15\r\n";
                xlog("New body is $var(newbody)");
                create_dialog();
                rtpengine_offer("from-tag=$ft replace-session-connection
trust-address replace-origin codec-strip-g729",,$var(body),$var(newbody));
                xlog("Body from RTPENGINE is $var(body)");
                $json(reply) := $rtpquery;

$var(port)=$json_pretty(reply/tags/$ft/medias[0]/streams[0]/local port);
                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");
                xlog("Body is $var(body)");
                t_reply_with_body(200, "OK", $var(body));
                rtpengine_play_media("call-id=$ci from-tag=$ft
file=/etc/rtpengine/unk_num.wav");
                async(sleep(10), after_media);

Here is the sngrep showing that first ACK is coming in with CSEQ 1 for
example, Reinvite, 200OK and ack for CSEQ 2, then 200OK and ACK for CSEQ 1
then 200OK and ACK for CSEQ 2.  until it times out with the
async(sleep(10), after_media);

Any help is appreciated

Thank you

Kevin

On Tue, Nov 7, 2023 at 9:19 AM Kevin Kennedy <kennedy4...@gmail.com> wrote:

> Looks like in the debug it is not finding an SDP so it cant construct a
> response.  Is there a way to remedy this?
>
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:rtpengine:extract_body: No body found
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> ERROR:rtpengine:rtpengine_offer_answer_body: can't extract body from the
> message
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:parse_headers: flags=40
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:parse_to_param: tag=1985761840-1699375436084-
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:parse_to_param: end of header reached, state=11
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:_parse_to: end of header reached, state=29
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:_parse_to: display={}, ruri={sip:+17024054893@10.20.252.101
> ;user=phone}
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:rtpengine:rtpe_function_call: proxy reply:
> d7:createdi1699375436e10:created_usi125586e11:last
> signali1699375436e4:SSRCde4:tagsde6:totalsd3:RTPd7:packetsi0e5:bytesi0e6:errorsi0ee4:RTCPd7:packetsi0e5:bytesi0e6:errorsi0eee6:result2:oke
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:parse_headers: flags=ffffffffffffffff
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:sipmsgops:remove_body_part_f: no body found
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:parse_headers: flags=ffffffffffffffff
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:pv_get_msg_body: no message body
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> ERROR:core:get_cmd_fixups: Variable in param [3] is not a string
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> ERROR:core:do_action: Failed to get fixups for command <t_reply_with_body>
> in /etc/opensips/opensips.cfg, line 284
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:rtpengine:rtpe_function_call: proxy reply:
> d8:durationi10152e6:result2:oke
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:tm:t_newtran: transaction on entrance=(nil)
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:parse_headers: flags=ffffffffffffffff
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:parse_headers: flags=78
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:tm:t_lookup_request: start searching: hash=31608, isACK=0
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:tm:matching_3261: RFC3261 transaction matching failed
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:tm:t_lookup_request: no transaction found
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:tm:run_any_trans_callbacks: trans=0x7f920581abe8, callback type 1, id 0
> entered
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:core:parse_headers: flags=ffffffffffffffff
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:tm:_reply_light: reply sent out. buf=0x7f92094d8218: SIP/2.0 1...,
> shmem=0x7f920581dfa8: SIP/2.0 1
> Nov  7 11:43:56 lab-opensips opensips[4670]: Nov  7 11:43:56 [4670]
> DBG:tm:_reply_light: finished
>
> Thank you.
>
> Kevin
>
> On Mon, Nov 6, 2023 at 2:58 PM Kevin Kennedy <kennedy4...@gmail.com>
> wrote:
>
>> I would like to clarify the issue in case its not 100% clear.
>> * Caller sends INVITE with No SDP(Late Media Invite)
>> * Another device in path (B2BUA) receives INVITE and sends dummy SDP to
>> Opensips with just G.711 codec in the Offer
>> * Opensips Creates Dialog and sends 200OK with SDP using
>> t_reply_with_body based on previously provided information.
>> * B2BUA receives 200OK with SDP then sends ACK followed by a Re-INVITE
>> with No SDP back to OpenSips.
>> * Opensips appears to accept the ACK as it doesn't retransmit the 200OK
>> right away as before updated changes.
>> * Opensips sends 100 trying with new CSEQ from Re-INVITE with no SDP
>> * 200OK Loop created
>>     * Opensips send 200 OK with old CSEQ
>>     * B2BUA sends ACK with old CSEQ
>> * Call times out.
>>
>> No audio sent
>>
>> Thank you
>>
>> Kevin.
>> *
>>
>>
>>
>> On Mon, Nov 6, 2023 at 12:54 PM Kevin Kennedy <kennedy4...@gmail.com>
>> wrote:
>>
>>> I tried updating from Opensips 3.2 to Opensips 3.4.2 as I saw that there
>>> was some re-invite fixes.  Still doesn't seem to resolve this issue.  What
>>> am I missing to handle this correctly?
>>>
>>> Thank you.
>>>
>>> Kevin
>>>
>>> On Fri, Nov 3, 2023 at 12:51 PM Kevin Kennedy <kennedy4...@gmail.com>
>>> wrote:
>>>
>>>> Dmitry,
>>>> Thank you for your response, it does appear to work this way and is
>>>> absorbing the ACK now, but when a Re-INVITE happens, it responds correctly
>>>> with the updated Cseq in the 100 Trying, but the 200 OK (using the
>>>> t_reply_with_body), still has the same Cseq as the initial INVITE.  How can
>>>> I make adjustments for this?
>>>>
>>>> Thank you.
>>>>
>>>> Kevin
>>>>
>>>> On Fri, Nov 3, 2023 at 5:10 AM Dmitry Ponomaryov <iamha...@gmail.com>
>>>> wrote:
>>>>
>>>>> 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<iamha...@gmail.com>
>>>>> > To:users@lists.opensips.org
>>>>> > Subject: Re: [OpenSIPS-Users] Opensips and rtpengine_play_media not
>>>>> >       absorbing ACK
>>>>> > Message-ID:<3971cbc2-7281-2299-4212-7f241e8b8...@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<kennedy4...@gmail.com>
>>>>> > To: OpenSIPS users mailling list<users@lists.opensips.org>
>>>>> > Subject: [OpenSIPS-Users] Opensips and rtpengine_play_media not
>>>>> >       absorbing ACK
>>>>> > Message-ID:
>>>>> >       <
>>>>> cabdxsrxltp2_uex_upx1adg16af6gaetzjujutpki8c7h3k...@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
>>>>> >
>>>>> >
>>>>> > ------------------------------
>>>>> >
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users@lists.opensips.org
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>
>>>>
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to