presence_mwi.c
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
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
00046 static int mod_init(void);
00047
00048
00049 add_event_t pres_add_event;
00050
00051
00052 static cmd_export_t cmds[] =
00053 {
00054 {0, 0, 0, 0, 0, 0}
00055 };
00056
00057
00058 static param_export_t params[] = {
00059 {0, 0, 0}
00060 };
00061
00062
00063 struct module_exports exports= {
00064 "presence_mwi",
00065 DEFAULT_DLFLAGS,
00066 cmds,
00067 params,
00068 0,
00069 0,
00070 0,
00071 0,
00072 mod_init,
00073 0,
00074 0,
00075 0
00076 };
00077
00078
00079
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 }