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

Function mod_init

modules/uac/uac.c:201–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199
200
201static int mod_init(void)
202{
203 LM_INFO("initializing...\n");
204 int rr_api_loaded=0;
205 int dlg_api_loaded=0;
206
207 if ( is_script_func_used("uac_auth", -1) ) {
208 /* load the UAC_AUTH API as uac_auth() is invoked from script */
209 if(load_uac_auth_api(&uac_auth_api)<0){
210 LM_ERR("can't load UAC_AUTH API, needed for uac_auth()\n");
211 goto error;
212 }
213 }
214
215 /* load the TM API - FIXME it should be loaded only
216 * if NO_RESTORE and AUTH */
217 if (load_tm_api(&uac_tmb)!=0) {
218 LM_ERR("can't load TM API\n");
219 goto error;
220 }
221
222 if (restore_mode_str && *restore_mode_str) {
223 if (strcasecmp(restore_mode_str,"none")==0) {
224 restore_mode = UAC_NO_RESTORE;
225 } else if (strcasecmp(restore_mode_str,"manual")==0) {
226 restore_mode = UAC_MANUAL_RESTORE;
227 } else if (strcasecmp(restore_mode_str,"auto")==0) {
228 restore_mode = UAC_AUTO_RESTORE;
229 } else {
230 LM_ERR("unsupported value '%s' for restore_mode\n",
231 restore_mode_str);
232 goto error;
233 }
234 }
235
236 if ( is_script_func_used("uac_replace_from", -1) ||
237 is_script_func_used("uac_replace_to", -1) ) {
238
239 uac_replace_flags = context_register_int(CONTEXT_GLOBAL, NULL);
240 if (uac_replace_flags < 0)
241 return -1;
242
243 /* replace TO/FROM stuff is used, get prepared */
244
245 rr_from_param.len = strlen(rr_from_param.s);
246 rr_to_param.len = strlen(rr_to_param.s);
247 if ( (rr_from_param.len==0 || rr_to_param.len==0) &&
248 restore_mode!=UAC_NO_RESTORE) {
249 LM_ERR("rr_store_param cannot be empty if FROM is restoreable\n");
250 goto error;
251 }
252
253 uac_passwd.len = strlen(uac_passwd.s);
254
255 if (restore_mode!=UAC_NO_RESTORE) {
256 /* load the RR API */
257 if (load_rr_api(&uac_rrb)!=0) {
258 LM_ERR("can't load RR API\n");

Callers

nothing calls this directly

Calls 8

is_script_func_usedFunction · 0.85
load_uac_auth_apiFunction · 0.85
load_tm_apiFunction · 0.85
context_register_intFunction · 0.85
load_rr_apiFunction · 0.85
load_dlg_apiFunction · 0.85
parse_store_bavpFunction · 0.85
init_from_replacerFunction · 0.85

Tested by

no test coverage detected