presence_mwi.c

Go to the documentation of this file.
00001 /*
00002  * presence_mwi module - Presence Handling of message-summary events
00003  *
00004  * Copyright (C) 2007 Juha Heinanen
00005  *
00006  * This file is part of Kamailio, a free SIP server.
00007  *
00008  * Kamailio is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * Kamailio is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License 
00019  * along with this program; if not, write to the Free Software 
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  * History:
00023  * --------
00024  *  2007-05-1  initial version (jih)
00025  */
00026 
00027 #include <stdio.h>
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include <time.h>
00031 #include <sys/types.h>
00032 #include <unistd.h>
00033 
00034 #include "../../sr_module.h"
00035 #include "../../dprint.h"
00036 #include "../../str.h"
00037 #include "../../parser/msg_parser.h"
00038 #include "../../mem/mem.h"
00039 #include "../presence/bind_presence.h"
00040 #include "add_events.h"
00041 #include "presence_mwi.h"
00042 
00043 MODULE_VERSION
00044 
00045 /* module functions */
00046 static int mod_init(void);
00047 
00048 /* module variables */
00049 add_event_t pres_add_event;
00050 
00051 /* module exported commands */
00052 static cmd_export_t cmds[] =
00053 {
00054     {0,  0, 0, 0, 0, 0}
00055 };
00056 
00057 /* module exported paramaters */
00058 static param_export_t params[] = {
00059     {0, 0, 0}
00060 };
00061 
00062 /* module exports */
00063 struct module_exports exports= {
00064     "presence_mwi",           /* module name */
00065     DEFAULT_DLFLAGS,            /* dlopen flags */
00066     cmds,                  /* exported functions */
00067     params,                /* exported parameters */
00068     0,                     /* exported statistics */
00069     0,                     /* exported MI functions */
00070     0,                     /* exported pseudo-variables */
00071    0,                   /* extra processes */
00072     mod_init,              /* module initialization function */
00073     0,                     /* response handling function */
00074     0,                     /* destroy function */
00075     0                   /* per-child init function */
00076 };
00077    
00078 /*
00079  * init module function
00080  */
00081 static int mod_init(void)
00082 {
00083    presence_api_t pres;
00084     bind_presence_t bind_presence;
00085 
00086     bind_presence= (bind_presence_t)find_export("bind_presence", 1,0);
00087     if (!bind_presence) {
00088    LM_ERR("can't bind presence\n");
00089    return -1;
00090     }
00091     if (bind_presence(&pres) < 0) {
00092    LM_ERR("can't bind pua\n");
00093    return -1;
00094     }
00095 
00096     pres_add_event = pres.add_event;
00097     if (add_event == NULL) {
00098    LM_ERR("could not import add_event\n");
00099    return -1;
00100     }
00101     if(mwi_add_events() < 0) {
00102    LM_ERR("failed to add mwi events\n");
00103    return -1;     
00104     } 
00105     
00106     return 0;
00107 }

Generated on Thu May 24 08:00:52 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6