- moved Call Logging functionality to it's own plugin.
This commit is contained in:
parent
9b4162b81b
commit
e8b2346781
@ -1,5 +1,7 @@
|
|||||||
0.7.1
|
0.7.1
|
||||||
=====
|
=====
|
||||||
|
02-Feb-2008: - More work on new plugin API.
|
||||||
|
- moved Call Logging functionality to it's own plugin.
|
||||||
22-Jan-2008: - closing </chapter> tag missing in docu
|
22-Jan-2008: - closing </chapter> tag missing in docu
|
||||||
21-Jan-2008: - new plugin API (dynamically loadable plugins)
|
21-Jan-2008: - new plugin API (dynamically loadable plugins)
|
||||||
|
|
||||||
|
|||||||
13
RELNOTES
13
RELNOTES
@ -2,7 +2,18 @@ Release Notes for siproxd-0.7.1
|
|||||||
===============================
|
===============================
|
||||||
|
|
||||||
Major changes since 0.7.0:
|
Major changes since 0.7.0:
|
||||||
-
|
- Plugin API
|
||||||
|
|
||||||
|
Upgrade Notes 0.7.0 to 0.7.1:
|
||||||
|
With the new plugin API, some configurations have changed in
|
||||||
|
configuration file.
|
||||||
|
- plugin_shortdial: configuration options have been renamed
|
||||||
|
pi_shortdial_akey -> plugin_shortdial_akey
|
||||||
|
pi_shortdial_entry -> plugin_shortdial_entry
|
||||||
|
- Call logging: The log_calls directive does no longer exist.
|
||||||
|
You load plugin_logcall and get logging. You don't load it
|
||||||
|
and don't get logging to syslog.
|
||||||
|
|
||||||
|
|
||||||
General Overview:
|
General Overview:
|
||||||
- SIP (RFC3261) Proxy for SIP based softphones hidden behind a
|
- SIP (RFC3261) Proxy for SIP based softphones hidden behind a
|
||||||
|
|||||||
@ -74,11 +74,6 @@ daemonize = 1
|
|||||||
# see what siproxd is doing - or NOT doing)
|
# see what siproxd is doing - or NOT doing)
|
||||||
silence_log = 1
|
silence_log = 1
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# Shall I log call establishment to syslog?
|
|
||||||
#
|
|
||||||
log_calls = 1
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Secure Enviroment settings:
|
# Secure Enviroment settings:
|
||||||
# user: uid/gid to switch to after startup
|
# user: uid/gid to switch to after startup
|
||||||
@ -295,6 +290,7 @@ plugindir=/home/hb9xar/src/siproxd/src/.libs/
|
|||||||
# List of plugins to load
|
# List of plugins to load
|
||||||
#load_plugin=plugin_demo.so
|
#load_plugin=plugin_demo.so
|
||||||
load_plugin=plugin_shortdial.so
|
load_plugin=plugin_shortdial.so
|
||||||
|
load_plugin=plugin_logcall.so
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|||||||
@ -39,13 +39,17 @@ siproxd_SOURCES = siproxd.c proxy.c register.c sock.c utils.c \
|
|||||||
# Plugin modules, installed in "pkglib" directory ($prefix/lib/siproxd/)
|
# Plugin modules, installed in "pkglib" directory ($prefix/lib/siproxd/)
|
||||||
#
|
#
|
||||||
pkglib_LTLIBRARIES = plugin_demo.la \
|
pkglib_LTLIBRARIES = plugin_demo.la \
|
||||||
plugin_shortdial.la
|
plugin_shortdial.la \
|
||||||
|
plugin_logcall.la
|
||||||
#
|
#
|
||||||
plugin_demo_la_SOURCES = plugin_demo.c
|
plugin_demo_la_SOURCES = plugin_demo.c
|
||||||
plugin_demo_la_LDFLAGS = -module
|
plugin_demo_la_LDFLAGS = -module
|
||||||
#
|
#
|
||||||
plugin_shortdial_la_SOURCES = plugin_shortdial.c
|
plugin_shortdial_la_SOURCES = plugin_shortdial.c
|
||||||
plugin_shortdial_la_LDFLAGS = -module
|
plugin_shortdial_la_LDFLAGS = -module
|
||||||
|
#
|
||||||
|
plugin_logcall_la_SOURCES = plugin_logcall.c
|
||||||
|
plugin_logcall_la_LDFLAGS = -module
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
131
src/plugin_logcall.c
Normal file
131
src/plugin_logcall.c
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2008 Thomas Ries <tries@gmx.net>
|
||||||
|
|
||||||
|
This file is part of Siproxd.
|
||||||
|
|
||||||
|
Siproxd is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Siproxd is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warrantry of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Siproxd; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
#include <osipparser2/osip_parser.h>
|
||||||
|
|
||||||
|
#include "siproxd.h"
|
||||||
|
#include "plugins.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
static char const ident[]="$Id$";
|
||||||
|
|
||||||
|
/* Plug-in identification */
|
||||||
|
static char name[]="plugin_logcall";
|
||||||
|
static char desc[]="Logs calls to syslog";
|
||||||
|
|
||||||
|
/* global configuration storage - required for config file location */
|
||||||
|
extern struct siproxd_config configuration;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialization.
|
||||||
|
* Called once suring siproxd startup.
|
||||||
|
*/
|
||||||
|
int plugin_init(plugin_def_t *plugin_def) {
|
||||||
|
/* API version number of siproxd that this plugin is built against.
|
||||||
|
* This constant will change whenever changes to the API are made
|
||||||
|
* that require adaptions in the plugin. */
|
||||||
|
plugin_def->api_version=SIPROXD_API_VERSION;
|
||||||
|
|
||||||
|
/* Name and descriptive text of the plugin */
|
||||||
|
plugin_def->name=name;
|
||||||
|
plugin_def->desc=desc;
|
||||||
|
|
||||||
|
/* Execution mask - during what stages of SIP processing shall
|
||||||
|
* the plugin be called. */
|
||||||
|
plugin_def->exe_mask=PLUGIN_PRE_PROXY;
|
||||||
|
|
||||||
|
return STS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Processing.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int plugin_process(int stage, sip_ticket_t *ticket){
|
||||||
|
osip_message_t *request;
|
||||||
|
osip_uri_t *from_url = NULL;
|
||||||
|
osip_uri_t *to_url = NULL;
|
||||||
|
char *to_username =NULL;
|
||||||
|
char *to_host = NULL;
|
||||||
|
char *from_username =NULL;
|
||||||
|
char *from_host = NULL;
|
||||||
|
char *call_type = NULL;
|
||||||
|
|
||||||
|
request=ticket->sipmsg;
|
||||||
|
/* From: 1st preference is From header, then try contact header */
|
||||||
|
if (request->from->url) {
|
||||||
|
from_url = request->from->url;
|
||||||
|
} else {
|
||||||
|
from_url = (osip_uri_t *)osip_list_get(&(request->contacts), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
to_url = request->to->url;
|
||||||
|
|
||||||
|
if (to_url) {
|
||||||
|
to_username = to_url->username;
|
||||||
|
to_host = to_url->host;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (from_url) {
|
||||||
|
from_username = from_url->username;
|
||||||
|
from_host = from_url->host;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* INVITE */
|
||||||
|
if (MSG_IS_INVITE(request)) {
|
||||||
|
if (ticket->direction==REQTYP_INCOMING) call_type="Incoming";
|
||||||
|
else call_type="Outgoing";
|
||||||
|
/* BYE / CANCEL */
|
||||||
|
} else if (MSG_IS_ACK(request)) {
|
||||||
|
call_type="ACK";
|
||||||
|
} else if (MSG_IS_BYE(request) || MSG_IS_CANCEL(request)) {
|
||||||
|
call_type="Ending";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (call_type) {
|
||||||
|
INFO("%s Call: %s@%s -> %s@%s",
|
||||||
|
call_type,
|
||||||
|
from_username ? from_username: "*NULL*",
|
||||||
|
from_host ? from_host : "*NULL*",
|
||||||
|
to_username ? to_username : "*NULL*",
|
||||||
|
to_host ? to_host : "*NULL*");
|
||||||
|
}
|
||||||
|
|
||||||
|
return STS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* De-Initialization.
|
||||||
|
* Called during shutdown of siproxd. Gives the plugin the chance
|
||||||
|
* to clean up its mess (e.g. dynamic memory allocation, database
|
||||||
|
* connections, whatever the plugin messes around with)
|
||||||
|
*/
|
||||||
|
int plugin_end(plugin_def_t *plugin_def){
|
||||||
|
return STS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
54
src/proxy.c
54
src/proxy.c
@ -111,60 +111,6 @@ int proxy_request (sip_ticket_t *ticket) {
|
|||||||
|
|
||||||
/*&&&& PLUGIN_PRE_PROXY */
|
/*&&&& PLUGIN_PRE_PROXY */
|
||||||
call_plugins(PLUGIN_PRE_PROXY, ticket);
|
call_plugins(PLUGIN_PRE_PROXY, ticket);
|
||||||
/*
|
|
||||||
* logging of passing calls
|
|
||||||
*/
|
|
||||||
/*&&&& this should be moved to its own logging plugin */
|
|
||||||
if (configuration.log_calls) {
|
|
||||||
osip_uri_t *from_url = NULL;
|
|
||||||
osip_uri_t *to_url = NULL;
|
|
||||||
char *to_username =NULL;
|
|
||||||
char *to_host = NULL;
|
|
||||||
char *from_username =NULL;
|
|
||||||
char *from_host = NULL;
|
|
||||||
char *call_type = NULL;
|
|
||||||
|
|
||||||
/* From: 1st preference is From header, then try contact header */
|
|
||||||
if (request->from->url) {
|
|
||||||
from_url = request->from->url;
|
|
||||||
} else {
|
|
||||||
from_url = (osip_uri_t *)osip_list_get(&(request->contacts), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
to_url = request->to->url;
|
|
||||||
|
|
||||||
if (to_url) {
|
|
||||||
to_username = to_url->username;
|
|
||||||
to_host = to_url->host;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (from_url) {
|
|
||||||
from_username = from_url->username;
|
|
||||||
from_host = from_url->host;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* INVITE */
|
|
||||||
if (MSG_IS_INVITE(request)) {
|
|
||||||
if (type==REQTYP_INCOMING) call_type="Incoming";
|
|
||||||
else call_type="Outgoing";
|
|
||||||
/* BYE / CANCEL */
|
|
||||||
} else if (MSG_IS_ACK(request)) {
|
|
||||||
call_type="ACK";
|
|
||||||
} else if (MSG_IS_BYE(request) || MSG_IS_CANCEL(request)) {
|
|
||||||
call_type="Ending";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (call_type) {
|
|
||||||
INFO("%s Call: %s@%s -> %s@%s",
|
|
||||||
call_type,
|
|
||||||
from_username ? from_username: "*NULL*",
|
|
||||||
from_host ? from_host : "*NULL*",
|
|
||||||
to_username ? to_username : "*NULL*",
|
|
||||||
to_host ? to_host : "*NULL*");
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* log_calls */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RFC 3261, Section 16.6 step 1
|
* RFC 3261, Section 16.6 step 1
|
||||||
|
|||||||
@ -78,7 +78,6 @@ static cfgopts_t main_cfg_opts[] = {
|
|||||||
{ "outbound_domain_host",TYP_STRINGA,&configuration.outbound_proxy_domain_host },
|
{ "outbound_domain_host",TYP_STRINGA,&configuration.outbound_proxy_domain_host },
|
||||||
{ "outbound_domain_port",TYP_STRINGA,&configuration.outbound_proxy_domain_port },
|
{ "outbound_domain_port",TYP_STRINGA,&configuration.outbound_proxy_domain_port },
|
||||||
{ "registration_file", TYP_STRING, &configuration.registrationfile },
|
{ "registration_file", TYP_STRING, &configuration.registrationfile },
|
||||||
{ "log_calls", TYP_INT4, &configuration.log_calls },
|
|
||||||
{ "pid_file", TYP_STRING, &configuration.pid_file },
|
{ "pid_file", TYP_STRING, &configuration.pid_file },
|
||||||
{ "default_expires", TYP_INT4, &configuration.default_expires },
|
{ "default_expires", TYP_INT4, &configuration.default_expires },
|
||||||
{ "autosave_registrations",TYP_INT4, &configuration.autosave_registrations },
|
{ "autosave_registrations",TYP_INT4, &configuration.autosave_registrations },
|
||||||
|
|||||||
@ -91,7 +91,6 @@ struct siproxd_config {
|
|||||||
stringa_t outbound_proxy_domain_host;
|
stringa_t outbound_proxy_domain_host;
|
||||||
stringa_t outbound_proxy_domain_port;
|
stringa_t outbound_proxy_domain_port;
|
||||||
char *registrationfile;
|
char *registrationfile;
|
||||||
int log_calls;
|
|
||||||
char *pid_file;
|
char *pid_file;
|
||||||
int default_expires;
|
int default_expires;
|
||||||
int autosave_registrations;
|
int autosave_registrations;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user