Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00038 #include <stdio.h>
00039 #include <stdlib.h>
00040 #include <string.h>
00041 #include <time.h>
00042 #include <sys/types.h>
00043 #include <unistd.h>
00044
00045 #include "../../sr_module.h"
00046 #include "../../dprint.h"
00047 #include "../../str.h"
00048 #include "../../parser/msg_parser.h"
00049 #include "../../mem/mem.h"
00050 #include "../presence/bind_presence.h"
00051 #include "add_events.h"
00052 #include "presence_mwi.h"
00053
00054 MODULE_VERSION
00055
00056
00057 static int mod_init(void);
00058
00059
00060 add_event_t pres_add_event;
00061
00062
00063 static cmd_export_t cmds[] =
00064 {
00065 {0, 0, 0, 0, 0, 0}
00066 };
00067
00068
00069 static param_export_t params[] = {
00070 {0, 0, 0}
00071 };
00072
00073
00074 struct module_exports exports= {
00075 "presence_mwi",
00076 DEFAULT_DLFLAGS,
00077 cmds,
00078 params,
00079 0,
00080 0,
00081 0,
00082 0,
00083 mod_init,
00084 0,
00085 0,
00086 0
00087 };
00088
00089
00090
00091
00092 static int mod_init(void)
00093 {
00094 presence_api_t pres;
00095 bind_presence_t bind_presence;
00096
00097 bind_presence= (bind_presence_t)find_export("bind_presence", 1,0);
00098 if (!bind_presence) {
00099 LM_ERR("can't bind presence\n");
00100 return -1;
00101 }
00102 if (bind_presence(&pres) < 0) {
00103 LM_ERR("can't bind pua\n");
00104 return -1;
00105 }
00106
00107 pres_add_event = pres.add_event;
00108 if (add_event == NULL) {
00109 LM_ERR("could not import add_event\n");
00110 return -1;
00111 }
00112 if(mwi_add_events() < 0) {
00113 LM_ERR("failed to add mwi events\n");
00114 return -1;
00115 }
00116
00117 return 0;
00118 }