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

Function receive_entity_create

modules/b2b_logic/entity_storage.c:231–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231static void receive_entity_create(enum b2b_entity_type entity_type,
232 str *entity_key, str *b2bl_key, bin_packet_t *storage)
233{
234 unsigned int hash_index, local_index;
235 b2bl_tuple_t *tuple = NULL, *old_tuple;
236 int tuple_repl_type;
237 str scenario_id;
238 str sdp;
239 str extra_headers;
240 int lifetime;
241 b2b_dlginfo_t dlginfo;
242 b2bl_entity_id_t *entity = NULL, **entity_head = NULL;
243 str entity_sid, to_uri, proxy, from_uri, from_dname, hdrs;
244 struct b2b_params init_params;
245
246 LM_DBG("Received CREATE event for entity [%.*s]\n",
247 entity_key->len, entity_key->s);
248
249 if (b2bl_parse_key(b2bl_key, &hash_index, &local_index) < 0) {
250 LM_ERR("Bad tuple key: %.*s\n", b2bl_key->len, b2bl_key->s);
251 return;
252 }
253
254 B2BL_LOCK_GET(hash_index);
255
256 old_tuple = b2bl_search_tuple_safe(hash_index, local_index);
257
258 bin_pop_int(storage, &tuple_repl_type);
259
260 switch (tuple_repl_type) {
261 case REPL_TUPLE_NEW:
262 if (!old_tuple) {
263 bin_pop_str(storage, &scenario_id);
264 bin_pop_str(storage, &extra_headers);
265 } else {
266 LM_DBG("Tuple [%.*s] already created\n", b2bl_key->len, b2bl_key->s);
267 bin_skip_str(storage, 2);
268 }
269
270 if (old_tuple) {
271 tuple = old_tuple;
272 } else {
273 memset(&init_params, 0, sizeof init_params);
274
275 if (!scenario_id.s)
276 init_params.id = B2B_INTERNAL_ID_PTR;
277 else if (!str_strcmp(&scenario_id, const_str(B2B_TOP_HIDING_SCENARY)))
278 init_params.id = B2B_TOP_HIDING_ID_PTR;
279 else
280 init_params.id = &scenario_id;
281
282 init_params.req_route = global_req_rt_ref;
283 init_params.reply_route = global_reply_rt_ref;
284
285 tuple = b2bl_insert_new(NULL, hash_index, &init_params,
286 &extra_headers,
287 local_index, &b2bl_key, INSERTDB_FLAG, TUPLE_REPL_RECV);
288 if (!tuple) {

Callers 1

entity_event_receivedFunction · 0.70

Calls 15

b2bl_parse_keyFunction · 0.85
b2bl_search_tuple_safeFunction · 0.85
bin_pop_intFunction · 0.85
bin_pop_strFunction · 0.85
bin_skip_strFunction · 0.85
b2bl_insert_newFunction · 0.85
get_ticksFunction · 0.85
unpack_context_valsFunction · 0.85
b2bl_search_entityFunction · 0.85
b2bl_create_new_entityFunction · 0.85
entity_add_dlginfoFunction · 0.85
b2bl_add_serverFunction · 0.85

Tested by

no test coverage detected