[Devel] Changing a newly added header in the branch_route

Klaus Darilion klaus.mailinglists at pernau.at
Thu Jun 14 11:54:21 CEST 2007

Probably now the answer you want to hear, but: Why not adding the header 
  in the branch route instead of changing?


Ardjan Zwartjes wrote:
> I'm currently working on a OpenSER module for which I need the following
> functionality:
> 1. In the "route" block in the configuration an initialize function is
> called which adds a header using something similar to append_hf from the
> textops module, for example say it adds the header "X-Test: test".
> 2. The scripts performs some functions and branches the call.
> 3. In the branch_route I want to change the "X-Test" header to another
> value based om some data gathered by my module.
> I hoped this would be a simple task, but so far I haven't been able to
> implement this. This is the problem:
> - append_hf uses insert_new_lump_before() to add the new header to the
> msg->add_rm or msg->body_lumps lump lists, so a subsequent textops calls
> like remove_hf call won't find the header.
> - I have circumvented this problem by creating a function that also
> looks through the msg->add_rm and msg->body_lumps lists and if necessary
> changes the lump->u.value to a new string so a different header will be
> added. This works as long as I do this in the route block.
> - If I call this function in the branch_route however the lump that adds
> the header cannot be found but the header also isn't accessible through
> the msg->headers list (even when it's fully parsed). 
> So my question is: Does anybody knows what I need to do to change a
> header that was added in the route block to a new value in the
> branch_route? Thanks in advance!
> Kind regards,
> Ardjan Zwartjes.
> _______________________________________________
> Devel mailing list
> Devel at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/devel

More information about the Devel mailing list