[sr-dev] Additional headers on a dispatcher options ping

Federico Cabiddu federico.cabiddu at gmail.com
Fri May 31 07:27:34 CEST 2019


Hi,
to add headers to locally generated requests, as it's the case for
dispatcher's OPTIONS, you could use tm's module "local-request" event route
to catch the outgoing OPTIONS and append a header before it's relayed.
Something like this:

event_route[tm:local-request] { # Handle locally generated requests
    if (is_method("OPTIONS")) {
                xlog("L_INFO", "dispatcher generated OPTIONS to $du\n");
                append_hf("X-CustomHeader: myValue\r\n");
    }
}

Cheers,

Federico

On Thu, May 30, 2019 at 9:28 PM Henning Westerholt <hw at skalatan.de> wrote:

> Hello Tim,
>
> at the moment there is no such functionality available in the module. But
> have a look eg. to the implementation of this function
>
>
> https://kamailio.org/docs/modules/5.2.x/modules/dispatcher.html#dispatcher.p.ds_ping_from
>
> in C function "void ds_ping_set(ds_set_t *node)" which allows to set the
> From header for the dispatcher pings. Maybe this gives you a starting
> point. If you came up with an extension, we are always open to pull
> requests. :-)
>
> Cheers,
>
> Henning
> Am 22.05.19 um 00:06 schrieb Tim Chubb:
>
> Hi
>
>
>
> Is there any mechanism to add a contact and rr headers to the option
> messages generated by dispatcher?
>
>
>
> I have a need for both headers to be present otherwise the message gets
> rejected at the proxy im trying to connect to,  the content of the headers
> in my use case is the from address, so would seem trivial (in so far I know
> enough c to just about follow what’s going on in the code, but wouldn’t
> know where to start to add the functionality) to add using the existing
> from attribute and a pair of additional modparams to enable this
> functionality, if its not already possible
>
> Currently I have a workaround by generating the pings in asterisk and
> routing as usual, but would really prefer to not reinvent the wheel and use
> dispatcher as I do with other trunks and services mainly for consistency
> and keeping what is essentially a routing issue out of the application
> stack, as apart from the missing headers dispatchers functionality is
> exactly what I need.
>
>
>
> Any suggestions?
>
>
>
> Tim.
>
>
>
>
>
>
> _______________________________________________
> Kamailio (SER) - Development Mailing Listsr-dev at lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
> --
> Henning Westerholt - https://skalatan.de/blog/
> Kamailio services - https://skalatan.de/services
>
> _______________________________________________
> Kamailio (SER) - Development Mailing List
> sr-dev at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190531/507de131/attachment.html>


More information about the sr-dev mailing list