Hello OpenSER/Kamailio developers,
we implemented some additional features in siptrace.
The main objective was to have multiple kamailios send duplicates
of sent/received packets to one logging server (also running kamailio).
We did not just set db_url to the logging server because of
performance concerns.
The attached patches contain our commits.
I hope that you find them useful.
Viele Grüße / Best regards,
Tristan Bruns (DECOIT GmbH)
0001-modules_k-siptrace-separately-store-to-db-and-or-sen.patch
modules_k/siptrace: separately store to db and/or send duplicate
0002-modules_k-siptrace-Add-trace_to_database-configurati.patch
modules_k/siptrace: Add trace_to_database configuration parameter
Adding configuration parameter to disable writing to the database.
We can use this to only duplicate the SIP messages without storing
them in our database.
0003-modules_k-siptrace-Add-x-headers-feature.patch
modules_k/siptrace: Add "x-headers" feature
The "x-headers" feature stores the fromip, toip, method and
direction in the message body (using X-* headers). This allows to
transmit them using duplicate_uri from one kamailio to an other.
0004-modules_k-siptrace-Add-column-time_us.patch
modules_k/siptrace: Add column time_us
0005-modules_k-siptrace-Add-time-to-x-headers.patch
modules_k/siptrace: Add time to x-headers
Module: sip-router
Branch: master
Commit: 233d01912e4ea5965fb68361f406aee0f650efac
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=233d019…
Author: pd <peter.dunkley(a)crocodile-rcs.com>
Committer: pd <peter.dunkley(a)crocodile-rcs.com>
Date: Tue Aug 9 14:47:19 2011 +0100
modules_k/textops: Added new exported function append_time_to_request()
- This function is similar to the existing append_time(), but the existing
function adds the Date header to replies generated by Kamailio. This
function modifies the request.
In my scenario I want all MESSAGE requests to contain Date headers. The
MSILO module inserts Date headers into MESSAGEs that have been stored,
but not all clients insert Date headers. This function enables me
to ensure all MESSAGE requests contain the Date header that I require.
This is not exactly correct as the Date header should reflect the time
when the request is first sent - but the current time on the Kamailio
server is better than nothing and good enough for my needs.
- Usage example:
if (is_method("MESSAGE") && !is_present_hf("Date"))
append_time_to_request();
---
modules_k/textops/README | 133 ++++++++++++++++++------------
modules_k/textops/doc/textops_admin.xml | 56 +++++++++++++
modules_k/textops/textops.c | 49 +++++++++++
3 files changed, 185 insertions(+), 53 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=233…
Module: sip-router
Branch: master
Commit: 414af8a49bae2a41069b003aa9da83823c729bd0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=414af8a…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: Tue Aug 9 08:36:39 2011 +0300
modules_k/auth_radius: added optional uri_user param to radius_www_authorize()
- Useful for http authorization.
---
modules_k/auth_radius/README | 13 +++++++++----
modules_k/auth_radius/authorize.c | 14 ++++++++++++--
modules_k/auth_radius/authorize.h | 15 ++++++++++-----
modules_k/auth_radius/authrad_mod.c | 4 +++-
modules_k/auth_radius/doc/auth_radius_admin.xml | 13 ++++++++++++-
5 files changed, 46 insertions(+), 13 deletions(-)
diff --git a/modules_k/auth_radius/README b/modules_k/auth_radius/README
index 3222d50..e40fa57 100644
--- a/modules_k/auth_radius/README
+++ b/modules_k/auth_radius/README
@@ -49,7 +49,7 @@ Jan Janak
5. Exported Functions
- 5.1. radius_www_authorize(realm)
+ 5.1. radius_www_authorize(realm [, uri_user])
5.2. radius_proxy_authorize(realm [, uri_user])
List of Examples
@@ -82,7 +82,7 @@ Chapter 1. Admin Guide
5. Exported Functions
- 5.1. radius_www_authorize(realm)
+ 5.1. radius_www_authorize(realm [, uri_user])
5.2. radius_proxy_authorize(realm [, uri_user])
1. Overview
@@ -206,10 +206,10 @@ modparam("auth_radius", "use_ruri_flag", 22)
5. Exported Functions
- 5.1. radius_www_authorize(realm)
+ 5.1. radius_www_authorize(realm [, uri_user])
5.2. radius_proxy_authorize(realm [, uri_user])
-5.1. radius_www_authorize(realm)
+5.1. radius_www_authorize(realm [, uri_user])
The function verifies credentials according to RFC2617. If the
credentials are verified successfully then the function will succeed
@@ -240,6 +240,11 @@ modparam("auth_radius", "use_ruri_flag", 22)
to the user so he can decide what username and password to use. In
case of REGISTER requests it is usually hostpart of To URI.
The string may contain pseudo variables.
+ * uri_user - Uri_user is an optional pseudo variable parameter whose
+ value, if present, will be given to Radius server as value of
+ SIP-URI-User check item. If uri_user pseudo variable parameter is
+ not present, the server will generate SIP-URI-User check item value
+ from user part of To/From URI.
This function can be used from REQUEST_ROUTE.
diff --git a/modules_k/auth_radius/authorize.c b/modules_k/auth_radius/authorize.c
index c84deec..9dfc9b3 100644
--- a/modules_k/auth_radius/authorize.c
+++ b/modules_k/auth_radius/authorize.c
@@ -236,10 +236,20 @@ int radius_proxy_authorize_2(struct sip_msg* _msg, char* _realm,
/*
- * Authorize using WWW-Authorize header field
+ * Authorize using WWW-Authorize header field (no URI user parameter given)
*/
-int radius_www_authorize(struct sip_msg* _msg, char* _realm, char* _s2)
+int radius_www_authorize_1(struct sip_msg* _msg, char* _realm, char* _s2)
{
return authorize(_msg, (pv_elem_t*)_realm, (pv_spec_t *)0,
HDR_AUTHORIZATION_T);
}
+
+
+/*
+ * Authorize using WWW-Authorize header field (URI user parameter given)
+ */
+int radius_www_authorize_2(struct sip_msg* _msg, char* _realm, char* _uri_user)
+{
+ return authorize(_msg, (pv_elem_t*)_realm, (pv_spec_t *)_uri_user,
+ HDR_AUTHORIZATION_T);
+}
diff --git a/modules_k/auth_radius/authorize.h b/modules_k/auth_radius/authorize.h
index 33cfb5f..014ed9d 100644
--- a/modules_k/auth_radius/authorize.h
+++ b/modules_k/auth_radius/authorize.h
@@ -33,21 +33,26 @@
/*
- * Authorize using Proxy-Authorize header field (no from parameter given)
+ * Authorize using Proxy-Authorize header field (no URI user parameter given)
*/
int radius_proxy_authorize_1(struct sip_msg* _msg, char* _realm, char* _s2);
/*
- * Authorize using Proxy-Authorize header field (from parameter given)
+ * Authorize using Proxy-Authorize header field (URI user parameter given)
*/
-int radius_proxy_authorize_2(struct sip_msg* _msg, char* _realm, char* _from);
+int radius_proxy_authorize_2(struct sip_msg* _msg, char* _realm, char* _uri_user);
/*
- * Authorize using WWW-Authorization header field
+ * Authorize using WWW-Authorization header field (no URI user parameter given)
*/
-int radius_www_authorize(struct sip_msg* _msg, char* _realm, char* _s2);
+int radius_www_authorize_1(struct sip_msg* _msg, char* _realm, char* _s2);
+
+/*
+ * Authorize using WWW-Authorization header field (URI user parameter given)
+ */
+int radius_www_authorize_2(struct sip_msg* _msg, char* _realm, char* _uri_user);
#endif /* AUTHORIZE_H */
diff --git a/modules_k/auth_radius/authrad_mod.c b/modules_k/auth_radius/authrad_mod.c
index 59e27c5..f0ef531 100644
--- a/modules_k/auth_radius/authrad_mod.c
+++ b/modules_k/auth_radius/authrad_mod.c
@@ -73,7 +73,9 @@ struct extra_attr *auth_extra = 0;
* Exported functions
*/
static cmd_export_t cmds[] = {
- {"radius_www_authorize", (cmd_function)radius_www_authorize, 1, auth_fixup,
+ {"radius_www_authorize", (cmd_function)radius_www_authorize_1, 1, auth_fixup,
+ 0, REQUEST_ROUTE},
+ {"radius_www_authorize", (cmd_function)radius_www_authorize_2, 2, auth_fixup,
0, REQUEST_ROUTE},
{"radius_proxy_authorize", (cmd_function)radius_proxy_authorize_1, 1, auth_fixup,
0, REQUEST_ROUTE},
diff --git a/modules_k/auth_radius/doc/auth_radius_admin.xml b/modules_k/auth_radius/doc/auth_radius_admin.xml
index eb99ca8..699d454 100644
--- a/modules_k/auth_radius/doc/auth_radius_admin.xml
+++ b/modules_k/auth_radius/doc/auth_radius_admin.xml
@@ -193,7 +193,7 @@ modparam("auth_radius", "use_ruri_flag", 22)
<section>
<title>Exported Functions</title>
<section>
- <title><function moreinfo="none">radius_www_authorize(realm)</function></title>
+ <title><function moreinfo="none">radius_www_authorize(realm [, uri_user])</function></title>
<para>
The function verifies credentials according to
<ulink url="http://www.ietf.org/rfc/rfc2617.txt">RFC2617</ulink>. If
@@ -253,6 +253,17 @@ modparam("auth_radius", "use_ruri_flag", 22)
The string may contain pseudo variables.
</para>
</listitem>
+ <listitem>
+ <para><emphasis>uri_user</emphasis> - Uri_user is an
+ optional pseudo variable parameter whose value, if
+ present, will be given to Radius server as value of
+ SIP-URI-User check item.
+ If uri_user pseudo variable parameter is not
+ present, the server will generate
+ SIP-URI-User check item value from user part of
+ To/From URI.
+ </para>
+ </listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE.
Module: sip-router
Branch: master
Commit: 34db39d95f9fcb03d5624ee6fb15b8542295a2f5
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=34db39d…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Mon Aug 8 22:42:19 2011 +0200
db_postgres: fix doxygen errors, small extensions and cleanups in comments
---
modules/db_postgres/km_pg_con.c | 2 -
modules/db_postgres/pg_cmd.h | 23 +++++++---------
modules/db_postgres/pg_fld.c | 17 +++---------
modules/db_postgres/pg_fld.h | 53 ++++++++++++++++++--------------------
4 files changed, 40 insertions(+), 55 deletions(-)
diff --git a/modules/db_postgres/km_pg_con.c b/modules/db_postgres/km_pg_con.c
index 98dbb43..472e8de 100644
--- a/modules/db_postgres/km_pg_con.c
+++ b/modules/db_postgres/km_pg_con.c
@@ -1,6 +1,4 @@
/*
- * $Id$
- *
* Copyright (C) 2001-2004 iptel.org
* Copyright (C) 2008 1&1 Internet AG
*
diff --git a/modules/db_postgres/pg_cmd.h b/modules/db_postgres/pg_cmd.h
index 1398d16..c48c31e 100644
--- a/modules/db_postgres/pg_cmd.h
+++ b/modules/db_postgres/pg_cmd.h
@@ -1,8 +1,4 @@
/*
- * $Id$
- *
- * PostgreSQL Database Driver for SER
- *
* Portions Copyright (C) 2001-2003 FhG FOKUS
* Copyright (C) 2003 August.Net Services, LLC
* Portions Copyright (C) 2005-2008 iptelorg GmbH
@@ -31,13 +27,15 @@
#ifndef _PG_CMD_H
#define _PG_CMD_H
-/** \addtogroup postgres
- * @{
- */
-/** \file
- * Declaration of pg_cmd data structure that contains PostgreSQL specific data
+/*!
+ * \file
+ * \brief DB_POSTGRES :: * Declaration of pg_cmd data structure
+ *
+ * Declaration of pg_cmd data structure that contains PostgreSQL specific data
* stored in db_cmd structures and related functions.
+ * \ingroup db_postgres
+ * Module: \ref db_postgres
*/
#include "pg_oid.h"
@@ -90,6 +88,7 @@ int pg_cmd(db_cmd_t* cmd);
* necessary.
* @param res A pointer to (optional) result structure if the command returns
* a result.
+ * @param cmd executed command
* @retval 0 if executed successfully
* @retval A negative number if the database server failed to execute command
* @retval A positive number if there was an error on client side (SER)
@@ -106,7 +105,7 @@ int pg_cmd_exec(db_res_t* res, db_cmd_t* cmd);
* @param res A result set retrieved from PostgreSQL server.
* @retval 0 If executed successfully.
* @retval 1 If the result is empty.
- * @retival A negative number on error.
+ * @retval A negative number on error.
*/
int pg_cmd_first(db_res_t* res);
@@ -120,7 +119,7 @@ int pg_cmd_first(db_res_t* res);
* @param res A result set retrieved from PostgreSQL server.
* @retval 0 If executed successfully.
* @retval 1 If there are no more records in the result.
- * @retival A negative number on error.
+ * @retval A negative number on error.
*/
int pg_cmd_next(db_res_t* res);
@@ -150,6 +149,4 @@ int pg_getopt(db_cmd_t* cmd, char* optname, va_list ap);
*/
int pg_setopt(db_cmd_t* cmd, char* optname, va_list ap);
-/** @} */
-
#endif /* _PG_CMD_H */
diff --git a/modules/db_postgres/pg_fld.c b/modules/db_postgres/pg_fld.c
index 685d73b..fe64217 100644
--- a/modules/db_postgres/pg_fld.c
+++ b/modules/db_postgres/pg_fld.c
@@ -1,8 +1,4 @@
/*
- * $Id$
- *
- * PostgreSQL Database Driver for SER
- *
* Portions Copyright (C) 2001-2003 FhG FOKUS
* Copyright (C) 2003 August.Net Services, LLC
* Portions Copyright (C) 2005-2008 iptelorg GmbH
@@ -28,12 +24,12 @@
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/** \addtogroup postgres
- * @{
- */
-/** \file
- * Data field conversion and type checking functions.
+/*!
+ * \file
+ * \brief DB_POSTGRES :: Data field conversion and type checking functions.
+ * \ingroup db_postgres
+ * Module: \ref db_postgres
*/
#include "pg_fld.h"
@@ -934,6 +930,3 @@ int pg_pg2fld(db_fld_t* dst, PGresult* src, int row,
type, dst[i].type);
return -1;
}
-
-
-/** @} */
diff --git a/modules/db_postgres/pg_fld.h b/modules/db_postgres/pg_fld.h
index 917f22d..09b9926 100644
--- a/modules/db_postgres/pg_fld.h
+++ b/modules/db_postgres/pg_fld.h
@@ -1,8 +1,4 @@
/*
- * $Id$
- *
- * PostgreSQL Database Driver for SER
- *
* Portions Copyright (C) 2001-2003 FhG FOKUS
* Copyright (C) 2003 August.Net Services, LLC
* Portions Copyright (C) 2005-2008 iptelorg GmbH
@@ -31,13 +27,14 @@
#ifndef _PG_FLD_H
#define _PG_FLD_H
-/** \addtogroup postgres
- * @{
- */
-/** \file
- * Implementation of pg_fld data structure representing PostgreSQL fields and
- * related functions.
+/*!
+ * \file
+ * \brief DB_POSTGRES :: Implementation of pg_fld data structure
+ *
+ * Implementation of pg_fld data structure representing PostgreSQL fields and related functions.
+ * \ingroup db_postgres
+ * Module: \ref db_postgres
*/
#include "pg_oid.h"
@@ -75,8 +72,7 @@ struct pg_fld {
* attaches the structure to the generic db_fld structure.
* @param fld A generic db_fld structure to be exended.
* @param table Name of the table on the server.
- * @retval 0 on success.
- * @retval A negative number on error.
+ * @return 0 on success, negative number on error.
*/
int pg_fld(db_fld_t* fld, char* table);
@@ -89,15 +85,11 @@ int pg_resolve_result_oids(db_fld_t* fld, int n, PGresult* res);
/** Converts arrays of db_fld fields to PostgreSQL parameters.
* The function converts fields in SER db_fld format to parameters suitable
* for PostgreSQL API functions.
- * @param values An array of pointers to values in PostgreSQL format. The
+ * @param dst An array of pointers to values in PostgreSQL format. The
* function will store pointers to converted values there.
- * @param lenghts An array of integers that will be filled with lenghts
- * of values.
- * @param formats An array of value formats, see PostgreSQL API client
- * library documentation for more detail.
- * @param oids Types of corresponding columns on the server.
+ * @param off offset
* @param types A type conversion table.
- * @param fld An array of db_fld fields to be converted.
+ * @param src An array of db_fld fields to be converted.
* @param flags Connection flags controlling how values are converted.
* @todo Implement support for bit fields with size bigger than 32
* @todo Implement support for varbit properly to remove leading zeroes
@@ -113,10 +105,11 @@ int pg_fld2pg(struct pg_params* dst, int off, pg_type_t* types,
* The function converts fields from PostgreSQL result (PGresult structure)
* into the internal format used in SER. The function converts one row at a
* time.
- * @param fld The destination array of db_fld fields to be filled with converted
+ * @param dst The destination array of db_fld fields to be filled with converted
* values.
- * @param pres A PostgreSQL result structure to be converted into SER format.
+ * @param src A PostgreSQL result structure to be converted into SER format.
* @param row Number of the row to be converted.
+ * @param types A type conversion table.
* @param flags Connection flags controlling how values are converted.
* @retval 0 on success
* @retval A negative number on error.
@@ -129,20 +122,24 @@ int pg_pg2fld(db_fld_t* dst, PGresult* src, int row, pg_type_t* types,
/** Checks if all db_fld fields have types compatible with corresponding field
* types on the server.
* The functions checks whether all db_fld fields in the last parameter are
- * compatible with column types on the server.
- * @param oids An array of Oids of corresponding columns on the server.
- * @param lenghts An array of sizes of corresponding columns on the server.
- * @param types An array used to map internal field types to Oids.
+ * compatible with column types on the server, for conversion to postgres format.
* @param fld An array of db_fld fields to be checked.
+ * @param types An array used to map internal field types to Oids.
* @retval 0 on success
* @retval A negative number on error.
*/
int pg_check_fld2pg(db_fld_t* fld, pg_type_t* types);
-
+/** Checks if all db_fld fields have types compatible with corresponding field
+ * types on the server.
+ * The functions checks whether all db_fld fields in the last parameter are
+ * compatible with column types on the server, for conversion to interal DB format.
+ * @param fld An array of db_fld fields to be checked.
+ * @param types An array used to map internal field types to Oids.
+ * @retval 0 on success
+ * @retval A negative number on error.
+ */
int pg_check_pg2fld(db_fld_t* fld, pg_type_t* types);
-/** @} */
-
#endif /* _PG_FLD_H */