[OpenSIPS-Users] Create and send a 180 reply messsage

mayamatakeshi mayamatakeshi at gmail.com
Sun Oct 20 20:25:13 UTC 2024


On Sun, Oct 20, 2024 at 11:38 PM M S <medeanwz at gmail.com> wrote:

> Hi list,
> I am having a problem that my upstream provider disconnects the call if my
> client does not send 180/183 before 200 OK.
> At the time of receiving 200 OK (in reply_route) I can check to see if
> previously a 180/183 was also sent or not.
> My solution is: as soon as I receive a 200 OK from the client, if 180/183
> was not received before, I create a 180 ringing message and send it to
> upstream, before passing on 200. Now I realized that none of the usual
> methods (send_reply, sl_send_reply, t_send_reply) work from reply_route,
> and I have no idea how to use dlg_send_sequential to send a "180 ringing".
> Any ideas would be appreciated.
>
>
dlg_send_sequential would not work as it is used to generate a request.

I think opensips should allow t_reply to work from within ONREPLY_ROUTE.
Currently it, doesn't:

opensips tm.c:
    {"t_reply", (cmd_function)w_pv_t_reply, {
        {CMD_PARAM_INT, fixup_reply_code, 0},
        {CMD_PARAM_STR, 0, 0}, {0,0,0}},
        REQUEST_ROUTE | FAILURE_ROUTE},

But kamailio which, as opensips, inherited the tm foundation from openser
allows it:
    {"t_reply", w_t_reply, 2, fixup_t_reply, 0,
            REQUEST_ROUTE | ONREPLY_ROUTE | FAILURE_ROUTE},

So you could try patching opensips t_reply by adding the ONREPLY_ROUTE flag
till this is allowed in opensips (I'm not sure if it will work as extra
changes in code might be needed).

Alternatively, you could call a function in a perl/lua/python module to
change the "200 OK" with "180 Ringing", remove the top Via Header (beware
that the Via headers might be coalesced into a single one), remove the body
and use a raw socket to send the packet:
(ref: https://opensips.org/html/docs/modules/3.5.x/perl.html#func_perl_exec)

Obs: I assume the language module inherits the limitations from the route
it is being executed on, so I would not expect:
  $m->sl_send_reply("180", "Trying");
to work, but you could try to see what happens.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20241021/e3d95795/attachment.html>


More information about the Users mailing list