modules/dialog/dlg_db_handler.h
a70300b1
 /*
  * Copyright (C) 2007 Voice System SRL
60d9c557
  * Copyright (C) 2011 Carsten Bock, carsten@ng-voice.com
a70300b1
  *
27642a08
  * This file is part of Kamailio, a free SIP server.
a70300b1
  *
27642a08
  * Kamailio is free software; you can redistribute it and/or modify
a70300b1
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version
  *
27642a08
  * Kamailio is distributed in the hope that it will be useful,
a70300b1
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License 
  * along with this program; if not, write to the Free Software 
9e1ff448
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
a70300b1
  *
  */
 
c3291cfe
 /*!
  * \file
  * \brief Database interface
  * \ingroup dialog
  * Module: \ref dialog
  */
a70300b1
 
 #ifndef _DLG_DB_HANDLER_H_
 #define _DLG_DB_HANDLER_H_
 
 #include "../../str.h"
afda814b
 #include "../../lib/srdb1/db.h"
a70300b1
 
62c98ed1
 #define CALL_ID_COL				"callid"
a70300b1
 #define FROM_URI_COL			"from_uri"
 #define FROM_TAG_COL			"from_tag"
 #define TO_URI_COL				"to_uri"
 #define TO_TAG_COL				"to_tag"
 #define HASH_ID_COL				"hash_id"
 #define HASH_ENTRY_COL			"hash_entry"
 #define STATE_COL				"state"
 #define START_TIME_COL			"start_time"
 #define TIMEOUT_COL				"timeout"
62c98ed1
 #define TO_CSEQ_COL				"callee_cseq"
 #define FROM_CSEQ_COL			"caller_cseq"
 #define TO_ROUTE_COL			"callee_route_set"
 #define FROM_ROUTE_COL			"caller_route_set"
 #define TO_CONTACT_COL			"callee_contact"
 #define FROM_CONTACT_COL		"caller_contact"
 #define FROM_SOCK_COL			"caller_sock"
 #define TO_SOCK_COL				"callee_sock"
82fe2bff
 #define IFLAGS_COL				"iflags"
9f586299
 #define SFLAGS_COL				"sflags"
48c3a21a
 #define TOROUTE_NAME_COL		"toroute_name"
8c1b49d5
 #define REQ_URI_COL				"req_uri"
82fe2bff
 #define XDATA_COL				"xdata"
62c98ed1
 #define DIALOG_TABLE_NAME		"dialog"
8a22bf5b
 #define DLG_TABLE_VERSION		7
a70300b1
 
82fe2bff
 #define DIALOG_TABLE_COL_NO 		23
60d9c557
 
 #define VARS_HASH_ID_COL 		"hash_id"
 #define VARS_HASH_ENTRY_COL		"hash_entry"
 #define VARS_KEY_COL			"dialog_key"
 #define VARS_VALUE_COL			"dialog_value"
 #define DIALOG_VARS_TABLE_NAME		"dialog_vars"
 #define DLG_VARS_TABLE_VERSION		1
 
 #define DIALOG_VARS_TABLE_COL_NO 4
 
 
a70300b1
 /*every minute the dialogs' information will be refreshed*/
 #define DB_DEFAULT_UPDATE_PERIOD	60
 #define DB_MODE_NONE				0
 #define DB_MODE_REALTIME			1
 #define DB_MODE_DELAYED				2
8129c9a9
 #define DB_MODE_SHUTDOWN			3
a70300b1
 
 
60d9c557
 /* Dialog table */
e2cf6343
 extern str call_id_column; 
 extern str from_uri_column;
 extern str from_tag_column;
 extern str to_uri_column;
 extern str to_tag_column;
 extern str h_id_column;
 extern str h_entry_column;
 extern str state_column;
 extern str start_time_column;
 extern str timeout_column;
 extern str to_cseq_column;
 extern str from_cseq_column;
 extern str to_route_column;
 extern str from_route_column;
 extern str to_contact_column;
 extern str from_contact_column;
 extern str to_sock_column;
 extern str from_sock_column;
82fe2bff
 extern str iflags_column;
9f586299
 extern str sflags_column;
48c3a21a
 extern str toroute_name_column;
e2cf6343
 extern str dialog_table_name;
a70300b1
 extern int dlg_db_mode;
 
60d9c557
 /* Dialog-Vars Table */
 extern str vars_h_id_column;
 extern str vars_h_entry_column;
 extern str vars_key_column;
 extern str vars_value_column;
 extern str dialog_vars_table_name;
 
 
68c8b77d
 int init_dlg_db(const str *db_url, int dlg_hash_size, int db_update_period, int fetch_num_rows);
e2cf6343
 int dlg_connect_db(const str *db_url);
5ddbf042
 void destroy_dlg_db(void);
a70300b1
 
 int remove_dialog_from_db(struct dlg_cell * cell);
 int update_dialog_dbinfo(struct dlg_cell * cell);
b9bb99d2
 void dialog_update_db(unsigned int ticks, void * param);
a70300b1
 
 #endif