[Serusers] writing a module
Jan Janak
J.Janak at sh.cvut.cz
Fri Feb 14 12:44:34 CET 2003
Hello,
simply use fi_check() in the configuration script. That will call your
function.
regards, Jan.
On 14-02 11:13, Mario Kolberg wrote:
> Hi,
>
> I am trying to write a module for SER. I managed to write a tiny test
> module ("hello world") and it compiles fine (the source is attached).
> However, I'm not quite sure I fully understood how to execute the
> functions defined in the module.
>
> I included the module to sr_modules.c and also a line 'loadmodule' in
> the ser.cfg. But how do I actually execute the function in the module
> every time a (INVITE) message is received by the server?
>
> The docs couldn't really help ...
>
> Thanks very much!
>
> Regards,
> Mario
>
> --
> Mario Kolberg phone: +44 (0)1786 46 7440
> Lecturer in Computing Science fax : +44 (0)1786 46 4551
> email: mko at cs.stir.ac.uk
>
> Department of Computing Science and Mathematics
> University of Stirling
> Stirling FK9 4LA
> Scotland, UK
> --
> The University of Stirling is a university established in Scotland by
> charter at Stirling, FK9 4LA. Privileged/Confidential Information may
> be contained in this message. If you are not the addressee indicated
> in this message (or responsible for delivery of the message to such
> person), you may not disclose, copy or deliver this message to anyone
> and any action taken or omitted to be taken in reliance on it, is
> prohibited and may be unlawful. In such case, you should destroy this
> message and kindly notify the sender by reply email. Please advise
> immediately if you or your employer do not consent to Internet email
> for messages of this kind. Opinions, conclusions and other
> information in this message that do not relate to the official
> business of the University of Stirling shall be understood as neither
> given nor endorsed by it.
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
>
> #include "../../sr_module.h"
> #include "../../dprint.h"
> #include "../../error.h"
> #include "../../ut.h"
>
> static int fi_check(struct sip_msg* msg,char* str,char* str2);
> static int mod_init(void);
>
> #ifdef STATIC_FI
> struct module_exports fi_exports = {
> #else
> struct module_exports exports= {
> #endif
> "fi_module",
> (char*[]){
> "fi_check"
> },
> (cmd_function[]){
> fi_check
> },
> (int[]){
> 0
> },
> (fixup_function[]){
> 0
> },
> 1, NULL, NULL, NULL, 0,
> mod_init,
> (response_function) 0,
> (destroy_function) 0,
> 0,
> 0
> };
>
> static int mod_init(void)
> {
> printf("FI module initializing\n");
> return 0;
> }
>
>
> static int fi_check(struct sip_msg* msg, char* str1,char* str2)
> {
> printf("FI module executing\n");
> return 1;
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20030214/65d51697/attachment.pgp>
More information about the sr-users
mailing list