1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
/*
* $Id: acc_mod.h,v 1.4 2006/01/13 15:05:35 bogdan_iancu Exp $
*
* Accounting module
*
* Copyright (C) 2001-2003 FhG Fokus
*
* This file is part of openser, a free SIP server.
*
* openser is free software; you can redistribute it and/or modify
* 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
*
* openser is distributed in the hope that it will be useful,
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* History:
* ---------
* 2003-04-04 grand acc cleanup (jiri)
* 2003-11-04 multidomain support for mysql introduced (jiri)
* 2004-06-06 removed db_url, db_handle (andrei)
* 2005-06-28 multi leg call support added (bogdan)
*/
#ifndef _ACC_MOD_H
#define _ACC_MOD_H
#include "../../db/db.h"
#include "defs.h"
/* module parameter declaration */
extern int log_level;
extern int early_media;
extern int failed_transaction_flag;
extern char *log_fmt;
extern int report_cancels;
extern int log_flag;
extern int log_missed_flag;
extern int multileg_enabled;
extern int src_avp_id;
extern int dst_avp_id;
extern int detect_direction;
#ifdef RAD_ACC
extern int radius_flag;
extern int radius_missed_flag;
extern void *rh;
#endif
#ifdef DIAM_ACC
extern rd_buf_t *rb;
extern int diameter_flag;
extern int diameter_missed_flag;
#endif
#ifdef SQL_ACC
extern int db_flag;
extern int db_missed_flag;
extern int db_localtime;
extern char *db_table_acc;
extern char *db_table_mc;
extern char* acc_domain_col;
extern char* acc_sip_from_col;
extern char* acc_sip_to_col;
extern char* acc_sip_status_col;
extern char* acc_sip_method_col;
extern char* acc_i_uri_col;
extern char* acc_o_uri_col;
extern char* acc_sip_callid_col;
extern char* acc_user_col;
extern char* acc_time_col;
extern char* acc_from_uri;
extern char* acc_to_uri;
extern char* acc_totag_col;
extern char* acc_fromtag_col;
extern char* acc_dst_col;
extern char* acc_src_col;
#endif /* SQL_ACC */
static inline int is_failed_acc_on(struct sip_msg *rq)
{
return failed_transaction_flag
&& isflagset(rq, failed_transaction_flag)==1;
}
static inline int is_log_acc_on(struct sip_msg *rq)
{
return log_flag && isflagset(rq, log_flag)==1;
}
#ifdef SQL_ACC
static inline int is_db_acc_on(struct sip_msg *rq)
{
return db_flag && isflagset(rq, db_flag)==1;
}
#endif
#ifdef RAD_ACC
static inline int is_rad_acc_on(struct sip_msg *rq)
{
return radius_flag && isflagset(rq, radius_flag)==1;
}
#endif
#ifdef DIAM_ACC
static inline int is_diam_acc_on(struct sip_msg *rq)
{
return diameter_flag && isflagset(rq, diameter_flag)==1;
}
#endif
static inline int is_acc_on(struct sip_msg *rq)
{
if (is_log_acc_on(rq)) return 1;
#ifdef SQL_ACC
if (is_db_acc_on(rq)) return 1;
#endif
#ifdef RAD_ACC
if (is_rad_acc_on(rq)) return 1;
#endif
#ifdef DIAM_ACC
if (is_diam_acc_on(rq)) return 1;
#endif
return 0;
}
static inline int is_log_mc_on(struct sip_msg *rq)
{
return log_missed_flag && isflagset(rq, log_missed_flag)==1;
}
#ifdef SQL_ACC
static inline int is_db_mc_on(struct sip_msg *rq)
{
return db_missed_flag && isflagset(rq, db_missed_flag)==1;
}
#endif
#ifdef RAD_ACC
static inline int is_rad_mc_on(struct sip_msg *rq)
{
return radius_missed_flag && isflagset(rq, radius_missed_flag)==1;
}
#endif
#ifdef DIAM_ACC
static inline int is_diam_mc_on(struct sip_msg *rq)
{
return diameter_missed_flag && isflagset(rq, diameter_missed_flag)==1;
}
#endif
static inline int is_mc_on(struct sip_msg *rq)
{
if (is_log_mc_on(rq)) return 1;
#ifdef SQL_ACC
if (is_db_mc_on(rq)) return 1;
#endif
#ifdef RAD_ACC
if (is_rad_mc_on(rq)) return 1;
#endif
#ifdef DIAM_ACC
if (is_diam_mc_on(rq)) return 1;
#endif
return 0;
}
#endif
|