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

Function mod_init

modules/sst/sst.c:164–217  ·  view source on GitHub ↗

* The initialization function, called when the module is loaded by * the script. This function is called only once. * * Bind to the dialog module and setup the callbacks. Also initialize * the shared memory to store our interninal information in. * * @return 0 to continue to load the OpenSIPS, -1 to stop the loading * and abort OpenSIPS. */

Source from the content-addressed store, hash-verified

162 * and abort OpenSIPS.
163 */
164static int mod_init(void)
165{
166 LM_INFO("SIP Session Timer module - initializing\n");
167 /*
168 * if statistics are disabled, prevent their registration to core.
169 */
170 if (sst_enable_stats==0) {
171 exports.stats = 0;
172 }
173
174 sst_flag = get_flag_id_by_name(FLAG_TYPE_MSG, sst_flag_str, 0);
175
176 if (sst_flag == -1) {
177 LM_ERR("no sst flag set!!\n");
178 return -1;
179 }
180 else if (sst_flag > MAX_FLAG) {
181 LM_ERR("invalid sst flag %d!!\n", sst_flag);
182 return -1;
183 }
184
185 /* load SIGNALING API */
186 if(load_sig_api(&sigb)< 0) {
187 LM_ERR("can't load signaling functions\n");
188 return -1;
189 }
190
191 /*
192 * Init the handlers
193 */
194 sst_handler_init(sst_minSE, sst_flag, sst_reject,sst_interval);
195
196 /*
197 * Register the main (static) dialog call back.
198 */
199 if (load_dlg_api(&dialog_st) != 0) {
200 LM_ERR("failed to load dialog hooks\n");
201 return(-1);
202 }
203
204 /* Load dialog hooks */
205 dialog_st.register_dlgcb(NULL, DLGCB_CREATED, sst_dialog_created_CB, NULL, NULL);
206
207 if (dialog_st.register_dlgcb(NULL, DLGCB_LOADED, sst_dialog_loaded_CB,
208 NULL, NULL) != 0) {
209 LM_ERR("cannot register dialog_loaded callback\n");
210 return -1;
211 }
212
213 /*
214 * We are GOOD-TO-GO.
215 */
216 return 0;
217}

Callers

nothing calls this directly

Calls 4

get_flag_id_by_nameFunction · 0.85
load_sig_apiFunction · 0.85
sst_handler_initFunction · 0.85
load_dlg_apiFunction · 0.85

Tested by

no test coverage detected