On Jul 08, 2003 at 14:32, Mario Kolberg mko@cs.stir.ac.uk wrote:
Andrei,
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 with char*.
E.g.: str str1; str1.s=your_string; str1.len=strlen(your_string); append_hf(msg, (char*) &str1, 0);
append_hf has char* parameters because this is the prototype for module exported function: typedef int (*cmd_function)(struct sip_msg*, char*, char*);
Andrei