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

Function mod_init

modules/rtpproxy/rtpproxy.c:1153–1392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1151}
1152
1153static int
1154mod_init(void)
1155{
1156 int i;
1157 int tmp;
1158 float timeout;
1159 str *rn_name = &rtpp_notify_cfg.name;
1160
1161 if (rtpproxy_autobridge != 0) {
1162 LM_WARN("Auto bridging does not properly function when doing "
1163 "serial/parallel forking\n");
1164 }
1165
1166 if (nortpproxy_str.s==NULL || nortpproxy_str.s[0]==0) {
1167 nortpproxy_str.len = 0;
1168 nortpproxy_str.s = NULL;
1169 } else {
1170 nortpproxy_str.len = strlen(nortpproxy_str.s);
1171 while (nortpproxy_str.len > 0 && (nortpproxy_str.s[nortpproxy_str.len - 1] == '\r' ||
1172 nortpproxy_str.s[nortpproxy_str.len - 1] == '\n'))
1173 nortpproxy_str.len--;
1174 if (nortpproxy_str.len == 0)
1175 nortpproxy_str.s = NULL;
1176 }
1177
1178 rtpp_no = (unsigned int*)shm_malloc(sizeof(unsigned int));
1179 list_version = (unsigned int*)shm_malloc(sizeof(unsigned int));
1180 if(!rtpp_no || !list_version) {
1181 LM_ERR("No more shared memory\n");
1182 return -1;
1183 }
1184 *rtpp_no = 0;
1185 *list_version = 0;
1186 my_version = 0;
1187
1188 rtpp_set_versions = map_create(0);
1189 if (!rtpp_set_versions) {
1190 LM_ERR("failed to create 'versions' map\n");
1191 return -1;
1192 }
1193
1194 if (!(rtpp_set_list = (struct rtpp_set_head **)
1195 shm_malloc(sizeof(struct rtpp_set_head *)))) {
1196 LM_ERR("no more shm mem\n");
1197 return -1;
1198 }
1199 *rtpp_set_list = 0;
1200
1201 if(db_url.s == NULL)
1202 {
1203 if (rtpp_sets == 0) {
1204 int rtp_io_found = (rtp_io_childsock_f() == NULL) ? 0 : 1;
1205 if (!rtp_io_found || rtpproxy_add_rtpproxy_set("rtp.io:auto", -1) != 0) {
1206 LM_ERR("no rtpproxy set specified");
1207 return -1;
1208 }
1209 }
1210

Callers

nothing calls this directly

Calls 15

shm_mallocFunction · 0.85
map_createFunction · 0.85
rtp_io_childsock_fFunction · 0.85
db_bind_modFunction · 0.85
db_check_table_versionFunction · 0.85
lock_init_rwFunction · 0.85
select_rtpp_setFunction · 0.85
load_dlg_apiFunction · 0.85
load_tm_apiFunction · 0.85
parse_bavpFunction · 0.85

Tested by

no test coverage detected