[SR-Users] [Kamailio-Users] new feature: update sip msg content in request route

Klaus Darilion klaus.mailinglists at pernau.at
Mon Sep 21 15:15:59 CEST 2009


cool ...

Daniel-Constantin Mierla schrieb:
> Hello,
> 
> I just committed a new function in modules_k/textops - 
> msg_apply_changes(). Hopefully the name is suggestive enough - the 
> function applies the changes done to the content of sip message - e.g., 
> if you added a new header, once you use the function, that header will 
> become visible in config file.
> 
> Therefore the function tries to overcome the overhead of looping various 
> messages back to sip server just because modifications were not visible 
> once done. Another benefit is ability to access latest value for a field 
> (being header or body content) in case of need to hashes or signatures 
> for security purposes.
> 
> The function can be used only in request route for now. Be carefully 
> when using it, since it changes the expectation you had so far of always 
> working on initially received sip message. Once the function is sued, 
> initial content is lost forever. Since it builds a new buffer and 
> re-parses, it is not very recommended to use it extensively.
> 
> Example of usage:
> 
> append_hf("My-Header: yes\r\n");
> if(msg_apply_changes())
> {
>        # msg buffer has a new content
>        if(is_present_hf("My-Header"))
>        {
>               # will get always here
>       }
> }
> 
> Testing and feedback is welcome!
> 
> Cheers,
> Daniel
> 
> 
> _______________________________________________
> Kamailio (OpenSER) - Users mailing list
> Users at lists.kamailio.org
> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users




More information about the sr-users mailing list