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

Function init_cc_data

modules/call_center/cc_data.c:106–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104
105
106struct cc_data* init_cc_data(void)
107{
108 struct cc_data *data;
109
110 data = (struct cc_data*) shm_malloc( sizeof(struct cc_data) );
111 if (data==NULL) {
112 LM_ERR("failed to allocate shm mem\n");
113 return NULL;
114 }
115 memset( data, 0, sizeof(struct cc_data));
116
117 /* create & init lock */
118 if ( (data->lock=lock_alloc())==0) {
119 LM_CRIT("failed to alloc lock\n");
120 goto error;
121 }
122 if (lock_init(data->lock)==0 ) {
123 LM_CRIT("failed to init lock\n");
124 goto error;
125 }
126
127 /* set of locks for calls */
128 if ( (data->call_locks=lock_set_alloc(512))==0) {
129 LM_CRIT("failed to alloc set of call locks\n");
130 goto error;
131 }
132 if (lock_set_init(data->call_locks)==0 ) {
133 LM_CRIT("failed to init set of call locks\n");
134 goto error;
135 }
136
137 agent_evi_id = evi_publish_event(agent_event);
138 if (agent_evi_id == EVI_ERROR) {
139 LM_ERR("cannot register %.*s event\n", agent_event.len, agent_event.s);
140 goto error;
141 }
142
143 return data;
144error:
145 free_cc_data(data);
146 return NULL;
147}
148
149
150void free_cc_data(struct cc_data *data)

Callers 1

mod_initFunction · 0.85

Calls 6

shm_mallocFunction · 0.85
lock_initFunction · 0.85
lock_set_allocFunction · 0.85
lock_set_initFunction · 0.85
evi_publish_eventFunction · 0.85
free_cc_dataFunction · 0.85

Tested by

no test coverage detected