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

Function sync_dlg_db_mem

modules/dialog/dlg_db_handler.c:1868–2352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1866}
1867
1868static int sync_dlg_db_mem(void)
1869{
1870 db_res_t * res;
1871 db_val_t * values;
1872 db_row_t * rows;
1873 struct dlg_entry *d_entry;
1874 struct dlg_cell *known_dlg, *dlg = NULL;
1875 int i, nr_rows,callee_leg_idx,db_timeout;
1876 int no_rows = 10;
1877 unsigned int db_caller_cseq = 0, db_callee_cseq = 0;
1878 unsigned int dlg_caller_cseq = 0, dlg_callee_cseq = 0;
1879 const struct socket_info *caller_sock,*callee_sock;
1880 str callid, from_uri, to_uri, from_tag, to_tag;
1881 str cseq1,cseq2,contact1,contact2,rroute1,rroute2,mangled_fu,mangled_tu;
1882 unsigned int hash_entry, hash_id;
1883 int_str tag_name;
1884 int rc;
1885 int dlg_val_type;
1886 str_const flag_list;
1887
1888 res = 0;
1889 if((nr_rows = select_entire_dialog_table(&res,&no_rows)) < 0)
1890 goto error;
1891
1892 nr_rows = RES_ROW_N(res);
1893
1894 do {
1895 LM_DBG("loading information from database for %i dialogs\n", nr_rows);
1896
1897 rows = RES_ROWS(res);
1898
1899 /* for every row---dialog */
1900 for(i=0; i<nr_rows; i++){
1901
1902 values = ROW_VALUES(rows + i);
1903
1904 if (VAL_NULL(values) || VAL_TYPE(values) != DB_BIGINT) {
1905 LM_ERR("column %.*s cannot be null -> skipping\n",
1906 dlg_id_column.len, dlg_id_column.s);
1907 continue;
1908 }
1909
1910 dlg_parse_db_id(VAL_BIGINT(values), hash_entry, hash_id);
1911
1912 if (VAL_NULL(values+6) || VAL_NULL(values+7)) {
1913 LM_ERR("columns %.*s or/and %.*s cannot be null -> skipping\n",
1914 start_time_column.len, start_time_column.s,
1915 state_column.len, state_column.s);
1916 continue;
1917 }
1918
1919 if ( VAL_INT(values+7) == DLG_STATE_DELETED ) {
1920 LM_DBG("dialog already terminated -> skipping\n");
1921 continue;
1922 }
1923
1924 /*restore the dialog info*/
1925 GET_STR_VALUE(callid, values, 1, 1, 0);

Callers 1

mi_sync_db_dlgFunction · 0.85

Calls 15

get_dlg_unsafeFunction · 0.85
create_socket_infoFunction · 0.85
build_new_dlgFunction · 0.85
shm_freeFunction · 0.85
link_dlgFunction · 0.85
dlg_update_leg_infoFunction · 0.85
read_dialog_varsFunction · 0.85
fetch_dlg_valueFunction · 0.85
read_dialog_profilesFunction · 0.85
flag_list_to_bitmaskFunction · 0.85
insert_dlg_timerFunction · 0.85

Tested by

no test coverage detected