Merge branch 'master' into remove_redis
This commit is contained in:
commit
1c11193ca8
4
LICENSE
4
LICENSE
|
@ -1321,10 +1321,6 @@ Files: src/mod/event_handlers/mod_cdr_mongodb/driver/src/md5.[ch]
|
|||
Copyright: 1999, 2000, 2002 Aladdin Enterprises.
|
||||
License: zlib/libpng
|
||||
|
||||
Files: src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h
|
||||
Copyright: 2006, Author: Yossi Neiman of Cartis Solutions, Inc. <freeswitch AT cartissolutions.com>
|
||||
License: MPL-1.1
|
||||
|
||||
Files: src/mod/say/mod_say_??/mod_say_??.c
|
||||
scripts/c/socket2me/socket2me.c
|
||||
src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl
|
||||
|
|
|
@ -32,7 +32,6 @@ applications/mod_httapi
|
|||
#applications/mod_oreka
|
||||
#applications/mod_osp
|
||||
#applications/mod_prefix
|
||||
#applications/mod_rad_auth
|
||||
applications/mod_signalwire
|
||||
applications/mod_sms
|
||||
#applications/mod_snapshot
|
||||
|
@ -90,7 +89,6 @@ event_handlers/mod_event_socket
|
|||
#event_handlers/mod_fail2ban
|
||||
#event_handlers/mod_format_cdr
|
||||
#event_handlers/mod_json_cdr
|
||||
#event_handlers/mod_radius_cdr
|
||||
#event_handlers/mod_odbc_cdr
|
||||
#event_handlers/mod_smpp
|
||||
#event_handlers/mod_snmp
|
||||
|
@ -118,7 +116,6 @@ loggers/mod_console
|
|||
#loggers/mod_graylog2
|
||||
loggers/mod_logfile
|
||||
loggers/mod_syslog
|
||||
#loggers/mod_raven
|
||||
#say/mod_say_de
|
||||
say/mod_say_en
|
||||
#say/mod_say_es
|
||||
|
@ -142,7 +139,6 @@ say/mod_say_en
|
|||
xml_int/mod_xml_cdr
|
||||
#xml_int/mod_xml_curl
|
||||
#xml_int/mod_xml_ldap
|
||||
#xml_int/mod_xml_radius
|
||||
xml_int/mod_xml_rpc
|
||||
xml_int/mod_xml_scgi
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ applications/mod_nibblebill
|
|||
applications/mod_oreka
|
||||
#applications/mod_osp
|
||||
applications/mod_prefix
|
||||
#applications/mod_rad_auth
|
||||
applications/mod_signalwire
|
||||
applications/mod_sms
|
||||
applications/mod_snapshot
|
||||
|
@ -88,7 +87,6 @@ event_handlers/mod_event_multicast
|
|||
event_handlers/mod_event_socket
|
||||
event_handlers/mod_format_cdr
|
||||
event_handlers/mod_json_cdr
|
||||
#event_handlers/mod_radius_cdr
|
||||
event_handlers/mod_odbc_cdr
|
||||
event_handlers/mod_snmp
|
||||
#event_handlers/mod_event_zmq
|
||||
|
@ -136,6 +134,5 @@ timers/mod_timerfd
|
|||
xml_int/mod_xml_cdr
|
||||
xml_int/mod_xml_curl
|
||||
xml_int/mod_xml_ldap
|
||||
#xml_int/mod_xml_radius
|
||||
xml_int/mod_xml_rpc
|
||||
xml_int/mod_xml_scgi
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
<!-- <load module="mod_xml_rpc"/> -->
|
||||
<!-- <load module="mod_xml_curl"/> -->
|
||||
<!-- <load module="mod_xml_cdr"/> -->
|
||||
<!-- <load module="mod_xml_radius"/> -->
|
||||
<!-- <load module="mod_xml_scgi"/> -->
|
||||
|
||||
<!-- Event Handlers -->
|
||||
|
|
|
@ -2118,7 +2118,6 @@ AC_CONFIG_FILES([Makefile
|
|||
src/mod/applications/mod_oreka/Makefile
|
||||
src/mod/applications/mod_osp/Makefile
|
||||
src/mod/applications/mod_prefix/Makefile
|
||||
src/mod/applications/mod_rad_auth/Makefile
|
||||
src/mod/applications/mod_random/Makefile
|
||||
src/mod/applications/mod_skel/Makefile
|
||||
src/mod/applications/mod_signalwire/Makefile
|
||||
|
@ -2181,7 +2180,6 @@ AC_CONFIG_FILES([Makefile
|
|||
src/mod/event_handlers/mod_fail2ban/Makefile
|
||||
src/mod/event_handlers/mod_format_cdr/Makefile
|
||||
src/mod/event_handlers/mod_json_cdr/Makefile
|
||||
src/mod/event_handlers/mod_radius_cdr/Makefile
|
||||
src/mod/event_handlers/mod_odbc_cdr/Makefile
|
||||
src/mod/event_handlers/mod_smpp/Makefile
|
||||
src/mod/event_handlers/mod_snmp/Makefile
|
||||
|
@ -2209,7 +2207,6 @@ AC_CONFIG_FILES([Makefile
|
|||
src/mod/loggers/mod_graylog2/Makefile
|
||||
src/mod/loggers/mod_logfile/Makefile
|
||||
src/mod/loggers/mod_syslog/Makefile
|
||||
src/mod/loggers/mod_raven/Makefile
|
||||
src/mod/say/mod_say_de/Makefile
|
||||
src/mod/say/mod_say_en/Makefile
|
||||
src/mod/say/mod_say_es/Makefile
|
||||
|
@ -2233,7 +2230,6 @@ AC_CONFIG_FILES([Makefile
|
|||
src/mod/xml_int/mod_xml_cdr/Makefile
|
||||
src/mod/xml_int/mod_xml_curl/Makefile
|
||||
src/mod/xml_int/mod_xml_ldap/Makefile
|
||||
src/mod/xml_int/mod_xml_radius/Makefile
|
||||
src/mod/xml_int/mod_xml_rpc/Makefile
|
||||
src/mod/xml_int/mod_xml_scgi/Makefile
|
||||
src/mod/applications/mod_av/Makefile
|
||||
|
|
|
@ -36,7 +36,6 @@ avoid_mods=(
|
|||
applications/mod_limit
|
||||
applications/mod_mongo
|
||||
applications/mod_osp
|
||||
applications/mod_rad_auth
|
||||
applications/mod_skel
|
||||
applications/mod_cluechoo
|
||||
codecs/mod_com_g729
|
||||
|
@ -52,7 +51,6 @@ avoid_mods=(
|
|||
formats/mod_webm
|
||||
sdk/autotools
|
||||
xml_int/mod_xml_ldap
|
||||
xml_int/mod_xml_radius
|
||||
)
|
||||
avoid_mods_armhf=(
|
||||
languages/mod_v8
|
||||
|
@ -81,17 +79,14 @@ avoid_mods_wheezy=(
|
|||
)
|
||||
avoid_mods_trusty=(
|
||||
event_handlers/mod_amqp
|
||||
loggers/mod_raven
|
||||
)
|
||||
avoid_mods_utopic=(
|
||||
directories/mod_ldap
|
||||
loggers/mod_raven
|
||||
)
|
||||
avoid_mods_xenial=(
|
||||
event_handlers/mod_ldap
|
||||
event_handlers/mod_amqp
|
||||
asr_tts/mod_flite
|
||||
loggers/mod_raven
|
||||
)
|
||||
manual_pkgs=(
|
||||
freeswitch-all
|
||||
|
|
|
@ -164,10 +164,6 @@ Description: Longest prefix match search
|
|||
This module provides a data store with fast lookups by the longest
|
||||
prefix match (LPM) rule.
|
||||
|
||||
Module: applications/mod_rad_auth
|
||||
Description: RADIUS AA
|
||||
This module implements RADIUS Authentication and Authorization.
|
||||
|
||||
Module: applications/mod_random
|
||||
Description: Entropy extraction
|
||||
This module extracts entropy from FreeSWITCH and feeds it into
|
||||
|
@ -463,10 +459,6 @@ Module: event_handlers/mod_odbc_cdr
|
|||
Description: mod_odbc_cdr
|
||||
Adds mod_odbc_cdr.
|
||||
|
||||
Module: event_handlers/mod_radius_cdr
|
||||
Description: mod_radius_cdr
|
||||
Adds mod_radius_cdr.
|
||||
|
||||
Module: event_handlers/mod_smpp
|
||||
Description: mod_snmp
|
||||
Adds mod_snmp.
|
||||
|
@ -705,10 +697,6 @@ Description: mod_xml_ldap
|
|||
Adds mod_xml_ldap.
|
||||
Build-Depends: libldap2-dev, libsasl2-dev
|
||||
|
||||
Module: xml_int/mod_xml_radius
|
||||
Description: mod_xml_radius
|
||||
Adds mod_xml_radius
|
||||
|
||||
Module: xml_int/mod_xml_rpc
|
||||
Description: mod_xml_rpc
|
||||
Adds mod_xml_rpc.
|
||||
|
|
|
@ -1321,10 +1321,6 @@ Files: src/mod/event_handlers/mod_cdr_mongodb/driver/src/md5.[ch]
|
|||
Copyright: 1999, 2000, 2002 Aladdin Enterprises.
|
||||
License: zlib/libpng
|
||||
|
||||
Files: src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h
|
||||
Copyright: 2006, Author: Yossi Neiman of Cartis Solutions, Inc. <freeswitch AT cartissolutions.com>
|
||||
License: MPL-1.1
|
||||
|
||||
Files: src/mod/say/mod_say_??/mod_say_??.c
|
||||
scripts/c/socket2me/socket2me.c
|
||||
src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl
|
||||
|
|
|
@ -105,7 +105,6 @@ getlibs () {
|
|||
getlib http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
|
||||
#getlib http://download.zeromq.org/zeromq-2.1.9.tar.gz \
|
||||
# || getlib http://download.zeromq.org/historic/zeromq-2.1.9.tar.gz
|
||||
getlib http://files.freeswitch.org/downloads/libs/freeradius-client-1.1.7.tar.gz
|
||||
#getlib http://files.freeswitch.org/downloads/libs/v8-3.24.14.tar.bz2
|
||||
}
|
||||
|
||||
|
|
|
@ -110,10 +110,9 @@ Vendor: http://www.freeswitch.org/
|
|||
#
|
||||
######################################################################################################################
|
||||
Source0: http://files.freeswitch.org/%{name}-%{nonparsedversion}.tar.bz2
|
||||
Source1: http://files.freeswitch.org/downloads/libs/freeradius-client-1.1.7.tar.gz
|
||||
Source2: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
|
||||
Source3: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.8.tar.gz
|
||||
Source4: http://files.freeswitch.org/downloads/libs/sphinxbase-0.8.tar.gz
|
||||
Source1: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
|
||||
Source2: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.8.tar.gz
|
||||
Source3: http://files.freeswitch.org/downloads/libs/sphinxbase-0.8.tar.gz
|
||||
Prefix: %{prefix}
|
||||
|
||||
|
||||
|
@ -451,14 +450,6 @@ Provides FreeSWITCH mod_nibblebill, provides a credit/debit module for
|
|||
FreeSWITCH to allow real-time debiting of credit or cash from a database
|
||||
while calls are in progress.
|
||||
|
||||
%package application-rad_auth
|
||||
Summary: FreeSWITCH mod_rad_auth
|
||||
Group: System/Libraries
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description application-rad_auth
|
||||
Provides FreeSWITCH mod_rad_auth, authentication via RADIUS protocol from FreeSWITCH dialplan
|
||||
|
||||
%package application-signalwire
|
||||
Summary: FreeSWITCH mod_signalwire
|
||||
Group: System/Libraries
|
||||
|
@ -862,14 +853,6 @@ Requires: %{name} = %{version}-%{release}
|
|||
%description event-json-cdr
|
||||
JSON CDR Logger for FreeSWITCH.
|
||||
|
||||
%package event-radius-cdr
|
||||
Summary: RADIUS Logger for the FreeSWITCH open source telephony platform
|
||||
Group: System/Libraries
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description event-radius-cdr
|
||||
RADIUS Logger for the FreeSWITCH open source telephony platform
|
||||
|
||||
%package event-snmp
|
||||
Summary: SNMP stats reporter for the FreeSWITCH open source telephony platform
|
||||
Group: System/Libraries
|
||||
|
@ -1251,7 +1234,8 @@ APPLICATION_MODULES_DE+="applications/mod_esl"
|
|||
|
||||
APPLICATION_MODULES_FR="applications/mod_fifo applications/mod_fsk applications/mod_fsv applications/mod_hash \
|
||||
applications/mod_httapi applications/mod_http_cache applications/mod_lcr applications/mod_limit \
|
||||
applications/mod_memcache applications/mod_mongo applications/mod_nibblebill applications/mod_rad_auth"
|
||||
applications/mod_memcache applications/mod_mongo applications/mod_nibblebill"
|
||||
|
||||
|
||||
APPLICATION_MODULES_SZ="applications/mod_signalwire applications/mod_sms applications/mod_snapshot \
|
||||
applications/mod_spandsp applications/mod_spy \
|
||||
|
@ -1316,7 +1300,7 @@ ENDPOINTS_MODULES=" \
|
|||
######################################################################################################################
|
||||
EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_cdr_pg_csv event_handlers/mod_cdr_sqlite \
|
||||
event_handlers/mod_cdr_mongodb event_handlers/mod_format_cdr event_handlers/mod_erlang_event event_handlers/mod_event_multicast \
|
||||
event_handlers/mod_event_socket event_handlers/mod_json_cdr event_handlers/mod_radius_cdr \
|
||||
event_handlers/mod_event_socket event_handlers/mod_json_cdr \
|
||||
event_handlers/mod_snmp"
|
||||
|
||||
#### BUILD ISSUES NET RESOLVED FOR RELEASE event_handlers/mod_event_zmq
|
||||
|
@ -1898,9 +1882,6 @@ fi
|
|||
%files application-nibblebill
|
||||
%{MODINSTDIR}/mod_nibblebill.so*
|
||||
|
||||
%files application-rad_auth
|
||||
%{MODINSTDIR}/mod_rad_auth.so*
|
||||
|
||||
%files application-signalwire
|
||||
%{MODINSTDIR}/mod_signalwire.so*
|
||||
|
||||
|
@ -2062,9 +2043,6 @@ fi
|
|||
%files event-json-cdr
|
||||
%{MODINSTDIR}/mod_json_cdr.so*
|
||||
|
||||
%files event-radius-cdr
|
||||
%{MODINSTDIR}/mod_radius_cdr.so*
|
||||
|
||||
%files event-snmp
|
||||
%{MODINSTDIR}/mod_snmp.so*
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ opal
|
|||
/esl/Debug/
|
||||
/esl/Release/
|
||||
/flite-*/
|
||||
/freeradius-client-*/
|
||||
/ilbc/config-h.in
|
||||
/ilbc/doc/Makefile
|
||||
/ilbc/doc/Makefile.in
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
include $(top_srcdir)/build/modmake.rulesam
|
||||
MODNAME=mod_rad_auth
|
||||
|
||||
RADCLIENT_VERSION=1.1.7
|
||||
RADCLIENT=freeradius-client-$(RADCLIENT_VERSION)
|
||||
RADCLIENT_DIR=$(switch_srcdir)/libs/$(RADCLIENT)
|
||||
RADCLIENT_BUILDDIR=$(switch_builddir)/libs/$(RADCLIENT)
|
||||
RADCLIENT_LIBDIR=$(RADCLIENT_BUILDDIR)/lib
|
||||
RADCLIENT_LA=${RADCLIENT_LIBDIR}/libfreeradius-client.la
|
||||
|
||||
mod_LTLIBRARIES = mod_rad_auth.la
|
||||
mod_rad_auth_la_SOURCES = mod_rad_auth.c
|
||||
mod_rad_auth_la_CFLAGS = $(AM_CFLAGS) -I$(RADCLIENT_DIR)/include
|
||||
mod_rad_auth_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(RADCLIENT_LA)
|
||||
mod_rad_auth_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
||||
|
||||
BUILT_SOURCES=$(RADCLIENT_LA)
|
||||
|
||||
$(RADCLIENT_DIR):
|
||||
$(GETLIB) $(RADCLIENT).tar.gz
|
||||
|
||||
$(RADCLIENT_BUILDDIR)/Makefile: $(RADCLIENT_DIR)
|
||||
mkdir -p $(RADCLIENT_BUILDDIR)
|
||||
cd $(RADCLIENT_BUILDDIR) && $(DEFAULT_VARS) $(RADCLIENT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(RADCLIENT_DIR)
|
||||
$(TOUCH_TARGET)
|
||||
|
||||
$(RADCLIENT_LA): $(RADCLIENT_BUILDDIR)/Makefile
|
||||
cd $(RADCLIENT_BUILDDIR) && CFLAGS="$(CFLAGS)" $(MAKE)
|
||||
$(TOUCH_TARGET)
|
|
@ -1,936 +0,0 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Neal Horman <neal at wanlink dot com>
|
||||
* Tihomir Culjaga <tculjaga@gmail.com>
|
||||
*
|
||||
* mod_rad_auth.c -- module for radius authorization/authentication
|
||||
*
|
||||
*/
|
||||
#include <switch.h>
|
||||
#include <freeradius-client.h>
|
||||
|
||||
#define RC_CONFIG_FILE "/usr/local/etc/radiusclient/radiusclient.conf"
|
||||
#define EMBENDED_CONFIG 1
|
||||
|
||||
#define STR_LENGTH 512
|
||||
char* rc_config_file = NULL;
|
||||
|
||||
struct config_vsas
|
||||
{
|
||||
char* name;
|
||||
int id;
|
||||
char* value;
|
||||
int pec;
|
||||
int expr;
|
||||
int direction;
|
||||
|
||||
struct config_vsas *pNext;
|
||||
};
|
||||
|
||||
struct config_client
|
||||
{
|
||||
char* name;
|
||||
char* value;
|
||||
|
||||
struct config_client *pNext;
|
||||
};
|
||||
|
||||
typedef struct config_vsas CONFIG_VSAS;
|
||||
typedef struct config_client CONFIG_CLIENT;
|
||||
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rad_authshutdown);
|
||||
SWITCH_MODULE_RUNTIME_FUNCTION(mod_rad_authruntime);
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_rad_authload);
|
||||
SWITCH_MODULE_DEFINITION(mod_rad_auth, mod_rad_authload, mod_rad_authshutdown, NULL /*mod_rad_authruntime*/);
|
||||
|
||||
CONFIG_VSAS* CONFIGVSAS;
|
||||
CONFIG_CLIENT* CONFIGCLIENT;
|
||||
|
||||
void free_radius_auth_value_pair(VALUE_PAIR *send, VALUE_PAIR *received, rc_handle *rh)
|
||||
{
|
||||
if (send)
|
||||
rc_avpair_free(send);
|
||||
|
||||
if (received)
|
||||
rc_avpair_free(received);
|
||||
|
||||
if (rh)
|
||||
rc_destroy(rh);
|
||||
rh = NULL;
|
||||
}
|
||||
|
||||
char* extract_in_variable(char* invar)
|
||||
{
|
||||
char *var = NULL;
|
||||
if (strlen(invar) < 4)
|
||||
return NULL;
|
||||
|
||||
while (invar[0] == ' ')
|
||||
invar++;
|
||||
|
||||
if (invar[0] != 'i' && invar[0] != 'I' && invar[1] != 'n' && invar[1]
|
||||
!= 'N' && invar[2] != ' ' && invar[2] != ' ')
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
var = strchr(invar, ' ');
|
||||
|
||||
while (var[0] == ' ')
|
||||
var++;
|
||||
|
||||
return var;
|
||||
}
|
||||
|
||||
char* extract_out_variable(char* outvar)
|
||||
{
|
||||
char *var = NULL;
|
||||
if (strlen(outvar) < 5)
|
||||
return NULL;
|
||||
|
||||
while (outvar[0] == ' ')
|
||||
outvar++;
|
||||
|
||||
if (outvar[0] != 'o' && outvar[0] != 'O' && outvar[1] != 'u' && outvar[1]
|
||||
!= 'U' && outvar[2] != 't' && outvar[2] != 'T' && outvar[3] != ' '
|
||||
&& outvar[3] != ' ')
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
var = strchr(outvar, ' ');
|
||||
|
||||
while (var[0] == ' ')
|
||||
{
|
||||
var++;
|
||||
}
|
||||
|
||||
return var;
|
||||
}
|
||||
|
||||
|
||||
CONFIG_VSAS* GetVSAS(char* key)
|
||||
{
|
||||
CONFIG_VSAS* PCONFIGVSAS = CONFIGVSAS;
|
||||
|
||||
while(PCONFIGVSAS)
|
||||
{
|
||||
if (strcmp(key, PCONFIGVSAS->name) == 0)
|
||||
{
|
||||
return PCONFIGVSAS;
|
||||
}
|
||||
|
||||
PCONFIGVSAS = PCONFIGVSAS->pNext;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* GetValue(switch_channel_t *channel, CONFIG_VSAS* VSAS, char* value)
|
||||
{
|
||||
if (VSAS == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Internal Error : VSAS is null object.\n");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (VSAS->value == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Internal Error : VSAS->value is null object.\n");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (VSAS->expr == 1)
|
||||
{
|
||||
const char* v = switch_channel_get_variable(channel, VSAS->value);
|
||||
|
||||
if (v != NULL)
|
||||
{
|
||||
strcpy(value, v);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Undefined channel variable: %s.\n", VSAS->value);
|
||||
strcpy(value, "");
|
||||
return value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(value, VSAS->value);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
int radius_auth_test(switch_channel_t *channel, char* username1, char* passwd1, char* auth_result, char* biling_model, char* credit_amount, char* currency, char* preffered_lang)
|
||||
{
|
||||
int result;
|
||||
char username[128];
|
||||
char passwd[AUTH_PASS_LEN + 1];
|
||||
VALUE_PAIR *send, *received;
|
||||
uint32_t service;
|
||||
char msg[4096], username_realm[256];
|
||||
char *default_realm;
|
||||
rc_handle *rh;
|
||||
|
||||
strcpy(username, "123");
|
||||
strcpy(passwd, "123");
|
||||
|
||||
if ((rh = rc_read_config(RC_CONFIG_FILE)) == NULL)
|
||||
return ERROR_RC;
|
||||
|
||||
if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0)
|
||||
return ERROR_RC;
|
||||
|
||||
default_realm = rc_conf_str(rh, "default_realm");
|
||||
|
||||
|
||||
send = NULL;
|
||||
|
||||
/*
|
||||
* Fill in User-Name
|
||||
*/
|
||||
|
||||
strncpy(username_realm, username, sizeof(username_realm));
|
||||
|
||||
/* Append default realm */
|
||||
if ((strchr(username_realm, '@') == NULL) && default_realm &&
|
||||
(*default_realm != '\0'))
|
||||
{
|
||||
strncat(username_realm, "@", sizeof(username_realm)-strlen(username_realm)-1);
|
||||
strncat(username_realm, default_realm, sizeof(username_realm)-strlen(username_realm)-1);
|
||||
}
|
||||
|
||||
if (rc_avpair_add(rh, &send, PW_USER_NAME, username_realm, -1, 0) == NULL)
|
||||
return ERROR_RC;
|
||||
|
||||
/*
|
||||
* Fill in User-Password
|
||||
*/
|
||||
|
||||
if (rc_avpair_add(rh, &send, PW_USER_PASSWORD, passwd, -1, 0) == NULL)
|
||||
return ERROR_RC;
|
||||
|
||||
/*
|
||||
* Fill in Service-Type
|
||||
*/
|
||||
|
||||
service = PW_AUTHENTICATE_ONLY;
|
||||
if (rc_avpair_add(rh, &send, PW_SERVICE_TYPE, &service, -1, 0) == NULL)
|
||||
return ERROR_RC;
|
||||
|
||||
result = rc_auth(rh, 0, send, &received, msg);
|
||||
|
||||
if (result == OK_RC)
|
||||
{
|
||||
fprintf(stderr, "\"%s\" RADIUS Authentication OK\n", username);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "\"%s\" RADIUS Authentication failure (RC=%i)\n", username, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
int radius_auth(switch_channel_t *channel, char* called_number, char* username, char* password , char* auth_result/*, char* biling_model, char* credit_amount, char* currency, char* preffered_lang*/)
|
||||
{
|
||||
int result = OK_RC;
|
||||
VALUE_PAIR *send = NULL;
|
||||
VALUE_PAIR *received = NULL;
|
||||
VALUE_PAIR *service_vp;
|
||||
DICT_ATTR *pda;
|
||||
CONFIG_VSAS* PCONFIGVSAS = NULL;
|
||||
char *default_realm = NULL;
|
||||
rc_handle *rh = NULL;
|
||||
int attrid =0;
|
||||
|
||||
char msg[STR_LENGTH * 10 + 1];
|
||||
char username_realm[STR_LENGTH + 1];
|
||||
char value[STR_LENGTH + 1];
|
||||
int integer;
|
||||
|
||||
memset(msg, 0, STR_LENGTH * 10);
|
||||
memset(username_realm, 0, STR_LENGTH);
|
||||
|
||||
send = NULL;
|
||||
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
#if EMBENDED_CONFIG
|
||||
|
||||
CONFIG_CLIENT* PCONFIGCLIENT = CONFIGCLIENT;
|
||||
|
||||
rh = rc_new();
|
||||
if (rh == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Failed to allocate initial structure.\n");
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "allocate initial structure.\n");
|
||||
|
||||
/* Initialize the config structure */
|
||||
|
||||
rh = rc_config_init(rh);
|
||||
if (rh == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"ERROR: Failed to initialze configuration.\n");
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"initialzed configuration.\n");
|
||||
|
||||
while(PCONFIGCLIENT)
|
||||
{
|
||||
//if (rc_add_config(rh, "auth_order", "radius", "config", 0) != 0)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "set %s := %s.\n", PCONFIGCLIENT->name, PCONFIGCLIENT->value);
|
||||
if (rc_add_config(rh, PCONFIGCLIENT->name, PCONFIGCLIENT->value, "config", 0) != 0)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Unable to set %s := %s.\n", PCONFIGCLIENT->name, PCONFIGCLIENT->value);
|
||||
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
|
||||
PCONFIGCLIENT = PCONFIGCLIENT->pNext;
|
||||
}
|
||||
|
||||
if (result == ERROR_RC)
|
||||
break;
|
||||
|
||||
|
||||
#else
|
||||
if ((rh = rc_read_config(!rc_config_file ? RC_CONFIG_FILE : rc_config_file)) == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading radius config file\n");
|
||||
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading radius dictionary\n");
|
||||
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
|
||||
default_realm = rc_conf_str(rh, "default_realm");
|
||||
if (default_realm == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "default_realm is null object.\n");
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
|
||||
strncpy(username_realm, username, sizeof(username_realm));
|
||||
|
||||
if ((strchr(username_realm, '@') == NULL) && default_realm &&
|
||||
(*default_realm != '\0'))
|
||||
{
|
||||
strncat(username_realm, "@", sizeof(username_realm)-strlen(username_realm)-1);
|
||||
strncat(username_realm, default_realm, sizeof(username_realm)-strlen(username_realm)-1);
|
||||
}
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"... radius: User-Name: %s\n", username);
|
||||
if (rc_avpair_add(rh, &send, PW_USER_NAME, username_realm, -1, 0)== NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "An Error occured during rc_avpair_add : username\n");
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"... radius: User-Password: %s\n", password);
|
||||
if (rc_avpair_add(rh, &send, PW_USER_PASSWORD, password, -1, 0) == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "An Error occured during rc_avpair_add : password\n");
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!called_number || strcmp(called_number, "") == 0)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"... radius: Called-station-Id is empty, ignoring...\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"... radius: Called-station-Id: %s\n", called_number);
|
||||
if (rc_avpair_add(rh, &send, 30, called_number, -1, 0) == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "An Error occured during rc_avpair_add : Called-station-Id\n");
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PCONFIGVSAS = CONFIGVSAS;
|
||||
|
||||
while(PCONFIGVSAS)
|
||||
{
|
||||
if (PCONFIGVSAS->direction == 1)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle attribute: %s\n", PCONFIGVSAS->name );
|
||||
|
||||
memset(value, 0, STR_LENGTH);
|
||||
GetValue(channel, PCONFIGVSAS, value);
|
||||
|
||||
if (PCONFIGVSAS->pec != 0)
|
||||
attrid = PCONFIGVSAS->id | (PCONFIGVSAS->pec << 16);
|
||||
else
|
||||
attrid = PCONFIGVSAS->id ;
|
||||
|
||||
pda = rc_dict_getattr(rh, attrid);
|
||||
|
||||
if (pda == NULL)
|
||||
{
|
||||
result = ERROR_RC;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown attribute: key:%s, not found in dictionary\n", PCONFIGVSAS->name);
|
||||
break;
|
||||
}
|
||||
|
||||
if (PCONFIGVSAS->pec != 0 && rc_dict_getvend(rh, PCONFIGVSAS->pec) == NULL)
|
||||
{
|
||||
result = ERROR_RC;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown vendor specific id: key:%s, id:%dnot found in dictionary\n", PCONFIGVSAS->name, PCONFIGVSAS->pec);
|
||||
break;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "... dictionary data: id:%d, vendor id:%d, attr type:%d, attr name:%s (%d)\n", PCONFIGVSAS->id, PCONFIGVSAS->pec, pda->type, pda->name, attrid);
|
||||
|
||||
switch(pda->type)
|
||||
{
|
||||
case PW_TYPE_STRING:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "... radius: key:%s, value:%s (%s) as string\n", PCONFIGVSAS->name, PCONFIGVSAS->value, value);
|
||||
if (rc_avpair_add(rh, &send, PCONFIGVSAS->id, value, -1, PCONFIGVSAS->pec) == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "An Error occured during rc_avpair_add : %s\n", PCONFIGVSAS->name);
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
//case PW_TYPE_DATE:
|
||||
case PW_TYPE_INTEGER:
|
||||
integer = atoi(value);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "... radius: key:%s, value:%s (%d) as integer\n", PCONFIGVSAS->name, PCONFIGVSAS->value, integer);
|
||||
|
||||
|
||||
if (rc_avpair_add(rh, &send, PCONFIGVSAS->id, &integer, -1, PCONFIGVSAS->pec) == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "An Error occured during rc_avpair_add : %s\n", PCONFIGVSAS->name);
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case PW_TYPE_IPADDR:
|
||||
integer = rc_get_ipaddr(value);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "... radius: key:%s, value:%s (%d) as ipaddr\n", PCONFIGVSAS->name, PCONFIGVSAS->value, integer);
|
||||
|
||||
|
||||
if (rc_avpair_add(rh, &send, PCONFIGVSAS->id, &integer, -1, PCONFIGVSAS->pec) == NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "An Error occured during rc_avpair_add : %s\n", PCONFIGVSAS->name);
|
||||
result = ERROR_RC;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown attribute type: key:%s, type %d\n", PCONFIGVSAS->name, pda->type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PCONFIGVSAS = PCONFIGVSAS->pNext;
|
||||
}
|
||||
|
||||
|
||||
if (result != ERROR_RC)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sending radius packet ...\n" );
|
||||
result = rc_auth(rh, 0, send, &received, msg);
|
||||
|
||||
|
||||
if (result == OK_RC)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"RADIUS Authentication OK\n");
|
||||
|
||||
strcpy(auth_result, "OK");
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
" RADIUS Authentication failure (RC=%d)\n",
|
||||
result);
|
||||
|
||||
strcpy(auth_result, "NOK");
|
||||
}
|
||||
|
||||
|
||||
|
||||
PCONFIGVSAS = CONFIGVSAS;
|
||||
|
||||
while(PCONFIGVSAS)
|
||||
{
|
||||
if (PCONFIGVSAS->direction == 0)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle attribute: %s\n", PCONFIGVSAS->name );
|
||||
if ((service_vp = rc_avpair_get(received, PCONFIGVSAS->id, PCONFIGVSAS->pec)) != NULL)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\tattribute (%s) found in radius packet\n", PCONFIGVSAS->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\tset variable %s := %s\n", PCONFIGVSAS->value, service_vp->strvalue);
|
||||
|
||||
switch_channel_set_variable(channel, PCONFIGVSAS->value, service_vp->strvalue);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\tNo found out attribute id: %d, pec:%d, (%s)\n", PCONFIGVSAS->id, PCONFIGVSAS->pec, PCONFIGVSAS->name );
|
||||
}
|
||||
}
|
||||
|
||||
PCONFIGVSAS = PCONFIGVSAS->pNext;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "abort sending radius packet.\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
} while(1 == 0);
|
||||
|
||||
if (result == ERROR_RC)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"An error occured during RADIUS Authentication(RC=%d)\n",
|
||||
result);
|
||||
}
|
||||
|
||||
free_radius_auth_value_pair(send, received, rh);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(auth_function)
|
||||
{
|
||||
char* in_called_number = NULL;
|
||||
char *in_username = NULL;
|
||||
char *in_password = NULL;
|
||||
|
||||
char *out_auth_result = NULL;
|
||||
/*char *out_biling_model = NULL;
|
||||
char *out_credit_amount = NULL;
|
||||
char *out_currency = NULL;
|
||||
char *out_preffered_lang = NULL;*/
|
||||
|
||||
char auth_result[STR_LENGTH + 1];
|
||||
/*char biling_model[STR_LENGTH + 1];
|
||||
char credit_amount[STR_LENGTH + 1];
|
||||
char currency[STR_LENGTH + 1];
|
||||
char preffered_lang[STR_LENGTH + 1];*/
|
||||
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
memset(auth_result, 0, STR_LENGTH);
|
||||
/*memset(biling_model, 0, STR_LENGTH);
|
||||
memset(credit_amount, 0, STR_LENGTH);
|
||||
memset(currency, 0, STR_LENGTH);
|
||||
memset(preffered_lang, 0, STR_LENGTH);*/
|
||||
|
||||
if (switch_strlen_zero(data))
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"No variable name specified.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
char *in_called_number_expanded = NULL;
|
||||
char *in_username_expanded = NULL;
|
||||
char *in_password_expanded = NULL;
|
||||
|
||||
|
||||
in_called_number = switch_core_session_strdup(session, data);
|
||||
|
||||
in_username = strchr(in_called_number, ',');
|
||||
|
||||
if (in_username)
|
||||
{
|
||||
*in_username++ = '\0';
|
||||
if (switch_strlen_zero(in_username))
|
||||
{
|
||||
in_username = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
in_password = strchr(in_username, ',');
|
||||
|
||||
if (in_password)
|
||||
{
|
||||
*in_password++ = '\0';
|
||||
if (switch_strlen_zero(in_password))
|
||||
{
|
||||
in_password = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
out_auth_result = strchr(in_password, ',');
|
||||
|
||||
if (out_auth_result)
|
||||
{
|
||||
*out_auth_result++ = '\0';
|
||||
if (switch_strlen_zero(out_auth_result))
|
||||
{
|
||||
out_auth_result = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*out_biling_model = strchr(out_auth_result, ',');
|
||||
|
||||
if (out_biling_model)
|
||||
{
|
||||
*out_biling_model++ = '\0';
|
||||
if (switch_strlen_zero(out_biling_model))
|
||||
{
|
||||
out_biling_model = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
out_credit_amount = strchr(out_biling_model, ',');
|
||||
|
||||
if (out_credit_amount)
|
||||
{
|
||||
*out_credit_amount++ = '\0';
|
||||
if (switch_strlen_zero(out_credit_amount))
|
||||
{
|
||||
out_credit_amount = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
out_currency = strchr(out_credit_amount, ',');
|
||||
|
||||
if (out_currency)
|
||||
{
|
||||
*out_currency++ = '\0';
|
||||
if (switch_strlen_zero(out_currency))
|
||||
{
|
||||
out_currency = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
out_preffered_lang = strchr(out_currency, ',');
|
||||
|
||||
if (out_preffered_lang)
|
||||
{
|
||||
*out_preffered_lang++ = '\0';
|
||||
if (switch_strlen_zero(out_preffered_lang))
|
||||
{
|
||||
out_preffered_lang = NULL;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (in_called_number)
|
||||
in_called_number = extract_in_variable(in_called_number);
|
||||
|
||||
in_username = extract_in_variable(in_username);
|
||||
in_password = extract_in_variable(in_password);
|
||||
out_auth_result = extract_out_variable(out_auth_result);
|
||||
/*out_biling_model = extract_out_variable(out_biling_model);
|
||||
out_credit_amount = extract_out_variable(out_credit_amount);
|
||||
out_currency = extract_out_variable(out_currency);
|
||||
out_preffered_lang = extract_out_variable(out_preffered_lang);*/
|
||||
|
||||
if (!in_username || !in_password)
|
||||
{
|
||||
//todo: throw Exception
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Syntax error.\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (in_called_number)
|
||||
in_called_number_expanded = switch_channel_expand_variables(channel, in_called_number);
|
||||
|
||||
in_username_expanded = switch_channel_expand_variables(channel, in_username);
|
||||
in_password_expanded = switch_channel_expand_variables(channel, in_password);
|
||||
|
||||
|
||||
if (radius_auth(channel, in_called_number_expanded, in_username_expanded, in_password_expanded ,
|
||||
auth_result/*, biling_model, credit_amount, currency, preffered_lang*/) != OK_RC)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "An error occured during radius authorization.\n");
|
||||
}
|
||||
|
||||
|
||||
switch_channel_set_variable(channel, out_auth_result, auth_result);
|
||||
|
||||
/*switch_channel_set_variable(channel, out_biling_model, biling_model);
|
||||
switch_channel_set_variable(channel, out_credit_amount, credit_amount);
|
||||
switch_channel_set_variable(channel, out_currency, currency);
|
||||
switch_channel_set_variable(channel, out_preffered_lang, preffered_lang);*/
|
||||
|
||||
if (in_called_number && in_called_number_expanded && in_called_number_expanded != in_called_number)
|
||||
{
|
||||
switch_safe_free(in_called_number_expanded);
|
||||
}
|
||||
|
||||
if (in_username_expanded && in_username_expanded != in_username)
|
||||
{
|
||||
switch_safe_free(in_username_expanded);
|
||||
}
|
||||
|
||||
if (in_password_expanded && in_password_expanded != in_password)
|
||||
{
|
||||
switch_safe_free(in_password_expanded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
switch_status_t load_config()
|
||||
{
|
||||
CONFIG_VSAS* PCONFIGVSAS = NULL;
|
||||
CONFIG_CLIENT* PCONFIGCLIENT = NULL;
|
||||
|
||||
char *cf = "rad_auth.conf";
|
||||
switch_xml_t cfg, xml, settings, param;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_event_t *params = NULL;
|
||||
|
||||
char *name;
|
||||
char *id;
|
||||
char *value;
|
||||
char *pec;
|
||||
char *expr;
|
||||
char* direction;
|
||||
|
||||
CONFIGVSAS = NULL;
|
||||
CONFIGCLIENT = NULL;
|
||||
|
||||
switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
|
||||
switch_assert(params);
|
||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile",
|
||||
"profile_rad_auth");
|
||||
|
||||
//vsas
|
||||
|
||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, params)))
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"open of %s failed\n", cf);
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
return status;
|
||||
}
|
||||
|
||||
if ((settings = switch_xml_child(cfg, "settings")))
|
||||
{
|
||||
for (param = switch_xml_child(settings, "param"); param; param
|
||||
= param->next)
|
||||
{
|
||||
name = (char *) switch_xml_attr_soft(param, "name");
|
||||
value = (char *) switch_xml_attr_soft(param, "value");
|
||||
|
||||
if (strcmp(name, "radius_config") == 0)
|
||||
{
|
||||
if (rc_config_file == NULL)
|
||||
rc_config_file = malloc(STR_LENGTH + 1);
|
||||
strcpy(rc_config_file, value);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "radius config: %s\n", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((settings = switch_xml_child(cfg, "vsas")))
|
||||
{
|
||||
for (param = switch_xml_child(settings, "param"); param; param
|
||||
= param->next)
|
||||
{
|
||||
if (CONFIGVSAS == NULL)
|
||||
{
|
||||
CONFIGVSAS = malloc(sizeof(CONFIG_VSAS));
|
||||
PCONFIGVSAS = CONFIGVSAS;
|
||||
}
|
||||
else
|
||||
{
|
||||
PCONFIGVSAS->pNext = malloc(sizeof(CONFIG_VSAS));
|
||||
PCONFIGVSAS = PCONFIGVSAS->pNext;
|
||||
}
|
||||
|
||||
name = (char *) switch_xml_attr_soft(param, "name");
|
||||
id = (char *) switch_xml_attr_soft(param, "id");
|
||||
value = (char *) switch_xml_attr_soft(param, "value");
|
||||
pec = (char *) switch_xml_attr_soft(param, "pec");
|
||||
expr = (char *) switch_xml_attr_soft(param, "expr");
|
||||
direction = (char *) switch_xml_attr_soft(param, "direction");
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "config attr: %s, %s, %s, %s, %s, %s\n", name, id, value, pec, expr, direction);
|
||||
|
||||
PCONFIGVSAS->name = (char*) malloc(STR_LENGTH + 1);
|
||||
PCONFIGVSAS->value = (char*) malloc(STR_LENGTH + 1);
|
||||
|
||||
strncpy(PCONFIGVSAS->name, name, STR_LENGTH);
|
||||
strncpy(PCONFIGVSAS->value, value, STR_LENGTH);
|
||||
PCONFIGVSAS->id = atoi(id);
|
||||
PCONFIGVSAS->pec = atoi(pec);
|
||||
PCONFIGVSAS->expr = atoi(expr);
|
||||
if(strcmp(direction, "in") == 0)
|
||||
PCONFIGVSAS->direction = 1;
|
||||
else
|
||||
PCONFIGVSAS->direction = 0;
|
||||
PCONFIGVSAS->pNext = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((settings = switch_xml_child(cfg, "client")))
|
||||
{
|
||||
for (param = switch_xml_child(settings, "param"); param; param
|
||||
= param->next)
|
||||
{
|
||||
if (CONFIGCLIENT == NULL)
|
||||
{
|
||||
CONFIGCLIENT = malloc(sizeof(CONFIG_CLIENT));
|
||||
PCONFIGCLIENT = CONFIGCLIENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
PCONFIGCLIENT->pNext = malloc(sizeof(CONFIG_CLIENT));
|
||||
PCONFIGCLIENT = PCONFIGCLIENT->pNext;
|
||||
}
|
||||
|
||||
name = (char *) switch_xml_attr_soft(param, "name");
|
||||
value = (char *) switch_xml_attr_soft(param, "value");
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "config client: %s, %s\n", name, value);
|
||||
|
||||
PCONFIGCLIENT->name = (char*) malloc(STR_LENGTH + 1);
|
||||
PCONFIGCLIENT->value = (char*) malloc(STR_LENGTH + 1);
|
||||
|
||||
strncpy(PCONFIGCLIENT->name, name, STR_LENGTH);
|
||||
strncpy(PCONFIGCLIENT->value, value, STR_LENGTH);
|
||||
|
||||
PCONFIGCLIENT->pNext = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
switch_xml_free(xml);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_rad_authload)
|
||||
{
|
||||
switch_application_interface_t *app_interface;
|
||||
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
|
||||
SWITCH_ADD_APP(app_interface, "auth_function", NULL, NULL, auth_function, "in <USERNAME>, in <PASSWORD>, out <AUTH_RESULT>, out <BILING_MODEL>, out <CREDIT_AMOUNT>, out <CURRENCY>, out <PREFFERED_LANG>", SAF_SUPPORT_NOMEDIA);
|
||||
|
||||
load_config();
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"mod rad_auth services is loaded.\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_RUNTIME_FUNCTION(mod_rad_authruntime)
|
||||
{
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rad_authshutdown)
|
||||
{
|
||||
CONFIG_VSAS* PCONFIGVSAS = CONFIGVSAS;
|
||||
CONFIG_CLIENT* PCONFIGCLIENT = CONFIGCLIENT;
|
||||
|
||||
CONFIG_VSAS* tmpVSAS = NULL;
|
||||
CONFIG_CLIENT* tmpCLIENT = NULL;
|
||||
|
||||
while(PCONFIGVSAS)
|
||||
{
|
||||
if (PCONFIGVSAS->name)
|
||||
free(PCONFIGVSAS->name);
|
||||
PCONFIGVSAS->name = NULL;
|
||||
|
||||
if (PCONFIGVSAS->value)
|
||||
free(PCONFIGVSAS->value);
|
||||
PCONFIGVSAS->value = NULL;
|
||||
|
||||
tmpVSAS = PCONFIGVSAS;
|
||||
PCONFIGVSAS = PCONFIGVSAS->pNext;
|
||||
|
||||
free(tmpVSAS);
|
||||
}
|
||||
|
||||
CONFIGVSAS = NULL;
|
||||
|
||||
|
||||
while(PCONFIGCLIENT)
|
||||
{
|
||||
if (PCONFIGCLIENT->name)
|
||||
free(PCONFIGCLIENT->name);
|
||||
PCONFIGCLIENT->name = NULL;
|
||||
|
||||
if (PCONFIGCLIENT->value)
|
||||
free(PCONFIGCLIENT->value);
|
||||
PCONFIGCLIENT->value = NULL;
|
||||
|
||||
tmpCLIENT = PCONFIGCLIENT;
|
||||
PCONFIGCLIENT = PCONFIGCLIENT->pNext;
|
||||
|
||||
free(tmpCLIENT);
|
||||
}
|
||||
|
||||
CONFIGCLIENT = NULL;
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
include $(top_srcdir)/build/modmake.rulesam
|
||||
MODNAME=mod_radius_cdr
|
||||
|
||||
RADCLIENT_VERSION=1.1.7
|
||||
RADCLIENT=freeradius-client-$(RADCLIENT_VERSION)
|
||||
RADCLIENT_DIR=$(switch_srcdir)/libs/$(RADCLIENT)
|
||||
RADCLIENT_BUILDDIR=$(switch_builddir)/libs/$(RADCLIENT)
|
||||
RADCLIENT_LIBDIR=$(RADCLIENT_BUILDDIR)/lib
|
||||
RADCLIENT_LA=${RADCLIENT_LIBDIR}/libfreeradius-client.la
|
||||
|
||||
mod_LTLIBRARIES = mod_radius_cdr.la
|
||||
mod_radius_cdr_la_SOURCES = mod_radius_cdr.c
|
||||
mod_radius_cdr_la_CFLAGS = $(AM_CFLAGS) -I$(RADCLIENT_DIR)/include
|
||||
mod_radius_cdr_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(RADCLIENT_LA)
|
||||
mod_radius_cdr_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
||||
BUILT_SOURCES=$(RADCLIENT_LA)
|
||||
|
||||
$(RADCLIENT_DIR):
|
||||
$(GETLIB) $(RADCLIENT).tar.gz
|
||||
|
||||
$(RADCLIENT_BUILDDIR)/Makefile: $(RADCLIENT_DIR)
|
||||
mkdir -p $(RADCLIENT_BUILDDIR)
|
||||
cd $(RADCLIENT_BUILDDIR) && $(DEFAULT_VARS) $(RADCLIENT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(RADCLIENT_DIR)
|
||||
$(TOUCH_TARGET)
|
||||
|
||||
$(RADCLIENT_LA): $(RADCLIENT_BUILDDIR)/Makefile
|
||||
cd $(RADCLIENT_BUILDDIR) && CFLAGS="$(CFLAGS)" $(MAKE)
|
||||
$(TOUCH_TARGET)
|
||||
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
mod_radius_cdr - A cdr Accounting module for FreeSWITCH.
|
||||
|
||||
cparker at segv dot org
|
||||
|
||||
=========================================================================================
|
||||
|
||||
Currently, this is in it's infancy, and is still being worked on. It is not
|
||||
yet enabled by default in building.
|
||||
|
||||
Comments, code, patches are always welcome. :)
|
||||
|
||||
=========================================================================================
|
||||
|
||||
Pre-reqs:
|
||||
|
||||
In order to use this module you will need to have the CVS head of the freeradius-client
|
||||
library installed.
|
||||
|
||||
CVS version as of June 14, 2007 or later will be sufficient.
|
||||
|
||||
Instructions on how to retrieve and install this can be found here:
|
||||
|
||||
http://wiki.freeradius.org/Radiusclient
|
||||
|
||||
=========================================================================================
|
||||
|
||||
Building:
|
||||
|
||||
1) Compile and install freeradius-client library.
|
||||
|
||||
2) Edit the top level 'configure.in'. At approx line 336 you need to add:
|
||||
|
||||
---
|
||||
AC_CONFIG_FILES([Makefile
|
||||
src/Makefile
|
||||
src/mod/Makefile
|
||||
src/mod/event_handlers/mod_cdr/Makefile
|
||||
+ src/mod/event_handlers/mod_radius_cdr/Makefile
|
||||
src/mod/endpoints/mod_sofia/Makefile
|
||||
src/include/switch_am_config.h
|
||||
build/getlib.sh
|
||||
build/modmake.rules])
|
||||
---
|
||||
|
||||
3) Rerun bootstrap, re-run configure
|
||||
|
||||
4) Edit the top-level 'modules.conf'. Add the following entry:
|
||||
|
||||
...
|
||||
event_handlers/mod_radius_cdr
|
||||
...
|
||||
|
||||
5) Run make, and make install. Make sure the module is built and installed.
|
||||
|
||||
6) Configure FreeSWITCH to load mod_radius_cdr
|
||||
|
||||
- Copy the 'mod_radius_cdr.conf.xml' file to the FreeSWITCH conf directory
|
||||
- Copy the 'radius/' directory to the FreeSWITCH conf directory
|
||||
- Edit 'conf/modules.conf' to load mod_radius_cdr
|
||||
- Edit 'conf/freeswitch.xml' to include 'mod_radius_cdr.conf.xml'
|
||||
|
||||
=========================================================================================
|
||||
|
||||
Here's a sample RADIUS transaction ( logged to a detail file via FreeRADIUS server ):
|
||||
|
||||
Fri Jun 8 08:23:10 2007
|
||||
Acct-Status-Type = Start
|
||||
Acct-Session-Id = "d734ff5e-bf04-4045-8cb3-f5744574808b"
|
||||
Freeswitch-Src = "8478797989"
|
||||
Freeswitch-CLID = "Chris Parker"
|
||||
Freeswitch-Dst = "888"
|
||||
Freeswitch-Dialplan = "XML"
|
||||
NAS-Port = 0
|
||||
Acct-Delay-Time = 0
|
||||
NAS-IP-Address = 127.0.0.1
|
||||
Client-IP-Address = 127.0.0.1
|
||||
Acct-Unique-Session-Id = "4b7754541b5902fa"
|
||||
Timestamp = 1181308990
|
||||
|
||||
Fri Jun 8 08:23:31 2007
|
||||
Acct-Status-Type = Stop
|
||||
Acct-Session-Id = "d734ff5e-bf04-4045-8cb3-f5744574808b"
|
||||
Freeswitch-Hangupcause = Normal-Clearing
|
||||
Freeswitch-Src = "8478797989"
|
||||
Freeswitch-CLID = "Chris Parker"
|
||||
Freeswitch-Dst = "888"
|
||||
Freeswitch-Dialplan = "XML"
|
||||
Freeswitch-Lastapp = "bridge"
|
||||
Freeswitch-Billusec = 21460442
|
||||
NAS-Port = 0
|
||||
Acct-Delay-Time = 0
|
||||
NAS-IP-Address = 127.0.0.1
|
||||
Client-IP-Address = 127.0.0.1
|
||||
Acct-Unique-Session-Id = "4b7754541b5902fa"
|
||||
Timestamp = 1181309011
|
||||
|
||||
|
||||
|
|
@ -1,892 +0,0 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Chris Parker <cparker@segv.org>
|
||||
* Mathieu Rene <mrene@avgs.ca>
|
||||
*
|
||||
*
|
||||
* mod_radius_cdr.c -- RADIUS CDR Module
|
||||
*
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include <sys/stat.h>
|
||||
#include <freeradius-client.h>
|
||||
#include "mod_radius_cdr.h"
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_radius_cdr_load);
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_radius_cdr_shutdown);
|
||||
SWITCH_MODULE_DEFINITION(mod_radius_cdr, mod_radius_cdr_load, mod_radius_cdr_shutdown, NULL);
|
||||
|
||||
static struct {
|
||||
int shutdown;
|
||||
switch_thread_rwlock_t *rwlock;
|
||||
} globals = {
|
||||
0};
|
||||
|
||||
static char cf[] = "mod_radius_cdr.conf";
|
||||
static char my_dictionary[PATH_MAX];
|
||||
static char my_seqfile[PATH_MAX];
|
||||
static char *my_deadtime; /* 0 */
|
||||
static char *my_timeout; /* 5 */
|
||||
static char *my_retries; /* 3 */
|
||||
static char my_servers[SERVER_MAX][255];
|
||||
static const char *my_timezone=""; /* Asia/Tokyo */
|
||||
|
||||
static rc_handle *my_radius_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
rc_handle *rad_config;
|
||||
|
||||
rad_config = rc_new();
|
||||
|
||||
if (rad_config == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Error initializing rc_handle!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rad_config = rc_config_init(rad_config);
|
||||
|
||||
if (rad_config == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error initializing radius config!\n");
|
||||
rc_destroy(rad_config);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Some hardcoded ( for now ) defaults needed to initialize radius */
|
||||
if (rc_add_config(rad_config, "auth_order", "radius", "mod_radius_cdr.c", 0) != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting auth_order = radius failed\n");
|
||||
rc_destroy(rad_config);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (rc_add_config(rad_config, "seqfile", my_seqfile, "mod_radius_cdr.c", 0) != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting seqfile = %s failed\n", my_seqfile);
|
||||
rc_destroy(rad_config);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Add the module configs to initialize rad_config */
|
||||
|
||||
for (i = 0; i < SERVER_MAX && my_servers[i][0] != '\0'; i++) {
|
||||
if (rc_add_config(rad_config, "acctserver", my_servers[i], cf, 0) != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting acctserver = %s failed\n", my_servers[i]);
|
||||
rc_destroy(rad_config);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc_add_config(rad_config, "dictionary", my_dictionary, cf, 0) != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed setting dictionary = %s failed\n", my_dictionary);
|
||||
rc_destroy(rad_config);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (rc_add_config(rad_config, "radius_deadtime", my_deadtime, cf, 0) != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_deadtime = %s failed\n", my_deadtime);
|
||||
rc_destroy(rad_config);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (rc_add_config(rad_config, "radius_timeout", my_timeout, cf, 0) != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_timeout = %s failed\n", my_timeout);
|
||||
rc_destroy(rad_config);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (rc_add_config(rad_config, "radius_retries", my_retries, cf, 0) != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_retries = %s failed\n", my_retries);
|
||||
rc_destroy(rad_config);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Read the dictionary file(s) */
|
||||
if (rc_read_dictionary(rad_config, rc_conf_str(rad_config, "dictionary")) != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "reading dictionary file(s): %s\n", my_dictionary);
|
||||
rc_destroy(rad_config);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return rad_config;
|
||||
}
|
||||
|
||||
static switch_status_t my_on_routing(switch_core_session_t *session)
|
||||
{
|
||||
switch_xml_t cdr = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
rc_handle *rad_config;
|
||||
switch_status_t retval = SWITCH_STATUS_TERM;
|
||||
VALUE_PAIR *send = NULL;
|
||||
uint32_t client_port = 0;
|
||||
uint32_t framed_addr = 0;
|
||||
uint32_t status_type = PW_STATUS_START;
|
||||
switch_time_t callstartdate = 0;
|
||||
switch_time_t callanswerdate = 0;
|
||||
switch_time_t callenddate = 0;
|
||||
switch_time_t calltransferdate = 0;
|
||||
const char *signal_bond = NULL;
|
||||
|
||||
char *uuid_str;
|
||||
|
||||
switch_time_exp_t tm;
|
||||
switch_time_exp_t requested_tm;
|
||||
char buffer[32];
|
||||
|
||||
char *radius_avpair_data;
|
||||
char *delim;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_routing\n");
|
||||
|
||||
if (globals.shutdown) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (channel) {
|
||||
const char *disable_flag = switch_channel_get_variable(channel, "disable_radius_start");
|
||||
|
||||
if (switch_true(disable_flag)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Not Sending RADIUS Start\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
switch_thread_rwlock_rdlock(globals.rwlock);
|
||||
|
||||
rad_config = my_radius_init();
|
||||
|
||||
if (rad_config == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Error initializing radius, Start packet not logged.\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
|
||||
uuid_str = switch_core_session_get_uuid(session);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Error Generating Data!\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* GMT offset may change according daylight saving rules. Evaluating GMT offset each time */
|
||||
if (zstr(my_timezone)) {
|
||||
switch_time_exp_lt(&requested_tm, switch_micro_time_now());
|
||||
} else {
|
||||
switch_time_exp_tz_name(my_timezone, &requested_tm, switch_micro_time_now());
|
||||
}
|
||||
|
||||
/* Create the radius packet */
|
||||
|
||||
/* Set Status Type */
|
||||
if (rc_avpair_add(rad_config, &send, PW_ACCT_STATUS_TYPE, &status_type, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed setting Acct-Status-Type: Start\n");
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_ID, uuid_str, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Acct-Session-ID: %s\n", uuid_str);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Add VSAs */
|
||||
|
||||
if (channel) {
|
||||
/*switch_call_cause_t cause; */
|
||||
switch_caller_profile_t *profile;
|
||||
const char *radius_avpair = switch_channel_get_variable(channel, "radius_avpair");
|
||||
|
||||
/*
|
||||
cause = switch_channel_get_cause(channel);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
*/
|
||||
|
||||
if ((signal_bond = switch_channel_get_partner_uuid(channel)) && !zstr(signal_bond)) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_OTHER_LEG_ID, (void*) signal_bond, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Freeswitch-Other-Leg-Id: %s\n", uuid_str);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
profile = switch_channel_get_caller_profile(channel);
|
||||
|
||||
if (profile) {
|
||||
|
||||
callstartdate = profile->times->created;
|
||||
callanswerdate = profile->times->answered;
|
||||
calltransferdate = profile->times->transferred;
|
||||
callenddate = profile->times->hungup;
|
||||
|
||||
if (profile->username) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *) profile->username, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding User-Name: %s\n", profile->username);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->caller_id_number) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *) profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->caller_id_name) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *) profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->destination_number) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *) profile->destination_number, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->dialplan) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *) profile->dialplan, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->network_addr) {
|
||||
inet_pton(AF_INET, (void *) profile->network_addr, &framed_addr);
|
||||
framed_addr = htonl(framed_addr);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, &framed_addr, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->rdnis) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *) profile->rdnis, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->context) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *) profile->context, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->ani) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *) profile->ani, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->aniii) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *) profile->aniii, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->source) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *) profile->source, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (callstartdate > 0) {
|
||||
switch_time_exp_tz(&tm, callstartdate, requested_tm.tm_gmtoff);
|
||||
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CALLSTARTDATE, &buffer, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callstartdate: %s\n", buffer);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (callanswerdate > 0) {
|
||||
switch_time_exp_tz(&tm, callanswerdate, requested_tm.tm_gmtoff);
|
||||
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CALLANSWERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callanswerdate: %s\n", buffer);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (calltransferdate > 0) {
|
||||
switch_time_exp_tz(&tm, calltransferdate, requested_tm.tm_gmtoff);
|
||||
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CALLTRANSFERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Calltransferdate: %s\n", buffer);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (callenddate > 0) {
|
||||
switch_time_exp_tz(&tm, callenddate, requested_tm.tm_gmtoff);
|
||||
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CALLENDDATE, &buffer, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callenddate: %s\n", buffer);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile->caller_extension && profile->caller_extension->last_application && profile->caller_extension->last_application->application_name) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
|
||||
(void *) profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (radius_avpair) {
|
||||
char *radius_avpair_data_tmp = NULL;
|
||||
|
||||
radius_avpair_data = strdup(radius_avpair + (strncmp(radius_avpair, "ARRAY::", 7) ? 0 : 7));
|
||||
radius_avpair_data_tmp = radius_avpair_data;
|
||||
|
||||
do {
|
||||
delim = strstr(radius_avpair_data_tmp, "|:");
|
||||
|
||||
if (delim) {
|
||||
*delim = '\0';
|
||||
}
|
||||
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_AVPAIR, (void *)radius_avpair_data_tmp, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-AVPair: %s\n", radius_avpair_data_tmp);
|
||||
rc_destroy(rad_config);
|
||||
switch_safe_free(radius_avpair_data);
|
||||
goto end;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "added Freeswitch-AVPair: %s\n", radius_avpair_data_tmp);
|
||||
|
||||
if (delim) {
|
||||
radius_avpair_data_tmp = delim + 2;
|
||||
}
|
||||
} while (delim);
|
||||
|
||||
switch_safe_free(radius_avpair_data);
|
||||
}
|
||||
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "profile == NULL\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (rc_acct(rad_config, client_port, send) == OK_RC) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] RADIUS Accounting OK\n");
|
||||
retval = SWITCH_STATUS_SUCCESS;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] RADIUS Accounting Failed\n");
|
||||
retval = SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
rc_avpair_free(send);
|
||||
rc_destroy(rad_config);
|
||||
end:
|
||||
switch_xml_free(cdr);
|
||||
switch_thread_rwlock_unlock(globals.rwlock);
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
static switch_status_t my_on_reporting(switch_core_session_t *session)
|
||||
{
|
||||
switch_xml_t cdr = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
rc_handle *rad_config;
|
||||
switch_status_t retval = SWITCH_STATUS_TERM;
|
||||
VALUE_PAIR *send = NULL;
|
||||
uint32_t client_port = 0;
|
||||
uint32_t framed_addr = 0;
|
||||
uint32_t status_type = PW_STATUS_STOP;
|
||||
switch_time_t callstartdate = 0;
|
||||
switch_time_t callanswerdate = 0;
|
||||
switch_time_t callenddate = 0;
|
||||
switch_time_t calltransferdate = 0;
|
||||
switch_time_t billusec = 0;
|
||||
uint32_t billsec = 0;
|
||||
char *uuid_str;
|
||||
|
||||
switch_time_exp_t tm;
|
||||
switch_time_exp_t requested_tm;
|
||||
|
||||
char buffer[32] = "";
|
||||
|
||||
char *radius_avpair_data;
|
||||
char *delim;
|
||||
|
||||
if (globals.shutdown) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (channel) {
|
||||
const char *disable_flag = switch_channel_get_variable(channel, "disable_radius_stop");
|
||||
if (switch_true(disable_flag)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Not Sending RADIUS Stop\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
switch_thread_rwlock_rdlock(globals.rwlock);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_reporting\n");
|
||||
|
||||
rad_config = my_radius_init();
|
||||
|
||||
if (rad_config == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Error initializing radius, session not logged.\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
|
||||
uuid_str = switch_core_session_get_uuid(session);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Error Generating Data!\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* GMT offset may change according daylight saving rules. Evaluating GMT offset each time */
|
||||
if (zstr(my_timezone)) {
|
||||
switch_time_exp_lt(&requested_tm, time(NULL));
|
||||
} else {
|
||||
switch_time_exp_tz_name(my_timezone, &requested_tm, time(NULL));
|
||||
}
|
||||
|
||||
/* Create the radius packet */
|
||||
|
||||
/* Set Status Type */
|
||||
if (rc_avpair_add(rad_config, &send, PW_ACCT_STATUS_TYPE, &status_type, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Acct-Session-ID: %s\n", uuid_str);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_ID, uuid_str, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Acct-Session-ID: %s\n", uuid_str);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Add VSAs */
|
||||
|
||||
if (channel) {
|
||||
switch_call_cause_t cause;
|
||||
switch_caller_profile_t *profile;
|
||||
const char *radius_avpair = switch_channel_get_variable(channel, "radius_avpair");
|
||||
|
||||
cause = switch_channel_get_cause(channel);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
|
||||
profile = switch_channel_get_caller_profile(channel);
|
||||
|
||||
if (profile) {
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Calculating billable time\n");
|
||||
|
||||
/* calculate billable time */
|
||||
callstartdate = profile->times->created;
|
||||
callanswerdate = profile->times->answered;
|
||||
calltransferdate = profile->times->transferred;
|
||||
callenddate = profile->times->hungup;
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_ANSWERED)) {
|
||||
if (callstartdate && callanswerdate) {
|
||||
if (callenddate)
|
||||
billusec = callenddate - callanswerdate;
|
||||
else if (calltransferdate)
|
||||
billusec = calltransferdate - callanswerdate;
|
||||
}
|
||||
} else if (switch_channel_test_flag(channel, CF_TRANSFER)) {
|
||||
if (callanswerdate && calltransferdate)
|
||||
billusec = calltransferdate - callanswerdate;
|
||||
}
|
||||
billsec = (billusec / 1000000);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Finished calculating billable time\n");
|
||||
|
||||
if (profile->username) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *) profile->username, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding User-Name: %s\n", profile->username);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->caller_id_number) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *) profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->caller_id_name) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *) profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->destination_number) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *) profile->destination_number, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->dialplan) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *) profile->dialplan, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->network_addr) {
|
||||
inet_pton(AF_INET, (void *) profile->network_addr, &framed_addr);
|
||||
framed_addr = htonl(framed_addr);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, &framed_addr, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->rdnis) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *) profile->rdnis, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->context) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *) profile->context, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->ani) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *) profile->ani, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->aniii) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *) profile->aniii, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->source) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *) profile->source, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (profile->caller_extension && profile->caller_extension->last_application && profile->caller_extension->last_application->application_name) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
|
||||
(void *) profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_BILLUSEC, &billusec, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Billusec: %u\n", (uint32_t) billusec);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (callstartdate > 0) {
|
||||
switch_time_exp_tz(&tm, callstartdate, requested_tm.tm_gmtoff);
|
||||
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CALLSTARTDATE, &buffer, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callstartdate: %s\n", buffer);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (callanswerdate > 0) {
|
||||
switch_time_exp_tz(&tm, callanswerdate, requested_tm.tm_gmtoff);
|
||||
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CALLANSWERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callanswerdate: %s\n", buffer);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (calltransferdate > 0) {
|
||||
switch_time_exp_tz(&tm, calltransferdate, requested_tm.tm_gmtoff);
|
||||
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CALLTRANSFERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Calltransferdate: %s\n", buffer);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (callenddate > 0) {
|
||||
switch_time_exp_tz(&tm, callenddate, requested_tm.tm_gmtoff);
|
||||
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_CALLENDDATE, &buffer, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callenddate: %s\n", buffer);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_TIME, &billsec, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Acct-Session-Time: %u\n", billsec);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
|
||||
{
|
||||
const char *direction_str = profile->direction == SWITCH_CALL_DIRECTION_INBOUND ? "inbound" : "outbound";
|
||||
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_DIRECTION, (void *) direction_str, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Direction: %s\n", direction_str);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (radius_avpair) {
|
||||
radius_avpair_data = strdup(radius_avpair + (strncmp(radius_avpair, "ARRAY::", 7) ? 0 : 7));
|
||||
do {
|
||||
delim = strstr(radius_avpair_data, "|:");
|
||||
|
||||
if (delim) {
|
||||
*delim = '\0';
|
||||
}
|
||||
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_AVPAIR, (void *) radius_avpair_data, -1, PW_FS_PEC) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-AVPair: %s\n", radius_avpair_data);
|
||||
rc_destroy(rad_config);
|
||||
goto end;
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "added Freeswitch-AVPair: %s\n", radius_avpair_data);
|
||||
|
||||
if (delim) {
|
||||
radius_avpair_data = delim + 2;
|
||||
}
|
||||
} while (delim);
|
||||
}
|
||||
|
||||
} else { /* no profile, can't create data to send */
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "profile == NULL\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (rc_acct(rad_config, client_port, send) == OK_RC) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RADIUS Accounting OK\n");
|
||||
retval = SWITCH_STATUS_SUCCESS;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RADIUS Accounting Failed\n");
|
||||
retval = SWITCH_STATUS_TERM;
|
||||
}
|
||||
rc_avpair_free(send);
|
||||
rc_destroy(rad_config);
|
||||
|
||||
end:
|
||||
switch_xml_free(cdr);
|
||||
switch_thread_rwlock_unlock(globals.rwlock);
|
||||
return (retval);
|
||||
}
|
||||
|
||||
static switch_status_t load_config(void)
|
||||
{
|
||||
switch_xml_t cfg, xml, settings, param;
|
||||
|
||||
int num_servers = 0;
|
||||
int i = 0;
|
||||
static char *tz_name;
|
||||
|
||||
my_timeout = "5";
|
||||
my_retries = "3";
|
||||
my_deadtime = "0";
|
||||
strncpy(my_seqfile, "/var/run/radius.seq", PATH_MAX - 1);
|
||||
strncpy(my_dictionary, "/usr/local/freeswitch/conf/radius/dictionary", PATH_MAX - 1);
|
||||
|
||||
for (i = 0; i < SERVER_MAX; i++) {
|
||||
my_servers[i][0] = '\0';
|
||||
}
|
||||
|
||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if ((settings = switch_xml_child(cfg, "settings"))) {
|
||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||
|
||||
if (!strcmp(var, "acctserver")) {
|
||||
if (num_servers < SERVER_MAX) {
|
||||
strncpy(my_servers[num_servers], val, 255 - 1);
|
||||
num_servers++;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"you can only specify %d radius servers, ignoring excess server entry\n", SERVER_MAX);
|
||||
}
|
||||
} else if (!strcmp(var, "dictionary")) {
|
||||
strncpy(my_dictionary, val, PATH_MAX - 1);
|
||||
} else if (!strcmp(var, "seqfile")) {
|
||||
strncpy(my_seqfile, val, PATH_MAX - 1);
|
||||
} else if (!strcmp(var, "radius_timeout")) {
|
||||
my_timeout = strdup(val);
|
||||
} else if (!strcmp(var, "radius_retries")) {
|
||||
my_retries = strdup(val);
|
||||
} else if (!strcmp(var, "radius_deadtime")) {
|
||||
my_deadtime = strdup(val);
|
||||
} else if (!strcmp(var, "timezone")) {
|
||||
tz_name = strdup(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch_xml_free(xml);
|
||||
|
||||
if (num_servers < 1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "you must specify at least 1 radius server\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if (!zstr(tz_name)) {
|
||||
if (switch_lookup_timezone(tz_name)) {
|
||||
my_timezone= tz_name;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find timezone %s\n, Setting timezone to GMT", tz_name);
|
||||
my_timezone= "GMT";
|
||||
}
|
||||
}
|
||||
|
||||
/* If we made it this far, we succeeded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static const switch_state_handler_table_t state_handlers = {
|
||||
/*.on_init */ NULL,
|
||||
/*.on_routing */ my_on_routing,
|
||||
/*.on_execute */ NULL,
|
||||
/*.on_hangup */ NULL,
|
||||
/*.on_exchange_media */ NULL,
|
||||
/*.on_soft_execute */ NULL,
|
||||
/*.on_consume_media */ NULL,
|
||||
/*.on_hibernate */ NULL,
|
||||
/*.on_reset */ NULL,
|
||||
/*.on_park */ NULL,
|
||||
/*.on_reporting */ my_on_reporting
|
||||
};
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_radius_cdr_load)
|
||||
{
|
||||
|
||||
switch_thread_rwlock_create(&globals.rwlock, pool);
|
||||
|
||||
if (load_config() != SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
/* test global state handlers */
|
||||
switch_core_add_state_handler(&state_handlers);
|
||||
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_radius_cdr_shutdown)
|
||||
{
|
||||
|
||||
globals.shutdown = 1;
|
||||
switch_core_remove_state_handler(&state_handlers);
|
||||
switch_thread_rwlock_wrlock(globals.rwlock);
|
||||
switch_thread_rwlock_unlock(globals.rwlock);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
|
||||
*/
|
|
@ -1,35 +0,0 @@
|
|||
<configuration name="mod_radius_cdr.conf" description="RADIUS CDR Configuration">
|
||||
<settings>
|
||||
<!-- location of the radius dictionary file -->
|
||||
<param name="dictionary" value="/usr/local/freeswitch/conf/radius/dictionary"/>
|
||||
<!-- location of the radius sequence file -->
|
||||
<param name="seqfile" value="/var/run/radius.seq"/>
|
||||
|
||||
<!-- accounting servers, up to 8 allowed -->
|
||||
<!-- value is "host:port:secret", port is optional -->
|
||||
<!-- use IP ADDRESSES, not hostnames -->
|
||||
<param name="acctserver" value="127.0.0.1:1813:testing123"/>
|
||||
<param name="acctserver" value="10.0.0.254:1813:testing123"/>
|
||||
<param name="acctserver" value="192.168.10.10:1813:testing123"/>
|
||||
|
||||
<!-- number of retries for each server -->
|
||||
<param name="radius_retries" value="3"/>
|
||||
<!-- number of seconds to wait between retries -->
|
||||
<param name="radius_timeout" value="5"/>
|
||||
<!-- The length of time in seconds that we skip a nonresponsive RADIUS
|
||||
server for transaction requests. Server(s) being in the "dead" state
|
||||
are tried only after all other non-dead servers have been tried and
|
||||
failed or timeouted. The deadtime interval starts when the server
|
||||
does not respond to an authentication/accounting request transmissions.
|
||||
When the interval expires, the "dead" server would be re-tried again,
|
||||
and if it's still down then it will be considered "dead" for another
|
||||
such interval and so on. This option is no-op if there is only one
|
||||
server in the list. Set to 0 in order to disable the feature. -->
|
||||
<param name="radius_deadtime" value="0"/>
|
||||
<!-- Timezone name from "autoload_configs/timezones.conf.xml".
|
||||
All time related values will be adjusted for this timezone.
|
||||
If param is not provided used is local server timezone -->
|
||||
<!-- <param name="timezone" value="Asia/Tokyo"/> -->
|
||||
</settings>
|
||||
</configuration>
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
|
||||
* Copyright 2006, Author: Yossi Neiman of Cartis Solutions, Inc. <freeswitch AT cartissolutions.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Chris Parker <cparker AT segv.org>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Chris Parker <cparker AT segv.org>
|
||||
*
|
||||
* Description: Contains definitions and structs used by the radius cdr module.
|
||||
*
|
||||
* mod_radius_cdr.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MODRADIUSCDR
|
||||
#define MODRADIUSCDR
|
||||
|
||||
#define PW_FS_PEC 27880
|
||||
|
||||
#define PW_FS_AVPAIR 1
|
||||
#define PW_FS_CLID 2
|
||||
#define PW_FS_DIALPLAN 3
|
||||
#define PW_FS_SRC 4
|
||||
#define PW_FS_DST 5
|
||||
#define PW_FS_SRC_CHANNEL 6
|
||||
#define PW_FS_DST_CHANNEL 7
|
||||
#define PW_FS_ANI 8
|
||||
#define PW_FS_ANIII 9
|
||||
#define PW_FS_LASTAPP 10
|
||||
#define PW_FS_LASTDATA 11
|
||||
#define PW_FS_DISPOSITION 12
|
||||
#define PW_FS_HANGUPCAUSE 13
|
||||
#define PW_FS_BILLUSEC 15
|
||||
#define PW_FS_AMAFLAGS 16
|
||||
#define PW_FS_RDNIS 17
|
||||
#define PW_FS_CONTEXT 18
|
||||
#define PW_FS_SOURCE 19
|
||||
#define PW_FS_CALLSTARTDATE 20
|
||||
#define PW_FS_CALLANSWERDATE 21
|
||||
#define PW_FS_CALLTRANSFERDATE 22
|
||||
#define PW_FS_CALLENDDATE 23
|
||||
#define PW_FS_DIRECTION 24
|
||||
#define PW_FS_OTHER_LEG_ID 25
|
||||
|
||||
|
||||
#endif
|
|
@ -1,353 +0,0 @@
|
|||
#
|
||||
# Updated 97/06/13 to livingston-radius-2.01 miquels@cistron.nl
|
||||
#
|
||||
# This file contains dictionary translations for parsing
|
||||
# requests and generating responses. All transactions are
|
||||
# composed of Attribute/Value Pairs. The value of each attribute
|
||||
# is specified as one of 4 data types. Valid data types are:
|
||||
#
|
||||
# string - 0-253 octets
|
||||
# ipaddr - 4 octets in network byte order
|
||||
# integer - 32 bit value in big endian order (high byte first)
|
||||
# date - 32 bit value in big endian order - seconds since
|
||||
# 00:00:00 GMT, Jan. 1, 1970
|
||||
#
|
||||
# Enumerated values are stored in the user file with dictionary
|
||||
# VALUE translations for easy administration.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# ATTRIBUTE VALUE
|
||||
# --------------- -----
|
||||
# Framed-Protocol = PPP
|
||||
# 7 = 1 (integer encoding)
|
||||
#
|
||||
|
||||
#
|
||||
# Following are the proper new names. Use these.
|
||||
#
|
||||
ATTRIBUTE User-Name 1 string
|
||||
ATTRIBUTE Password 2 string
|
||||
ATTRIBUTE CHAP-Password 3 string
|
||||
ATTRIBUTE NAS-IP-Address 4 ipaddr
|
||||
ATTRIBUTE NAS-Port-Id 5 integer
|
||||
ATTRIBUTE Service-Type 6 integer
|
||||
ATTRIBUTE Framed-Protocol 7 integer
|
||||
ATTRIBUTE Framed-IP-Address 8 ipaddr
|
||||
ATTRIBUTE Framed-IP-Netmask 9 ipaddr
|
||||
ATTRIBUTE Framed-Routing 10 integer
|
||||
ATTRIBUTE Filter-Id 11 string
|
||||
ATTRIBUTE Framed-MTU 12 integer
|
||||
ATTRIBUTE Framed-Compression 13 integer
|
||||
ATTRIBUTE Login-IP-Host 14 ipaddr
|
||||
ATTRIBUTE Login-Service 15 integer
|
||||
ATTRIBUTE Login-TCP-Port 16 integer
|
||||
ATTRIBUTE Reply-Message 18 string
|
||||
ATTRIBUTE Callback-Number 19 string
|
||||
ATTRIBUTE Callback-Id 20 string
|
||||
ATTRIBUTE Framed-Route 22 string
|
||||
ATTRIBUTE Framed-IPX-Network 23 ipaddr
|
||||
ATTRIBUTE State 24 string
|
||||
ATTRIBUTE Class 25 string
|
||||
ATTRIBUTE Vendor-Specific 26 string
|
||||
ATTRIBUTE Session-Timeout 27 integer
|
||||
ATTRIBUTE Idle-Timeout 28 integer
|
||||
ATTRIBUTE Termination-Action 29 integer
|
||||
ATTRIBUTE Called-Station-Id 30 string
|
||||
ATTRIBUTE Calling-Station-Id 31 string
|
||||
ATTRIBUTE NAS-Identifier 32 string
|
||||
ATTRIBUTE Proxy-State 33 string
|
||||
ATTRIBUTE Login-LAT-Service 34 string
|
||||
ATTRIBUTE Login-LAT-Node 35 string
|
||||
ATTRIBUTE Login-LAT-Group 36 string
|
||||
ATTRIBUTE Framed-AppleTalk-Link 37 integer
|
||||
ATTRIBUTE Framed-AppleTalk-Network 38 integer
|
||||
ATTRIBUTE Framed-AppleTalk-Zone 39 string
|
||||
ATTRIBUTE Acct-Status-Type 40 integer
|
||||
ATTRIBUTE Acct-Delay-Time 41 integer
|
||||
ATTRIBUTE Acct-Input-Octets 42 integer
|
||||
ATTRIBUTE Acct-Output-Octets 43 integer
|
||||
ATTRIBUTE Acct-Session-Id 44 string
|
||||
ATTRIBUTE Acct-Authentic 45 integer
|
||||
ATTRIBUTE Acct-Session-Time 46 integer
|
||||
ATTRIBUTE Acct-Input-Packets 47 integer
|
||||
ATTRIBUTE Acct-Output-Packets 48 integer
|
||||
ATTRIBUTE Acct-Terminate-Cause 49 integer
|
||||
ATTRIBUTE Acct-Multi-Session-Id 50 string
|
||||
ATTRIBUTE Acct-Link-Count 51 integer
|
||||
ATTRIBUTE Event-Timestamp 55 integer
|
||||
ATTRIBUTE CHAP-Challenge 60 string
|
||||
ATTRIBUTE NAS-Port-Type 61 integer
|
||||
ATTRIBUTE Port-Limit 62 integer
|
||||
ATTRIBUTE Login-LAT-Port 63 integer
|
||||
ATTRIBUTE Connect-Info 77 string
|
||||
|
||||
#
|
||||
# RFC3162 IPv6 attributes
|
||||
#
|
||||
ATTRIBUTE NAS-IPv6-Address 95 string
|
||||
ATTRIBUTE Framed-Interface-Id 96 string
|
||||
ATTRIBUTE Framed-IPv6-Prefix 97 string
|
||||
ATTRIBUTE Login-IPv6-Host 98 string
|
||||
ATTRIBUTE Framed-IPv6-Route 99 string
|
||||
ATTRIBUTE Framed-IPv6-Pool 100 string
|
||||
|
||||
#
|
||||
# Experimental Non Protocol Attributes used by Cistron-Radiusd
|
||||
#
|
||||
ATTRIBUTE Huntgroup-Name 221 string
|
||||
ATTRIBUTE User-Category 1029 string
|
||||
ATTRIBUTE Group-Name 1030 string
|
||||
ATTRIBUTE Simultaneous-Use 1034 integer
|
||||
ATTRIBUTE Strip-User-Name 1035 integer
|
||||
ATTRIBUTE Fall-Through 1036 integer
|
||||
ATTRIBUTE Add-Port-To-IP-Address 1037 integer
|
||||
ATTRIBUTE Exec-Program 1038 string
|
||||
ATTRIBUTE Exec-Program-Wait 1039 string
|
||||
ATTRIBUTE Hint 1040 string
|
||||
|
||||
#
|
||||
# Non-Protocol Attributes
|
||||
# These attributes are used internally by the server
|
||||
#
|
||||
ATTRIBUTE Expiration 21 date
|
||||
ATTRIBUTE Auth-Type 1000 integer
|
||||
ATTRIBUTE Menu 1001 string
|
||||
ATTRIBUTE Termination-Menu 1002 string
|
||||
ATTRIBUTE Prefix 1003 string
|
||||
ATTRIBUTE Suffix 1004 string
|
||||
ATTRIBUTE Group 1005 string
|
||||
ATTRIBUTE Crypt-Password 1006 string
|
||||
ATTRIBUTE Connect-Rate 1007 integer
|
||||
|
||||
#
|
||||
# Integer Translations
|
||||
#
|
||||
|
||||
# User Types
|
||||
|
||||
VALUE Service-Type Login-User 1
|
||||
VALUE Service-Type Framed-User 2
|
||||
VALUE Service-Type Callback-Login-User 3
|
||||
VALUE Service-Type Callback-Framed-User 4
|
||||
VALUE Service-Type Outbound-User 5
|
||||
VALUE Service-Type Administrative-User 6
|
||||
VALUE Service-Type NAS-Prompt-User 7
|
||||
|
||||
# Framed Protocols
|
||||
|
||||
VALUE Framed-Protocol PPP 1
|
||||
VALUE Framed-Protocol SLIP 2
|
||||
|
||||
# Framed Routing Values
|
||||
|
||||
VALUE Framed-Routing None 0
|
||||
VALUE Framed-Routing Broadcast 1
|
||||
VALUE Framed-Routing Listen 2
|
||||
VALUE Framed-Routing Broadcast-Listen 3
|
||||
|
||||
# Framed Compression Types
|
||||
|
||||
VALUE Framed-Compression None 0
|
||||
VALUE Framed-Compression Van-Jacobson-TCP-IP 1
|
||||
|
||||
# Login Services
|
||||
|
||||
VALUE Login-Service Telnet 0
|
||||
VALUE Login-Service Rlogin 1
|
||||
VALUE Login-Service TCP-Clear 2
|
||||
VALUE Login-Service PortMaster 3
|
||||
|
||||
# Status Types
|
||||
|
||||
VALUE Acct-Status-Type Start 1
|
||||
VALUE Acct-Status-Type Stop 2
|
||||
VALUE Acct-Status-Type Alive 3
|
||||
VALUE Acct-Status-Type Accounting-On 7
|
||||
VALUE Acct-Status-Type Accounting-Off 8
|
||||
|
||||
# Authentication Types
|
||||
|
||||
VALUE Acct-Authentic RADIUS 1
|
||||
VALUE Acct-Authentic Local 2
|
||||
VALUE Acct-Authentic PowerLink128 100
|
||||
|
||||
# Termination Options
|
||||
|
||||
VALUE Termination-Action Default 0
|
||||
VALUE Termination-Action RADIUS-Request 1
|
||||
|
||||
# NAS Port Types, available in 3.3.1 and later
|
||||
|
||||
VALUE NAS-Port-Type Async 0
|
||||
VALUE NAS-Port-Type Sync 1
|
||||
VALUE NAS-Port-Type ISDN 2
|
||||
VALUE NAS-Port-Type ISDN-V120 3
|
||||
VALUE NAS-Port-Type ISDN-V110 4
|
||||
|
||||
# Acct Terminate Causes, available in 3.3.2 and later
|
||||
|
||||
VALUE Acct-Terminate-Cause User-Request 1
|
||||
VALUE Acct-Terminate-Cause Lost-Carrier 2
|
||||
VALUE Acct-Terminate-Cause Lost-Service 3
|
||||
VALUE Acct-Terminate-Cause Idle-Timeout 4
|
||||
VALUE Acct-Terminate-Cause Session-Timeout 5
|
||||
VALUE Acct-Terminate-Cause Admin-Reset 6
|
||||
VALUE Acct-Terminate-Cause Admin-Reboot 7
|
||||
VALUE Acct-Terminate-Cause Port-Error 8
|
||||
VALUE Acct-Terminate-Cause NAS-Error 9
|
||||
VALUE Acct-Terminate-Cause NAS-Request 10
|
||||
VALUE Acct-Terminate-Cause NAS-Reboot 11
|
||||
VALUE Acct-Terminate-Cause Port-Unneeded 12
|
||||
VALUE Acct-Terminate-Cause Port-Preempted 13
|
||||
VALUE Acct-Terminate-Cause Port-Suspended 14
|
||||
VALUE Acct-Terminate-Cause Service-Unavailable 15
|
||||
VALUE Acct-Terminate-Cause Callback 16
|
||||
VALUE Acct-Terminate-Cause User-Error 17
|
||||
VALUE Acct-Terminate-Cause Host-Request 18
|
||||
|
||||
#
|
||||
# Non-Protocol Integer Translations
|
||||
#
|
||||
|
||||
VALUE Auth-Type Local 0
|
||||
VALUE Auth-Type System 1
|
||||
VALUE Auth-Type SecurID 2
|
||||
VALUE Auth-Type Crypt-Local 3
|
||||
VALUE Auth-Type Reject 4
|
||||
|
||||
#
|
||||
# Cistron extensions
|
||||
#
|
||||
VALUE Auth-Type Pam 253
|
||||
VALUE Auth-Type Accept 254
|
||||
|
||||
#
|
||||
# Experimental Non-Protocol Integer Translations for Cistron-Radiusd
|
||||
#
|
||||
VALUE Fall-Through No 0
|
||||
VALUE Fall-Through Yes 1
|
||||
VALUE Add-Port-To-IP-Address No 0
|
||||
VALUE Add-Port-To-IP-Address Yes 1
|
||||
|
||||
#
|
||||
# Configuration Values
|
||||
# uncomment these two lines to turn account expiration on
|
||||
#
|
||||
|
||||
#VALUE Server-Config Password-Expiration 30
|
||||
#VALUE Server-Config Password-Warning 5
|
||||
|
||||
# -*- text -*-
|
||||
#
|
||||
# dictionary.freeswitch
|
||||
#
|
||||
# cparker@segv.org
|
||||
#
|
||||
# Version: $Id: $
|
||||
#
|
||||
|
||||
VENDOR Freeswitch 27880
|
||||
|
||||
#
|
||||
# Standard attribute
|
||||
#
|
||||
BEGIN-VENDOR Freeswitch
|
||||
|
||||
ATTRIBUTE Freeswitch-AVPair 1 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-CLID 2 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Dialplan 3 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Src 4 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Dst 5 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Src-Channel 6 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Dst-Channel 7 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Ani 8 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Aniii 9 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Lastapp 10 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Lastdata 11 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Disposition 12 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Hangupcause 13 integer Freeswitch
|
||||
ATTRIBUTE Freeswitch-Billusec 15 integer Freeswitch
|
||||
ATTRIBUTE Freeswitch-AMAFlags 16 integer Freeswitch
|
||||
ATTRIBUTE Freeswitch-RDNIS 17 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Context 18 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Source 19 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Callstartdate 20 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Callanswerdate 21 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Calltransferdate 22 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Callenddate 23 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Direction 24 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Other-Leg-Id 25 string Freeswitch
|
||||
|
||||
#
|
||||
# Freeswitch-Hangupcause
|
||||
#
|
||||
VALUE Freeswitch-Hangupcause None 0
|
||||
VALUE Freeswitch-Hangupcause Unallocated-Number 1
|
||||
VALUE Freeswitch-Hangupcause No-Route-Transit-Net 2
|
||||
VALUE Freeswitch-Hangupcause No-Route-Destination 3
|
||||
VALUE Freeswitch-Hangupcause Channel-Unacceptable 6
|
||||
VALUE Freeswitch-Hangupcause Call-Awarded-Delivery 7
|
||||
VALUE Freeswitch-Hangupcause Normal-Clearing 16
|
||||
VALUE Freeswitch-Hangupcause User-Busy 17
|
||||
VALUE Freeswitch-Hangupcause No-User-Response 18
|
||||
VALUE Freeswitch-Hangupcause No-Answer 19
|
||||
VALUE Freeswitch-Hangupcause Subscriber-Absent 20
|
||||
VALUE Freeswitch-Hangupcause Call-Rejected 21
|
||||
VALUE Freeswitch-Hangupcause Number-Changed 22
|
||||
VALUE Freeswitch-Hangupcause Redirecto-To-New-Destination 23
|
||||
VALUE Freeswitch-Hangupcause Exchange-Routing-Error 25
|
||||
VALUE Freeswitch-Hangupcause Destination-Out-Of-Order 27
|
||||
VALUE Freeswitch-Hangupcause Invalid-Number-Format 28
|
||||
VALUE Freeswitch-Hangupcause Facility-Rejected 29
|
||||
VALUE Freeswitch-Hangupcause Response-To-Status-Enquiry 30
|
||||
VALUE Freeswitch-Hangupcause Normal-Unspecified 31
|
||||
VALUE Freeswitch-Hangupcause Normal-Circuit-Congestion 34
|
||||
VALUE Freeswitch-Hangupcause Network-Out-Of-Order 38
|
||||
VALUE Freeswitch-Hangupcause Normal-Temporary-Failure 41
|
||||
VALUE Freeswitch-Hangupcause Switch-Congestion 42
|
||||
VALUE Freeswitch-Hangupcause Access-Info-Discarded 43
|
||||
VALUE Freeswitch-Hangupcause Requested-Chan-Unavail 44
|
||||
VALUE Freeswitch-Hangupcause Pre-Empted 45
|
||||
VALUE Freeswitch-Hangupcause Facility-Not-Subscribed 50
|
||||
VALUE Freeswitch-Hangupcause Outgoing-Call-Barred 52
|
||||
VALUE Freeswitch-Hangupcause Incoming-Call-Barred 54
|
||||
VALUE Freeswitch-Hangupcause Bearercapability-Notauth 57
|
||||
VALUE Freeswitch-Hangupcause Bearercapability-Notavail 58
|
||||
VALUE Freeswitch-Hangupcause Service-Unavailable 63
|
||||
VALUE Freeswitch-Hangupcause Bearercapability-Notimpl 65
|
||||
VALUE Freeswitch-Hangupcause Chan-Not-Implemented 66
|
||||
VALUE Freeswitch-Hangupcause Facility-Not-Implemented 69
|
||||
VALUE Freeswitch-Hangupcause Service-Not-Implemented 79
|
||||
VALUE Freeswitch-Hangupcause Invalid-Call-Reference 81
|
||||
VALUE Freeswitch-Hangupcause Incompatible-Destination 88
|
||||
VALUE Freeswitch-Hangupcause Invalid-Msg-Unspecified 95
|
||||
VALUE Freeswitch-Hangupcause Mandatory-IE-Missing 96
|
||||
VALUE Freeswitch-Hangupcause Message-Type-Nonexist 97
|
||||
VALUE Freeswitch-Hangupcause Wrong-Message 98
|
||||
VALUE Freeswitch-Hangupcause IE-Nonexist 99
|
||||
VALUE Freeswitch-Hangupcause Invalid-IE-Contents 100
|
||||
VALUE Freeswitch-Hangupcause Wrong-Call-State 101
|
||||
VALUE Freeswitch-Hangupcause Recovery-On-Timer-Expire 102
|
||||
VALUE Freeswitch-Hangupcause Mandatory-IE-Length-Error 103
|
||||
VALUE Freeswitch-Hangupcause Protocol-Error 111
|
||||
VALUE Freeswitch-Hangupcause Interworking 127
|
||||
VALUE Freeswitch-Hangupcause Success 142
|
||||
VALUE Freeswitch-Hangupcause Originator-Cancel 487
|
||||
VALUE Freeswitch-Hangupcause Crash 500
|
||||
VALUE Freeswitch-Hangupcause System-Shutdown 501
|
||||
VALUE Freeswitch-Hangupcause Lose-Race 502
|
||||
VALUE Freeswitch-Hangupcause Manager-Request 503
|
||||
VALUE Freeswitch-Hangupcause Blind-Transfer 600
|
||||
VALUE Freeswitch-Hangupcause Attended-Transfer 601
|
||||
VALUE Freeswitch-Hangupcause Allotted-Timeout 602
|
||||
VALUE Freeswitch-Hangupcause User-Challenge 603
|
||||
VALUE Freeswitch-Hangupcause Media-Timeout 604
|
||||
VALUE Freeswitch-Hangupcause Picked-Off 605
|
||||
VALUE Freeswitch-Hangupcause User-Not-Registered 606
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
END-VENDOR Freeswitch
|
|
@ -1,8 +0,0 @@
|
|||
include $(top_srcdir)/build/modmake.rulesam
|
||||
MODNAME=mod_raven
|
||||
|
||||
mod_LTLIBRARIES = mod_raven.la
|
||||
mod_raven_la_SOURCES = mod_raven.c
|
||||
mod_raven_la_CFLAGS = $(AM_CFLAGS)
|
||||
mod_raven_la_LIBADD = $(switch_builddir)/libfreeswitch.la
|
||||
mod_raven_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
|
@ -1,11 +0,0 @@
|
|||
<configuration name="raven.conf" description="Raven Logger">
|
||||
<settings>
|
||||
<param name="uri" value=""/>
|
||||
<param name="key" value=""/>
|
||||
<param name="secret" value=""/>
|
||||
<param name="key" value=""/>
|
||||
<param name="project" value=""/>
|
||||
<param name="loglevel" value="err"/>
|
||||
<param name="uuid" value="true"/>
|
||||
</settings>
|
||||
</configuration>
|
|
@ -1,320 +0,0 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2010, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Tamas Cseke <tamas.cseke@vcc.live>
|
||||
*
|
||||
* mod_raven.c -- Raven Logging
|
||||
*
|
||||
*/
|
||||
#include <switch.h>
|
||||
#include <zlib.h>
|
||||
#include <switch_curl.h>
|
||||
|
||||
#define RAVEN_ZLIB_CHUNK 16384
|
||||
#define RAVEN_VERSION "5"
|
||||
#define RAVEN_UA "freeswitch-raven/1.0"
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_raven_load);
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_raven_shutdown);
|
||||
SWITCH_MODULE_DEFINITION(mod_raven, mod_raven_load, mod_raven_shutdown, NULL);
|
||||
|
||||
static switch_status_t load_config(void);
|
||||
|
||||
static struct {
|
||||
char *uri;
|
||||
char *key;
|
||||
char *secret;
|
||||
char *project;
|
||||
switch_bool_t log_uuid;
|
||||
switch_log_level_t log_level;
|
||||
} globals;
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_uri, globals.uri);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_key, globals.key);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_secret, globals.secret);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_project, globals.project);
|
||||
|
||||
static switch_loadable_module_interface_t raven_module_interface = {
|
||||
/*.module_name */ modname,
|
||||
/*.endpoint_interface */ NULL,
|
||||
/*.timer_interface */ NULL,
|
||||
/*.dialplan_interface */ NULL,
|
||||
/*.codec_interface */ NULL,
|
||||
/*.application_interface */ NULL,
|
||||
/*.api_interface */ NULL,
|
||||
/*.file_interface */ NULL,
|
||||
/*.speech_interface */ NULL,
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
|
||||
static switch_status_t encode(const char *raw, int raw_len, char **encoded_out)
|
||||
{
|
||||
z_stream stream;
|
||||
unsigned char *encoded = NULL, *compressed = NULL;
|
||||
int ret;
|
||||
switch_size_t compressed_size = 0, compressed_len = 0, need_bytes;
|
||||
|
||||
stream.zalloc = Z_NULL;
|
||||
stream.zfree = Z_NULL;
|
||||
stream.opaque = Z_NULL;
|
||||
ret = deflateInit(&stream, Z_DEFAULT_COMPRESSION);
|
||||
if (ret != Z_OK) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
stream.next_in = (unsigned char *)raw;
|
||||
stream.avail_in = raw_len;
|
||||
|
||||
do {
|
||||
compressed_size += RAVEN_ZLIB_CHUNK;
|
||||
compressed = realloc(compressed, compressed_size + 1);
|
||||
switch_assert(compressed != NULL);
|
||||
|
||||
stream.avail_out = compressed_size - compressed_len;
|
||||
stream.next_out = compressed + compressed_len;
|
||||
|
||||
ret = deflate(&stream, Z_FINISH);
|
||||
assert(ret != Z_STREAM_ERROR);
|
||||
compressed_len = compressed_size - stream.avail_out;
|
||||
} while (stream.avail_in != 0);
|
||||
|
||||
deflateEnd(&stream);
|
||||
|
||||
need_bytes = compressed_len * 3 + 1;
|
||||
encoded = malloc(need_bytes);
|
||||
switch_assert(encoded);
|
||||
memset(encoded, 0, need_bytes);
|
||||
switch_b64_encode(compressed, compressed_len, encoded, need_bytes);
|
||||
|
||||
switch_safe_free(compressed);
|
||||
|
||||
*encoded_out = (char *)encoded;
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t raven_capture(const char *userdata, const char *message, const char *level, const char *file, const char *func, int line)
|
||||
{
|
||||
cJSON* json, *fingerprint;
|
||||
char *raw_body;
|
||||
char *encoded_body = NULL;
|
||||
switch_time_t timestamp = switch_micro_time_now();
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||
|
||||
switch_uuid_str(uuid, sizeof(uuid));
|
||||
json = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(json, "event_id", (const char *)uuid);
|
||||
cJSON_AddNumberToObject(json, "timestamp", timestamp);
|
||||
cJSON_AddStringToObject(json, "platform", RAVEN_UA);
|
||||
cJSON_AddStringToObject(json, "project", globals.project);
|
||||
cJSON_AddStringToObject(json, "server_name", switch_core_get_hostname());
|
||||
cJSON_AddStringToObject(json, "level", level);
|
||||
|
||||
if (globals.log_uuid && !zstr(userdata)) {
|
||||
cJSON_AddItemToObject(json, "message", cJSON_CreateStringPrintf("%s %s", userdata, message));
|
||||
} else {
|
||||
cJSON_AddStringToObject(json, "message", message);
|
||||
}
|
||||
|
||||
fingerprint = cJSON_CreateArray();
|
||||
cJSON_AddItemToArray(fingerprint, cJSON_CreateString(file));
|
||||
cJSON_AddItemToArray(fingerprint, cJSON_CreateString(func));
|
||||
cJSON_AddItemToArray(fingerprint, cJSON_CreateNumber(line));
|
||||
cJSON_AddItemToObject(json, "fingerprint", fingerprint);
|
||||
|
||||
raw_body = cJSON_PrintUnformatted(json);
|
||||
|
||||
if ((status = encode(raw_body, strlen(raw_body), &encoded_body)) == SWITCH_STATUS_SUCCESS) {
|
||||
int response;
|
||||
CURL *curl_handle = switch_curl_easy_init();
|
||||
switch_curl_slist_t * list = NULL;
|
||||
char *auth_header = switch_mprintf("X-Sentry-Auth: Sentry sentry_version=%s,"
|
||||
" sentry_client=%s,"
|
||||
" sentry_timestamp=%d,"
|
||||
" sentry_key=%s,"
|
||||
" sentry_secret=%s",
|
||||
RAVEN_VERSION, RAVEN_UA,
|
||||
timestamp, globals.key, globals.secret);
|
||||
|
||||
char *url = switch_mprintf( "%s/api/%s/store/", globals.uri, globals.project);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_URL,url);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_POST, 1);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, encoded_body);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, strlen(encoded_body));
|
||||
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, RAVEN_UA);
|
||||
|
||||
list = switch_curl_slist_append(list, auth_header);
|
||||
list = switch_curl_slist_append(list, "Content-Type: application/octet-stream");
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, list);
|
||||
|
||||
if (!strncasecmp(globals.uri, "https", 5)) {
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
|
||||
switch_curl_easy_perform(curl_handle);
|
||||
switch_curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &response);
|
||||
|
||||
if (response != 200) {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
switch_curl_easy_cleanup(curl_handle);
|
||||
switch_curl_slist_free_all(list);
|
||||
switch_safe_free(url);
|
||||
switch_safe_free(auth_header);
|
||||
}
|
||||
|
||||
switch_safe_free(raw_body);
|
||||
switch_safe_free(encoded_body);
|
||||
cJSON_Delete(json);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t mod_raven_logger(const switch_log_node_t *node, switch_log_level_t level)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
if (level != SWITCH_LOG_CONSOLE && !zstr(node->data)) {
|
||||
const char * raven_level;
|
||||
|
||||
switch (level) {
|
||||
case SWITCH_LOG_DEBUG:
|
||||
raven_level = "debug";
|
||||
break;
|
||||
case SWITCH_LOG_INFO:
|
||||
raven_level = "info";
|
||||
break;
|
||||
case SWITCH_LOG_NOTICE:
|
||||
case SWITCH_LOG_WARNING:
|
||||
raven_level = "warning";
|
||||
break;
|
||||
case SWITCH_LOG_ERROR:
|
||||
raven_level = "error";
|
||||
break;
|
||||
case SWITCH_LOG_CRIT:
|
||||
case SWITCH_LOG_ALERT:
|
||||
raven_level = "fatal";
|
||||
break;
|
||||
default:
|
||||
raven_level = "debug";
|
||||
break;
|
||||
}
|
||||
|
||||
status = raven_capture(node->userdata, node->data, raven_level, node->file, node->func, node->line);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static switch_status_t load_config(void)
|
||||
{
|
||||
char *cf = "raven.conf";
|
||||
switch_xml_t cfg, xml, settings, param;
|
||||
|
||||
globals.log_level = SWITCH_LOG_WARNING;
|
||||
globals.log_uuid = SWITCH_TRUE;
|
||||
|
||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if ((settings = switch_xml_child(cfg, "settings"))) {
|
||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||
|
||||
if (!strcmp(var, "uri")) {
|
||||
set_global_uri(val);
|
||||
} else if (!strcmp(var, "key")) {
|
||||
set_global_key(val);
|
||||
} else if (!strcmp(var, "secret")) {
|
||||
set_global_secret(val);
|
||||
} else if (!strcmp(var, "project")) {
|
||||
set_global_project(val);
|
||||
} else if (!strcasecmp(var, "loglevel") && !zstr(val)) {
|
||||
globals.log_level = switch_log_str2level(val);
|
||||
if (globals.log_level == SWITCH_LOG_INVALID) {
|
||||
globals.log_level = SWITCH_LOG_WARNING;
|
||||
}
|
||||
} else if (!strcasecmp(var, "uuid")) {
|
||||
globals.log_uuid = switch_true(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
switch_xml_free(xml);
|
||||
|
||||
if (zstr(globals.uri) || zstr(globals.project) || zstr(globals.key) || zstr(globals.secret)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing parameter\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_raven_load)
|
||||
{
|
||||
switch_status_t status;
|
||||
*module_interface = &raven_module_interface;
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
switch_log_bind_logger(mod_raven_logger, globals.log_level, SWITCH_FALSE);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_raven_shutdown)
|
||||
{
|
||||
switch_safe_free(globals.uri);
|
||||
switch_safe_free(globals.key);
|
||||
switch_safe_free(globals.secret);
|
||||
switch_safe_free(globals.project);
|
||||
|
||||
switch_log_unbind_logger(mod_raven_logger);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
|
||||
*/
|
|
@ -1 +0,0 @@
|
|||
freeradius-client*
|
|
@ -1,27 +0,0 @@
|
|||
<include>
|
||||
|
||||
<extension name="auth" continue="true">
|
||||
<condition field="${radius_auth_result}" expression="^$">
|
||||
<action application="radius_auth" inline="true"/>
|
||||
</condition>
|
||||
</extension>
|
||||
|
||||
<extension name="rejections">
|
||||
<condition field="${radius_auth_result}" expression="^2$">
|
||||
<action application="hangup" data="CALL_REJECTED"/>
|
||||
</condition>
|
||||
</extension>
|
||||
|
||||
<extension name="timeouts">
|
||||
<condition field="${radius_auth_result}" expression="^1$">
|
||||
<action application="hangup" data="SWITCH_CONGESTION"/>
|
||||
</condition>
|
||||
</extension>
|
||||
|
||||
<extension name="originate_leg" continue="true">
|
||||
<condition>
|
||||
<action application="export" data="nolocal:h323-call-origin=originate"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</include>
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
include $(top_srcdir)/build/modmake.rulesam
|
||||
MODNAME=mod_xml_radius
|
||||
|
||||
RADCLIENT_VERSION=1.1.7
|
||||
RADCLIENT=freeradius-client-$(RADCLIENT_VERSION)
|
||||
RADCLIENT_DIR=$(switch_srcdir)/libs/$(RADCLIENT)
|
||||
RADCLIENT_BUILDDIR=$(switch_builddir)/libs/$(RADCLIENT)
|
||||
RADCLIENT_LIBDIR=$(RADCLIENT_BUILDDIR)/lib
|
||||
RADCLIENT_LA=${RADCLIENT_LIBDIR}/libfreeradius-client.la
|
||||
|
||||
mod_LTLIBRARIES = mod_xml_radius.la
|
||||
mod_xml_radius_la_SOURCES = mod_xml_radius.c
|
||||
mod_xml_radius_la_CFLAGS = $(AM_CFLAGS) -I$(RADCLIENT_DIR)/include
|
||||
mod_xml_radius_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(RADCLIENT_LA)
|
||||
mod_xml_radius_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
||||
|
||||
BUILT_SOURCES=$(RADCLIENT_LA)
|
||||
|
||||
$(RADCLIENT_DIR):
|
||||
$(GETLIB) $(RADCLIENT).tar.gz
|
||||
|
||||
$(RADCLIENT_BUILDDIR)/Makefile: $(RADCLIENT_DIR)
|
||||
mkdir -p $(RADCLIENT_BUILDDIR)
|
||||
cd $(RADCLIENT_BUILDDIR) && $(DEFAULT_VARS) $(RADCLIENT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(RADCLIENT_DIR)
|
||||
$(TOUCH_TARGET)
|
||||
|
||||
$(RADCLIENT_LA): $(RADCLIENT_BUILDDIR)/Makefile
|
||||
cd $(RADCLIENT_BUILDDIR) && CFLAGS="$(CFLAGS)" $(MAKE)
|
||||
$(TOUCH_TARGET)
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
--- ../../../../libs/freeradius-client-1.1.6/lib/config.c 2012-08-18 22:13:13.000000000 -0700
|
||||
+++ ./config.c 2012-08-18 22:14:08.000000000 -0700
|
||||
@@ -301,6 +301,8 @@
|
||||
int i;
|
||||
SERVER *authservers;
|
||||
SERVER *acctservers;
|
||||
+ OPTION *acct;
|
||||
+ OPTION *auth;
|
||||
|
||||
rh->config_options = malloc(sizeof(config_options_default));
|
||||
if (rh->config_options == NULL)
|
||||
@@ -311,8 +313,8 @@
|
||||
}
|
||||
memcpy(rh->config_options, &config_options_default, sizeof(config_options_default));
|
||||
|
||||
- authservers = rc_conf_srv(rh, "authserver");
|
||||
- acctservers = rc_conf_srv(rh, "acctserver");
|
||||
+ acct = find_option(rh, "acctserver", OT_ANY);
|
||||
+ auth = find_option(rh, "authserver", OT_ANY);
|
||||
authservers = malloc(sizeof(SERVER));
|
||||
acctservers = malloc(sizeof(SERVER));
|
||||
|
||||
@@ -334,6 +336,8 @@
|
||||
acctservers->name[i] = NULL;
|
||||
acctservers->secret[i] = NULL;
|
||||
}
|
||||
+ acct->val = acctservers;
|
||||
+ auth->val = authservers;
|
||||
return rh;
|
||||
}
|
||||
|
||||
@@ -894,11 +898,15 @@
|
||||
continue;
|
||||
if (rh->config_options[i].type == OT_SRV) {
|
||||
serv = (SERVER *)rh->config_options[i].val;
|
||||
- for (j = 0; j < serv->max; j++)
|
||||
+ for (j = 0; j < serv->max; j++) {
|
||||
free(serv->name[j]);
|
||||
- free(serv);
|
||||
- } else {
|
||||
+ free(serv->secret[j]);
|
||||
+ }
|
||||
free(rh->config_options[i].val);
|
||||
+ rh->config_options[i].val = NULL;
|
||||
+
|
||||
+ } else {
|
||||
+ free(rh->config_options[i].val);
|
||||
}
|
||||
}
|
||||
free(rh->config_options);
|
|
@ -1,244 +0,0 @@
|
|||
#
|
||||
# Updated 97/06/13 to livingston-radius-2.01 miquels@cistron.nl
|
||||
#
|
||||
# This file contains dictionary translations for parsing
|
||||
# requests and generating responses. All transactions are
|
||||
# composed of Attribute/Value Pairs. The value of each attribute
|
||||
# is specified as one of 4 data types. Valid data types are:
|
||||
#
|
||||
# string - 0-253 octets
|
||||
# ipaddr - 4 octets in network byte order
|
||||
# integer - 32 bit value in big endian order (high byte first)
|
||||
# date - 32 bit value in big endian order - seconds since
|
||||
# 00:00:00 GMT, Jan. 1, 1970
|
||||
#
|
||||
# Enumerated values are stored in the user file with dictionary
|
||||
# VALUE translations for easy administration.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# ATTRIBUTE VALUE
|
||||
# --------------- -----
|
||||
# Framed-Protocol = PPP
|
||||
# 7 = 1 (integer encoding)
|
||||
#
|
||||
|
||||
#
|
||||
# Following are the proper new names. Use these.
|
||||
#
|
||||
$INCLUDE /usr/local/src/freeswitch/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.cisco
|
||||
$INCLUDE /usr/local/src/freeswitch/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.rfc5090
|
||||
|
||||
ATTRIBUTE User-Name 1 string
|
||||
ATTRIBUTE Password 2 string
|
||||
ATTRIBUTE CHAP-Password 3 string
|
||||
ATTRIBUTE NAS-IP-Address 4 ipaddr
|
||||
ATTRIBUTE NAS-Port-Id 5 integer
|
||||
ATTRIBUTE Service-Type 6 integer
|
||||
ATTRIBUTE Framed-Protocol 7 integer
|
||||
ATTRIBUTE Framed-IP-Address 8 ipaddr
|
||||
ATTRIBUTE Framed-IP-Netmask 9 ipaddr
|
||||
ATTRIBUTE Framed-Routing 10 integer
|
||||
ATTRIBUTE Filter-Id 11 string
|
||||
ATTRIBUTE Framed-MTU 12 integer
|
||||
ATTRIBUTE Framed-Compression 13 integer
|
||||
ATTRIBUTE Login-IP-Host 14 ipaddr
|
||||
ATTRIBUTE Login-Service 15 integer
|
||||
ATTRIBUTE Login-TCP-Port 16 integer
|
||||
ATTRIBUTE Reply-Message 18 string
|
||||
ATTRIBUTE Callback-Number 19 string
|
||||
ATTRIBUTE Callback-Id 20 string
|
||||
ATTRIBUTE Framed-Route 22 string
|
||||
ATTRIBUTE Framed-IPX-Network 23 ipaddr
|
||||
ATTRIBUTE State 24 string
|
||||
ATTRIBUTE Class 25 string
|
||||
ATTRIBUTE Vendor-Specific 26 string
|
||||
ATTRIBUTE Session-Timeout 27 integer
|
||||
ATTRIBUTE Idle-Timeout 28 integer
|
||||
ATTRIBUTE Termination-Action 29 integer
|
||||
ATTRIBUTE Called-Station-Id 30 string
|
||||
ATTRIBUTE Calling-Station-Id 31 string
|
||||
ATTRIBUTE NAS-Identifier 32 string
|
||||
ATTRIBUTE Proxy-State 33 string
|
||||
ATTRIBUTE Login-LAT-Service 34 string
|
||||
ATTRIBUTE Login-LAT-Node 35 string
|
||||
ATTRIBUTE Login-LAT-Group 36 string
|
||||
ATTRIBUTE Framed-AppleTalk-Link 37 integer
|
||||
ATTRIBUTE Framed-AppleTalk-Network 38 integer
|
||||
ATTRIBUTE Framed-AppleTalk-Zone 39 string
|
||||
ATTRIBUTE Acct-Status-Type 40 integer
|
||||
ATTRIBUTE Acct-Delay-Time 41 integer
|
||||
ATTRIBUTE Acct-Input-Octets 42 integer
|
||||
ATTRIBUTE Acct-Output-Octets 43 integer
|
||||
ATTRIBUTE Acct-Session-Id 44 string
|
||||
ATTRIBUTE Acct-Authentic 45 integer
|
||||
ATTRIBUTE Acct-Session-Time 46 integer
|
||||
ATTRIBUTE Acct-Input-Packets 47 integer
|
||||
ATTRIBUTE Acct-Output-Packets 48 integer
|
||||
ATTRIBUTE Acct-Terminate-Cause 49 integer
|
||||
ATTRIBUTE Acct-Multi-Session-Id 50 string
|
||||
ATTRIBUTE Acct-Link-Count 51 integer
|
||||
ATTRIBUTE Event-Timestamp 55 integer
|
||||
ATTRIBUTE CHAP-Challenge 60 string
|
||||
ATTRIBUTE NAS-Port-Type 61 integer
|
||||
ATTRIBUTE Port-Limit 62 integer
|
||||
ATTRIBUTE Login-LAT-Port 63 integer
|
||||
ATTRIBUTE Connect-Info 77 string
|
||||
|
||||
#
|
||||
# RFC3162 IPv6 attributes
|
||||
#
|
||||
ATTRIBUTE NAS-IPv6-Address 95 string
|
||||
ATTRIBUTE Framed-Interface-Id 96 string
|
||||
ATTRIBUTE Framed-IPv6-Prefix 97 string
|
||||
ATTRIBUTE Login-IPv6-Host 98 string
|
||||
ATTRIBUTE Framed-IPv6-Route 99 string
|
||||
ATTRIBUTE Framed-IPv6-Pool 100 string
|
||||
|
||||
#
|
||||
# Experimental Non Protocol Attributes used by Cistron-Radiusd
|
||||
#
|
||||
ATTRIBUTE Huntgroup-Name 221 string
|
||||
ATTRIBUTE User-Category 1029 string
|
||||
ATTRIBUTE Group-Name 1030 string
|
||||
ATTRIBUTE Simultaneous-Use 1034 integer
|
||||
ATTRIBUTE Strip-User-Name 1035 integer
|
||||
ATTRIBUTE Fall-Through 1036 integer
|
||||
ATTRIBUTE Add-Port-To-IP-Address 1037 integer
|
||||
ATTRIBUTE Exec-Program 1038 string
|
||||
ATTRIBUTE Exec-Program-Wait 1039 string
|
||||
ATTRIBUTE Hint 1040 string
|
||||
|
||||
#
|
||||
# Non-Protocol Attributes
|
||||
# These attributes are used internally by the server
|
||||
#
|
||||
ATTRIBUTE Expiration 21 date
|
||||
ATTRIBUTE Auth-Type 1000 integer
|
||||
ATTRIBUTE Menu 1001 string
|
||||
ATTRIBUTE Termination-Menu 1002 string
|
||||
ATTRIBUTE Prefix 1003 string
|
||||
ATTRIBUTE Suffix 1004 string
|
||||
ATTRIBUTE Group 1005 string
|
||||
ATTRIBUTE Crypt-Password 1006 string
|
||||
ATTRIBUTE Connect-Rate 1007 integer
|
||||
|
||||
#
|
||||
# Integer Translations
|
||||
#
|
||||
|
||||
# User Types
|
||||
|
||||
VALUE Service-Type Login-User 1
|
||||
VALUE Service-Type Framed-User 2
|
||||
VALUE Service-Type Callback-Login-User 3
|
||||
VALUE Service-Type Callback-Framed-User 4
|
||||
VALUE Service-Type Outbound-User 5
|
||||
VALUE Service-Type Administrative-User 6
|
||||
VALUE Service-Type NAS-Prompt-User 7
|
||||
|
||||
# Framed Protocols
|
||||
|
||||
VALUE Framed-Protocol PPP 1
|
||||
VALUE Framed-Protocol SLIP 2
|
||||
|
||||
# Framed Routing Values
|
||||
|
||||
VALUE Framed-Routing None 0
|
||||
VALUE Framed-Routing Broadcast 1
|
||||
VALUE Framed-Routing Listen 2
|
||||
VALUE Framed-Routing Broadcast-Listen 3
|
||||
|
||||
# Framed Compression Types
|
||||
|
||||
VALUE Framed-Compression None 0
|
||||
VALUE Framed-Compression Van-Jacobson-TCP-IP 1
|
||||
|
||||
# Login Services
|
||||
|
||||
VALUE Login-Service Telnet 0
|
||||
VALUE Login-Service Rlogin 1
|
||||
VALUE Login-Service TCP-Clear 2
|
||||
VALUE Login-Service PortMaster 3
|
||||
|
||||
# Status Types
|
||||
|
||||
VALUE Acct-Status-Type Start 1
|
||||
VALUE Acct-Status-Type Stop 2
|
||||
VALUE Acct-Status-Type Alive 3
|
||||
VALUE Acct-Status-Type Accounting-On 7
|
||||
VALUE Acct-Status-Type Accounting-Off 8
|
||||
|
||||
# Authentication Types
|
||||
|
||||
VALUE Acct-Authentic RADIUS 1
|
||||
VALUE Acct-Authentic Local 2
|
||||
VALUE Acct-Authentic PowerLink128 100
|
||||
|
||||
# Termination Options
|
||||
|
||||
VALUE Termination-Action Default 0
|
||||
VALUE Termination-Action RADIUS-Request 1
|
||||
|
||||
# NAS Port Types, available in 3.3.1 and later
|
||||
|
||||
VALUE NAS-Port-Type Async 0
|
||||
VALUE NAS-Port-Type Sync 1
|
||||
VALUE NAS-Port-Type ISDN 2
|
||||
VALUE NAS-Port-Type ISDN-V120 3
|
||||
VALUE NAS-Port-Type ISDN-V110 4
|
||||
|
||||
# Acct Terminate Causes, available in 3.3.2 and later
|
||||
|
||||
VALUE Acct-Terminate-Cause User-Request 1
|
||||
VALUE Acct-Terminate-Cause Lost-Carrier 2
|
||||
VALUE Acct-Terminate-Cause Lost-Service 3
|
||||
VALUE Acct-Terminate-Cause Idle-Timeout 4
|
||||
VALUE Acct-Terminate-Cause Session-Timeout 5
|
||||
VALUE Acct-Terminate-Cause Admin-Reset 6
|
||||
VALUE Acct-Terminate-Cause Admin-Reboot 7
|
||||
VALUE Acct-Terminate-Cause Port-Error 8
|
||||
VALUE Acct-Terminate-Cause NAS-Error 9
|
||||
VALUE Acct-Terminate-Cause NAS-Request 10
|
||||
VALUE Acct-Terminate-Cause NAS-Reboot 11
|
||||
VALUE Acct-Terminate-Cause Port-Unneeded 12
|
||||
VALUE Acct-Terminate-Cause Port-Preempted 13
|
||||
VALUE Acct-Terminate-Cause Port-Suspended 14
|
||||
VALUE Acct-Terminate-Cause Service-Unavailable 15
|
||||
VALUE Acct-Terminate-Cause Callback 16
|
||||
VALUE Acct-Terminate-Cause User-Error 17
|
||||
VALUE Acct-Terminate-Cause Host-Request 18
|
||||
|
||||
#
|
||||
# Non-Protocol Integer Translations
|
||||
#
|
||||
|
||||
VALUE Auth-Type Local 0
|
||||
VALUE Auth-Type System 1
|
||||
VALUE Auth-Type SecurID 2
|
||||
VALUE Auth-Type Crypt-Local 3
|
||||
VALUE Auth-Type Reject 4
|
||||
|
||||
#
|
||||
# Cistron extensions
|
||||
#
|
||||
VALUE Auth-Type Pam 253
|
||||
VALUE Auth-Type Accept 254
|
||||
|
||||
#
|
||||
# Experimental Non-Protocol Integer Translations for Cistron-Radiusd
|
||||
#
|
||||
VALUE Fall-Through No 0
|
||||
VALUE Fall-Through Yes 1
|
||||
VALUE Add-Port-To-IP-Address No 0
|
||||
VALUE Add-Port-To-IP-Address Yes 1
|
||||
|
||||
#
|
||||
# Configuration Values
|
||||
# uncomment these two lines to turn account expiration on
|
||||
#
|
||||
|
||||
#VALUE Server-Config Password-Expiration 30
|
||||
#VALUE Server-Config Password-Warning 5
|
||||
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
# -*- text -*-
|
||||
#
|
||||
# dictionary.cisco
|
||||
#
|
||||
# Accounting VSAs originally by
|
||||
# "Marcelo M. Sosa Lugones" <marcelo@sosa.com.ar>
|
||||
#
|
||||
# Version: $Id$
|
||||
#
|
||||
# For documentation on Cisco RADIUS attributes, see:
|
||||
#
|
||||
# http://www.cisco.com/univercd/cc/td/doc/product/access/acs_serv/vapp_dev/vsaig3.htm
|
||||
#
|
||||
# For general documentation on Cisco RADIUS configuration, see:
|
||||
#
|
||||
# http://www.cisco.com/en/US/partner/tech/tk583/tk547/tsd_technology_support_sub-protocol_home.html
|
||||
#
|
||||
|
||||
VENDOR Cisco 9
|
||||
|
||||
#
|
||||
# Standard attribute
|
||||
#
|
||||
#BEGIN-VENDOR Cisco
|
||||
|
||||
ATTRIBUTE Cisco-AVPair 1 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-NAS-Port 2 string vendor=Cisco
|
||||
|
||||
#
|
||||
# T.37 Store-and-Forward attributes.
|
||||
#
|
||||
ATTRIBUTE Cisco-Fax-Account-Id-Origin 3 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Msg-Id 4 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Pages 5 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Coverpage-Flag 6 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Modem-Time 7 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Connect-Speed 8 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Recipient-Count 9 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Process-Abort-Flag 10 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Dsn-Address 11 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Dsn-Flag 12 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Mdn-Address 13 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Mdn-Flag 14 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Fax-Auth-Status 15 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Email-Server-Address 16 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Email-Server-Ack-Flag 17 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Gateway-Id 18 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Call-Type 19 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Port-Used 20 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Abort-Cause 21 string vendor=Cisco
|
||||
|
||||
#
|
||||
# Voice over IP attributes.
|
||||
#
|
||||
ATTRIBUTE h323-remote-address 23 string vendor=Cisco
|
||||
ATTRIBUTE h323-conf-id 24 string vendor=Cisco
|
||||
ATTRIBUTE h323-setup-time 25 string vendor=Cisco
|
||||
ATTRIBUTE h323-call-origin 26 string vendor=Cisco
|
||||
ATTRIBUTE h323-call-type 27 string vendor=Cisco
|
||||
ATTRIBUTE h323-connect-time 28 string vendor=Cisco
|
||||
ATTRIBUTE h323-disconnect-time 29 string vendor=Cisco
|
||||
ATTRIBUTE h323-disconnect-cause 30 string vendor=Cisco
|
||||
ATTRIBUTE h323-voice-quality 31 string vendor=Cisco
|
||||
ATTRIBUTE h323-gw-id 33 string vendor=Cisco
|
||||
ATTRIBUTE h323-incoming-conf-id 35 string vendor=Cisco
|
||||
|
||||
ATTRIBUTE Cisco-Policy-Up 37 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Policy-Down 38 string vendor=Cisco
|
||||
|
||||
ATTRIBUTE sip-conf-id 100 string vendor=Cisco
|
||||
ATTRIBUTE h323-credit-amount 101 string vendor=Cisco
|
||||
ATTRIBUTE h323-credit-time 102 string vendor=Cisco
|
||||
ATTRIBUTE h323-return-code 103 string vendor=Cisco
|
||||
ATTRIBUTE h323-prompt-id 104 string vendor=Cisco
|
||||
ATTRIBUTE h323-time-and-day 105 string vendor=Cisco
|
||||
ATTRIBUTE h323-redirect-number 106 string vendor=Cisco
|
||||
ATTRIBUTE h323-preferred-lang 107 string vendor=Cisco
|
||||
ATTRIBUTE h323-redirect-ip-address 108 string vendor=Cisco
|
||||
ATTRIBUTE h323-billing-model 109 string vendor=Cisco
|
||||
ATTRIBUTE h323-currency 110 string vendor=Cisco
|
||||
ATTRIBUTE subscriber 111 string vendor=Cisco
|
||||
ATTRIBUTE gw-rxd-cdn 112 string vendor=Cisco
|
||||
ATTRIBUTE gw-final-xlated-cdn 113 string vendor=Cisco
|
||||
ATTRIBUTE remote-media-address 114 string vendor=Cisco
|
||||
ATTRIBUTE release-source 115 string vendor=Cisco
|
||||
ATTRIBUTE gw-rxd-cgn 116 string vendor=Cisco
|
||||
ATTRIBUTE gw-final-xlated-cgn 117 string vendor=Cisco
|
||||
|
||||
# SIP Attributes
|
||||
ATTRIBUTE call-id 141 string vendor=Cisco
|
||||
ATTRIBUTE session-protocol 142 string vendor=Cisco
|
||||
ATTRIBUTE method 143 string vendor=Cisco
|
||||
ATTRIBUTE prev-hop-via 144 string vendor=Cisco
|
||||
ATTRIBUTE prev-hop-ip 145 string vendor=Cisco
|
||||
ATTRIBUTE incoming-req-uri 146 string vendor=Cisco
|
||||
ATTRIBUTE outgoing-req-uri 147 string vendor=Cisco
|
||||
ATTRIBUTE next-hop-ip 148 string vendor=Cisco
|
||||
ATTRIBUTE next-hop-dn 149 string vendor=Cisco
|
||||
ATTRIBUTE sip-hdr 150 string vendor=Cisco
|
||||
|
||||
#
|
||||
# Extra attributes sent by the Cisco, if you configure
|
||||
# "radius-server vsa accounting" (requires IOS11.2+).
|
||||
#
|
||||
ATTRIBUTE Cisco-Multilink-ID 187 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Num-In-Multilink 188 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Pre-Input-Octets 190 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Pre-Output-Octets 191 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Pre-Input-Packets 192 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Pre-Output-Packets 193 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Maximum-Time 194 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Disconnect-Cause 195 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Data-Rate 197 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-PreSession-Time 198 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-PW-Lifetime 208 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-IP-Direct 209 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-PPP-VJ-Slot-Comp 210 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-PPP-Async-Map 212 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-IP-Pool-Definition 217 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Assign-IP-Pool 218 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Route-IP 228 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Link-Compression 233 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Target-Util 234 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Maximum-Channels 235 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Data-Filter 242 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Call-Filter 243 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Idle-Limit 244 integer vendor=Cisco
|
||||
ATTRIBUTE Cisco-Subscriber-Password 249 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Account-Info 250 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Service-Info 251 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Command-Code 252 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Control-Info 253 string vendor=Cisco
|
||||
ATTRIBUTE Cisco-Xmit-Rate 255 integer vendor=Cisco
|
||||
|
||||
VALUE Cisco-Disconnect-Cause Unknown 2
|
||||
VALUE Cisco-Disconnect-Cause CLID-Authentication-Failure 4
|
||||
VALUE Cisco-Disconnect-Cause No-Carrier 10
|
||||
VALUE Cisco-Disconnect-Cause Lost-Carrier 11
|
||||
VALUE Cisco-Disconnect-Cause No-Detected-Result-Codes 12
|
||||
VALUE Cisco-Disconnect-Cause User-Ends-Session 20
|
||||
VALUE Cisco-Disconnect-Cause Idle-Timeout 21
|
||||
VALUE Cisco-Disconnect-Cause Exit-Telnet-Session 22
|
||||
VALUE Cisco-Disconnect-Cause No-Remote-IP-Addr 23
|
||||
VALUE Cisco-Disconnect-Cause Exit-Raw-TCP 24
|
||||
VALUE Cisco-Disconnect-Cause Password-Fail 25
|
||||
VALUE Cisco-Disconnect-Cause Raw-TCP-Disabled 26
|
||||
VALUE Cisco-Disconnect-Cause Control-C-Detected 27
|
||||
VALUE Cisco-Disconnect-Cause EXEC-Program-Destroyed 28
|
||||
VALUE Cisco-Disconnect-Cause Timeout-PPP-LCP 40
|
||||
VALUE Cisco-Disconnect-Cause Failed-PPP-LCP-Negotiation 41
|
||||
VALUE Cisco-Disconnect-Cause Failed-PPP-PAP-Auth-Fail 42
|
||||
VALUE Cisco-Disconnect-Cause Failed-PPP-CHAP-Auth 43
|
||||
VALUE Cisco-Disconnect-Cause Failed-PPP-Remote-Auth 44
|
||||
VALUE Cisco-Disconnect-Cause PPP-Remote-Terminate 45
|
||||
VALUE Cisco-Disconnect-Cause PPP-Closed-Event 46
|
||||
VALUE Cisco-Disconnect-Cause Session-Timeout 100
|
||||
VALUE Cisco-Disconnect-Cause Session-Failed-Security 101
|
||||
VALUE Cisco-Disconnect-Cause Session-End-Callback 102
|
||||
VALUE Cisco-Disconnect-Cause Invalid-Protocol 120
|
||||
|
||||
#END-VENDOR Cisco
|
|
@ -1,27 +0,0 @@
|
|||
# -*- text -*-
|
||||
#
|
||||
# Attributes and values defined in RFC 5090.
|
||||
# http://www.ietf.org/rfc/rfc5090.txt
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
ATTRIBUTE Digest-Response 103 string
|
||||
ATTRIBUTE Digest-Realm 104 string
|
||||
ATTRIBUTE Digest-Nonce 105 string
|
||||
ATTRIBUTE Digest-Response-Auth 106 string
|
||||
ATTRIBUTE Digest-Nextnonce 107 string
|
||||
ATTRIBUTE Digest-Method 108 string
|
||||
ATTRIBUTE Digest-URI 109 string
|
||||
ATTRIBUTE Digest-Qop 110 string
|
||||
ATTRIBUTE Digest-Algorithm 111 string
|
||||
ATTRIBUTE Digest-Entity-Body-Hash 112 string
|
||||
ATTRIBUTE Digest-CNonce 113 string
|
||||
ATTRIBUTE Digest-Nonce-Count 114 string
|
||||
ATTRIBUTE Digest-Username 115 string
|
||||
ATTRIBUTE Digest-Opaque 116 string
|
||||
ATTRIBUTE Digest-Auth-Param 117 string
|
||||
ATTRIBUTE Digest-AKA-Auts 118 string
|
||||
ATTRIBUTE Digest-Domain 119 string
|
||||
ATTRIBUTE Digest-Stale 120 string
|
||||
ATTRIBUTE Digest-HA1 121 string
|
||||
ATTRIBUTE SIP-AOR 122 string
|
File diff suppressed because it is too large
Load Diff
|
@ -1,167 +0,0 @@
|
|||
<configuration name="xml_radius.conf" description="Radius XML Gateway">
|
||||
<!--
|
||||
auth_invite is only called when a directory lookup is done on an inbound invite. Usually that means a digest auth challenge on the invite.
|
||||
|
||||
auth_reg is only called on the actual registration.
|
||||
|
||||
auth_app is used when an invite is in the dialplan. If your profile requires digest auth then this isn't needed.
|
||||
but if your profile is doing only ip authentication this allows you to authenticate the call without the need for digest auth.
|
||||
|
||||
acct_start happens when the call goes into the state 'routing' which means it is starting the dialplan
|
||||
-->
|
||||
<auth_invite>
|
||||
<connection name="testing">
|
||||
<param name="authserver" value="127.0.0.1:1812:testing123"/>
|
||||
<param name="radius_timeout" value="10"/>
|
||||
<param name="radius_retries" value="2"/>
|
||||
<param name="radius_deadtime" value="0"/>
|
||||
<param name="dictionary" value="/usr/local/src/freeswitch/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary"/>
|
||||
<param name="seqfile" value="/var/run/radius.seq"/>
|
||||
</connection>
|
||||
<fields>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="src-gw-ip=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
|
||||
<param vendor="Cisco" name="h323-conf-id" variable="Core-UUID" format="%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="request-type=number"/>
|
||||
<param name="Called-Station-Id" variable="sip_to_user" format="%s"/>
|
||||
<param name="Calling-Station-Id" variable="sip_from_user" format="%s"/>
|
||||
<param name="User-Name" variable="sip_from_user" format="%s"/>
|
||||
<param name="Digest-Response" variable="sip_auth_response" format="%s"/>
|
||||
<param name="Digest-Realm" variable="sip_auth_realm" format="%s"/>
|
||||
<param name="Digest-Nonce" variable="sip_auth_nonce" format="%s"/>
|
||||
<param name="Digest-Username" variable="sip_auth_username" format="%s"/>
|
||||
<param name="Digest-URI" variable="sip_auth_uri" format="%s"/>
|
||||
<param name="Digest-Method" variable="sip_auth_method" format="%s"/>
|
||||
<param name="Digest-Algorithm" variable="sip_auth_method" format="MD5"/>
|
||||
<param name="Digest-Qop" variable="sip_auth_qop" format="%s"/>
|
||||
<param name="Digest-CNonce" variable="sip_auth_cnonce" format="%s"/>
|
||||
<param name="Digest-Nonce-Count" variable="sip_auth_nc" format="%s"/>
|
||||
</fields>
|
||||
</auth_invite>
|
||||
<auth_reg>
|
||||
<connection name="testing">
|
||||
<param name="authserver" value="127.0.0.1:1812:testing123"/>
|
||||
<param name="radius_timeout" value="10"/>
|
||||
<param name="radius_retries" value="2"/>
|
||||
<param name="radius_deadtime" value="0"/>
|
||||
<param name="dictionary" value="/usr/local/src/freeswitch/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary"/>
|
||||
<param name="seqfile" value="/var/run/radius.seq"/>
|
||||
</connection>
|
||||
<fields>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="request-type=user"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="src-gw-ip=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
|
||||
<param name="User-Name" variable="sip_from_user" format="%s"/>
|
||||
<param name="Digest-Response" variable="sip_auth_response" format="%s"/>
|
||||
<param name="Digest-Realm" variable="sip_auth_realm" format="%s"/>
|
||||
<param name="Digest-Nonce" variable="sip_auth_nonce" format="%s"/>
|
||||
<param name="Digest-Username" variable="sip_auth_username" format="%s"/>
|
||||
<param name="Digest-URI" variable="sip_auth_uri" format="%s"/>
|
||||
<param name="Digest-Method" variable="sip_auth_method" format="%s"/>
|
||||
<param name="Digest-Algorithm" variable="sip_auth_method" format="MD5"/>
|
||||
<param name="Digest-Qop" variable="sip_auth_qop" format="%s"/>
|
||||
<param name="Digest-CNonce" variable="sip_auth_cnonce" format="%s"/>
|
||||
<param name="Digest-Nonce-Count" variable="sip_auth_nc" format="%s"/>
|
||||
</fields>
|
||||
</auth_reg>
|
||||
<auth_app>
|
||||
<connection name="testing">
|
||||
<param name="authserver" value="127.0.0.1:1812:testing123"/>
|
||||
<param name="radius_timeout" value="10"/>
|
||||
<param name="radius_retries" value="2"/>
|
||||
<param name="radius_deadtime" value="0"/>
|
||||
<param name="dictionary" value="/usr/local/src/freeswitch/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary"/>
|
||||
<param name="seqfile" value="/var/run/radius.seq"/>
|
||||
</connection>
|
||||
<fields>
|
||||
<param vendor="Cisco" name="h323-conf-id" variable_secondary="uuid" variable="originating_leg_uuid" format="%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="uuid" format="h323-call-id=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_network_ip" format="src-gw-ip=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-number-in=%s" />
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_user" format="dst-number-in=%s" />
|
||||
<param name="Called-Station-Id" variable="sip_to_user" format="%s"/>
|
||||
<param name="Calling-Station-Id" variable="sip_from_user" format="%s"/>
|
||||
</fields>
|
||||
</auth_app>
|
||||
<auth_reg>
|
||||
<connection name="testing">
|
||||
<param name="authserver" value="127.0.0.1:1812:testing123"/>
|
||||
<param name="radius_timeout" value="10"/>
|
||||
<param name="radius_retries" value="2"/>
|
||||
<param name="radius_deadtime" value="0"/>
|
||||
<param name="dictionary" value="/usr/share/freeradius/dictionary.cisco"/>
|
||||
<param name="seqfile" value="/var/run/radius.seq"/>
|
||||
</connection>
|
||||
<fields>
|
||||
</fields>
|
||||
</auth_reg>
|
||||
<acct_start>
|
||||
<connection name="testing">
|
||||
<param name="acctserver" value="127.0.0.1:1813:testing123"/>
|
||||
<param name="radius_timeout" value="10"/>
|
||||
<param name="radius_retries" value="0"/>
|
||||
<param name="radius_deadtime" value="0"/>
|
||||
<param name="dictionary" value="/usr/local/src/freeswitch/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary"/>
|
||||
<param name="seqfile" value="/var/run/radius.seq"/>
|
||||
</connection>
|
||||
<fields>
|
||||
<param vendor="Cisco" name="h323-call-origin" variable="h323-call-origin" default="answer" format="%s"/>
|
||||
<param vendor="Cisco" name="h323-conf-id" variable_secondary="uuid" variable="originating_leg_uuid" format="%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="uuid" format="h323-call-id=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_contact_host" format="src-gw-ip=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" variable_secondary="ani" format="src-gw-name=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" variable_secondary="ani" format="src-number-in=%s" />
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" variable_secondary="ani" format="src-number-out=%s" />
|
||||
<param name="Calling-Station-Id" variable="sip_from_user" variable_secondary="ani" format="%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_host" format="dst-gw-ip=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="destination_number" format="dst-gw-name=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="destination_number" format="dst-number-in=%s" />
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="destination_number" format="dst-number-out=%s" />
|
||||
<param name="Called-Station-Id" variable="destination_number" format="%s"/>
|
||||
<param vendor="Cisco" name="h323-setup-time"/>
|
||||
</fields>
|
||||
<conditions>
|
||||
<condition>
|
||||
<!-- anti="true" will cause any leg that matches to not be logged -->
|
||||
<param var="sip_to_host" regex="^8\.8\.8\.8" anti="true"/>
|
||||
</condition>
|
||||
</conditions>
|
||||
</acct_start>
|
||||
<acct_end>
|
||||
<connection name="testing">
|
||||
<param name="acctserver" value="127.0.0.1:1813:testing123"/>
|
||||
<param name="radius_timeout" value="10"/>
|
||||
<param name="radius_retries" value="0"/>
|
||||
<param name="radius_deadtime" value="0"/>
|
||||
<param name="dictionary" value="/usr/local/src/freeswitch/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary"/>
|
||||
<param name="seqfile" value="/var/run/radius.seq"/>
|
||||
</connection>
|
||||
<fields>
|
||||
<param vendor="Cisco" name="h323-call-origin" variable="h323-call-origin" default="answer" format="%s"/>
|
||||
<param vendor="Cisco" name="h323-conf-id" variable_secondary="uuid" variable="originating_leg_uuid" format="%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="uuid" format="h323-call-id=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_contact_host" format="src-gw-ip=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" variable_secondary="ani" format="src-gw-name=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" variable_secondary="ani" format="src-number-in=%s" />
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" variable_secondary="ani" format="src-number-out=%s" />
|
||||
<param name="Calling-Station-Id" variable="sip_from_user" variable_secondary="ani" format="%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_host" format="dst-gw-ip=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_user" variable_secondary="dialed_extension" format="dst-gw-name=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_user" variable_secondary="dialed_extension" format="dst-number-in=%s" />
|
||||
<param name="Called-Station-Id" variable="destination_number" format="%s"/>
|
||||
<param vendor="Cisco" name="h323-setup-time"/>
|
||||
<param vendor="Cisco" name="h323-connect-time"/>
|
||||
<param vendor="Cisco" name="h323-disconnect-time"/>
|
||||
<param vendor="Cisco" name="h323-disconnect-cause"/>
|
||||
<param name="Acct-Session-Time" variable="billsec" format="%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable_secondary="progressmsec" variable="progress_mediamsec" format="pdd-time=%s"/>
|
||||
<param vendor="Cisco" name="Cisco-AVPair" variable="destination_number" format="dst-number-out=%s"/>
|
||||
</fields>
|
||||
<conditions>
|
||||
<condition>
|
||||
<param var="sip_to_host" regex="^8\.8\.8\.8" anti="true"/>
|
||||
</condition>
|
||||
</conditions>
|
||||
</acct_end>
|
||||
</configuration>
|
Loading…
Reference in New Issue