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

Function load_entity

modules/b2b_entities/b2be_db.c:582–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580}
581
582static int load_entity(int_str_t *vals)
583{
584 dlg_leg_t leg, *new_leg;
585 b2b_dlg_t dlg, *shm_dlg= NULL;
586 unsigned int hash_index, local_index;
587 str* b2b_key;
588 str sockinfo_str;
589 str host;
590 int port, proto;
591 b2b_table htable;
592 int type;
593
594 memset(&dlg, 0, sizeof(b2b_dlg_t));
595
596 type = vals[0].i;
597 dlg.tag[1] = vals[2].s;
598 dlg.callid = vals[3].s;
599
600 if(type == B2B_SERVER)/* extract hash and local index */
601 {
602 b2b_key = &vals[2].s;
603 htable = server_htable;
604 if(b2b_parse_key(&dlg.tag[1], &hash_index, &local_index) < 0)
605 {
606 LM_ERR("Wrong format for b2b key [%.*s]\n", dlg.tag[1].len, dlg.tag[1].s);
607 return -1;
608 }
609 dlg.tag[1].s = NULL;
610 dlg.tag[1].len = 0;
611
612 if (hash_index >= server_hsize) {
613 LM_ERR("Hash Index [%d] too large! Increase the 'server_hsize'"
614 "parameter!\n", hash_index);
615 return -1;
616 }
617 }
618 else
619 {
620 b2b_key = &vals[3].s;
621 htable = client_htable;
622
623 if(b2b_parse_key(&dlg.callid, &hash_index, &local_index) < 0)
624 {
625 LM_ERR("Wrong format for b2b key [%.*s]\n", dlg.callid.len, dlg.callid.s);
626 return -1;
627 }
628
629 if (hash_index >= client_hsize) {
630 LM_DBG("Hash Index [%d] too large! Increase the 'client_hsize'"
631 "parameter!\n", hash_index);
632 return -1;
633 }
634 }
635 dlg.id = local_index;
636 dlg.state = vals[15].i;
637 dlg.ruri = vals[4].s;
638 dlg.from_uri = vals[5].s;
639 dlg.from_dname = vals[6].s;

Callers 2

b2b_entities_restore_dbFunction · 0.85
b2b_entities_restore_cdbFunction · 0.85

Calls 5

b2b_parse_keyFunction · 0.85
parse_phostportFunction · 0.85
b2b_dlg_copyFunction · 0.85
b2b_htable_insertFunction · 0.85
b2b_dup_legFunction · 0.85

Tested by

no test coverage detected