[Serusers] Re: adding a header
pelinescu-onciul at fokus.fraunhofer.de
Tue Jul 8 16:59:28 CEST 2003
On Jul 08, 2003 at 14:32, Mario Kolberg <mko at cs.stir.ac.uk> wrote:
> thanks very much! I have now taken Jiri's advice and use the textops
> package to add the header.
> However, in the package, I'm calling append_hf with the message and a
> char* which is the new header. From the look of it, it seems that
> append_hf should call str_fixup for the char*.
append_hf is ment to be called from the script. When the script is
processed str_fixup will be automatically called (and it will convert
char* to str*).
*_fixup functions area a way of pre-processing parameters on ser
initialization (in this case instead of computing strlen(str) each
time append_hf is called from the script, it will be computed only once
on ser startup; another example is using it to compile the regular
expressions only once , see search & fixup_regex).
If you call append_hf directly (not from the script) make sure it will
receive str parameters. It expects str* parameters although is declared
append_hf(msg, (char*) &str1, 0);
append_hf has char* parameters because this is the prototype for module
typedef int (*cmd_function)(struct sip_msg*, char*, char*);
More information about the sr-users