[Devel] Changing a newly added header in the branch_route

Klaus Darilion klaus.mailinglists at pernau.at
Thu Jun 14 14:53:22 CEST 2007



Ardjan Zwartjes wrote:
>> Probably now the answer you want to hear, but: Why not adding 
>> the header 
>>   in the branch route instead of changing?
> 
> Because in fact I'm developing several related modules with 1 core
> module. 
> 1. The core module initializes the header with some information.
> 2. Optionally one of the extra modules adds some extra information in
> the branch route.
> 
> So even when nothing happens in the branch route the header should
> exist.

Maybe you can work around by using AVPs to signal values from core to 
related modules and let the header be added by the related module.

Another workaround would be to process the lumps and then re-parse the 
message (as it would be needed for SIP Identity)


regards
klaus

> 
> 
> 
> 
>> 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 
>>> msg->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