MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / mod_init

Function mod_init

modules/presence_xcapdiff/presence_xcapdiff.c:71–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69};
70
71static int
72mod_init(void)
73{
74 bind_presence_t bind_presence;
75 presence_api_t pres;
76 bind_pua_t bind_pua;
77 pres_ev_t event;
78 pua_api_t pua;
79
80 LM_INFO("initializing...\n");
81
82 bind_presence = (bind_presence_t)find_export("bind_presence", 0);
83 if (bind_presence) {
84 if (bind_presence(&pres) < 0) {
85 LM_ERR("could not bind to the presence module API\n");
86 return -1;
87 }
88
89 memset(&event, 0, sizeof(pres_ev_t));
90 event.name = s_event_name;
91 event.content_type = s_content_type;
92 event.default_expires = 3600;
93 event.type = PUBL_TYPE;
94 event.req_auth = 0;
95
96 if (pres.add_event(&event) < 0) {
97 LM_ERR("could not add xcap-diff event to presence\n");
98 return -1;
99 }
100 } else {
101 LM_NOTICE("subscribing to the xcap-diff event is not available as the presence module is not loaded\n");
102 }
103
104 bind_pua = (bind_pua_t)find_export("bind_pua", 0);
105 if (bind_pua) {
106 if (bind_pua(&pua) < 0) {
107 LM_ERR("could not bind to the pua module API\n");
108 return -1;
109 }
110
111 if(pua.add_event(XCAPDIFF_EVENT, s_event_name.s, s_content_type.s, 0) < 0) {
112 LM_ERR("could not add xcap-diff event to pua\n");
113 return -1;
114 }
115 } else {
116 LM_NOTICE("publishing of xcap-diff events is not available as the pua module is not loaded\n");
117 }
118
119 return 0;
120}
121
122

Callers

nothing calls this directly

Calls 3

find_exportFunction · 0.85
bind_presenceFunction · 0.85
bind_puaFunction · 0.85

Tested by

no test coverage detected