Freeswitch-trunk
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
June 2009
- 21 participants
- 501 discussions
[commit] r13991 - in freeswitch/trunk/contrib/mod/endpoints/mod_khomp: src tools
by FreeSWITCH SVN 26 Jun '09
by FreeSWITCH SVN 26 Jun '09
26 Jun '09
Author: raulfragoso
Date: Fri Jun 26 18:33:24 2009
New Revision: 13991
Log:
Even more khomp files
Added:
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/globals.cpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/opt.cpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/tools/
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/tools/generate-k3l-header.pl (contents, props changed)
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/globals.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/globals.cpp Fri Jun 26 18:33:24 2009
@@ -0,0 +1,17 @@
+#include "globals.h"
+
+
+K3LAPI Globals::_k3lapi;
+
+config_options Globals::_options;
+
+switch_endpoint_interface_t * Globals::_khomp_endpoint_interface;
+switch_api_interface_t * Globals::_api_interface;
+switch_memory_pool_t * Globals::_module_pool = NULL;
+int Globals::_running = 1;
+
+unsigned int Globals::_flags;
+int Globals::_calls;
+switch_mutex_t * Globals::_mutex;
+
+
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/khomp_pvt.cpp Fri Jun 26 18:33:24 2009
@@ -0,0 +1,3 @@
+#include "khomp_pvt.h"
+
+KhompPvt::KhompPvtVector KhompPvt::_pvts;
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/opt.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/src/opt.cpp Fri Jun 26 18:33:24 2009
@@ -0,0 +1,91 @@
+#include "opt.h"
+
+#include "globals.h"
+
+
+bool Opt::_debug;
+char * Opt::_ip;
+int Opt::_port;
+
+char * Opt::_dialplan;
+char * Opt::_codec_string;
+char * Opt::_codec_order[SWITCH_MAX_CODECS];
+int Opt::_codec_order_last;
+char * Opt::_codec_rates_string;
+char * Opt::_codec_rates[SWITCH_MAX_CODECS];
+int Opt::_codec_rates_last;
+
+
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, Opt::_dialplan);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, Opt::_codec_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, Opt::_codec_rates_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ip, Opt::_ip);
+
+
+
+void Opt::initialize(void)
+{
+ Globals::_options.add(config_option("debug", _debug, false));
+ //Globals::options.add(config_option("port", _port, ???));
+ //Globals::options.add(config_option("ip", _ip, ???));
+ //Globals::options.add(config_option("dialplan", _dialplan, ???));
+ //Globals::options.add(config_option("ip", _ip, ???));
+}
+
+void Opt::obtain(void)
+{
+ load_configuration("khomp.conf", NULL);
+}
+
+void Opt::load_configuration(const char *file_name, const char **section, bool show_errors)
+{
+ switch_xml_t cfg, xml, settings, param;
+
+ switch_mutex_init(&Globals::_mutex, SWITCH_MUTEX_NESTED, Globals::_module_pool);
+ if (!(xml = switch_xml_open_cfg(file_name, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", file_name);
+ return;
+ }
+
+ 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, "_debug")) {
+ Globals::_options.process(var, val);
+ //_debug = atoi(val);
+ } else if (!strcmp(var, "port")) {
+ _port = atoi(val);
+ } else if (!strcmp(var, "ip")) {
+ set_global_ip(val);
+ //} else if (!strcmp(var, "codec-master")) {
+ //if (!strcasecmp(val, "us")) {
+ // switch_set_flag(&globals, GFLAG_MY_CODEC_PREFS);
+ //}
+ } else if (!strcmp(var, "dialplan")) {
+ set_global_dialplan(val);
+ } else if (!strcmp(var, "codec-prefs")) {
+ set_global_codec_string(val);
+ _codec_order_last = switch_separate_string(_codec_string, ',', _codec_order, SWITCH_MAX_CODECS);
+ } else if (!strcmp(var, "codec-rates")) {
+ set_global_codec_rates_string(val);
+ _codec_rates_last = switch_separate_string(_codec_rates_string, ',', _codec_rates, SWITCH_MAX_CODECS);
+ }
+ }
+ }
+
+ if (!_dialplan) {
+ set_global_dialplan("default");
+ }
+
+ if (!_port) {
+ _port = 4569;
+ }
+
+ switch_xml_free(xml);
+
+}
+void Opt::clean_configuration(void){}
+
+
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/tools/generate-k3l-header.pl
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/tools/generate-k3l-header.pl Fri Jun 26 18:33:24 2009
@@ -0,0 +1,102 @@
+#!/usr/bin/perl
+
+my @files =
+ ( 'KTypeDefs.h', 'KVoIP.h', 'KDefs.h', 'KErrorDefs.h', 'KH100Defs.h',
+ 'KMixerDefs.h', 'KR2D.h', 'KISDN.h', 'KGSM.h', 'KStats.h', 'k3lVersion.h', 'k3l.h' );
+
+my $text = "";
+
+foreach my $file (@files)
+{
+ open FILE, ('api/' . $file);
+
+ while (<FILE>)
+ {
+ $text .= $_;
+ }
+
+ close (FILE);
+}
+
+$text =~ s/[\/][\*](.+?)[\*][\/]//smg;
+$text =~ s/[\/][\/](.+)//mg;
+$text =~ s/\#include.+\n//g;
+$text =~ s/\n\n/\n/mg;
+
+my $header =
+"/*
+ KHOMP endpoint provider for FreeSWITCH(tm)
+ Copyright (C) 2007-2009 Khomp Ind. & Com.
+
+ 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.
+
+ Alternatively, the contents of this file may be used under the terms of the
+ \"GNU Lesser General Public License 2.1\" license (the “LGPL\" License), in which
+ case the provisions of \"LGPL License\" are applicable instead of those above.
+
+ If you wish to allow use of your version of this file only under the terms of
+ the LGPL License and not to allow others to use your version of this file under
+ the MPL, indicate your decision by deleting the provisions above and replace them
+ with the notice and other provisions required by the LGPL License. If you do not
+ delete the provisions above, a recipient may use your version of this file under
+ either the MPL or the LGPL License.
+
+ The LGPL header follows below:
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
+
+";
+
+my $footer =
+"
+enum KISDNDebugFlag
+{
+ kidfQ931 = 0x01,
+ kidfLAPD = 0x02,
+ kidfSystem = 0x04,
+ kidfInvalid = 0x08,
+};
+
+#define CM_VOIP_START_DEBUG 0x20
+#define CM_VOIP_STOP_DEBUG 0x21
+#define CM_VOIP_DUMP_STAT 0x22
+
+#define CM_ISDN_DEBUG 0x24
+
+#define CM_PING 0x123456
+#define EV_PONG 0x654321
+
+#define CM_LOG_REQUEST 0x100
+#define CM_LOG_CREATE_DISPATCHER 0x101
+#define CM_LOG_DESTROY_DISPATCHER 0x102
+
+";
+
+open FILE, '>', '../include/k3lDefs.h';
+print FILE $header;
+print FILE "#ifndef INCLUDED_K3LDEFS_H\n";
+print FILE "#define INCLUDED_K3LDEFS_H\n";
+print FILE $text;
+print FILE $footer;
+print FILE "#endif /* INCLUDED_K3LDEFS_H */\n";
+close FILE;
1
0
[commit] r13990 - in freeswitch/trunk/contrib/mod/endpoints/mod_khomp: commons include
by FreeSWITCH SVN 26 Jun '09
by FreeSWITCH SVN 26 Jun '09
26 Jun '09
Author: raulfragoso
Date: Fri Jun 26 18:24:24 2009
New Revision: 13990
Log:
More files from Khomp
Added:
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/strings.hpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/types.hpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/globals.h
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/k3lDefs.h
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/khomp_pvt.h
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/mod_khomp.h
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/opt.h
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/strings.hpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/strings.hpp Fri Jun 26 18:24:24 2009
@@ -0,0 +1,63 @@
+#include <limits.h>
+
+#include <list>
+#include <vector>
+#include <string>
+
+#include <format.hpp>
+
+#include <types.hpp>
+
+/* Generic string funcions */
+
+#ifndef INCLUDED_STRINGS_HPP
+#define INCLUDED_STRINGS_HPP
+
+struct Strings
+{
+ typedef std::list<std::string> list_type;
+ typedef std::vector<std::string> vector_type;
+
+ struct Merger
+ {
+ void add(std::string);
+
+ std::string merge(const std::string &);
+ std::string merge(const char *);
+
+ bool empty() { return _list.empty(); };
+
+ protected:
+ list_type _list;
+ };
+
+ public:
+ struct invalid_value
+ {
+ invalid_value(const char * value): _value(value) {};
+ invalid_value(std::string value): _value(value) {};
+
+ std::string & value() { return _value; }
+
+ protected:
+ std::string _value;
+ };
+
+ struct not_implemented {};
+
+ static void tokenize(const std::string &, vector_type &, const std::string & delims = ",;:", long int max_toxens = LONG_MAX);
+
+ static bool toboolean(std::string);
+ static std::string fromboolean(bool);
+
+ static long tolong(std::string, int base = 10);
+ static unsigned long toulong(std::string, int base = 10);
+ static unsigned long long toulonglong(std::string, int base = 10);
+
+ static std::string lower(std::string);
+ static std::string hexadecimal(std::string);
+
+ static std::string trim(const std::string&, const std::string& trim_chars = " \f\n\r\t\v");
+};
+
+#endif // INCLUDED_STRINGS_HPP //
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/types.hpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/types.hpp Fri Jun 26 18:24:24 2009
@@ -0,0 +1,169 @@
+#ifndef INCLUDED_TYPES_HPP
+#define INCLUDED_TYPES_HPP
+
+#if defined(LINUX) || defined(__LINUX__) || defined(__linux__)
+#include <stdlib.h>
+#endif
+
+/*** Used for conditional compilation based on K3L version ***/
+
+#define K3L_AT_LEAST(major,minor,build) \
+ (((k3lApiMajorVersion == major) && ((k3lApiMinorVersion == minor) && (k3lApiBuildVersion >= build)) || \
+ ((k3lApiMajorVersion == major) && (k3lApiMinorVersion > minor))) || \
+ (k3lApiMajorVersion > major))
+
+#define K3L_EXACT(major,minor,build) \
+ ((k3lApiMajorVersion == major) && (k3lApiMinorVersion == minor) && (k3lApiBuildVersion >= build))
+
+/**** Used for indexing any kind of Khomp object. ****/
+
+typedef unsigned short int ushort;
+
+template <class value_type>
+struct ktype_id
+{
+ ktype_id(value_type id): _id(id) {};
+
+ value_type id(void) { return _id; };
+
+ protected:
+ value_type _id;
+};
+
+struct deviceId: ktype_id<ushort> { deviceId(ushort id): ktype_id<ushort>(id) {}; };
+struct channelId: ktype_id<ushort> { channelId(ushort id): ktype_id<ushort>(id) {}; };
+struct playerId: ktype_id<ushort> { playerId(ushort id): ktype_id<ushort>(id) {}; };
+struct mixerId: ktype_id<ushort> { mixerId(ushort id): ktype_id<ushort>(id) {}; };
+struct linkId: ktype_id<ushort> { linkId(ushort id): ktype_id<ushort>(id) {}; };
+
+struct kobject
+{
+ struct hash;
+ struct less;
+ struct equal;
+ struct hashLess;
+
+ struct item
+ {
+ typedef enum
+ {
+ DEVICE = 1,
+ CHANNEL = 2,
+ PLAYER = 3,
+ MIXER = 4,
+ LINK = 5,
+ }
+ type_t;
+
+ item(deviceId dev)
+ {
+ _type = DEVICE;
+ _dev = dev.id();
+ _obj = 0xffff;
+ };
+
+ item(deviceId dev, channelId chan)
+ {
+ _type = CHANNEL;
+ _dev = dev.id();
+ _obj = chan.id();
+ };
+
+ item(deviceId dev, playerId play)
+ {
+ _type = PLAYER;
+ _dev = dev.id();
+ _obj = play.id();
+ };
+
+ item(deviceId dev, mixerId mix)
+ {
+ _type = MIXER;
+ _dev = dev.id();
+ _obj = mix.id();
+ };
+
+ item(deviceId dev, linkId lnk)
+ {
+ _type = LINK;
+ _dev = dev.id();
+ _obj = lnk.id();
+ };
+
+ type_t type() { return _type; };
+ ushort device() { return _dev; };
+ ushort object() { return _obj; };
+
+ protected:
+ type_t _type;
+ ushort _dev;
+ ushort _obj;
+
+ private:
+ item();
+
+ friend struct kobject::hash;
+ friend struct kobject::less;
+ friend struct kobject::equal;
+ friend struct kobject::hashLess;
+ };
+
+ struct hash
+ {
+ size_t operator()(const item &i) const
+ {
+ return (((ushort) (i._type)) << 28) + ((i._dev) << 16) + (i._obj);
+ }
+ };
+
+ struct equal
+ {
+ bool operator()(const item &i1, const item &i2) const
+ {
+ return
+ ((i1._type == i2._type) &&
+ (i1._dev == i2._dev) &&
+ (i1._obj == i2._obj));
+ }
+ };
+
+ struct less
+ {
+ bool comp(const item &i1, const item &i2) const
+ {
+ if (i1._type < i2._type)
+ return true;
+
+ if (i1._type == i2._type)
+ {
+ if (i1._dev < i2._dev)
+ return true;
+
+ if (i1._dev == i2._dev)
+ {
+ if (i1._obj < i2._obj)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+ bool operator()(const item &i1, const item &i2) const
+ {
+ return comp(i1,i2);
+ }
+ };
+
+ struct hashLess
+ : public hash, public less
+ {
+ public:
+ static const size_t bucket_size = 4;
+ static const size_t min_buckets = 8;
+ };
+};
+
+#endif /* INCLUDED_TYPES_HPP */
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/globals.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/globals.h Fri Jun 26 18:24:24 2009
@@ -0,0 +1,38 @@
+#ifndef _GLOBALS_H_
+#define _GLOBALS_H_
+
+#include "k3lapi.hpp"
+
+#include <config_options.hpp>
+
+#include <vector>
+
+extern "C"
+{
+ #include <switch.h>
+}
+
+
+struct Globals
+{
+
+ static K3LAPI _k3lapi;
+
+ /* Config options class */
+ static config_options _options;
+
+
+
+ static switch_endpoint_interface_t *_khomp_endpoint_interface;
+ static switch_api_interface_t *_api_interface;
+ static switch_memory_pool_t *_module_pool;
+ static int _running;
+
+ static unsigned int _flags;
+ static int _calls;
+ static switch_mutex_t *_mutex;
+
+};
+
+
+#endif /* _GLOBALS_H_ */
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/k3lDefs.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/k3lDefs.h Fri Jun 26 18:24:24 2009
@@ -0,0 +1,66 @@
+/*
+ KHOMP endpoint provider for FreeSWITCH(tm)
+ Copyright (C) 2007-2009 Khomp Ind. & Com.
+
+ 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.
+
+ Alternatively, the contents of this file may be used under the terms of the
+ "GNU Lesser General Public License 2.1" license (the “LGPL" License), in which
+ case the provisions of "LGPL License" are applicable instead of those above.
+
+ If you wish to allow use of your version of this file only under the terms of
+ the LGPL License and not to allow others to use your version of this file under
+ the MPL, indicate your decision by deleting the provisions above and replace them
+ with the notice and other provisions required by the LGPL License. If you do not
+ delete the provisions above, a recipient may use your version of this file under
+ either the MPL or the LGPL License.
+
+ The LGPL header follows below:
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
+
+#ifndef INCLUDED_K3LDEFS_H
+#define INCLUDED_K3LDEFS_H
+
+enum KISDNDebugFlag
+{
+ kidfQ931 = 0x01,
+ kidfLAPD = 0x02,
+ kidfSystem = 0x04,
+ kidfInvalid = 0x08,
+};
+
+#define CM_VOIP_START_DEBUG 0x20
+#define CM_VOIP_STOP_DEBUG 0x21
+#define CM_VOIP_DUMP_STAT 0x22
+
+#define CM_ISDN_DEBUG 0x24
+
+#define CM_PING 0x123456
+#define EV_PONG 0x654321
+
+#define CM_LOG_REQUEST 0x100
+#define CM_LOG_CREATE_DISPATCHER 0x101
+#define CM_LOG_DESTROY_DISPATCHER 0x102
+
+#endif /* INCLUDED_K3LDEFS_H */
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/khomp_pvt.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/khomp_pvt.h Fri Jun 26 18:24:24 2009
@@ -0,0 +1,80 @@
+#ifndef _KHOMP_PVT_H_
+#define _KHOMP_PVT_H_
+
+#include "globals.h"
+
+struct KhompPvt
+{
+
+ typedef std::vector < KhompPvt * > PvtVectorType;
+ typedef std::vector < PvtVectorType > PvtVector2Type;
+ typedef PvtVector2Type KhompPvtVector;
+
+ KhompPvt(K3LAPI::target & target)
+ : _target(target), _session(NULL) {};
+
+ K3LAPI::target target()
+ {
+ return _target;
+ }
+
+ void session(switch_core_session_t * newSession)
+ {
+ _session = newSession;
+ }
+
+ switch_core_session_t * session()
+ {
+ return _session;
+ }
+
+ static KhompPvt * khompPvt(int32 device, int32 object)
+ {
+ if (!Globals::_k3lapi.valid_channel(device, object))
+ throw K3LAPI::invalid_channel(device, object);
+
+ return _pvts[device][object];
+ }
+
+ static KhompPvt * khompPvt(K3LAPI::target & target)
+ {
+ return _pvts[target.device][target.object];
+ }
+
+ static void initialize(void)
+ {
+
+//// tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))
+ //for (unsigned dev = 0; dev < Globals::_k3lapi.device_count(); dev++)
+ //{
+ // _pvts.push_back(std::vector<KhompPvt>());
+
+ //for (unsigned obj = 0; obj < Globals::_k3lapi.channel_count(obj); obj++)
+ //_pvts.back().push_back(KhompPvt(K3LAPI::target(Globals::_k3lapi, K3LAPI::target::CHANNEL, dev, obj)));
+ // }
+ }
+
+ K3LAPI::target _target;
+ switch_core_session_t * _session;
+
+ unsigned int flags; //TODO: Alterar o nome depois
+
+ switch_codec_t _read_codec;
+ switch_codec_t _write_codec;
+
+ switch_frame_t _read_frame;
+
+ unsigned char _databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+
+ switch_caller_profile_t *_caller_profile;
+
+ switch_mutex_t *_mutex;
+ switch_mutex_t *flag_mutex; //TODO: Alterar o nome depois
+
+ /* static stuff */
+ static KhompPvtVector _pvts;
+};
+
+
+
+#endif /* _KHOMP_PVT_H_*/
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/mod_khomp.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/mod_khomp.h Fri Jun 26 18:24:24 2009
@@ -0,0 +1,10 @@
+#ifndef _MOD_KHOMP_H_
+#define _MOD_KHOMP_H_
+
+#include "globals.h"
+#include "khomp_pvt.h"
+#include "opt.h"
+
+
+
+#endif /* _MOD_KHOMP_H_ */
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/opt.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/include/opt.h Fri Jun 26 18:24:24 2009
@@ -0,0 +1,42 @@
+#ifndef _OPT_H_
+#define _OPT_H_
+
+struct Opt
+{
+
+ typedef enum {
+ GFLAG_MY_CODEC_PREFS = (1 << 0)
+ } GFLAGS;
+
+
+ static void initialize(void);
+ static void obtain(void);
+
+
+protected:
+
+ static void load_configuration(const char *, const char **, bool show_errors = true);
+ static void clean_configuration(void);
+
+
+public:
+ static bool _debug;
+ static char *_ip;
+ static int _port;
+ static char *_dialplan;
+ static char *_codec_string;
+ static char *_codec_order[]; //[SWITCH_MAX_CODECS]
+ static int _codec_order_last;
+ static char *_codec_rates_string;
+ static char *_codec_rates[]; //[SWITCH_MAX_CODECS]
+ static int _codec_rates_last;
+
+
+
+};
+
+
+
+
+
+#endif /* _OPT_H_ */
1
0
[commit] r13989 - in freeswitch/trunk/contrib/mod/endpoints/mod_khomp: . commons
by FreeSWITCH SVN 26 Jun '09
by FreeSWITCH SVN 26 Jun '09
26 Jun '09
Author: raulfragoso
Date: Fri Jun 26 18:20:45 2009
New Revision: 13989
Log:
Merge of changes from Khomp plus some minor changes in the code structure
Added:
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/config_options.cpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/config_options.hpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/format.cpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/format.hpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/k3lapi.hpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/strings.cpp
Modified:
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/Makefile
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/k3lapi.cpp
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp
Modified: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/Makefile
==============================================================================
--- freeswitch/trunk/contrib/mod/endpoints/mod_khomp/Makefile (original)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/Makefile Fri Jun 26 18:20:45 2009
@@ -1,6 +1,8 @@
MODNAME=mod_khomp
-LOCAL_CFLAGS=-I./include -I./commons/include -lk3l -D_REENTRANT -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DK3L_HOSTSYSTEM
+VERBOSE=1
+LOCAL_CFLAGS=-I./include -I./commons -D_REENTRANT -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DK3L_HOSTSYSTEM
+LOCAL_LDFLAGS=-lk3l
+LOCAL_OBJS= ./commons/k3lapi.o ./commons/config_options.o ./commons/format.o ./commons/strings.o
+LOCAL_OBJS+= ./src/globals.o ./src/opt.o ./src/khomp_pvt.o
-LOCAL_OBJS= ./commons/k3lapi.o
-
-include ../../../build/modmake.rules
+include ../../../../build/modmake.rules
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/config_options.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/config_options.cpp Fri Jun 26 18:20:45 2009
@@ -0,0 +1,665 @@
+#include <config_options.hpp>
+
+config_option::config_option(std::string name, const config_option::string_type & value, const config_option::string_type defvalue, string_allowed_type allowed, bool list_me)
+: _my_name(name), _value_data(new string_data_type(const_cast<string_type &>(value), defvalue, allowed)),
+ _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, const config_option::string_type & value, const config_option::string_type defvalue, bool list_me)
+: _my_name(name), _value_data(new string_data_type(const_cast<string_type &>(value), defvalue, string_allowed_type())),
+ _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, const config_option::sint_type & value, const config_option::sint_type defvalue,
+ config_option::sint_type min, config_option::sint_type max, config_option::sint_type step, bool list_me)
+: _my_name(name), _value_data(new sint_data_type(const_cast<sint_type &>(value), defvalue, range<sint_type>(min, max, step))),
+ _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, const config_option::uint_type & value, const config_option::uint_type defvalue,
+ config_option::uint_type min, config_option::uint_type max, config_option::uint_type step, bool list_me)
+: _my_name(name), _value_data(new uint_data_type(const_cast<uint_type &>(value), defvalue, range<uint_type>(min, max, step))),
+ _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, const config_option::bool_type & value, const config_option::bool_type defvalue, bool list_me)
+: _my_name(name), _value_data(new bool_data_type(const_cast<bool_type &>(value), defvalue)),
+ _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, config_option::fun_type fun, std::string defvalue, string_allowed_type allowed, bool list_me)
+: _my_name(name), _value_data(new fun_data_type(fun, defvalue, allowed)),
+ _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::config_option(std::string name, config_option::fun_type fun, std::string defvalue, bool list_me)
+: _my_name(name), _value_data(new fun_data_type(fun, defvalue, string_allowed_type())),
+ _list_me(list_me), _values(NULL), _loaded(false)
+{};
+
+config_option::~config_option(void)
+{
+ if (_values)
+ {
+ for (unsigned int i = 0; _values[i] != NULL; i++)
+ delete _values[i];
+
+ delete[] _values;
+ }
+};
+
+void config_option::set(config_option::string_type value)
+{
+ switch (_value_data.which())
+ {
+ case ID_STRING:
+ {
+ try
+ {
+ string_data_type & tmp = _value_data.get<string_data_type>();
+
+
+ if (tmp.string_allowed.empty())
+ {
+ tmp.string_val = value;
+ _loaded = true;
+ }
+ else
+ {
+ if (tmp.string_allowed.find(value) != tmp.string_allowed.end())
+ {
+ tmp.string_val = value;
+ _loaded = true;
+ return;
+ }
+
+ std::string allowed_string;
+
+ for (string_allowed_type::iterator i = tmp.string_allowed.begin(); i != tmp.string_allowed.end(); i++)
+ {
+ allowed_string += " '";
+ allowed_string += (*i);
+ allowed_string += "'";
+ }
+
+ throw config_process_failure(STG(FMT("value '%s' not allowed for option '%s' (allowed values:%s)")
+ % value % _my_name % allowed_string));
+ }
+ break;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+ }
+
+ case ID_FUN:
+ {
+ try
+ {
+ fun_data_type & tmp = _value_data.get<fun_data_type>();
+ tmp.fun_val(value);
+ _loaded = true;
+ break;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+
+ }
+
+ default:
+ {
+ throw config_process_failure(STG(FMT("option '%s' is not of type string, nor function defined") % _my_name));
+ }
+ }
+}
+
+void config_option::set(config_option::sint_type value)
+{
+ try
+ {
+ sint_data_type & tmp = _value_data.get<sint_data_type>();
+
+ if (value < tmp.sint_range.minimum)
+ throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (too low)") % value % _my_name));
+
+ if (value > tmp.sint_range.maximum)
+ throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (too high)") % value % _my_name));
+
+ if (((value - tmp.sint_range.minimum) % tmp.sint_range.step) != 0)
+ throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (outside allowed step)") % value % _my_name));
+
+ tmp.sint_val = value;
+ _loaded = true;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+}
+
+void config_option::set(config_option::uint_type value)
+{
+ try
+ {
+ uint_data_type & tmp = _value_data.get<uint_data_type>();
+
+ if (value < tmp.uint_range.minimum)
+ throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (too low)") % value % _my_name));
+
+ if (value > tmp.uint_range.maximum)
+ throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (too high)") % value % _my_name));
+
+ if (((value - tmp.uint_range.minimum) % tmp.uint_range.step) != 0)
+ throw config_process_failure(STG(FMT("value '%d' out-of-range for option '%s' (outside allowed step)") % value % _my_name));
+
+ tmp.uint_val = value;
+ _loaded = true;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+}
+
+void config_option::set(config_option::bool_type value)
+{
+ try
+ {
+ bool_data_type & tmp = _value_data.get<bool_data_type>();
+ tmp.bool_val = value;
+ _loaded = true;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+
+}
+
+std::string & config_option::name(void) { return _my_name; };
+
+config_option::value_id_type config_option::type(void)
+{
+ return (value_id_type) _value_data.which();
+};
+
+const char ** config_option::values(void)
+{
+ if (_values != NULL)
+ return _values;
+
+ switch ((value_id_type) _value_data.which())
+ {
+ case config_option::ID_BOOL:
+ {
+ _values = new const char*[3];
+
+ _values[0] = strdup("yes");
+ _values[1] = strdup("no");
+ _values[2] = NULL;
+
+ return _values;
+ }
+
+ case config_option::ID_SINT:
+ {
+ try
+ {
+ sint_data_type & tmp = _value_data.get<sint_data_type>();
+
+
+ unsigned int count = ((tmp.sint_range.maximum - tmp.sint_range.minimum) / tmp.sint_range.step) + 1;
+ unsigned int index = 0;
+
+ _values = new const char*[count + 1];
+
+ for (sint_type i = tmp.sint_range.minimum; i <= tmp.sint_range.maximum; i += tmp.sint_range.step, index++)
+ _values[index] = strdup(STG(FMT("%d") % i).c_str());
+
+ _values[index] = NULL;
+
+ return _values;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+ }
+
+ case config_option::ID_UINT:
+ {
+ try
+ {
+ uint_data_type & tmp = _value_data.get<uint_data_type>();
+
+ unsigned int count = ((tmp.uint_range.maximum - tmp.uint_range.minimum) / tmp.uint_range.step) + 1;
+ unsigned int index = 0;
+
+ _values = new const char*[count + 1];
+
+ for (uint_type i = tmp.uint_range.minimum; i <= tmp.uint_range.maximum; i += tmp.uint_range.step, index++)
+ _values[index] = strdup(STG(FMT("%d") % i).c_str());
+
+ _values[index] = NULL;
+
+ return _values;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+ }
+
+ case config_option::ID_STRING:
+ {
+ try
+ {
+ string_data_type & tmp = _value_data.get<string_data_type>();
+
+ _values = new const char*[ tmp.string_allowed.size() + 1 ];
+
+ unsigned int index = 0;
+
+ for (string_allowed_type::iterator i = tmp.string_allowed.begin(); i != tmp.string_allowed.end(); i++, index++)
+ _values[index] = strdup((*i).c_str());
+
+ _values[index] = NULL;
+
+ return _values;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+ }
+
+ case config_option::ID_FUN:
+ {
+ try
+ {
+ fun_data_type & tmp = _value_data.get<fun_data_type>();
+
+ _values = new const char*[ tmp.fun_allowed.size() + 1 ];
+
+ unsigned int index = 0;
+
+ for (string_allowed_type::iterator i = tmp.fun_allowed.begin(); i != tmp.fun_allowed.end(); i++, index++)
+ _values[index] = strdup((*i).c_str());
+
+ _values[index] = NULL;
+ return _values;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+
+ }
+
+ default:
+ throw config_process_failure(STG(FMT("unknown type identifier '%d'") % _value_data.which()));
+ }
+};
+
+void config_option::reset(void)
+{
+ _loaded = false;
+};
+
+void config_option::commit(void)
+{
+ if (_loaded)
+ return;
+
+ switch ((value_id_type) _value_data.which())
+ {
+ case config_option::ID_BOOL:
+ {
+ try
+ {
+ bool_data_type & tmp = _value_data.get<bool_data_type>();
+ tmp.bool_val = tmp.bool_default;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+
+ break;
+ }
+
+ case config_option::ID_SINT:
+ {
+ try
+ {
+ sint_data_type & tmp = _value_data.get<sint_data_type>();
+ tmp.sint_val = tmp.sint_default;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+ break;
+ }
+
+ case config_option::ID_UINT:
+ {
+ try
+ {
+ uint_data_type & tmp = _value_data.get<uint_data_type>();
+ tmp.uint_val = tmp.uint_default;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+ break;
+ }
+
+ case config_option::ID_STRING:
+ {
+ try
+ {
+ string_data_type & tmp = _value_data.get<string_data_type>();
+ tmp.string_val = tmp.string_default;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+ break;
+ }
+
+ case config_option::ID_FUN:
+ {
+ try
+ {
+ fun_data_type & tmp = _value_data.get<fun_data_type>();
+ tmp.fun_val(tmp.fun_default);
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+ break;
+ }
+
+ default:
+ throw config_process_failure(STG(FMT("unknown type identifier '%d'") % _value_data.which()));
+ }
+
+ _loaded = true;
+};
+
+void config_option::copy_from(config_option & src)
+{
+ if (src._value_data.which() != _value_data.which())
+ throw config_process_failure(STG(FMT("unable to copy options, source type differs from destination.")));
+
+ if (!src._loaded)
+ return;
+
+ switch ((value_id_type) _value_data.which())
+ {
+ case config_option::ID_BOOL:
+ {
+ try
+ {
+ bool_data_type & stmp = src._value_data.get<bool_data_type>();
+ bool_data_type & dtmp = _value_data.get<bool_data_type>();
+ /* do not copy references, but values.. */
+ bool tmpval = stmp.bool_val;
+ dtmp.bool_val = tmpval;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+
+ break;
+ }
+
+ case config_option::ID_SINT:
+ {
+ try
+ {
+ sint_data_type & stmp = src._value_data.get<sint_data_type>();
+ sint_data_type & dtmp = _value_data.get<sint_data_type>();
+ /* do not copy references, but values.. */
+ int tmpval = stmp.sint_val;
+ dtmp.sint_val = tmpval;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+
+ break;
+ }
+
+ case config_option::ID_UINT:
+ {
+ try
+ {
+ uint_data_type & stmp = src._value_data.get<uint_data_type>();
+ uint_data_type & dtmp = _value_data.get<uint_data_type>();
+ /* do not copy references, but values.. */
+ unsigned int tmpval = stmp.uint_val;
+ dtmp.uint_val = tmpval;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+
+
+ break;
+ }
+
+ case config_option::ID_STRING:
+ {
+ try
+ {
+ string_data_type & stmp = src._value_data.get<string_data_type>();
+ string_data_type & dtmp = _value_data.get<string_data_type>();
+ /* do not copy references, but values.. */
+ std::string tmpval = stmp.string_val;
+ dtmp.string_val = tmpval;
+ }
+ catch(value_type::InvalidType & e)
+ {
+ throw;
+ }
+
+ break;
+ }
+
+ case config_option::ID_FUN:
+ {
+ /* TO IMPLEMENT (NEEDS ANOTHER METHOD ON FUNCTION FOR GETTING VALUE) */
+
+// fun_data_type & tmp = boost::get<fun_data_type>(_value_data);
+//
+// if (!tmp.loaded)
+// {
+// tmp.fun_val(tmp.fun_default);
+// tmp.loaded = true;
+// }
+ break;
+ }
+
+ default:
+ throw config_process_failure(STG(FMT("unknown type identifier '%d'") % _value_data.which()));
+ }
+
+ _loaded = true;
+};
+
+/*********************************/
+
+bool config_options::add(config_option option)
+{
+ //option_map_type::iterator iter2 = _map.begin();
+
+ //boost::tie(iter2, ok2)
+ std::pair<option_map_type::iterator, bool> ret = _map.insert(option_pair_type(option.name(), option));
+
+ return ret.second;
+}
+
+bool config_options::synonym(std::string equiv_opt, std::string main_opt)
+{
+ //syn_option_map_type::iterator iter = _syn_map.begin();
+
+ //boost::tie(iter, ok)
+ std::pair<syn_option_map_type::iterator, bool> ret = _syn_map.insert(syn_option_pair_type(equiv_opt, main_opt));
+
+ return ret.second;
+}
+
+config_options::string_set config_options::options(void)
+{
+ string_set res;
+
+ for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++)
+ res.insert((*i).first);
+
+ return res;
+}
+
+void config_options::process(const char * name, const char * value)
+{
+ option_map_type::iterator iter = find_option(name);
+
+ if (iter == _map.end())
+ throw config_process_failure(STG(FMT("unknown option '%s'") % name));
+
+ try
+ {
+ switch ((*iter).second.type())
+ {
+ case config_option::ID_SINT:
+ set<config_option::sint_type>((*iter).first, Strings::toulong(value));
+ return;
+ case config_option::ID_UINT:
+ set<config_option::uint_type>((*iter).first, Strings::tolong(value));
+ return;
+ case config_option::ID_BOOL:
+ set<config_option::bool_type>((*iter).first, Strings::toboolean(value));
+ return;
+ case config_option::ID_STRING:
+ case config_option::ID_FUN:
+ set<config_option::string_type>((*iter).first, std::string(value));
+ return;
+ default:
+ throw config_process_failure(STG(FMT("unknown type identifier '%d'") % (*iter).second.type()));
+ }
+ }
+ catch (Strings::invalid_value e)
+ {
+ throw config_process_failure(STG(FMT("invalid value '%s' for option '%s'") % value % name));
+ }
+}
+
+const char ** config_options::values(const char * name)
+{
+ option_map_type::iterator iter = find_option(name);
+
+ if (iter == _map.end())
+ throw config_process_failure(STG(FMT("unknown option '%s'") % name));
+
+ return (*iter).second.values();
+}
+
+const char ** config_options::values(void)
+{
+ if (_values != NULL)
+ return _values;
+
+ unsigned int count = 0;
+
+ for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++)
+ if ((*i).second.list_me())
+ ++count;
+
+ _values = new const char*[ count + 1 ];
+
+ unsigned int index = 0;
+
+ for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++)
+ {
+ if ((*i).second.list_me())
+ {
+ _values[index] = strdup((*i).first.c_str());
+ ++index;
+ }
+ }
+
+ _values[index] = NULL;
+
+ return _values;
+}
+
+void config_options::reset(void)
+{
+ for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++)
+ (*i).second.reset();
+}
+
+config_options::messages_type config_options::commit(void)
+{
+ messages_type msgs;
+
+ for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++)
+ {
+ try
+ {
+ (*i).second.commit();
+ }
+ catch (config_process_failure e)
+ {
+ msgs.push_back(e.msg);
+ }
+ }
+
+ return msgs;
+}
+
+bool config_options::loaded(std::string name)
+{
+ option_map_type::iterator iter = find_option(name);
+
+ if (iter == _map.end())
+ return false;
+
+ return iter->second.loaded();
+}
+
+void config_options::copy_from(config_options & source, std::string name)
+{
+ option_map_type::iterator iter_src = source.find_option(name);
+ option_map_type::iterator iter_dst = find_option(name);
+
+ if (iter_src == source._map.end())
+ throw config_process_failure(STG(FMT("unknown option '%s' on source") % name));
+
+ if (iter_dst == _map.end())
+ throw config_process_failure(STG(FMT("unknown option '%s' on destination") % name));
+
+ iter_dst->second.copy_from(iter_src->second);
+}
+
+config_options::option_map_type::iterator config_options::find_option(std::string name)
+{
+ syn_option_map_type::iterator syn_iter = _syn_map.find(name);
+
+ if (syn_iter != _syn_map.end())
+ name = syn_iter->second;
+
+ option_map_type::iterator iter = _map.find(name);
+
+ return iter;
+}
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/config_options.hpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/config_options.hpp Fri Jun 26 18:20:45 2009
@@ -0,0 +1,281 @@
+#include <set>
+#include <map>
+#include <vector>
+
+#include <strings.hpp>
+
+#include <format.hpp>
+
+#ifndef INCLUDED_CONFIG_OPTIONS
+#define INCLUDED_CONFIG_OPTIONS
+
+template < typename base_type >
+struct Variant
+{
+ struct InvalidType {};
+
+ Variant(base_type * value) : _value(value)
+ {
+ _count = new int(1);
+ };
+
+ Variant(const Variant & v) : _value(v._value), _count(v._count)
+ {
+
+ (*_count)++;
+ }
+
+ ~Variant()
+ {
+ (*_count)--;
+ if (_value && !(*_count))
+ {
+ delete _value;
+ delete _count;
+ }
+ };
+
+ template < typename return_type >
+ return_type & get(void)
+ {
+ try
+ {
+ return_type & ret = dynamic_cast < return_type & > (*_value);
+ return ret;
+ }
+ catch (std::bad_cast & e)
+ {
+ throw InvalidType();
+ }
+
+ };
+
+ int which()
+ {
+ return _value->which();
+ }
+
+ protected:
+ base_type * _value;
+ int *_count;
+};
+
+struct config_process_failure
+{
+ config_process_failure(std::string _msg): msg(_msg) {};
+ std::string msg;
+};
+
+struct config_option
+{
+ typedef int sint_type;
+ typedef unsigned int uint_type;
+ typedef bool bool_type;
+
+ typedef std::string string_type;
+ //typedef boost::function1<void, std::string>
+ typedef void (*fun_type)(std::string);
+
+ typedef std::set < string_type > string_allowed_type;
+
+ /* this should reflect 'variant.which()'! */
+ typedef enum
+ {
+ ID_SINT = 0,
+ ID_UINT = 1,
+ ID_BOOL = 2,
+ ID_STRING = 3,
+ ID_FUN = 4,
+ }
+ value_id_type;
+
+ template <typename number_type>
+ struct range
+ {
+ range(number_type _minimum, number_type _maximum, number_type _step)
+ : minimum(_minimum), maximum(_maximum), step(_step) {};
+
+ number_type minimum, maximum, step;
+ };
+
+ struct BaseType
+ {
+ BaseType() {}
+
+ virtual ~BaseType() {}
+
+ virtual int which() = 0;
+ };
+
+ struct sint_data_type : public BaseType
+ {
+ sint_data_type(sint_type & _sint_val, sint_type _sint_default, range<sint_type> _sint_range)
+ : sint_val(_sint_val), sint_default(_sint_default), sint_range(_sint_range) {};
+
+ int which()
+ {
+ return ID_SINT;
+ }
+
+ sint_type & sint_val;
+ sint_type sint_default;
+ range<sint_type> sint_range;
+ };
+
+ struct uint_data_type : public BaseType
+ {
+ uint_data_type(uint_type & _uint_val, uint_type _uint_default, range<uint_type> _uint_range)
+ : uint_val(_uint_val), uint_default(_uint_default), uint_range(_uint_range) {};
+
+ int which()
+ {
+ return ID_UINT;
+ }
+
+ uint_type & uint_val;
+ uint_type uint_default;
+ range<uint_type> uint_range;
+ };
+
+ struct bool_data_type : public BaseType
+ {
+ bool_data_type(bool_type & _bool_val, bool_type _bool_default)
+ : bool_val(_bool_val), bool_default(_bool_default) {};
+
+ int which()
+ {
+ return ID_BOOL;
+ }
+
+ bool_type & bool_val;
+ bool_type bool_default;
+ };
+
+ struct string_data_type : public BaseType
+ {
+ string_data_type(std::string & _string_val, std::string _string_default, string_allowed_type _string_allowed)
+ : string_val(_string_val), string_default(_string_default), string_allowed(_string_allowed) {};
+
+ int which()
+ {
+ return ID_STRING;
+ }
+
+ std::string & string_val;
+ std::string string_default;
+ string_allowed_type string_allowed;
+ };
+
+ struct fun_data_type : public BaseType
+ {
+ fun_data_type(fun_type _fun_val, std::string _fun_default, string_allowed_type _fun_allowed)
+ : fun_val(_fun_val), fun_default(_fun_default), fun_allowed(_fun_allowed) {};
+
+ int which()
+ {
+ return ID_FUN;
+ }
+
+ fun_type fun_val;
+ std::string fun_default;
+ string_allowed_type fun_allowed;
+ };
+
+
+ typedef Variant < BaseType > value_type;
+ //typedef boost::variant < sint_data_type , uint_data_type, bool_data_type, string_data_type, fun_data_type > value_type;
+
+ config_option(std::string, const string_type &, const string_type, string_allowed_type allowed, bool list_me = true);
+ config_option(std::string, const string_type &, const string_type = "", bool list_me = true);
+ config_option(std::string, const sint_type &, const sint_type = 0, sint_type min = -INT_MAX, sint_type max = INT_MAX, sint_type step = 1, bool list_me = true);
+ config_option(std::string, const uint_type &, const uint_type = 0, uint_type min = 0, uint_type max = UINT_MAX, uint_type step = 1, bool list_me = true);
+ config_option(std::string, const bool_type &, const bool_type = false, bool list_me = true);
+ config_option(std::string, fun_type, std::string defvalue, string_allowed_type allowed, bool list_me = true);
+ config_option(std::string, fun_type, std::string defvalue = "", bool list_me = true);
+
+ ~config_option(void);
+
+ void set(string_type value);
+
+ void set(sint_type value);
+ void set(uint_type value);
+ void set(bool_type value);
+
+ std::string & name(void);
+ value_id_type type(void);
+
+ const char ** values(void);
+
+ void reset(void);
+ void commit(void);
+
+ bool list_me(void) { return _list_me; };
+ bool loaded(void) { return _loaded; };
+
+ void copy_from(config_option &);
+
+ protected:
+ std::string _my_name;
+ value_type _value_data;
+
+ bool _list_me;
+ const char ** _values;
+ bool _loaded;
+};
+
+struct config_options
+{
+ typedef std::vector < std::string > messages_type;
+
+ config_options(void): _values(NULL) {};
+
+ typedef std::set < std::string > string_set;
+
+ typedef std::map < std::string, config_option > option_map_type;
+ typedef std::pair < std::string, config_option > option_pair_type;
+
+ typedef std::map < std::string, std::string > syn_option_map_type;
+ typedef std::pair < std::string, std::string > syn_option_pair_type;
+
+ bool add(config_option option);
+
+ /* only valid in "process" (for backwards compatibility config files) */
+ bool synonym(std::string, std::string);
+
+ template <typename value_type>
+ void set(std::string name, value_type value)
+ {
+ option_map_type::iterator iter = _map.find(name);
+
+ if (iter == _map.end())
+ throw config_process_failure(STG(FMT("unknown option: %s") % name));
+
+ (*iter).second.set(value);
+ }
+
+ string_set options(void);
+
+ void process(const char *, const char *); /* process option from file */
+
+ void reset(void); /* reset loaded opts */
+ messages_type commit(void); /* set defaults */
+
+ const char ** values(const char *); /* option value */
+ const char ** values(void); /* values from options */
+
+ bool loaded(std::string); /* return if config was loaded */
+
+ void copy_from(config_options &, std::string);
+
+ protected:
+ option_map_type::iterator find_option(std::string);
+
+ protected:
+ option_map_type _map;
+ syn_option_map_type _syn_map;
+
+ const char ** _values;
+};
+
+#endif /* INCLUDED_CONFIG_OPTIONS */
+
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/format.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/format.cpp Fri Jun 26 18:20:45 2009
@@ -0,0 +1,208 @@
+#include "format.hpp"
+
+const char * Format::INVALID_MSG = "** Invalid Format **";
+
+
+Format::Format(const char * fmt, bool exception)
+ : _valid(true), _exception(exception)
+{
+ std::string text;
+ std::string arg;
+
+ const char * ptr = fmt;
+
+ while(*ptr != '\0')
+ {
+ if (*ptr != '%')
+ {
+ text += *ptr;
+ ptr++;
+ continue;
+ }
+ else if(*(ptr+1) == '%')
+ {
+ text += *ptr;
+ ptr++;
+ text += *ptr;
+ ptr++;
+ continue;
+ }
+
+ _args.push(new Argument(text, "text"));
+
+ text.clear();
+
+ arg += *ptr;
+
+ bool finished = false;
+
+ ptr++;
+
+ while(*ptr != '\0' && !finished)
+ {
+
+ Argument * argument;
+
+ switch (*ptr)
+ {
+ case ' ':
+ arg += *ptr;
+ _args.push(new Argument(arg, "text"));
+ arg.clear();
+ finished = true;
+ break;
+
+ case '%':
+ _args.push(new Argument(arg, "text"));
+ arg.clear();
+ arg += *ptr;
+ break;
+
+ case 'h':
+ arg += *ptr;
+ break;
+
+ case 'l':
+ arg += *ptr;
+ break;
+
+ case 'd':
+ case 'i':
+ arg += *ptr;
+ argument = new Argument(arg, typeid(int).name());
+ argument->type(typeid(unsigned int).name());
+ _args.push(argument);
+ argument = NULL;
+ arg.clear();
+ finished = true;
+ break;
+
+ case 'o':
+ case 'u':
+ case 'x':
+ case 'X':
+ arg += *ptr;
+ argument = new Argument(arg, typeid(unsigned int).name());
+ argument->type(typeid(int).name());
+ _args.push(argument);
+ argument = NULL;
+ arg.clear();
+ finished = true;
+ break;
+
+ case 'e':
+ case 'E':
+ case 'f':
+ case 'F':
+ case 'g':
+ case 'G':
+ case 'a':
+ case 'A':
+ arg += *ptr;
+ argument = new Argument(arg, typeid(double).name());
+ argument->type(typeid(float).name());
+ _args.push(argument);
+ argument = NULL;
+ arg.clear();
+ finished = true;
+ break;
+
+ case 'c':
+ arg += *ptr;
+ argument = new Argument(arg, typeid(char).name());
+ argument->type(typeid(unsigned char).name());
+ _args.push(argument);
+ argument = NULL;
+ arg.clear();
+ finished = true;
+ break;
+
+ case 's':
+ arg += *ptr;
+ argument = new Argument(arg, typeid(const char *).name());
+ argument->type(typeid(char *).name());
+ argument->type(typeid(const unsigned char *).name());
+ argument->type(typeid(unsigned char *).name());
+ _args.push(argument);
+ argument = NULL;
+ arg.clear();
+ finished = true;
+ break;
+
+ case 'p':
+ case 'C':
+ case 'S':
+ case 'n':
+ case 'm':
+ arg += *ptr;
+ _args.push(new Argument(arg, ""));
+ arg.clear();
+ finished = true;
+ break;
+ default:
+ arg += *ptr;
+ break;
+ }
+
+ ptr++;
+
+ }
+ }
+
+ if(!text.empty())
+ _args.push(new Argument(text, "text"));
+
+ if(!arg.empty())
+ _args.push(new Argument(arg, "text"));
+
+}
+
+std::string Format::str()
+{
+
+ if(!_valid)
+ {
+ if(_exception)
+ throw InvalidFormat(INVALID_MSG);
+
+ _result.clear();
+ _result += INVALID_MSG;
+ return _result;
+ }
+
+ Argument * top;
+ bool text;
+
+ do
+ {
+ text = false;
+
+ if(_args.empty())
+ return _result;
+
+ top = _args.front();
+ _args.pop();
+
+ if(top->compare("text"))
+ {
+ _result += top->fmts();
+ text = true;
+ free(top);
+ }
+
+ }
+ while(text);
+
+ free(top);
+
+ _valid = false;
+
+ if(_exception)
+ throw InvalidFormat(INVALID_MSG);
+
+ _result.clear();
+ _result += INVALID_MSG;
+ return _result;
+}
+
+
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/format.hpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/format.hpp Fri Jun 26 18:20:45 2009
@@ -0,0 +1,183 @@
+#ifndef _FORMAT_H_
+#define _FORMAT_H_
+
+#include <string>
+#include <queue>
+#include <set>
+#include <typeinfo>
+#include <cstring>
+#include <cstdlib>
+
+/* macros used for shortening lines and making the code clearer */
+#define STG(x) (x).str()
+#define FMT(x) Format(x)
+
+struct Format
+{
+ static const char * INVALID_MSG;
+
+ struct Argument
+ {
+ typedef std::set < std::string > StringSet;
+
+ Argument(std::string init_fmts, std::string init_type)
+ : _fmts(init_fmts)
+ {
+ _types.insert(init_type);
+ };
+
+ void type(std::string t)
+ {
+ _types.insert(t);
+ }
+
+ bool compare(const char * type)
+ {
+ for(StringSet::iterator it = _types.begin(); it != _types.end(); it++)
+ {
+ if(!strcmp(type, (*it).c_str()))
+ return true;
+ }
+ return false;
+ }
+
+ std::string fmts()
+ {
+ return _fmts;
+ }
+
+ protected:
+ std::string _fmts;
+ StringSet _types;
+ };
+
+ struct InvalidFormat
+ {
+ InvalidFormat(std::string msg) : _msg(msg) {}
+
+ std::string _msg;
+ };
+
+
+ typedef std::queue < Argument *> ArgumentsQueue;
+
+ Format(const char * fmt, bool exception = false);
+
+ std::string str();
+
+ template < typename Type >
+ Format & operator % ( Type value )
+ {
+ Argument * top;
+ bool text;
+
+ do
+ {
+ text = false;
+
+ if(_args.empty()) {
+ _valid = false;
+ if(_exception)
+ throw InvalidFormat(INVALID_MSG);
+ return *this;
+ }
+
+ top = _args.front();
+ _args.pop();
+
+ if(top->compare("text"))
+ {
+ _result += top->fmts();
+ text = true;
+ free(top);
+ }
+
+ }
+ while(text);
+
+ char tmp[1000];
+
+ if(top->compare(""))
+ {
+ snprintf(tmp, 1000, top->fmts().c_str(), value);
+ _result += tmp;
+ }
+ else if (top->compare(typeid(Type).name()))
+ {
+ snprintf(tmp, 1000, top->fmts().c_str(), value);
+ _result += tmp;
+ }
+ else
+ {
+ free(top);
+ _valid = false;
+ if(_exception)
+ throw InvalidFormat(INVALID_MSG);
+ return *this;
+ }
+
+ free(top);
+
+ return *this;
+ }
+
+Format & operator%( std::string & value )
+{
+ Argument * top;
+ bool text;
+
+ do
+ {
+ text = false;
+
+ if(_args.empty()) {
+ _valid = false;
+ if(_exception)
+ throw InvalidFormat(INVALID_MSG);
+ return *this;
+ }
+
+ top = _args.front();
+ _args.pop();
+
+ if(top->compare("text"))
+ {
+ _result += top->fmts();
+ text = true;
+ free(top);
+ }
+
+ }
+ while(text);
+
+ char tmp[1000];
+
+ if (top->compare(typeid(char *).name()))
+ {
+ snprintf(tmp, 1000, top->fmts().c_str(), value.c_str());
+ _result += tmp;
+ }
+ else
+ {
+ free(top);
+ _valid = false;
+ if(_exception)
+ throw InvalidFormat(INVALID_MSG);
+ return *this;
+ }
+
+ free(top);
+
+ return *this;
+}
+
+private:
+ bool _valid;
+ bool _exception;
+ std::string _result;
+ ArgumentsQueue _args;
+
+};
+
+#endif /* _FORMAT_H_ */
+
Modified: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/k3lapi.cpp
==============================================================================
--- freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/k3lapi.cpp (original)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/k3lapi.cpp Fri Jun 26 18:20:45 2009
@@ -7,169 +7,165 @@
K3LAPI::~K3LAPI()
{
- _device_count = 0;
-
- if (_device_type) { delete[] _device_type; _device_type = NULL; }
- if (_device_config) { delete[] _device_config; _device_config = NULL; }
- if (_channel_config) { delete[] _channel_config; _channel_config = NULL; }
- if (_link_config) { delete[] _link_config; _link_config = NULL; }
- if (_channel_count) { delete[] _channel_count; _channel_count = NULL; }
- if (_link_count) { delete[] _link_count; _link_count = NULL; }
+ _device_count = 0;
+
+ if (_device_type) { delete[] _device_type; _device_type = NULL; }
+ if (_device_config) { delete[] _device_config; _device_config = NULL; }
+ if (_channel_config) { delete[] _channel_config; _channel_config = NULL; }
+ if (_link_config) { delete[] _link_config; _link_config = NULL; }
+ if (_channel_count) { delete[] _channel_count; _channel_count = NULL; }
+ if (_link_count) { delete[] _link_count; _link_count = NULL; }
}
/* initialize the whole thing! */
-
+
void K3LAPI::start(void)
{
- /* tie the used k3l to the compiled k3l version */
- char *ret = k3lStart(2, 0, 0); //k3lApiMajorVersion, k3lApiMinorVersion, 0); //k3lApiBuildVersion);
-
- if (ret && *ret)
- throw start_failed(ret);
-
- /* call init automagically */
- init();
+ /* tie the used k3l to the compiled k3l version */
+ char *ret = k3lStart(2, 0, 0); //k3lApiBuildVersion);
+
+ if (ret && *ret)
+ throw start_failed(ret);
+
+ /* call init automagically */
+ init();
}
void K3LAPI::stop(void)
{
- k3lStop();
+ k3lStop();
}
/* envio de comandos para placa */
-
+
void K3LAPI::mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 index)
{
- KMixerCommand mix;
+ KMixerCommand mix;
mix.Track = track;
- mix.Source = src;
+ mix.Source = src;
mix.SourceIndex = index;
- command(dev, obj, CM_MIXER, (const char *) &mix);
+ command(dev, obj, CM_MIXER, (const char *) &mix);
}
void K3LAPI::mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int32 index)
{
- KMixerCommand mix;
+ KMixerCommand mix;
mix.Track = track;
- mix.Source = src;
+ mix.Source = src;
mix.SourceIndex = index;
- command(dev, obj, CM_MIXER_CTBUS, (const char *) &mix);
+ command(dev, obj, CM_MIXER_CTBUS, (const char *) &mix);
}
void K3LAPI::command(int32 dev, int32 obj, int32 code, std::string & str)
{
- command(dev, obj, code, str.c_str());
+ command(dev, obj, code, str.c_str());
}
void K3LAPI::command (int32 dev, int32 obj, int32 code, const char * parms)
{
K3L_COMMAND cmd;
- cmd.Cmd = code;
+ cmd.Cmd = code;
cmd.Object = obj;
- cmd.Params = (byte *)parms;
+ cmd.Params = (byte *)parms;
- int32 rc = k3lSendCommand(dev, &cmd);
-
- if (rc != ksSuccess)
- throw failed_command(code, dev, obj, rc);
+ int32 rc = k3lSendCommand(dev, &cmd);
+
+ if (rc != ksSuccess)
+ throw failed_command(code, dev, obj, rc);
}
void K3LAPI::raw_command(int32 dev, int32 dsp, std::string & str)
{
- raw_command(dev, dsp, str.data(), str.size());
+ raw_command(dev, dsp, str.data(), str.size());
}
void K3LAPI::raw_command(int32 dev, int32 dsp, const char * cmds, int32 size)
{
std::string str(cmds, size);
- int32 rc = k3lSendRawCommand(dev, dsp, (void *)cmds, size);
+ int32 rc = k3lSendRawCommand(dev, dsp, (void *)cmds, size);
- if (rc != ksSuccess)
- throw failed_raw_command(dev, dsp, rc);
+ if (rc != ksSuccess)
+ throw failed_raw_command(dev, dsp, rc);
}
KLibraryStatus K3LAPI::get_param(K3L_EVENT *ev, const char *name, std::string &res)
{
- char tmp_param[256];
- memset((void*)tmp_param, 0, sizeof(tmp_param));
+ char tmp_param[256];
+ memset((void*)tmp_param, 0, sizeof(tmp_param));
- int32 rc = k3lGetEventParam (ev, (sbyte *)name, (sbyte *)tmp_param, sizeof(tmp_param)-1);
-
- if (rc != ksSuccess)
- return (KLibraryStatus)rc;
+ int32 rc = k3lGetEventParam (ev, (sbyte *)name, (sbyte *)tmp_param, sizeof(tmp_param)-1);
+
+ if (rc != ksSuccess)
+ return (KLibraryStatus)rc;
- res.append(tmp_param, strlen(tmp_param));
- return ksSuccess;
+ res.append(tmp_param, strlen(tmp_param));
+ return ksSuccess;
}
-
+
std::string K3LAPI::get_param(K3L_EVENT *ev, const char *name)
{
- std::string res;
+ std::string res;
- KLibraryStatus rc = get_param(ev, name, res);
+ KLibraryStatus rc = get_param(ev, name, res);
- if (rc != ksSuccess)
- throw get_param_failed(name, rc);
-
- return res;
+ if (rc != ksSuccess)
+ throw get_param_failed(name, rc);
+
+ return res;
}
void K3LAPI::init(void)
{
- if (_device_count != 0) return;
+ if (_device_count != 0) return;
- _device_count = k3lGetDeviceCount();
+ _device_count = k3lGetDeviceCount();
- _device_type = new KDeviceType[_device_count];
- _device_config = new device_conf_type[_device_count];
- _channel_config = new channel_ptr_conf_type[_device_count];
- _KChannel = new KChannel_ptr_t[_device_count];
- _link_config = new link_ptr_conf_type[_device_count];
- _channel_count = new unsigned int[_device_count];
- _link_count = new unsigned int[_device_count];
-
- for (unsigned int dev = 0; dev < _device_count; dev++)
- {
- _device_type[dev] = (KDeviceType) k3lGetDeviceType(dev);
-
- /* caches each device config */
- if (k3lGetDeviceConfig(dev, ksoDevice + dev, &(_device_config[dev]), sizeof(_device_config[dev])) != ksSuccess)
- throw start_failed("k3lGetDeviceConfig(device)");
-
- /* adjust channel/link count for device */
- _channel_count[dev] = _device_config[dev].ChannelCount;
- _link_count[dev] = _device_config[dev].LinkCount;
-
- /* caches each channel config */
- _channel_config[dev] = new channel_conf_type[_channel_count[dev]];
- _KChannel[dev] = new KChannel_t[_channel_count[dev]];
-
- for (unsigned int obj = 0; obj < _channel_count[dev]; obj++)
- {
- if (k3lGetDeviceConfig(dev, ksoChannel + obj, &(_channel_config[dev][obj]),
- sizeof(_channel_config[dev][obj])) != ksSuccess)
- {
- throw start_failed("k3lGetDeviceConfig(channel)");
- }
- }
-
- /* adjust link count for device */
- _link_count[dev] = _device_config[dev].LinkCount;
-
- /* caches each link config */
- _link_config[dev] = new link_conf_type[_link_count[dev]];
-
- for (unsigned int obj = 0; obj < _link_count[dev]; obj++)
- {
- if (k3lGetDeviceConfig(dev, ksoLink + obj, &(_link_config[dev][obj]),
- sizeof(_link_config[dev][obj])) != ksSuccess)
- throw start_failed("k3lGetDeviceConfig(link)");
- }
- }
+ _device_type = new KDeviceType[_device_count];
+ _device_config = new device_conf_type[_device_count];
+ _channel_config = new channel_ptr_conf_type[_device_count];
+ _link_config = new link_ptr_conf_type[_device_count];
+ _channel_count = new unsigned int[_device_count];
+ _link_count = new unsigned int[_device_count];
+
+ for (unsigned int dev = 0; dev < _device_count; dev++)
+ {
+ _device_type[dev] = (KDeviceType) k3lGetDeviceType(dev);
+
+ /* caches each device config */
+ if (k3lGetDeviceConfig(dev, ksoDevice + dev, &(_device_config[dev]), sizeof(_device_config[dev])) != ksSuccess)
+ throw start_failed("k3lGetDeviceConfig(device)");
+
+ /* adjust channel/link count for device */
+ _channel_count[dev] = _device_config[dev].ChannelCount;
+ _link_count[dev] = _device_config[dev].LinkCount;
+
+ /* caches each channel config */
+ _channel_config[dev] = new channel_conf_type[_channel_count[dev]];
+
+ for (unsigned int obj = 0; obj < _channel_count[dev]; obj++)
+ {
+ if (k3lGetDeviceConfig(dev, ksoChannel + obj, &(_channel_config[dev][obj]),
+ sizeof(_channel_config[dev][obj])) != ksSuccess)
+ throw start_failed("k3lGetDeviceConfig(channel)");
+ }
+
+ /* adjust link count for device */
+ _link_count[dev] = _device_config[dev].LinkCount;
+
+ /* caches each link config */
+ _link_config[dev] = new link_conf_type[_link_count[dev]];
+
+ for (unsigned int obj = 0; obj < _link_count[dev]; obj++)
+ {
+ if (k3lGetDeviceConfig(dev, ksoLink + obj, &(_link_config[dev][obj]),
+ sizeof(_link_config[dev][obj])) != ksSuccess)
+ throw start_failed("k3lGetDeviceConfig(link)");
+ }
+ }
}
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/k3lapi.hpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/k3lapi.hpp Fri Jun 26 18:20:45 2009
@@ -0,0 +1,309 @@
+#include <string>
+
+#include <k3l.h>
+
+/* if using full k3l.h (for softpbx), version already defined. */
+#ifndef k3lApiMajorVersion
+# include <k3lVersion.h>
+#endif
+
+#ifdef __GNUC_PREREQ
+#if __GNUC_PREREQ(4,3)
+#include <cstring>
+#endif
+#endif
+
+#ifndef INCLUDED_K3LAPI_HPP
+#define INCLUDED_K3LAPI_HPP
+
+struct K3LAPI
+{
+ /* exceptions */
+
+ struct start_failed
+ {
+ start_failed(const char * _msg) : msg(_msg) {};
+ std::string msg;
+ };
+
+ struct failed_command
+ {
+ failed_command(int32 _code, unsigned short _dev, unsigned short _obj, int32 _rc)
+ : code(_code), dev(_dev), obj(_obj), rc(_rc) {};
+
+ int32 code;
+ unsigned short dev;
+ unsigned short obj;
+ int32 rc;
+ };
+
+ struct failed_raw_command
+ {
+ failed_raw_command(unsigned short _dev, unsigned short _dsp, int32 _rc)
+ : dev(_dev), dsp(_dsp), rc(_rc) {};
+
+ unsigned short dev;
+ unsigned short dsp;
+ int32 rc;
+ };
+
+ struct invalid_session
+ {
+ invalid_session(unsigned int _device, unsigned int _channel)
+ : device(_device), channel(_channel) {};
+
+ unsigned int device;
+ unsigned int channel;
+ };
+
+ struct invalid_device
+ {
+ invalid_device(int32 _device)
+ : device(_device) {};
+
+ int32 device;
+ };
+
+ struct invalid_channel
+ {
+ invalid_channel(int32 _device, int32 _channel)
+ : device(_device), channel(_channel) {};
+
+ int32 device, channel;
+ };
+
+ struct invalid_link
+ {
+ invalid_link(unsigned int _device, unsigned int _link)
+ : device(_device), link(_link) {};
+
+ int32 device, link;
+ };
+
+ struct get_param_failed
+ {
+ get_param_failed(std::string _name, int32 _rc)
+ : name(_name), rc((KLibraryStatus)_rc) {};
+
+ std::string name;
+ KLibraryStatus rc;
+ };
+
+ typedef K3L_DEVICE_CONFIG device_conf_type;
+ typedef K3L_CHANNEL_CONFIG channel_conf_type;
+ typedef K3L_CHANNEL_CONFIG * channel_ptr_conf_type;
+ typedef K3L_LINK_CONFIG link_conf_type;
+ typedef K3L_LINK_CONFIG * link_ptr_conf_type;
+
+ /* constructors/destructors */
+
+ K3LAPI();
+ ~K3LAPI();
+
+ /* (init|final)ialize the whole thing! */
+
+ void start(void);
+ void stop(void);
+
+ /* verificacao de intervalos */
+
+ inline bool valid_device(int32 dev)
+ {
+ return (dev >= 0 && dev < ((int32)_device_count));
+ }
+
+ inline bool valid_channel(int32 dev, int32 obj)
+ {
+ return (valid_device(dev) && obj >= 0 && obj < ((int32)_channel_count[dev]));
+ }
+
+ inline bool valid_link(int32 dev, int32 obj)
+ {
+ return (valid_device(dev) && obj >= 0 && obj < ((int32)_link_count[dev]));
+ }
+
+ /* identificadores alto-nivel de objectos */
+ struct target
+ {
+ typedef enum { DEVICE, CHANNEL, MIXER, LINK } target_type;
+
+ target(K3LAPI & k3lapi, target_type type_init, int32 device_value, int32 object_value)
+ : type(type_init),
+ device((unsigned short)device_value),
+ object((unsigned short)object_value)
+ {
+ switch (type_init)
+ {
+ case DEVICE:
+ if (!k3lapi.valid_device(device))
+ throw invalid_device(device);
+ break;
+
+ case CHANNEL:
+ case MIXER:
+ if (!k3lapi.valid_channel(device, object))
+ throw invalid_channel(device, object);
+ break;
+
+ case LINK:
+ if (!k3lapi.valid_link(device, object))
+ throw invalid_link(device, object);
+ break;
+ }
+
+ };
+
+ target_type type;
+
+ unsigned short device;
+ unsigned short object;
+ };
+
+ /* envio de comandos para placa (geral) */
+
+ void raw_command(int32 dev, int32 dsp, std::string & str);
+ void raw_command(int32 dev, int32 dsp, const char * cmds, int32 size);
+
+ /* obter dados 'cacheados' (geral) */
+
+ inline unsigned int device_count(void)
+ {
+ return _device_count;
+ }
+
+ /* envio de comandos para placa (sem identificadores) */
+
+ void mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 index);
+ void mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int32 index);
+
+ void command (int32 dev, int32 obj, int32 code, std::string & str);
+ void command (int32 dev, int32 obj, int32 code, const char * parms = NULL);
+
+ /* obter dados 'cacheados' (sem identificadores) */
+
+ inline unsigned int channel_count(int32 dev)
+ {
+ if (!valid_device(dev))
+ throw invalid_device(dev);
+
+ return _channel_count[dev];
+ }
+
+ inline unsigned int link_count(int32 dev)
+ {
+ if (!valid_device(dev))
+ throw invalid_device(dev);
+
+ return _link_count[dev];
+ }
+
+ KDeviceType device_type(int32 dev)
+ {
+ if (!valid_device(dev))
+ throw invalid_device(dev);
+
+ return _device_type[dev];
+ }
+
+
+ K3L_DEVICE_CONFIG & device_config(int32 dev)
+ {
+ if (!valid_device(dev))
+ throw invalid_device(dev);
+
+ return _device_config[dev];
+ }
+
+ K3L_CHANNEL_CONFIG & channel_config(int32 dev, int32 obj)
+ {
+ if (!valid_channel(dev, obj))
+ throw invalid_channel(dev, obj);
+
+ return _channel_config[dev][obj];
+ }
+
+ K3L_LINK_CONFIG & link_config(int32 dev, int32 obj)
+ {
+ if (!valid_channel(dev, obj))
+ throw invalid_channel(dev, obj);
+
+ return _link_config[dev][obj];
+ }
+
+ /* envio de comandos para placa (com identificadores) */
+
+ void mixer(target & tgt, byte track, KMixerSource src, int32 index)
+ {
+ mixer((int32)tgt.device, (int32)tgt.object, track, src, index);
+ }
+
+ void mixerCTbus(target & tgt, byte track, KMixerSource src, int32 index)
+ {
+ mixerCTbus((int32)tgt.device, (int32)tgt.object, track, src, index);
+ }
+
+ void command (target & tgt, int32 code, std::string & str)
+ {
+ command((int32)tgt.device, (int32)tgt.object, code, str);
+ };
+
+ void command (target & tgt, int32 code, const char * parms = NULL)
+ {
+ command((int32)tgt.device, (int32)tgt.object, code, parms);
+ };
+
+ /* obter dados 'cacheados' (com indentificadores) */
+
+ inline unsigned int channel_count(target & tgt)
+ {
+ return _channel_count[tgt.device];
+ }
+
+ inline unsigned int link_count(target & tgt)
+ {
+ return _link_count[tgt.device];
+ }
+
+ KDeviceType device_type(target & tgt)
+ {
+ return _device_type[tgt.device];
+ }
+
+
+ K3L_DEVICE_CONFIG & device_config(target & tgt)
+ {
+ return _device_config[tgt.device];
+ }
+
+ K3L_CHANNEL_CONFIG & channel_config(target & tgt)
+ {
+ return _channel_config[tgt.device][tgt.object];
+ }
+
+ K3L_LINK_CONFIG & link_config(target & tgt)
+ {
+ return _link_config[tgt.device][tgt.object];
+ }
+
+ /* pega valores em strings de eventos */
+
+ KLibraryStatus get_param(K3L_EVENT *ev, const char *name, std::string &res);
+ std::string get_param(K3L_EVENT *ev, const char *name);
+
+ /* inicializa valores em cache */
+
+ void init(void);
+
+ protected:
+
+ unsigned int _device_count;
+ unsigned int * _channel_count;
+ unsigned int * _link_count;
+
+ device_conf_type * _device_config;
+ channel_ptr_conf_type * _channel_config;
+ link_ptr_conf_type * _link_config;
+ KDeviceType * _device_type;
+};
+
+#endif /* INCLUDED_K3LAPI_HPP */
Added: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/strings.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/strings.cpp Fri Jun 26 18:20:45 2009
@@ -0,0 +1,153 @@
+#include <strings.hpp>
+
+void Strings::Merger::add(std::string s)
+{
+ _list.push_back(s);
+};
+
+std::string Strings::Merger::merge(const std::string & sep)
+{
+ list_type::iterator i = _list.begin();
+
+ std::string res;
+
+ if (i != _list.end())
+ {
+ res += (*i);
+ ++i;
+ };
+
+ while (i != _list.end())
+ {
+ res += sep;
+ res += (*i);
+ ++i;
+ }
+
+ return res;
+};
+
+std::string Strings::Merger::merge(const char *sep)
+{
+ std::string ssep(sep);
+ return merge(ssep);
+}
+
+void Strings::tokenize(const std::string & str, Strings::vector_type & tokens,
+ const std::string & delims, long int max_tokens)
+{
+ std::string::size_type init = str.find_first_not_of(delims, 0);
+ std::string::size_type fini = str.find_first_of(delims, init);
+
+ long int cur_token = 1;
+
+ while (std::string::npos != init)
+ {
+ if (std::string::npos != fini && cur_token < max_tokens)
+ {
+ tokens.push_back(str.substr(init, fini - init));
+ ++cur_token;
+ }
+ else
+ {
+ tokens.push_back(str.substr(init, str.size() - init));
+ break;
+ }
+
+ init = str.find_first_not_of(delims, fini);
+ fini = str.find_first_of(delims, init);
+ }
+}
+
+bool Strings::toboolean(std::string str)
+{
+ std::string tmp(str);
+
+ Strings::lower(tmp);
+
+ if ((tmp == "true") || (tmp == "yes")) return true;
+ if ((tmp == "false") || (tmp == "no")) return false;
+
+ throw invalid_value(str);
+}
+
+long Strings::tolong(std::string str, int base)
+{
+ char *str_end = 0;
+
+ unsigned long value = strtol(str.c_str(), &str_end, base);
+
+ if (str_end && *str_end == 0)
+ return value;
+
+ throw invalid_value(str);
+}
+
+unsigned long Strings::toulong(std::string str, int base)
+{
+ char *str_end = 0;
+
+ unsigned long value = strtoul(str.c_str(), &str_end, base);
+
+ if (str_end && *str_end == 0)
+ return value;
+
+ throw invalid_value(str);
+}
+
+unsigned long long Strings::toulonglong(std::string str, int base)
+{
+#if defined(_WINDOWS) || defined(_Windows) || defined(_WIN32) || defined(WIN32)
+ throw not_implemented();
+#else
+ char *str_end = 0;
+
+ unsigned long long value = strtoull(str.c_str(), &str_end, base);
+
+ if (str_end && *str_end == 0)
+ return value;
+
+ throw invalid_value(str);
+#endif
+}
+
+std::string Strings::fromboolean(bool value)
+{
+ if (value) return "true";
+ else return "false";
+}
+
+std::string Strings::lower(std::string str)
+{
+ std::string res;
+
+ for (std::string::iterator i = str.begin(); i != str.end(); i++)
+ res += tolower((*i));
+
+ return res;
+}
+
+std::string Strings::hexadecimal(std::string value)
+{
+ std::string result;
+
+ for (std::string::iterator i = value.begin(); i != value.end(); i++)
+ {
+ if (i != value.begin())
+ result += " ";
+
+ result += STG(FMT("%2x") % (unsigned int)(*i));
+ }
+
+ return result;
+}
+
+std::string Strings::trim(const std::string& str, const std::string& trim_chars)
+{
+ std::string result(str);
+
+ result.erase( result.find_last_not_of( trim_chars ) + 1 );
+ result.erase( 0, result.find_first_not_of( trim_chars ) );
+
+ return result;
+}
Modified: freeswitch/trunk/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp
==============================================================================
--- freeswitch/trunk/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp (original)
+++ freeswitch/trunk/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp Fri Jun 26 18:20:45 2009
@@ -29,156 +29,144 @@
* mod_khomp.c -- Khomp board Endpoint Module
*
*/
-
+
#define KHOMP_SYNTAX "khomp show [info|links|channels]"
-/* Our includes */
-#include "k3lapi.hpp"
+#include "mod_khomp.h"
+
+/* Handles callbacks and events from the boards */
+static int32 Kstdcall khomp_event_callback(int32 obj, K3L_EVENT * e);
+static void Kstdcall khomp_audio_listener(int32 deviceid, int32 objectid, byte * read_buffer, int32 read_size);
-extern "C"
+typedef enum
{
- #include <switch.h>
- #include "k3l.h"
+ TFLAG_IO = (1 << 0),
+ TFLAG_INBOUND = (1 << 1),
+ TFLAG_OUTBOUND = (1 << 2),
+ TFLAG_DTMF = (1 << 3),
+ TFLAG_VOICE = (1 << 4),
+ TFLAG_HANGUP = (1 << 5),
+ TFLAG_LINEAR = (1 << 6),
+ TFLAG_CODEC = (1 << 7),
+ TFLAG_BREAK = (1 << 8)
}
+TFLAGS;
+/* Module management routines */
SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown);
-//SWITCH_MODULE_RUNTIME_FUNCTION(mod_khomp_runtime);
-SWITCH_MODULE_DEFINITION(mod_khomp, mod_khomp_load, mod_khomp_shutdown, NULL); //mod_khomp_runtime);
+SWITCH_MODULE_DEFINITION(mod_khomp, mod_khomp_load, mod_khomp_shutdown, NULL);
+/* State handlers for FreeSWITCH */
+static switch_status_t channel_on_init(switch_core_session_t *session);
+static switch_status_t channel_on_routing(switch_core_session_t *session);
+static switch_status_t channel_on_execute(switch_core_session_t *session);
+static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_exchange_media(
+ switch_core_session_t *session);
+static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-switch_endpoint_interface_t *khomp_endpoint_interface;
-static switch_memory_pool_t *module_pool = NULL;
-static int running = 1;
-
-static K3LAPI * k3l;
-
-
-typedef enum {
- TFLAG_IO = (1 << 0),
- TFLAG_INBOUND = (1 << 1),
- TFLAG_OUTBOUND = (1 << 2),
- TFLAG_DTMF = (1 << 3),
- TFLAG_VOICE = (1 << 4),
- TFLAG_HANGUP = (1 << 5),
- TFLAG_LINEAR = (1 << 6),
- TFLAG_CODEC = (1 << 7),
- TFLAG_BREAK = (1 << 8)
-} TFLAGS;
-
-typedef enum {
- GFLAG_MY_CODEC_PREFS = (1 << 0)
-} GFLAGS;
-
-
-static struct {
- int debug;
- char *ip;
- int port;
- char *dialplan;
- char *codec_string;
- char *codec_order[SWITCH_MAX_CODECS];
- int codec_order_last;
- char *codec_rates_string;
- char *codec_rates[SWITCH_MAX_CODECS];
- int codec_rates_last;
- unsigned int flags;
- int calls;
- switch_mutex_t *mutex;
-} globals;
-
-struct private_object {
- unsigned int flags;
- switch_codec_t read_codec;
- switch_codec_t write_codec;
- switch_frame_t read_frame;
- unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
- switch_core_session_t *session;
- switch_caller_profile_t *caller_profile;
- switch_mutex_t *mutex;
- switch_mutex_t *flag_mutex;
- //switch_thread_cond_t *cond;
- unsigned int KDeviceId; // Represent de board we are making the call from
- unsigned int KChannel; // Represent the channel we are making the call from
+switch_state_handler_table_t khomp_state_handlers = {
+ /*.on_init */ channel_on_init,
+ /*.on_routing */ channel_on_routing,
+ /*.on_execute */ channel_on_execute,
+ /*.on_hangup */ channel_on_hangup,
+ /*.on_exchange_media */ channel_on_exchange_media,
+ /*.on_soft_execute */ channel_on_soft_execute
};
-typedef struct private_object private_t;
+/* Callbacks for FreeSWITCH */
+static switch_call_cause_t channel_outgoing_channel(
+ switch_core_session_t *session,
+ switch_event_t *var_event,
+ switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session,
+ switch_memory_pool_t **pool,
+ switch_originate_flag_t flags);
+static switch_status_t channel_read_frame(switch_core_session_t *session,
+ switch_frame_t **frame,
+ switch_io_flag_t flags,
+ int stream_id);
+static switch_status_t channel_write_frame(switch_core_session_t *session,
+ switch_frame_t *frame,
+ switch_io_flag_t flags,
+ int stream_id);
+static switch_status_t channel_kill_channel(switch_core_session_t *session,
+ int sig);
+static switch_status_t channel_send_dtmf(switch_core_session_t *session,
+ const switch_dtmf_t *dtmf);
+static switch_status_t channel_receive_message(switch_core_session_t *session,
+ switch_core_session_message_t *msg);
+static switch_status_t channel_receive_event(switch_core_session_t *session,
+ switch_event_t *event);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ip, globals.ip);
+switch_io_routines_t khomp_io_routines = {
+ /*.outgoing_channel */ channel_outgoing_channel,
+ /*.read_frame */ channel_read_frame,
+ /*.write_frame */ channel_write_frame,
+ /*.kill_channel */ channel_kill_channel,
+ /*.send_dtmf */ channel_send_dtmf,
+ /*.receive_message */ channel_receive_message,
+ /*.receive_event */ channel_receive_event
+};
/* Macros to define specific API functions */
SWITCH_STANDARD_API(khomp);
-
-static switch_status_t channel_on_init(switch_core_session_t *session);
-static switch_status_t channel_on_hangup(switch_core_session_t *session);
-static switch_status_t channel_on_routing(switch_core_session_t *session);
-static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
-static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
- switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
-static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
-static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
-static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
-
/* Helper function prototypes */
static void printSystemSummary(switch_stream_handle_t* stream);
-static void printLinks(switch_stream_handle_t* stream, unsigned int device, unsigned int link);
-static void printChannels(switch_stream_handle_t* stream, unsigned int device, unsigned int link);
-/* Handles callbacks and events from the boards */
-static int32 Kstdcall khomp_event_callback(int32 obj, K3L_EVENT * e);
-KLibraryStatus khomp_channel_from_event(unsigned int KDeviceId, unsigned int KChannel, K3L_EVENT * event);
-/* Callback for receiving audio buffers from the boards */
-static void Kstdcall khomp_audio_listener (int32 deviceid, int32 mixer, byte * read_buffer, int32 read_size);
+static void printLinks(switch_stream_handle_t* stream, unsigned int device,
+ unsigned int link);
+static void printChannels(switch_stream_handle_t* stream, unsigned int device,
+ unsigned int link);
/* Will init part of our private structure and setup all the read/write buffers */
-static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *session)
+static switch_status_t tech_init(KhompPvt *tech_pvt, switch_core_session_t *session)
{
- tech_pvt->read_frame.data = tech_pvt->databuf;
- tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
- switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
- switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
- switch_core_session_set_private(session, tech_pvt);
- tech_pvt->session = session;
-
- if (switch_core_codec_init(&tech_pvt->read_codec,
- "PCMA",
- NULL,
- 8000,
- 20,
- 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
- return SWITCH_STATUS_GENERR;
- } else {
- if (switch_core_codec_init(&tech_pvt->write_codec,
- "PCMA",
- NULL,
- 8000,
- 20,
- 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
- switch_core_codec_destroy(&tech_pvt->read_codec);
- return SWITCH_STATUS_GENERR;
- }
- }
-
- switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
- switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
- switch_set_flag_locked(tech_pvt, TFLAG_CODEC);
- tech_pvt->read_frame.codec = &tech_pvt->read_codec;
- switch_set_flag_locked(tech_pvt, TFLAG_IO);
+ tech_pvt->_read_frame.data = tech_pvt->_databuf;
+ tech_pvt->_read_frame.buflen = sizeof(tech_pvt->_databuf);
+ switch_mutex_init(&tech_pvt->_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+
+ switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+ switch_core_session_set_private(session, tech_pvt);
+ tech_pvt->_session = session;
+
+ if (switch_core_codec_init(&tech_pvt->_read_codec,
+ "PCMA",
+ NULL,
+ 8000,
+ 20,
+ 1,
+ SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL, switch_core_session_get_pool(tech_pvt->_session)) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
+ return SWITCH_STATUS_GENERR;
+ } else {
+ if (switch_core_codec_init(&tech_pvt->_write_codec,
+ "PCMA",
+ NULL,
+ 8000,
+ 20,
+ 1,
+ SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL, switch_core_session_get_pool(tech_pvt->_session)) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
+ switch_core_codec_destroy(&tech_pvt->_read_codec);
+ return SWITCH_STATUS_GENERR;
+ }
+ }
- return SWITCH_STATUS_SUCCESS;
+ switch_core_session_set_read_codec(tech_pvt->_session, &tech_pvt->_read_codec);
+ switch_core_session_set_write_codec(tech_pvt->_session, &tech_pvt->_write_codec);
+ switch_set_flag_locked(tech_pvt, TFLAG_CODEC);
+
+ tech_pvt->_read_frame.codec = &tech_pvt->_read_codec;
+
+ switch_set_flag_locked(tech_pvt, TFLAG_IO);
+
+ return SWITCH_STATUS_SUCCESS;
}
@@ -189,311 +177,299 @@
*/
static switch_status_t channel_on_init(switch_core_session_t *session)
{
- switch_channel_t *channel;
- private_t *tech_pvt = NULL;
+ KhompPvt * tech_pvt = static_cast< KhompPvt* >(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
- tech_pvt = static_cast< private_t* >(switch_core_session_get_private(session));
- assert(tech_pvt != NULL);
+ switch_set_flag_locked(tech_pvt, TFLAG_IO);
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
- switch_set_flag_locked(tech_pvt, TFLAG_IO);
-
- /* Move channel's state machine to ROUTING. This means the call is trying
- to get from the initial start where the call because, to the point
- where a destination has been identified. If the channel is simply
- left in the initial state, nothing will happen. */
- switch_channel_set_state(channel, CS_ROUTING);
- switch_mutex_lock(globals.mutex);
- globals.calls++;
- switch_mutex_unlock(globals.mutex);
+ /* Move channel's state machine to ROUTING. This means the call is trying
+ to get from the initial start where the call because, to the point
+ where a destination has been identified. If the channel is simply
+ left in the initial state, nothing will happen. */
+ switch_channel_set_state(channel, CS_ROUTING);
- return SWITCH_STATUS_SUCCESS;
+ switch_mutex_lock(Globals::_mutex);
+ Globals::_calls++;
+ switch_mutex_unlock(Globals::_mutex);
+
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_on_routing(switch_core_session_t *session)
{
- switch_channel_t *channel = NULL;
- private_t *tech_pvt = NULL;
+ switch_channel_t *channel = NULL;
+ KhompPvt *tech_pvt = NULL;
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
- tech_pvt = static_cast<private_t *>(switch_core_session_get_private(session));
- assert(tech_pvt != NULL);
+ tech_pvt = static_cast<KhompPvt *>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel));
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_on_execute(switch_core_session_t *session)
{
- switch_channel_t *channel = NULL;
- private_t *tech_pvt = NULL;
+ switch_channel_t *channel = NULL;
+ KhompPvt *tech_pvt = NULL;
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
- tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
- assert(tech_pvt != NULL);
+ tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_on_hangup(switch_core_session_t *session)
{
- switch_channel_t *channel = NULL;
- private_t *tech_pvt = NULL;
+ switch_channel_t *channel = NULL;
+ KhompPvt *tech_pvt = NULL;
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
- tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
- assert(tech_pvt != NULL);
+ tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
- switch_clear_flag_locked(tech_pvt, TFLAG_IO);
- switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
- //switch_thread_cond_signal(tech_pvt->cond);
-
- if (tech_pvt->read_codec.implementation) {
- switch_core_codec_destroy(&tech_pvt->read_codec);
- }
-
- if (tech_pvt->write_codec.implementation) {
- switch_core_codec_destroy(&tech_pvt->write_codec);
- }
+ switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ //switch_thread_cond_signal(tech_pvt->_cond);
- try {
- k3l->command(tech_pvt->KDeviceId, tech_pvt->KChannel, CM_DISCONNECT, NULL);
- }
- catch(K3LAPI::failed_command & e)
- {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "WE COULD NOT HANGUP THE CHANNEL! rc:%d\n", e.rc);
- return SWITCH_STATUS_TERM;
+ if (tech_pvt->_read_codec.implementation) {
+ switch_core_codec_destroy(&tech_pvt->_read_codec);
}
+ if (tech_pvt->_write_codec.implementation) {
+ switch_core_codec_destroy(&tech_pvt->_write_codec);
+ }
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Originator Hangup.\n", switch_channel_get_name(channel));
- switch_mutex_lock(globals.mutex);
- globals.calls--;
- if (globals.calls < 0) {
- globals.calls = 0;
- }
- switch_mutex_unlock(globals.mutex);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Originator Hangup.\n", switch_channel_get_name(channel));
+ switch_mutex_lock(Globals::_mutex);
+ Globals::_calls--;
+ if (Globals::_calls < 0) {
+ Globals::_calls = 0;
+ }
+ switch_mutex_unlock(Globals::_mutex);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
{
- switch_channel_t *channel = NULL;
- private_t *tech_pvt = NULL;
-
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
-
- tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
- assert(tech_pvt != NULL);
-
- switch (sig) {
- case SWITCH_SIG_KILL:
- switch_clear_flag_locked(tech_pvt, TFLAG_IO);
- switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
- switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
- //switch_thread_cond_signal(tech_pvt->cond);
- break;
- case SWITCH_SIG_BREAK:
- switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
- break;
- default:
- break;
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL KILL\n");
+ switch_channel_t *channel = NULL;
+ KhompPvt *tech_pvt = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+
+ switch (sig) {
+ case SWITCH_SIG_KILL:
+ switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+ //switch_thread_cond_signal(tech_pvt->_cond);
+ break;
+ case SWITCH_SIG_BREAK:
+ switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
+ break;
+ default:
+ break;
+ }
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_on_exchange_media(switch_core_session_t *session)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
- return SWITCH_STATUS_SUCCESS;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_on_soft_execute(switch_core_session_t *session)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
- return SWITCH_STATUS_SUCCESS;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
- private_t *tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
- switch_assert(tech_pvt != NULL);
+ KhompPvt *tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+ switch_assert(tech_pvt != NULL);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
{
- switch_channel_t *channel = NULL;
- private_t *tech_pvt = NULL;
- //switch_time_t started = switch_time_now();
- //unsigned int elapsed;
- switch_byte_t *data;
-
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
-
- tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
- assert(tech_pvt != NULL);
- tech_pvt->read_frame.flags = SFF_NONE;
- *frame = NULL;
-
-
- while (switch_test_flag(tech_pvt, TFLAG_IO)) {
-
- if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
- switch_clear_flag(tech_pvt, TFLAG_BREAK);
- goto cng;
- }
-
- if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
- return SWITCH_STATUS_FALSE;
- }
-
- //if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) {
- // switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
- if (!tech_pvt->read_frame.datalen) {
- continue;
- }
- *frame = &tech_pvt->read_frame;
+ switch_channel_t *channel = NULL;
+ KhompPvt *tech_pvt = NULL;
+ //switch_time_t started = switch_time_now();
+ //unsigned int elapsed;
+ switch_byte_t *data;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+ tech_pvt->_read_frame.flags = SFF_NONE;
+ *frame = NULL;
+
+
+ while (switch_test_flag(tech_pvt, TFLAG_IO)) {
+
+ if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
+ switch_clear_flag(tech_pvt, TFLAG_BREAK);
+ goto cng;
+ }
+
+ if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ if (!tech_pvt->_read_frame.datalen) {
+ continue;
+ }
+ *frame = &tech_pvt->_read_frame;
#ifdef BIGENDIAN
- if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
- switch_swap_linear((*frame)->data, (int) (*frame)->datalen / 2);
- }
+ if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+ switch_swap_linear((*frame)->data, (int) (*frame)->datalen / 2);
+ }
#endif
- return SWITCH_STATUS_SUCCESS;
- //}
+ return SWITCH_STATUS_SUCCESS;
- switch_cond_next();
- }
+ switch_cond_next();
+ }
- return SWITCH_STATUS_FALSE;
+ return SWITCH_STATUS_FALSE;
cng:
- data = (switch_byte_t *) tech_pvt->read_frame.data;
- data[0] = 65;
- data[1] = 0;
- tech_pvt->read_frame.datalen = 2;
- tech_pvt->read_frame.flags = SFF_CNG;
- *frame = &tech_pvt->read_frame;
- return SWITCH_STATUS_SUCCESS;
+ data = (switch_byte_t *) tech_pvt->_read_frame.data;
+ data[0] = 65;
+ data[1] = 0;
+ tech_pvt->_read_frame.datalen = 2;
+ tech_pvt->_read_frame.flags = SFF_CNG;
+ *frame = &tech_pvt->_read_frame;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
{
- switch_channel_t *channel = NULL;
- private_t *tech_pvt = NULL;
- //switch_frame_t *pframe;
-
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
-
- tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
- assert(tech_pvt != NULL);
-
- if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
- return SWITCH_STATUS_FALSE;
- }
+ switch_channel_t *channel = NULL;
+ KhompPvt *tech_pvt = NULL;
+ //switch_frame_t *pframe;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+
+ if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ return SWITCH_STATUS_FALSE;
+ }
#ifdef BIGENDIAN
- if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
- switch_swap_linear(frame->data, (int) frame->datalen / 2);
- }
+ if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+ switch_swap_linear(frame->data, (int) frame->datalen / 2);
+ }
#endif
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_answer_channel(switch_core_session_t *session)
{
- private_t *tech_pvt;
- switch_channel_t *channel = NULL;
+ KhompPvt *tech_pvt;
+ switch_channel_t *channel = NULL;
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
- tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
- assert(tech_pvt != NULL);
+ tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
{
- switch_channel_t *channel;
- private_t *tech_pvt;
+ switch_channel_t *channel;
+ KhompPvt *tech_pvt;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "When the fuck is this called?.\n");
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
- tech_pvt = (private_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ tech_pvt = (KhompPvt *) switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
- switch (msg->message_id) {
- case SWITCH_MESSAGE_INDICATE_ANSWER:
- {
- channel_answer_channel(session);
- }
- break;
- default:
- break;
- }
+ switch (msg->message_id) {
+ case SWITCH_MESSAGE_INDICATE_ANSWER:
+ {
+ channel_answer_channel(session);
+ }
+ break;
+ default:
+ break;
+ }
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
- switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
+ switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
- char *argv[3] = { 0 };
- int argc = 0;
+ char *argv[3] = { 0 };
+ int argc = 0;
- if ((*new_session = switch_core_session_request(khomp_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
- private_t *tech_pvt;
- switch_channel_t *channel;
- switch_caller_profile_t *caller_profile;
-
- switch_core_session_add_stream(*new_session, NULL);
- if ((tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) != 0) {
- channel = switch_core_session_get_channel(*new_session);
- tech_init(tech_pvt, *new_session);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
- switch_core_session_destroy(new_session);
- return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
- }
+ if ((*new_session = switch_core_session_request(Globals::_khomp_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+ KhompPvt *tech_pvt;
+ switch_channel_t *channel;
+ switch_caller_profile_t *caller_profile;
+
+ switch_core_session_add_stream(*new_session, NULL);
+ if ((tech_pvt = (KhompPvt *) switch_core_session_alloc(*new_session, sizeof(KhompPvt))) != 0) {
+ channel = switch_core_session_get_channel(*new_session);
+ tech_init(tech_pvt, *new_session);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
+ switch_core_session_destroy(new_session);
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+ }
- if (outbound_profile) {
- char name[128];
+ if (outbound_profile) {
+ char name[128];
- snprintf(name, sizeof(name), "Khomp/%s", outbound_profile->destination_number);
- switch_channel_set_name(channel, name);
+ snprintf(name, sizeof(name), "Khomp/%s", outbound_profile->destination_number);
+ switch_channel_set_name(channel, name);
/* Let's setup our own vars on tech_pvt */
if ((argc = switch_separate_string(outbound_profile->destination_number, '/', argv, (sizeof(argv) / sizeof(argv[0])))) < 3)
@@ -503,220 +479,148 @@
}
else
{
- tech_pvt->KDeviceId = atoi(argv[0]);
- tech_pvt->KChannel = atoi(argv[1]);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Dialing to %s out from Board:%u, Channel:%u.\n",
- argv[2],
- tech_pvt->KDeviceId,
- tech_pvt->KChannel);
+// usar algoritmo de busca de canais (spec.*).
+// tech_pvt->_KDeviceId = atoi(argv[0]);
+// tech_pvt->_KChannel = atoi(argv[1]);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Dialing to %s out\n",// from Board:%u, Channel:%u.\n",
+ argv[2]
+ //, tech_pvt->_KDeviceId, tech_pvt->_KChannel
+ );
}
- caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
- switch_channel_set_caller_profile(channel, caller_profile);
- tech_pvt->caller_profile = caller_profile;
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
- switch_core_session_destroy(new_session);
+ caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
+ switch_channel_set_caller_profile(channel, caller_profile);
+ tech_pvt->_caller_profile = caller_profile;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
+ switch_core_session_destroy(new_session);
/* Destroy the channel session */
- k3l->setSession(tech_pvt->KDeviceId, tech_pvt->KChannel, NULL);
- return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
- }
+ // Globals::_k3lapi.setSession(tech_pvt->_KDeviceId, tech_pvt->_KChannel, NULL);
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+ }
- switch_channel_set_flag(channel, CF_OUTBOUND);
- switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
- switch_channel_set_state(channel, CS_INIT);
+ switch_channel_set_flag(channel, CF_OUTBOUND);
+ switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
+ switch_channel_set_state(channel, CS_INIT);
try {
/* Lets make the call! */
char params[ 255 ];
- sprintf(params, "dest_addr=\"%s\" orig_addr=\"%s\"", argv[2], outbound_profile->caller_id_number);
+ sprintf(params, "dest_addr=\"%s\"", argv[2]);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "We are calling with params: %s.\n", params);
- k3l->command(tech_pvt->KDeviceId,tech_pvt->KChannel, CM_MAKE_CALL, params);
+ //Globals::_k3lapi.command(tech_pvt->_KDeviceId,tech_pvt->_KChannel, CM_MAKE_CALL, params);
}
catch(K3LAPI::failed_command & e)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not place call! Cause: code%x and rc%d.\n", e.code, e.rc);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not place call! Cause: code%x and rc%d.\n", e.code, e.rc);
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
/* Add the new session the the channel's info */
- k3l->setSession(tech_pvt->KDeviceId, tech_pvt->KChannel, *new_session);
+ //Globals::_k3lapi.setSession(tech_pvt->_KDeviceId, tech_pvt->_KChannel, *new_session);
- return SWITCH_CAUSE_SUCCESS;
- }
+ return SWITCH_CAUSE_SUCCESS;
+ }
- return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event)
{
- struct private_object *tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
- char *body = switch_event_get_body(event);
- switch_assert(tech_pvt != NULL);
-
- if (!body) {
- body = "";
- }
+ struct KhompPvt *tech_pvt = static_cast<KhompPvt*>(switch_core_session_get_private(session));
+ char *body = switch_event_get_body(event);
+ switch_assert(tech_pvt != NULL);
- return SWITCH_STATUS_SUCCESS;
-}
-
-
-
-switch_state_handler_table_t khomp_state_handlers = {
- /*.on_init */ channel_on_init,
- /*.on_routing */ channel_on_routing,
- /*.on_execute */ channel_on_execute,
- /*.on_hangup */ channel_on_hangup,
- /*.on_exchange_media */ channel_on_exchange_media,
- /*.on_soft_execute */ channel_on_soft_execute
-};
-
-switch_io_routines_t khomp_io_routines = {
- /*.outgoing_channel */ channel_outgoing_channel,
- /*.read_frame */ channel_read_frame,
- /*.write_frame */ channel_write_frame,
- /*.kill_channel */ channel_kill_channel,
- /*.send_dtmf */ channel_send_dtmf,
- /*.receive_message */ channel_receive_message,
- /*.receive_event */ channel_receive_event
-};
+ if (!body) {
+ body = (char *)"";
+ }
-static switch_status_t load_config(void)
-{
- const char *cf = "khomp.conf";
- switch_xml_t cfg, xml, settings, param;
+ return SWITCH_STATUS_SUCCESS;
+}
- memset(&globals, 0, sizeof(globals));
- switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
- 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, "debug")) {
- globals.debug = atoi(val);
- } else if (!strcmp(var, "port")) {
- globals.port = atoi(val);
- } else if (!strcmp(var, "ip")) {
- set_global_ip(val);
- } else if (!strcmp(var, "codec-master")) {
- if (!strcasecmp(val, "us")) {
- switch_set_flag(&globals, GFLAG_MY_CODEC_PREFS);
- }
- } else if (!strcmp(var, "dialplan")) {
- set_global_dialplan(val);
- } else if (!strcmp(var, "codec-prefs")) {
- set_global_codec_string(val);
- globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
- } else if (!strcmp(var, "codec-rates")) {
- set_global_codec_rates_string(val);
- globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
- }
- }
- }
-
- if (!globals.dialplan) {
- set_global_dialplan("default");
- }
-
- if (!globals.port) {
- globals.port = 4569;
- }
- switch_xml_free(xml);
- return SWITCH_STATUS_SUCCESS;
-}
SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load)
{
- module_pool = pool;
+ Globals::_module_pool = pool;
- memset(&globals, 0, sizeof(globals));
-
- load_config();
+ /* start config system! */
+ Opt::initialize();
+
+ Opt::obtain();
- switch_api_interface_t *api_interface;
+ //load_config();
- *module_interface = switch_loadable_module_create_module_interface(pool, "mod_khomp");
- khomp_endpoint_interface = static_cast<switch_endpoint_interface_t*>(switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE));
- khomp_endpoint_interface->interface_name = "khomp";
- khomp_endpoint_interface->io_routines = &khomp_io_routines;
- khomp_endpoint_interface->state_handler = &khomp_state_handlers;
/*
Spawn our k3l global var that will be used along the module
for sending info to the boards
*/
- k3lSetGlobalParam (klpResetFwOnStartup, 1);
- k3lSetGlobalParam (klpDisableInternalVoIP, 1);
-
- k3l = new K3LAPI();
/* Start the API and connect to KServer */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting K3L...\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting K3L...\n");
try {
- k3l->start();
+ Globals::_k3lapi.start();
} catch (K3LAPI::start_failed & e) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "K3L not started. Reason:%s.\n", e.msg.c_str());
return SWITCH_STATUS_TERM;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "K3L started.\n");
-
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "K3L started.\n");
+
k3lRegisterEventHandler( khomp_event_callback );
- k3lRegisterAudioListener (NULL, khomp_audio_listener);
+ k3lRegisterAudioListener (NULL, khomp_audio_listener);
+
+ *module_interface = switch_loadable_module_create_module_interface(pool, "mod_khomp");
+ Globals::_khomp_endpoint_interface = static_cast<switch_endpoint_interface_t*>(switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE));
+ Globals::_khomp_endpoint_interface->interface_name = "khomp";
+ Globals::_khomp_endpoint_interface->io_routines = &khomp_io_routines;
+ Globals::_khomp_endpoint_interface->state_handler = &khomp_state_handlers;
/* Add all the specific API functions */
- SWITCH_ADD_API(api_interface, "khomp", "Khomp Menu", khomp, KHOMP_SYNTAX);
+ SWITCH_ADD_API(Globals::_api_interface, "khomp", "Khomp Menu", khomp, KHOMP_SYNTAX);
- /* indicate that the module should continue to be loaded */
- return SWITCH_STATUS_SUCCESS;
+ /* indicate that the module should continue to be loaded */
+ return SWITCH_STATUS_SUCCESS;
}
/*
SWITCH_MODULE_RUNTIME_FUNCTION(mod_khomp_runtime)
{
- return SWITCH_STATUS_TERM;
+ return SWITCH_STATUS_TERM;
}
*/
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown)
{
- int x = 0;
+ int x = 0;
- running = -1;
+ Globals::_running = -1;
- while (running) {
- if (x++ > 100) {
- break;
- }
- switch_yield(20000);
- }
-
- /* Free dynamically allocated strings */
- switch_safe_free(globals.dialplan);
- switch_safe_free(globals.codec_string);
- switch_safe_free(globals.codec_rates_string);
- switch_safe_free(globals.ip);
-
- /* Finnish him! */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stopping K3L...\n");
- k3l->stop();
- delete k3l;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "the K3L API has been stopped!\n");
-
- return SWITCH_STATUS_SUCCESS;
+ while (Globals::_running) {
+ if (x++ > 100) {
+ break;
+ }
+ switch_yield(20000);
+ }
+
+ /* Free dynamically allocated strings */
+ switch_safe_free(Opt::_dialplan);
+ switch_safe_free(Opt::_codec_string);
+ switch_safe_free(Opt::_codec_rates_string);
+ switch_safe_free(Opt::_ip);
+
+ /* Finnish him! */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stopping K3L...\n");
+ Globals::_k3lapi.stop();
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "the K3L API has been stopped!\n");
+
+ return SWITCH_STATUS_SUCCESS;
}
/*
@@ -725,27 +629,27 @@
*/
SWITCH_STANDARD_API(khomp)
{
- char *argv[10] = { 0 };
- int argc = 0;
- void *val;
- char *myarg = NULL;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
+ char *argv[10] = { 0 };
+ int argc = 0;
+ void *val;
+ char *myarg = NULL;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
/* We should not ever get a session here */
- if (session) return status;
+ if (session) return status;
- if (switch_strlen_zero(cmd) || !(myarg = strdup(cmd))) {
- stream->write_function(stream, "USAGE: %s\n", KHOMP_SYNTAX);
- return SWITCH_STATUS_FALSE;
- }
-
- if ((argc = switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1) {
- stream->write_function(stream, "USAGE: %s\n", KHOMP_SYNTAX);
- goto done;
- }
+ if (switch_strlen_zero(cmd) || !(myarg = strdup(cmd))) {
+ stream->write_function(stream, "USAGE: %s\n", KHOMP_SYNTAX);
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if ((argc = switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1) {
+ stream->write_function(stream, "USAGE: %s\n", KHOMP_SYNTAX);
+ goto done;
+ }
/* Below show ... */
- if (argv[0] && !strncasecmp(argv[0], "show", 4)) {
+ if (argv[0] && !strncasecmp(argv[0], "show", 4)) {
/* Show the API summary and information */
if (argv[1] && !strncasecmp(argv[1], "info", 4)) {
printSystemSummary(stream);
@@ -761,13 +665,13 @@
printChannels(stream, NULL, NULL);
}
- } else {
- stream->write_function(stream, "USAGE: %s\n", KHOMP_SYNTAX);
- }
+ } else {
+ stream->write_function(stream, "USAGE: %s\n", KHOMP_SYNTAX);
+ }
done:
- switch_safe_free(myarg);
- return status;
+ switch_safe_free(myarg);
+ return status;
}
@@ -775,13 +679,13 @@
static void printChannels(switch_stream_handle_t* stream, unsigned int device, unsigned int link) {
if (!device) {
// Print all channels from all boards and links
- stream->write_function(stream, "|--------- Khomp ----------|\n");
- stream->write_function(stream, "| Board | Channel | Status |\n");
- for (int board=0 ; board < k3l->device_count() ; board++) {
- for (int channel=0 ; channel < k3l->channel_count(board) ; channel++) {
+ stream->write_function(stream, "|--------- Khomp ----------|\n");
+ stream->write_function(stream, "| Board | Channel | Status |\n");
+ for (int board=0 ; board < Globals::_k3lapi.device_count() ; board++) {
+ for (int channel=0 ; channel < Globals::_k3lapi.channel_count(board) ; channel++) {
try {
K3L_CHANNEL_CONFIG channelConfig;
- channelConfig = k3l->channel_config( board, channel );
+ channelConfig = Globals::_k3lapi.channel_config( board, channel );
}
catch (...){
stream->write_function(stream, "OOOPSS. Something went wrong, cleanup this mess!\n");
@@ -821,12 +725,12 @@
// We want to see all links from all devices
if (!device) {
- for(int device=0 ; device < k3l->device_count() ; device++)
+ for(int device=0 ; device < Globals::_k3lapi.device_count() ; device++)
{
- K3L_LINK_CONFIG & config = k3l->link_config(device, link);
+ K3L_LINK_CONFIG & config = Globals::_k3lapi.link_config(device, link);
K3L_LINK_STATUS status;
- for(int link=0 ; link < k3l->link_count(device) ; link++)
+ for(int link=0 ; link < Globals::_k3lapi.link_count(device) ; link++)
{
const char * E1Status = "";
if (k3lGetDeviceStatus (device, link + ksoLink, &status, sizeof(status)) == ksSuccess)
@@ -922,13 +826,13 @@
, apiCfg.VpdVersionNeeded , apiCfg.StrVersion);
}
- for (unsigned int i = 0; i < k3l->device_count(); i++)
+ for (unsigned int i = 0; i < Globals::_k3lapi.device_count(); i++)
{
- K3L_DEVICE_CONFIG & devCfg = k3l->device_config(i);
+ K3L_DEVICE_CONFIG & devCfg = Globals::_k3lapi.device_config(i);
stream->write_function(stream, " ------------------------------------------------------------------\n");
- switch (k3l->device_type(i))
+ switch (Globals::_k3lapi.device_type(i))
{
/* E1 boards */
case kdtE1:
@@ -1001,7 +905,7 @@
}
default:
stream->write_function(stream, "| [[ %02d ]] Unknown type '%02d'! Please contact Khomp support for help! |\n"
- , i , k3l->device_type(i));
+ , i , Globals::_k3lapi.device_type(i));
break;
}
}
@@ -1010,120 +914,17 @@
}
/* End of helper functions */
-/* Create a new channel on incoming call */
-KLibraryStatus khomp_channel_from_event(unsigned int KDeviceId, unsigned int KChannel, K3L_EVENT * event)
-{
- switch_core_session_t *session = NULL;
- private_t *tech_pvt = NULL;
- switch_channel_t *channel = NULL;
- char name[128];
-
- if (!(session = switch_core_session_request(khomp_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Initilization Error!\n");
- return ksFail;
- }
-
- switch_core_session_add_stream(session, NULL);
-
- tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(private_t));
- assert(tech_pvt != NULL);
- channel = switch_core_session_get_channel(session);
- if (tech_init(tech_pvt, session) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Initilization Error!\n");
- switch_core_session_destroy(&session);
- return ksFail;
- }
-
-
- /* Get all data from event */
- std::string cidNum;
- std::string destination_number;
- try
- {
- cidNum = k3l->get_param(event, "orig_addr");
- destination_number = k3l->get_param(event, "dest_addr");
- }
- catch ( K3LAPI::get_param_failed & err )
- {
- // TODO: Can we set NULL variables? What should we do if this fails?
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not get param %s on channel %u, board %u.\n", err.name.c_str(), KChannel, KDeviceId);
- }
-
- /*if (switch_strlen_zero(sigmsg->channel->caller_data.cid_num.digits)) {
- if (!switch_strlen_zero(sigmsg->channel->caller_data.ani.digits)) {
- switch_set_string(sigmsg->channel->caller_data.cid_num.digits, sigmsg->channel->caller_data.ani.digits);
- } else {
- switch_set_string(sigmsg->channel->caller_data.cid_num.digits, sigmsg->channel->chan_number);
- }
- }
- */
-
- /* Set the caller profile - Look at documentation */
- tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
- "Khomp",
- "XML", // TODO: Dialplan module to use?
- NULL,
- NULL,
- NULL,
- cidNum.c_str(),
- NULL,
- NULL,
- (char *) modname,
- "default", // TODO: Context to look for on the dialplan?
- destination_number.c_str());
-
- assert(tech_pvt->caller_profile != NULL);
- /* END */
-
- /* WHAT??? - Look at documentation */
- //switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_NONE);
- /* END */
-
- /* */
- snprintf(name, sizeof(name), "Khomp/%u/%u/%s", KDeviceId, KChannel, tech_pvt->caller_profile->destination_number);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect inbound channel %s\n", name);
- switch_channel_set_name(channel, name);
- switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
- /* END */
-
-
- switch_channel_set_state(channel, CS_INIT);
- if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
- switch_core_session_destroy(&session);
- return ksFail;
- }
-
- /* WHAT?
- if (zap_channel_add_token(sigmsg->channel, switch_core_session_get_uuid(session), 0) != ZAP_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error adding token\n");
- switch_core_session_destroy(&session);
- return ZAP_FAIL;
- }
- */
-
- /* Set the session to the channel */
- k3l->setSession(KDeviceId, KChannel, session);
-
- return ksSuccess;
-}
-
static int32 Kstdcall khomp_event_callback(int32 obj, K3L_EVENT * e)
-{
+{
/* TODO: How do we make sure channels inside FreeSWITCH only change to valid states on K3L? */
switch(e->Code)
{
case EV_NEW_CALL:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "New call on %u to %s. [EV_NEW_CALL]\n", obj, k3l->get_param(e, "dest_addr").c_str());
- if (khomp_channel_from_event(e->DeviceId, obj, e) != ksSuccess )
- {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Something bad happened while getting channel session. Device:%u/Channel:%u. [EV_CONNECT]\n", e->DeviceId, obj);
- return ksFail;
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "New call on %u to %s. [EV_NEW_CALL]\n", obj, Globals::_k3lapi.get_param(e, "dest_addr").c_str());
try {
- k3l->command(e->DeviceId, obj, CM_RINGBACK, NULL);
- k3l->command(e->DeviceId, obj, CM_CONNECT, NULL);
+ Globals::_k3lapi.command(e->DeviceId, obj, CM_RINGBACK, NULL);
+ Globals::_k3lapi.command(e->DeviceId, obj, CM_CONNECT, NULL);
}
catch (K3LAPI::failed_command & err)
{
@@ -1131,43 +932,31 @@
}
break;
case EV_DISCONNECT:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Called party dropped the call on: %u. Releasing channel. [EV_DISCONNECT]\n", obj);
+ if (channel_on_hangup(KhompPvt::khompPvt(e->DeviceId, obj)->session()) != SWITCH_STATUS_SUCCESS)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not hangup channel: %u on board %u. Releasing board channel anyway. [EV_DISCONNECT]\n", obj, e->DeviceId);
+ try
{
- switch_core_session_t * session = NULL;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Called party dropped the call on: %u. Releasing channel. [EV_DISCONNECT]\n", obj);
- try
- {
- session = k3l->getSession(e->DeviceId, obj);
- }
- catch(K3LAPI::invalid_channel & err)
- {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Session does not exist on channel: %u on board %u. Releasing board channel anyway. [EV_DISCONNECT]\n", obj, e->DeviceId);
- }
- if (channel_on_hangup(session) != SWITCH_STATUS_SUCCESS)
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not hangup channel: %u on board %u. Releasing board channel anyway. [EV_DISCONNECT]\n", obj, e->DeviceId);
- try
- {
- k3l->setSession(e->DeviceId, obj, NULL);
- }
- catch(K3LAPI::invalid_channel & err)
- {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "We are trying to set session on an non existent channel: %u on board %u. Releasing channel. [EV_DISCONNECT]\n", obj, e->DeviceId);
- }
- /* Do we need to release on the board? */
- k3l->command(e->DeviceId, obj, CM_DISCONNECT, NULL);
+ Globals::_k3lapi.command(e->DeviceId, obj, CM_DISCONNECT, NULL);
+ KhompPvt::khompPvt(e->DeviceId, obj)->session(NULL);
+ }
+ catch(K3LAPI::invalid_channel & err)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not send CM_DISCONNECT!\n");
}
break;
case EV_CONNECT:
- switch_core_session_t* session;
+ switch_core_session_t* session;
try
{
- session = k3l->getSession(e->DeviceId ,obj);
+ session = KhompPvt::khompPvt(e->DeviceId, obj)->session();
switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Call will be answered on board %u, channel %u. [EV_CONNECT]\n", e->DeviceId, obj);
switch_channel_mark_answered(channel);
/* Start listening for audio */
const size_t buffer_size = 16;
- k3l->command(e->DeviceId, obj, CM_LISTEN, (const char *) &buffer_size);
+ Globals::_k3lapi.command(e->DeviceId, obj, CM_LISTEN, (const char *) &buffer_size);
}
catch (K3LAPI::invalid_session & err)
{
@@ -1229,7 +1018,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Channel %u on board %u reported failure. [EV_CHANNEL_FAIL]\n", obj, e->DeviceId);
break;
case EV_LINK_STATUS:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Link %u on board %u changed. [EV_LINK_STATUS]\n", e->DeviceId, obj);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Link %u on board %u changed. [EV_LINK_STATUS]\n", e->DeviceId, obj);
break;
case EV_PHYSICAL_LINK_DOWN:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Link %u on board %u is DOWN. [EV_PHYSICAL_LINK_DOWN]\n", e->DeviceId, obj);
@@ -1275,14 +1064,12 @@
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New Event has just arrived on %u with untreated code: %x\n", obj, e->Code);
}
-
+
return ksSuccess;
}
-
static void Kstdcall khomp_audio_listener (int32 deviceid, int32 mixer, byte * read_buffer, int32 read_size)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New audio buffer for deviceid %d, mixer %d, with size %d\n", deviceid, mixer, read_size);
}
/* For Emacs:
1
0
Author: mikej
Date: Fri Jun 26 16:02:10 2009
New Revision: 13988
Log:
partial update of spec file for current trunk (FSBUILD-176)
Modified:
freeswitch/trunk/freeswitch.spec
Modified: freeswitch/trunk/freeswitch.spec
==============================================================================
--- freeswitch/trunk/freeswitch.spec (original)
+++ freeswitch/trunk/freeswitch.spec Fri Jun 26 16:02:10 2009
@@ -1,836 +1,875 @@
-%define _prefix /opt/freeswitch
-%define prefix %{_prefix}
-%define sysconfdir /opt/freeswitch/conf
-%define _sysconfdir %{sysconfdir}
-
-Name: freeswitch
-Summary: FreeSWITCH open source telephony platform
-License: MPL
-Group: Productivity/Telephony/Servers
-Version: 1.0.4
-Release: 1
-URL: http://www.freeswitch.org/
-Packager: Michal Bielicki
-Vendor: http://www.halokwadrat.de/
-Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2
-Source1: http://svn.freeswitch.org/downloads/libs/celt-0.5.1.tar.gz
-Source2: http://svn.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz
-Source3: http://svn.freeswitch.org/downloads/libs/lame-3.97.tar.gz
-Source4: http://svn.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz
-Source5: http://svn.freeswitch.org/downloads/libs/mpg123.tar.gz
-Source6: http://svn.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz
-Source7: http://svn.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz
-Source8: http://svn.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz
-Source9: http://svn.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz
-Source10: http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.7.tar.gz
-Source11: http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.7.tar.gz
-Source12: http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.7.tar.gz
-Source13: http://files.freeswitch.org/freeswitch-sounds-music-48000-1.0.7.tar.gz
-Source14: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.7.tar.gz
-Source15: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.7.tar.…
-Source16: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.7.tar.…
-Source17: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-1.0.7.tar.…
-Source18: http://svn.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.ta…
-Prefix: %{prefix}
-
-#AutoReqProv: no
-
-%if 0%{?suse_version} > 100
-#BuildRequires: openldap2-devel
-BuildRequires: lzo-devel
-%else
-BuildRequires: openldap-devel
-%endif
-BuildRequires: autoconf
-BuildRequires: automake
-BuildRequires: curl-devel
-BuildRequires: gcc-c++
-BuildRequires: gnutls-devel
-BuildRequires: libtool >= 1.5.17
-BuildRequires: ncurses-devel
-BuildRequires: openssl-devel
-BuildRequires: perl
-BuildRequires: pkgconfig
-BuildRequires: termcap
-BuildRequires: unixODBC-devel
-BuildRequires: gdbm-devel
-BuildRequires: db4-devel
-BuildRequires: python-devel
-BuildRequires: libogg-devel
-BuildRequires: libvorbis-devel
-BuildRequires: libtiff-devel
-#BuildRequires: mono-devel
-BuildRequires: alsa-lib-devel
-BuildRequires: which
-BuildRequires: zlib-devel
-
-%if %{?suse_version:1}0
-%if 0%{?suse_version} > 910
-#BuildRequires: autogen
-%endif
-%endif
-
-%if 0%{?suse_version} > 800
-#PreReq: /usr/sbin/useradd /usr/sbin/groupadd
-PreReq: %insserv_prereq %fillup_prereq
-%endif
-
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-%description
-FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice
-and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a
-simple switching engine, a media gateway or a media server to host IVR applications using
-simple scripts or XML to control the callflow.
-
-We support various communication technologies such as SIP, H.323, IAX2 and GoogleTalk making
-it easy to interface with other open source PBX systems such as sipX, OpenPBX, Bayonne, YATE or Asterisk.
-
-We also support both wide and narrow band codecs making it an ideal solution to bridge legacy
-devices to the future. The voice channels and the conference bridge module all can operate
-at 8, 16 or 32 kilohertz and can bridge channels of different rates.
-
-FreeSWITCH runs on several operating systems including Windows, Max OS X, Linux, BSD and Solaris
-on both 32 and 64 bit platforms.
-
-Our developers are heavily involved in open source and have donated code and other resources to
-other telephony projects including sipXecs, OpenSER, Asterisk, CodeWeaver and OpenPBX.
-
-%package devel
-Summary: Development package for FreeSWITCH open source telephony platform
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description devel
-FreeSWITCH development files
-
-%package codec-passthru-amrwb
-Summary: Pass-through AMR WideBand Codec support for FreeSWITCH open source telephony platform
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-Conflicts: codec-amrwb
-
-%description codec-passthru-amrwb
-Pass-through AMR WideBand Codec support for FreeSWITCH open source telephony platform
-
-
-%package codec-passthru-amr
-Summary: Pass-through AMR Codec support for FreeSWITCH open source telephony platform
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-Conflicts: codec-amr
-
-%description codec-passthru-amr
-Pass-through AMR Codec support for FreeSWITCH open source telephony platform
-
-%package codec-passthru-g723_1
-Summary: Pass-through g723.1 Codec support for FreeSWITCH open source telephony platform
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-Conflicts: codec-g723_1
-
-%description codec-passthru-g723_1
-Pass-through g723.1 Codec support for FreeSWITCH open source telephony platform
-
-%package codec-passthru-g729
-Summary: Pass-through g729 Codec support for FreeSWITCH open source telephony platform
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-Conflicts: codec-g729
-
-%description codec-passthru-g729
-Pass-through g729 Codec support for FreeSWITCH open source telephony platform
-
-%package spidermonkey
-Summary: JavaScript support for the FreeSWITCH open source telephony platform
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description spidermonkey
-
-%package lua
-Summary: Lua support for the FreeSWITCH open source telephony platform
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description lua
-
-%package perl
-Summary: Perl support for the FreeSWITCH open source telephony platform
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description perl
-
-%package python
-Summary: Python support for the FreeSWITCH open source telephony platform
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description python
-
-
-%package lang-en
-Summary: Provides english language dependand modules and speech config for the FreeSwitch Open Source telephone platform.
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description lang-en
-English language phrases module and directory structure for say module and voicemail
-
-%package lang-fr
-Summary: Provides french language dependand modules and speech config for the FreeSwitch Open Source telephone platform.
-Group: System/LibrariesRequires: %{name} = %{version}-%{release}
-
-%description lang-fr
-French language phrases module and directory structure for say module and voicemail
-
-%package lang-de
-Summary: Provides german language dependand modules and speech config for the FreeSwitch Open Source telephone platform.
-Group: System/LibrariesRequires: %{name} = %{version}-%{release}
-
-%description lang-de
-German language phrases module and directory structure for say module and voicemail
-
-
-%package openzap
-Summary: Provides a unified interface to hardware TDM cards and ss7 stacks for freeswitch
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description openzap
-OpenZAP
-
-%package moh
-Summary: FreeSWITCH Music on hold files
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description moh
-8khz music on hold files for freeswitch
-
-
-%package hd-moh
-Summary: High Definition FreeSWITCH Music on hold files
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description hd-moh
-16khz High Definition FreeSWITCH Music on hold files
-
-
-%package uhd-moh
-Summary: Ultra High Definition FreeSWITCH Music on hold files
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description uhd-moh
-32khz Ultra High Definition FreeSWITCH Music on hold files
-
-
-%package cd-moh
-Summary: CD Quality FreeSWITCH Musci on hold files
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description cd-moh
-40khz CD Quality FreeSWITCH Music on hold files
-
-
-%package sounds-en-callie
-Summary: English prompts for Freeswitch
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description sounds-en-callie
-8khz English prompts for Freeswitch
-
-
-%package hd-sounds-en-callie
-Summary: High Density English prompts for Freeswitch
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description hd-sounds-en-callie
-16khz High Density English prompts for Freeswitch
-
-
-%package uhd-sounds-en-callie
-Summary: Ultra High Density English prompts for Freeswitch
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description uhd-sounds-en-callie
-32khz Ultra High Density English prompts for Freeswitch
-
-
-%package cd-sounds-en-callie
-Summary: CD Quality English prompts for Freeswitch
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description cd-sounds-en-callie
-40khz CD Quality English prompts for Freeswitch
-
-
-%prep
-%setup -b0 -q
-cp %{SOURCE1} libs/
-cp %{SOURCE2} libs/
-cp %{SOURCE3} libs/
-cp %{SOURCE4} libs/
-cp %{SOURCE5} libs/
-cp %{SOURCE6} libs/
-cp %{SOURCE7} libs/
-cp %{SOURCE8} libs/
-cp %{SOURCE9} libs/
-cp %{SOURCE10} .
-cp %{SOURCE11} .
-cp %{SOURCE12} .
-cp %{SOURCE13} .
-cp %{SOURCE14} .
-cp %{SOURCE15} .
-cp %{SOURCE16} .
-cp %{SOURCE17} .
-cp %{SOURCE18} libs/
-
-
-%build
-%ifos linux
-%if 0%{?suse_version} > 1000 && 0%{?suse_version} < 1030
-export CFLAGS="$CFLAGS -fstack-protector"
-%endif
-%if 0%{?fedora_version} >= 8
-export QA_RPATHS=$[ 0x0001|0x0002 ]
-%endif
-%endif
-
-PASSTHRU_CODEC_MODULES="codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr codecs/mod_amrwb"
-SPIDERMONKEY_MODULES="languages/mod_spidermonkey languages/mod_spidermonkey_curl languages/mod_spidermonkey_core_db languages/mod_spidermonkey_odbc languages/mod_spidermonkey_socket languages/mod_spidermonkey_teletone"
-APPLICATIONS_MODULES="applications/mod_commands applications/mod_conference applications/mod_dptools applications/mod_enum applications/mod_esf applications/mod_expr applications/mod_fifo applications/mod_limit applications/mod_rss applications/mod_voicemail applications/mod_fsv applications/mod_lcr applications/mod_easyroute applications/mod_stress applications/mod_http applications/mod_vmd applications/mod_limit applications/mod_soundtouch applications/mod_fax"
-ASR_TTS_MODULES="asr_tts/mod_pocketsphinx asr_tts/mod_flite"
-CODECS_MODULES="codecs/mod_ilbc codecs/mod_h26x codecs/mod_voipcodecs codecs/mod_speex codecs/mod_celt codecs/mod_siren"
-DIALPLANS_MODULES="dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml"
-DIRECTORIES_MODULES=""
-ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_iax endpoints/mod_portaudio endpoints/mod_sofia ../../libs/openzap/mod_openzap endpoints/mod_loopback"
-EVENT_HANDLERS_MODULES="event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv"
-FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream formats/mod_shout"
-LANGUAGES_MODULES="languages/mod_perl languages/mod_lua languages/mod_python languages/mod_yaml"
-LOGGERS_MODULES="loggers/mod_console loggers/mod_logfile loggers/mod_syslog"
-SAY_MODULES="say/mod_say_en say/mod_say_de say/mod_say_fr"
-TIMERS_MODULES=
-DISABLED_MODULES="applications/mod_soundtouch languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf languages/mod_managed languages/mod_java say/mod_say_it say/mod_say_es say/mod_say_nl"
-XML_INT_MODULES="xml_int/mod_xml_rpc xml_int/mod_xml_curl xml_int/mod_xml_cdr "
-MYMODULES="$PASSTHRU_CODEC_MODULES $SPIDERMONKEY_MODULES $APPLICATIONS_MODULES $ASR_TTS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $ENDPOINTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES"
-
-export MODULES=$MYMODULES
-test ! -f modules.conf || rm -f modules.conf
-touch modules.conf
-for i in $MODULES; do echo $i >> modules.conf; done
-export VERBOSE=yes
-export DESTDIR=$RPM_BUILD_ROOT/
-export PKG_CONFIG_PATH=/usr/bin/pkg-config:$PKG_CONFIG_PATH
-export ACLOCAL_FLAGS="-I /usr/share/aclocal"
-
-if test ! -f Makefile.in
-then
- ./bootstrap.sh
-fi
-
-
- %configure -C \
- --prefix=%{prefix} \
- --infodir=%{_infodir} \
- --mandir=%{_mandir} \
- --sysconfdir=%{sysconfdir} \
- --libdir=%{prefix}/lib \
- --enable-core-libedit-support \
- --enable-core-odbc-support \
-%ifos linux
-%if 0%{?fedora_version} >= 8
-%else
- --with-libcurl \
-%endif
-%endif
- --with-openssl \
- %{?configure_options}
-
-#Create the version header file here
-cat src/include/switch_version.h.in | sed "s/@SVN_VERSION@/%{version}/g" > src/include/switch_version.h
-touch .noversion
-
-%{__make}
-
-%install
-# delete unsupported langugages for now
-#rm -rf conf/lang/de
-#rm -rf conf/lang/fr
-#rm -rf $RPM_BUILD_ROOT%{prefix}/conf/lang/de
-#rm -rf $RPM_BUILD_ROOT%{prefix}/conf/lang/fr
-
-%{__make} DESTDIR=$RPM_BUILD_ROOT install
-
-# Install Sound Files
-%{__make} DESTDIR=$RPM_BUILD_ROOT cd-sounds-install
-%{__make} DESTDIR=$RPM_BUILD_ROOT cd-moh-install
-
-# Create a log dir
-%{__mkdir} -p $RPM_BUILD_ROOT%{prefix}/log
-
-%ifos linux
-#Install the library path config so the system can find the modules
-%{__mkdir} -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
-%{__cp} build/freeswitch.ld.so.conf $RPM_BUILD_ROOT/etc/ld.so.conf.d/
-# Install init files
-# On SuSE:
-%if 0%{?suse_version} > 100
-%{__install} -D -m 744 build/freeswitch.init.suse $RPM_BUILD_ROOT/etc/init.d/freeswitch
-%else
-# On RedHat like
-%{__install} -D -m 0755 build/freeswitch.init.redhat $RPM_BUILD_ROOT/etc/init.d/freeswitch
-%endif
-# On SuSE make /usr/sbin/rcfreeswitch a link to /etc/init.d/freeswitch
-%if 0%{?suse_version} > 100
-%{__mkdir} -p $RPM_BUILD_ROOT/usr/sbin
-%{__ln_s} -f /etc/init.d/freeswitch $RPM_BUILD_ROOT/usr/sbin/rcfreeswitch
-%endif
-# Add the sysconfiguration file
-%{__install} -D -m 744 build/freeswitch.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/freeswitch
-# Add monit file
-%{__install} -D -m 644 build/freeswitch.monitrc $RPM_BUILD_ROOT/etc/monit.d/freeswitch.monitrc
-%endif
-
-
-# Add a freeswitch user with group daemon
-%pre
-%ifos linux
-/usr/sbin/useradd -r -g daemon -s /bin/false -c "The FreeSWITCH Open Source Voice Platform" -d %{prefix} freeswitch 2> /dev/null || :
-%endif
-
-%post
-%{?run_ldconfig:%run_ldconfig}
-# Make FHS2.0 happy
-%{__mkdir} -p /etc/opt
-%{__ln_s} -f %{prefix}/conf /etc%{prefix}
-
-chkconfig --add freeswitch
-
-%postun
-%{?run_ldconfig:%run_ldconfig}
-userdel freeswitch
-
-%clean
-%{__rm} -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,freeswitch,daemon)
-%ifos linux
-%dir %attr(0750, root, root) /etc/monit.d
-%endif
-%dir %attr(0750, freeswitch, daemon) %{prefix}/db
-%dir %attr(0750, freeswitch, daemon) %{prefix}/log
-%dir %attr(0750, freeswitch, daemon) %{prefix}/log/xml_cdr
-%dir %attr(0750, freeswitch, daemon) %{prefix}/htdocs
-%dir %attr(0750, freeswitch, daemon) %{prefix}/scripts
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/dialplan
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/directory
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/directory/default
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/dialplan/default
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/dialplan/public
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/external
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/jingle_profiles
-%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar
-%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model
-%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model/communicator
-%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model/wsj1
-%ifos linux
-%config(noreplace) %attr(0644, freeswitch, daemon) /etc/monit.d/freeswitch.monitrc
-%endif
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/mime.types
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.tpl
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.ttml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/m3ua.conf
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/extensions.conf
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/acl.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/alsa.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/conference.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/console.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/dialplan_directory.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/dingaling.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/enum.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/event_multicast.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/event_socket.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_csv.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/fax.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/fifo.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/shout.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/timezones.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/iax.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/ivr.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/java.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/limit.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/local_stream.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/logfile.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/modules.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/pocketsphinx.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/portaudio.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/post_load_modules.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/python.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/rss.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/sofia.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/switch.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/syslog.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/voicemail.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_cdr.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_curl.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_rpc.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/zeroconf.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/easyroute.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/lcr.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/opal.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/unicall.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/memcache.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/default/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/public/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/default/*
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/external/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/jingle_profiles/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/default.dic
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/model/communicator/*
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/model/wsj1/*
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/htdocs/*
-%ifos linux
-/etc/ld.so.conf.d/*
-/etc/init.d/freeswitch
-/etc/sysconfig/freeswitch
-%if 0%{?suse_version} > 100
-/usr/sbin/rcfreeswitch
-%endif
-%endif
-%attr(0755, freeswitch, daemon) %{prefix}/bin/*
-%{prefix}/lib/libfreeswitch*.so*
-%{prefix}/mod/mod_console.so*
-%{prefix}/mod/mod_logfile.so*
-%{prefix}/mod/mod_syslog.so*
-%{prefix}/mod/mod_commands.so*
-%{prefix}/mod/mod_conference.so*
-%{prefix}/mod/mod_dptools.so*
-%{prefix}/mod/mod_enum.so*
-%{prefix}/mod/mod_esf.so*
-%{prefix}/mod/mod_expr.so*
-%{prefix}/mod/mod_fifo.so*
-%{prefix}/mod/mod_limit.so*
-%{prefix}/mod/mod_rss.so*
-%{prefix}/mod/mod_voicemail.so*
-%{prefix}/mod/mod_pocketsphinx.so*
-%{prefix}/mod/mod_flite.so*
-%{prefix}/mod/mod_ilbc.so*
-%{prefix}/mod/mod_h26x.so*
-%{prefix}/mod/mod_voipcodecs.so*
-%{prefix}/mod/mod_speex.so*
-%{prefix}/mod/mod_dialplan_directory.so*
-%{prefix}/mod/mod_dialplan_xml.so*
-%{prefix}/mod/mod_dialplan_asterisk.so*
-%{prefix}/mod/mod_dingaling.so*
-%{prefix}/mod/mod_iax.so*
-%{prefix}/mod/mod_portaudio.so*
-%{prefix}/mod/mod_sofia.so*
-%{prefix}/mod/mod_cdr_csv.so*
-%{prefix}/mod/mod_event_multicast.so*
-%{prefix}/mod/mod_event_socket.so*
-%{prefix}/mod/mod_native_file.so*
-%{prefix}/mod/mod_sndfile.so*
-%{prefix}/mod/mod_local_stream.so*
-%{prefix}/mod/mod_xml_rpc.so*
-%{prefix}/mod/mod_xml_curl.so*
-%{prefix}/mod/mod_xml_cdr.so*
-%{prefix}/mod/mod_fsv.so
-%{prefix}/mod/mod_tone_stream.so
-%{prefix}/mod/mod_amrwb.so
-%{prefix}/mod/mod_celt.so
-%{prefix}/mod/mod_easyroute.so
-%{prefix}/mod/mod_http.so
-%{prefix}/mod/mod_lcr.so
-%{prefix}/mod/mod_loopback.so
-%{prefix}/mod/mod_siren.so
-%{prefix}/mod/mod_stress.so
-%{prefix}/mod/mod_yaml.so
-%{prefix}/mod/mod_shout.so
-%{prefix}/mod/mod_fax.so
-%{prefix}/mod/mod_soundtouch.so
-%{prefix}/mod/mod_vmd.so
-
-%files openzap
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/tones.conf
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/openzap.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/pika.conf
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/openzap.conf
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/wanpipe.conf
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/zt.conf
-%{prefix}/lib/libopenzap.so*
-%{prefix}/mod/mod_openzap.so*
-%{prefix}/mod/ozmod_analog.so*
-%{prefix}/mod/ozmod_analog_em.so*
-%{prefix}/mod/ozmod_isdn.so*
-%{prefix}/mod/ozmod_skel.*
-%{prefix}/mod/ozmod_ss7_boost.so*
-%{prefix}/mod/ozmod_wanpipe.so*
-%{prefix}/mod/ozmod_zt.so*
-
-%files codec-passthru-amrwb
-%defattr(-,freeswitch,daemon)
-%{prefix}/mod/mod_amrwb.so*
-
-%files codec-passthru-amr
-%defattr(-,freeswitch,daemon)
-%{prefix}/mod/mod_amr.so*
-
-%files codec-passthru-g723_1
-%defattr(-,freeswitch,daemon)
-%{prefix}/mod/mod_g723_1.so*
-
-%files codec-passthru-g729
-%defattr(-,freeswitch,daemon)
-%{prefix}/mod/mod_g729.so*
-
-%files spidermonkey
-%defattr(-,freeswitch,daemon)
-%{prefix}/mod/mod_spidermonkey*.so*
-%{prefix}/lib/libjs.so*
-%{prefix}/lib/libnspr4.so
-%{prefix}/lib/libplds4.so
-%{prefix}/lib/libplc4.so
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/spidermonkey.conf.xml
-
-%files lua
-%defattr(-,freeswitch,daemon)
-%{prefix}/mod/mod_lua*.so*
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/lua.conf.xml
-
-%files perl
-%defattr(-,freeswitch,daemon)
-%{prefix}/mod/mod_perl*.so*
-%{prefix}/perl/*
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/perl.conf.xml
-
-%files python
-%defattr(-,freeswitch,daemon)
-%{prefix}/mod/mod_python*.so*
-%attr(0644, root, bin) /usr/lib/python2.4/site-packages/freeswitch.py*
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/python.conf.xml
-
-%files devel
-%defattr(-, freeswitch, daemon)
-%{prefix}/lib/*.a
-%{prefix}/lib/*.la
-%{prefix}/lib/pkgconfig/*
-%{prefix}/mod/*.a
-%{prefix}/mod/*.la
-%{prefix}/include/*.h
-%{prefix}/include/spandsp/*
-
-%files lang-en
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en/demo
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en/vm
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/demo/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/vm/*.xml
-%{prefix}/mod/mod_say_en.so*
-
-%files lang-de
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de/demo
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de/vm
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/demo/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/vm/*.xml
-%{prefix}/mod/mod_say_de.so*
-
-%files lang-fr
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/demo
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/vm
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/demo/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/vm/*.xml
-%{prefix}/mod/mod_say_fr.so*
-
-%files moh
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/8000
-%{prefix}/sounds/music/8000/*
-
-%files hd-moh
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/16000
-%{prefix}/sounds/music/16000/*
-
-%files uhd-moh
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/32000
-%{prefix}/sounds/music/32000/*
-
-%files cd-moh
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/48000
-%{prefix}/sounds/music/48000/*
-
-%files sounds-en-callie
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/8000
-%{prefix}/sounds/en/us/callie/ascii/8000/*
-%{prefix}/sounds/en/us/callie/conference/8000/*
-%{prefix}/sounds/en/us/callie/currency/8000/*
-%{prefix}/sounds/en/us/callie/digits/8000/*
-%{prefix}/sounds/en/us/callie/ivr/8000/*
-%{prefix}/sounds/en/us/callie/misc/8000/*
-%{prefix}/sounds/en/us/callie/phonetic-ascii/8000/*
-%{prefix}/sounds/en/us/callie/time/8000/*
-%{prefix}/sounds/en/us/callie/voicemail/8000/*
-
-%files hd-sounds-en-callie
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/16000
-%{prefix}/sounds/en/us/callie/ascii/16000/*
-%{prefix}/sounds/en/us/callie/conference/16000/*
-%{prefix}/sounds/en/us/callie/currency/16000/*
-%{prefix}/sounds/en/us/callie/digits/16000/*
-%{prefix}/sounds/en/us/callie/ivr/16000/*
-%{prefix}/sounds/en/us/callie/misc/16000/*
-%{prefix}/sounds/en/us/callie/phonetic-ascii/16000/*
-%{prefix}/sounds/en/us/callie/time/16000/*
-%{prefix}/sounds/en/us/callie/voicemail/16000/*
-
-
-%files uhd-sounds-en-callie
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/32000
-%{prefix}/sounds/en/us/callie/ascii/32000/*
-%{prefix}/sounds/en/us/callie/conference/32000/*
-%{prefix}/sounds/en/us/callie/currency/32000/*
-%{prefix}/sounds/en/us/callie/digits/32000/*
-%{prefix}/sounds/en/us/callie/ivr/32000/*
-%{prefix}/sounds/en/us/callie/misc/32000/*
-%{prefix}/sounds/en/us/callie/phonetic-ascii/32000/*
-%{prefix}/sounds/en/us/callie/time/32000/*
-%{prefix}/sounds/en/us/callie/voicemail/32000/*
-
-
-%files cd-sounds-en-callie
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/48000
-%{prefix}/sounds/en/us/callie/ascii/48000/*
-%{prefix}/sounds/en/us/callie/conference/48000/*
-%{prefix}/sounds/en/us/callie/currency/48000/*
-%{prefix}/sounds/en/us/callie/digits/48000/*
-%{prefix}/sounds/en/us/callie/ivr/48000/*
-%{prefix}/sounds/en/us/callie/misc/48000/*
-%{prefix}/sounds/en/us/callie/phonetic-ascii/48000/*
-%{prefix}/sounds/en/us/callie/time/48000/*
-%{prefix}/sounds/en/us/callie/voicemail/48000/*
-
-
-%changelog
-* Mon Feb 17 2009 - michal.bielicki(a)halokwadrat.de
-- added mod_python
-- added mod_fax
-- added mod_amrwb.so
-- added mod_celt.so
-- added mod_easyroute.so
-- added mod_http.so
-- added mod_lcr.so
-- added mod_loopback.so
-- added mod_siren.so
-- added mod/mod_stress.so
-- added mod_yaml.so
-- added mod_shout.so
-- added rpms or all sounds
-- openzap is now its own rpm
-- added french
-- added german
-- added missing dependencies
-- added soundfiles with separate rpms
-- added definition of all sourcefiles and added them to the SRPM
-- fixes to monit file
-- changes to redhat init file
-* Thu May 22 2008 - michal.bielicki(a)voiceworks.pl
-- disabled beta class language stuff
-- bumped revision up to rc6
-- added mod_lua
-- added mod_perl
-- Only bootstrap if no Makfile.in exists
-* Mon Feb 04 2008 - michal.bielicki(a)voiceworks.pl
-- More fixes to specfile
-- First go at SFE files
-* Sun Feb 03 2008 - michal.bielicki(a)voiceworks.pl
-- abstraction of prefix
-- more wrong stuff deleted
-- abstraction of mkdir, mv, rm, install etc into macros
-* Fri Jan 18 2008 - michal.bielicki(a)voiceworks.pl
-- fixes, fixes and more fixes in preparation for rc1
-* Thu Dec 5 2007 - michal.bielicki(a)voiceworks.pl
-- put in detail configfiles in to split of spidermonkey configs
-- created link from /opt/freesxwitch/conf to /etc%{prefix}
-* Thu Nov 29 2007 - michal.bielicki(a)voiceworks.pl
-- Added ifdefs for susealities
-- Added specifics for centos/redhat
-- Added specifics for fedora
-- Preparing to use it for adding it to SFE packaging for solaris
-- Added odbc stuff back in
-- made curl default
-- Separate package for mod_spidermonkey
-- got rid of modules.conf and stuffed everything in MODULES env var
-- got rid of handmade Cflags peter added ;)
-- fixed bin and libpaths
-- fixed locationof nspr and js libs
-- fixed odbc requirements
-- added all buildable modules
-- added redhat style init file
-- splitted off language dependant stuff into separate language files
-- disable non complete language modules
-* Tue Apr 24 2007 - peter+rpmspam(a)suntel.com.tr
-- Added a debug package
-- Split the passthrough codecs into separate packages
-* Fri Mar 16 2007 - peter+rpmspam(a)suntel.com.tr
-- Added devel package
-* Thu Mar 15 2007 - peter+rpmspam(a)suntel.com.tr
-- Initial RPM release
+%define _prefix /opt/freeswitch
+%define prefix %{_prefix}
+%define sysconfdir /opt/freeswitch/conf
+%define _sysconfdir %{sysconfdir}
+
+Name: freeswitch
+Summary: FreeSWITCH open source telephony platform
+License: MPL
+Group: Productivity/Telephony/Servers
+Version: 1.0.4
+Release: 1
+URL: http://www.freeswitch.org/
+Packager: Michal Bielicki
+Vendor: http://www.freeswitch.org/
+Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2
+Source1: http://svn.freeswitch.org/downloads/libs/celt-0.5.1.tar.gz
+Source2: http://svn.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz
+Source3: http://svn.freeswitch.org/downloads/libs/lame-3.97.tar.gz
+Source4: http://svn.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz
+Source5: http://svn.freeswitch.org/downloads/libs/mpg123.tar.gz
+Source6: http://svn.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz
+Source7: http://svn.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz
+Source8: http://svn.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz
+Source9: http://svn.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz
+Source10: http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.8.tar.gz
+Source11: http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.8.tar.gz
+Source12: http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.8.tar.gz
+Source13: http://files.freeswitch.org/freeswitch-sounds-music-48000-1.0.8.tar.gz
+Source14: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.10.tar.…
+Source15: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.10.tar…
+Source16: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.10.tar…
+Source17: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-1.0.10.tar…
+Source18: http://svn.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.ta…
+Prefix: %{prefix}
+
+#AutoReqProv: no
+
+%if 0%{?suse_version} > 100
+#BuildRequires: openldap2-devel
+BuildRequires: lzo-devel
+%else
+BuildRequires: openldap-devel
+%endif
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: curl-devel
+BuildRequires: gcc-c++
+BuildRequires: gnutls-devel
+BuildRequires: libtool >= 1.5.17
+BuildRequires: ncurses-devel
+BuildRequires: openssl-devel
+BuildRequires: perl
+BuildRequires: pkgconfig
+BuildRequires: termcap
+BuildRequires: unixODBC-devel
+BuildRequires: gdbm-devel
+BuildRequires: db4-devel
+BuildRequires: python-devel
+BuildRequires: libogg-devel
+BuildRequires: libvorbis-devel
+BuildRequires: libtiff-devel
+#BuildRequires: mono-devel
+BuildRequires: alsa-lib-devel
+BuildRequires: which
+BuildRequires: zlib-devel
+
+%if %{?suse_version:1}0
+%if 0%{?suse_version} > 910
+#BuildRequires: autogen
+%endif
+%endif
+
+%if 0%{?suse_version} > 800
+#PreReq: /usr/sbin/useradd /usr/sbin/groupadd
+PreReq: %insserv_prereq %fillup_prereq
+%endif
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+%description
+FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice
+and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a
+simple switching engine, a media gateway or a media server to host IVR applications using
+simple scripts or XML to control the callflow.
+
+We support various communication technologies such as SIP, H.323, IAX2 and GoogleTalk making
+it easy to interface with other open source PBX systems such as sipX, OpenPBX, Bayonne, YATE or Asterisk.
+
+We also support both wide and narrow band codecs making it an ideal solution to bridge legacy
+devices to the future. The voice channels and the conference bridge module all can operate
+at 8, 16 or 32 kilohertz and can bridge channels of different rates.
+
+FreeSWITCH runs on several operating systems including Windows, Max OS X, Linux, BSD and Solaris
+on both 32 and 64 bit platforms.
+
+Our developers are heavily involved in open source and have donated code and other resources to
+other telephony projects including sipXecs, OpenSER, Asterisk, CodeWeaver and OpenPBX.
+
+%package devel
+Summary: Development package for FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+FreeSWITCH development files
+
+%package codec-passthru-amrwb
+Summary: Pass-through AMR WideBand Codec support for FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+Conflicts: codec-amrwb
+
+%description codec-passthru-amrwb
+Pass-through AMR WideBand Codec support for FreeSWITCH open source telephony platform
+
+
+%package codec-passthru-amr
+Summary: Pass-through AMR Codec support for FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+Conflicts: codec-amr
+
+%description codec-passthru-amr
+Pass-through AMR Codec support for FreeSWITCH open source telephony platform
+
+%package codec-passthru-g723_1
+Summary: Pass-through g723.1 Codec support for FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+Conflicts: codec-g723_1
+
+%description codec-passthru-g723_1
+Pass-through g723.1 Codec support for FreeSWITCH open source telephony platform
+
+%package codec-passthru-g729
+Summary: Pass-through g729 Codec support for FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+Conflicts: codec-g729
+
+%description codec-passthru-g729
+Pass-through g729 Codec support for FreeSWITCH open source telephony platform
+
+%package spidermonkey
+Summary: JavaScript support for the FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description spidermonkey
+
+%package lua
+Summary: Lua support for the FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description lua
+
+%package perl
+Summary: Perl support for the FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description perl
+
+%package python
+Summary: Python support for the FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description python
+
+
+%package lang-en
+Summary: Provides english language dependand modules and speech config for the FreeSwitch Open Source telephone platform.
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description lang-en
+English language phrases module and directory structure for say module and voicemail
+
+%package lang-ru
+Summary: Provides russian language dependand modules and speech config for the FreeSwitch Open Source telephone platform.
+Group: System/LibrariesRequires: %{name} = %{version}-%{release}
+
+%description lang-ru
+Russian language phrases module and directory structure for say module and voicemail
+
+%package lang-fr
+Summary: Provides french language dependand modules and speech config for the FreeSwitch Open Source telephone platform.
+Group: System/LibrariesRequires: %{name} = %{version}-%{release}
+
+%description lang-fr
+French language phrases module and directory structure for say module and voicemail
+
+%package lang-de
+Summary: Provides german language dependand modules and speech config for the FreeSwitch Open Source telephone platform.
+Group: System/LibrariesRequires: %{name} = %{version}-%{release}
+
+%description lang-de
+German language phrases module and directory structure for say module and voicemail
+
+
+%package openzap
+Summary: Provides a unified interface to hardware TDM cards and ss7 stacks for freeswitch
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description openzap
+OpenZAP
+
+%package moh
+Summary: FreeSWITCH Music on hold files
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description moh
+8khz music on hold files for freeswitch
+
+
+%package hd-moh
+Summary: High Definition FreeSWITCH Music on hold files
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description hd-moh
+16khz High Definition FreeSWITCH Music on hold files
+
+
+%package uhd-moh
+Summary: Ultra High Definition FreeSWITCH Music on hold files
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description uhd-moh
+32khz Ultra High Definition FreeSWITCH Music on hold files
+
+
+%package cd-moh
+Summary: CD Quality FreeSWITCH Musci on hold files
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description cd-moh
+40khz CD Quality FreeSWITCH Music on hold files
+
+
+%package sounds-en-callie
+Summary: English prompts for Freeswitch
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description sounds-en-callie
+8khz English prompts for Freeswitch
+
+
+%package hd-sounds-en-callie
+Summary: High Density English prompts for Freeswitch
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description hd-sounds-en-callie
+16khz High Density English prompts for Freeswitch
+
+
+%package uhd-sounds-en-callie
+Summary: Ultra High Density English prompts for Freeswitch
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description uhd-sounds-en-callie
+32khz Ultra High Density English prompts for Freeswitch
+
+
+%package cd-sounds-en-callie
+Summary: CD Quality English prompts for Freeswitch
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description cd-sounds-en-callie
+40khz CD Quality English prompts for Freeswitch
+
+
+%prep
+%setup -b0 -q
+cp %{SOURCE1} libs/
+cp %{SOURCE2} libs/
+cp %{SOURCE3} libs/
+cp %{SOURCE4} libs/
+cp %{SOURCE5} libs/
+cp %{SOURCE6} libs/
+cp %{SOURCE7} libs/
+cp %{SOURCE8} libs/
+cp %{SOURCE9} libs/
+cp %{SOURCE10} .
+cp %{SOURCE11} .
+cp %{SOURCE12} .
+cp %{SOURCE13} .
+cp %{SOURCE14} .
+cp %{SOURCE15} .
+cp %{SOURCE16} .
+cp %{SOURCE17} .
+cp %{SOURCE18} libs/
+
+
+%build
+%ifos linux
+%if 0%{?suse_version} > 1000 && 0%{?suse_version} < 1030
+export CFLAGS="$CFLAGS -fstack-protector"
+%endif
+%if 0%{?fedora_version} >= 8
+export QA_RPATHS=$[ 0x0001|0x0002 ]
+%endif
+%endif
+
+PASSTHRU_CODEC_MODULES="codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr codecs/mod_amrwb"
+SPIDERMONKEY_MODULES="languages/mod_spidermonkey languages/mod_spidermonkey_curl languages/mod_spidermonkey_core_db languages/mod_spidermonkey_odbc languages/mod_spidermonkey_socket languages/mod_spidermonkey_teletone"
+APPLICATIONS_MODULES="applications/mod_commands applications/mod_conference applications/mod_dptools applications/mod_enum applications/mod_esf applications/mod_expr applications/mod_fifo applications/mod_limit applications/mod_rss applications/mod_voicemail applications/mod_fsv applications/mod_lcr applications/mod_easyroute applications/mod_stress applications/mod_http applications/mod_vmd applications/mod_limit applications/mod_soundtouch applications/mod_fax"
+CODECS_MODULES="codecs/mod_ilbc codecs/mod_h26x codecs/mod_voipcodecs codecs/mod_speex codecs/mod_celt codecs/mod_siren"
+DIALPLANS_MODULES="dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml"
+DIRECTORIES_MODULES=""
+ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_iax endpoints/mod_portaudio endpoints/mod_sofia ../../libs/openzap/mod_openzap endpoints/mod_loopback"
+ASR_TTS_MODULES="asr_tts/mod_pocketsphinx asr_tts/mod_flite asr_tts/mod_unimrcp"
+EVENT_HANDLERS_MODULES="event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv"
+FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream formats/mod_shout"
+LANGUAGES_MODULES="languages/mod_perl languages/mod_lua languages/mod_python languages/mod_yaml"
+LOGGERS_MODULES="loggers/mod_console loggers/mod_logfile loggers/mod_syslog"
+SAY_MODULES="say/mod_say_en say/mod_say_de say/mod_say_fr"
+TIMERS_MODULES=
+DISABLED_MODULES="applications/mod_soundtouch languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf languages/mod_managed languages/mod_java say/mod_say_it say/mod_say_es say/mod_say_nl"
+XML_INT_MODULES="xml_int/mod_xml_rpc xml_int/mod_xml_curl xml_int/mod_xml_cdr "
+MYMODULES="$PASSTHRU_CODEC_MODULES $SPIDERMONKEY_MODULES $APPLICATIONS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $ENDPOINTS_MODULES $ASR_TTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES"
+
+export MODULES=$MYMODULES
+test ! -f modules.conf || rm -f modules.conf
+touch modules.conf
+for i in $MODULES; do echo $i >> modules.conf; done
+export VERBOSE=yes
+export DESTDIR=$RPM_BUILD_ROOT/
+export PKG_CONFIG_PATH=/usr/bin/pkg-config:$PKG_CONFIG_PATH
+export ACLOCAL_FLAGS="-I /usr/share/aclocal"
+
+if test ! -f Makefile.in
+then
+ ./bootstrap.sh
+fi
+
+
+ %configure -C \
+ --prefix=%{prefix} \
+ --infodir=%{_infodir} \
+ --mandir=%{_mandir} \
+ --sysconfdir=%{sysconfdir} \
+ --libdir=%{prefix}/lib \
+ --enable-core-libedit-support \
+ --enable-core-odbc-support \
+%ifos linux
+%if 0%{?fedora_version} >= 8
+%else
+ --with-libcurl \
+%endif
+%endif
+ --with-openssl \
+ %{?configure_options}
+
+#Create the version header file here
+cat src/include/switch_version.h.in | sed "s/@SVN_VERSION@/%{version}/g" > src/include/switch_version.h
+touch .noversion
+
+%{__make}
+
+%install
+# delete unsupported langugages for now
+#rm -rf conf/lang/de
+#rm -rf conf/lang/fr
+#rm -rf $RPM_BUILD_ROOT%{prefix}/conf/lang/de
+#rm -rf $RPM_BUILD_ROOT%{prefix}/conf/lang/fr
+
+%{__make} DESTDIR=$RPM_BUILD_ROOT install
+
+# Install Sound Files
+%{__make} DESTDIR=$RPM_BUILD_ROOT cd-sounds-install
+%{__make} DESTDIR=$RPM_BUILD_ROOT cd-moh-install
+
+# Create a log dir
+%{__mkdir} -p $RPM_BUILD_ROOT%{prefix}/log
+
+%ifos linux
+# Install init files
+# On SuSE:
+%if 0%{?suse_version} > 100
+%{__install} -D -m 744 build/freeswitch.init.suse $RPM_BUILD_ROOT/etc/init.d/freeswitch
+%else
+# On RedHat like
+%{__install} -D -m 0755 build/freeswitch.init.redhat $RPM_BUILD_ROOT/etc/init.d/freeswitch
+%endif
+# On SuSE make /usr/sbin/rcfreeswitch a link to /etc/init.d/freeswitch
+%if 0%{?suse_version} > 100
+%{__mkdir} -p $RPM_BUILD_ROOT/usr/sbin
+%{__ln_s} -f /etc/init.d/freeswitch $RPM_BUILD_ROOT/usr/sbin/rcfreeswitch
+%endif
+# Add the sysconfiguration file
+%{__install} -D -m 744 build/freeswitch.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/freeswitch
+# Add monit file
+%{__install} -D -m 644 build/freeswitch.monitrc $RPM_BUILD_ROOT/etc/monit.d/freeswitch.monitrc
+%endif
+
+
+# Add a freeswitch user with group daemon
+%pre
+%ifos linux
+/usr/sbin/useradd -r -g daemon -s /bin/false -c "The FreeSWITCH Open Source Voice Platform" -d %{prefix} freeswitch 2> /dev/null || :
+%endif
+
+%post
+%{?run_ldconfig:%run_ldconfig}
+# Make FHS2.0 happy
+%{__mkdir} -p /etc/opt
+%{__ln_s} -f %{prefix}/conf /etc%{prefix}
+
+chkconfig --add freeswitch
+
+%postun
+%{?run_ldconfig:%run_ldconfig}
+userdel freeswitch
+
+%clean
+%{__rm} -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,freeswitch,daemon)
+%ifos linux
+%dir %attr(0750, root, root) /etc/monit.d
+%endif
+%dir %attr(0750, freeswitch, daemon) %{prefix}/db
+%dir %attr(0750, freeswitch, daemon) %{prefix}/log
+%dir %attr(0750, freeswitch, daemon) %{prefix}/log/xml_cdr
+%dir %attr(0750, freeswitch, daemon) %{prefix}/htdocs
+%dir %attr(0750, freeswitch, daemon) %{prefix}/scripts
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/dialplan
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/directory
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/directory/default
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/mrcp_profiles
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/dialplan/default
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/dialplan/public
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/external
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/jingle_profiles
+%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar
+%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model
+%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model/communicator
+%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model/wsj1
+%ifos linux
+%config(noreplace) %attr(0644, freeswitch, daemon) /etc/monit.d/freeswitch.monitrc
+%endif
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/mime.types
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.tpl
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.ttml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/m3ua.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/extensions.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/acl.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cidlookup.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/alsa.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/conference.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/console.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/dialplan_directory.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/dingaling.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/enum.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/event_multicast.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/event_socket.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_csv.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/fax.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/fifo.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/shout.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/timezones.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/iax.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/ivr.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/java.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/limit.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/local_stream.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/logfile.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/modules.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/pocketsphinx.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/portaudio.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/post_load_modules.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/python.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/rss.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/sofia.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/switch.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/syslog.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/voicemail.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_cdr.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_curl.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_rpc.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/zeroconf.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/easyroute.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/lcr.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/opal.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/unicall.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/memcache.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/nibblebill.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/unimrcp.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/default/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/public/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/default/*
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/external/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/jingle_profiles/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/mrcp_profiles/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/default.dic
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/model/communicator/*
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/model/wsj1/*
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/htdocs/*
+%ifos linux
+#/etc/ld.so.conf.d/*
+/etc/init.d/freeswitch
+/etc/sysconfig/freeswitch
+%if 0%{?suse_version} > 100
+/usr/sbin/rcfreeswitch
+%endif
+%endif
+%attr(0755, freeswitch, daemon) %{prefix}/bin/*
+%{prefix}/lib/libfreeswitch*.so*
+%{prefix}/mod/mod_console.so*
+%{prefix}/mod/mod_logfile.so*
+%{prefix}/mod/mod_syslog.so*
+%{prefix}/mod/mod_commands.so*
+%{prefix}/mod/mod_conference.so*
+%{prefix}/mod/mod_dptools.so*
+%{prefix}/mod/mod_enum.so*
+%{prefix}/mod/mod_esf.so*
+%{prefix}/mod/mod_expr.so*
+%{prefix}/mod/mod_fifo.so*
+%{prefix}/mod/mod_limit.so*
+%{prefix}/mod/mod_rss.so*
+%{prefix}/mod/mod_voicemail.so*
+%{prefix}/mod/mod_pocketsphinx.so*
+%{prefix}/mod/mod_flite.so*
+%{prefix}/mod/mod_ilbc.so*
+%{prefix}/mod/mod_h26x.so*
+%{prefix}/mod/mod_voipcodecs.so*
+%{prefix}/mod/mod_speex.so*
+%{prefix}/mod/mod_dialplan_directory.so*
+%{prefix}/mod/mod_dialplan_xml.so*
+%{prefix}/mod/mod_dialplan_asterisk.so*
+%{prefix}/mod/mod_dingaling.so*
+%{prefix}/mod/mod_iax.so*
+%{prefix}/mod/mod_portaudio.so*
+%{prefix}/mod/mod_sofia.so*
+%{prefix}/mod/mod_cdr_csv.so*
+%{prefix}/mod/mod_event_multicast.so*
+%{prefix}/mod/mod_event_socket.so*
+%{prefix}/mod/mod_native_file.so*
+%{prefix}/mod/mod_sndfile.so*
+%{prefix}/mod/mod_local_stream.so*
+%{prefix}/mod/mod_xml_rpc.so*
+%{prefix}/mod/mod_xml_curl.so*
+%{prefix}/mod/mod_xml_cdr.so*
+%{prefix}/mod/mod_fsv.so
+%{prefix}/mod/mod_tone_stream.so
+%{prefix}/mod/mod_amrwb.so
+%{prefix}/mod/mod_celt.so
+%{prefix}/mod/mod_easyroute.so
+%{prefix}/mod/mod_http.so
+%{prefix}/mod/mod_lcr.so
+%{prefix}/mod/mod_loopback.so
+%{prefix}/mod/mod_siren.so
+%{prefix}/mod/mod_stress.so
+%{prefix}/mod/mod_yaml.so
+%{prefix}/mod/mod_shout.so
+%{prefix}/mod/mod_fax.so
+%{prefix}/mod/mod_soundtouch.so
+%{prefix}/mod/mod_vmd.so
+%{prefix}/mod/mod_unimrcp.so
+
+%files openzap
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/tones.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/openzap.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/pika.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/openzap.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/wanpipe.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/zt.conf
+%{prefix}/lib/libopenzap.so*
+%{prefix}/mod/mod_openzap.so*
+%{prefix}/mod/ozmod_analog.so*
+%{prefix}/mod/ozmod_analog_em.so*
+%{prefix}/mod/ozmod_isdn.so*
+%{prefix}/mod/ozmod_skel.*
+%{prefix}/mod/ozmod_ss7_boost.so*
+%{prefix}/mod/ozmod_wanpipe.so*
+%{prefix}/mod/ozmod_zt.so*
+
+%files codec-passthru-amrwb
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_amrwb.so*
+
+%files codec-passthru-amr
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_amr.so*
+
+%files codec-passthru-g723_1
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_g723_1.so*
+
+%files codec-passthru-g729
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_g729.so*
+
+%files spidermonkey
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_spidermonkey*.so*
+%{prefix}/lib/libjs.so*
+%{prefix}/lib/libnspr4.so
+%{prefix}/lib/libplds4.so
+%{prefix}/lib/libplc4.so
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/spidermonkey.conf.xml
+
+%files lua
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_lua*.so*
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/lua.conf.xml
+
+%files perl
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_perl*.so*
+%{prefix}/perl/*
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/perl.conf.xml
+
+%files python
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_python*.so*
+%attr(0644, root, bin) /usr/lib/python2.4/site-packages/freeswitch.py*
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/python.conf.xml
+
+%files devel
+%defattr(-, freeswitch, daemon)
+%{prefix}/lib/*.a
+%{prefix}/lib/*.la
+%{prefix}/lib/pkgconfig/*
+%{prefix}/mod/*.a
+%{prefix}/mod/*.la
+%{prefix}/include/*.h
+%{prefix}/include/spandsp/*
+
+%files lang-en
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en/demo
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en/vm
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/demo/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/vm/*.xml
+%{prefix}/mod/mod_say_en.so*
+
+%files lang-de
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de/demo
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de/vm
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/demo/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/vm/*.xml
+%{prefix}/mod/mod_say_de.so*
+
+%files lang-fr
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/demo
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/vm
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/demo/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/vm/*.xml
+%{prefix}/mod/mod_say_fr.so*
+
+%files lang-ru
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/ru
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/ru/demo
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/ru/vm
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/demo/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/vm/*.xml
+
+%files moh
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/8000
+%{prefix}/sounds/music/8000/*
+
+%files hd-moh
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/16000
+%{prefix}/sounds/music/16000/*
+
+%files uhd-moh
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/32000
+%{prefix}/sounds/music/32000/*
+
+%files cd-moh
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/48000
+%{prefix}/sounds/music/48000/*
+
+%files sounds-en-callie
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/8000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/8000
+%{prefix}/sounds/en/us/callie/ascii/8000/*
+%{prefix}/sounds/en/us/callie/base256/8000/*
+%{prefix}/sounds/en/us/callie/conference/8000/*
+%{prefix}/sounds/en/us/callie/currency/8000/*
+%{prefix}/sounds/en/us/callie/digits/8000/*
+%{prefix}/sounds/en/us/callie/ivr/8000/*
+%{prefix}/sounds/en/us/callie/misc/8000/*
+%{prefix}/sounds/en/us/callie/phonetic-ascii/8000/*
+%{prefix}/sounds/en/us/callie/time/8000/*
+%{prefix}/sounds/en/us/callie/voicemail/8000/*
+%{prefix}/sounds/en/us/callie/zrtp/8000/*
+
+%files hd-sounds-en-callie
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/16000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/16000
+%{prefix}/sounds/en/us/callie/ascii/16000/*
+%{prefix}/sounds/en/us/callie/base256/16000/*
+%{prefix}/sounds/en/us/callie/conference/16000/*
+%{prefix}/sounds/en/us/callie/currency/16000/*
+%{prefix}/sounds/en/us/callie/digits/16000/*
+%{prefix}/sounds/en/us/callie/ivr/16000/*
+%{prefix}/sounds/en/us/callie/misc/16000/*
+%{prefix}/sounds/en/us/callie/phonetic-ascii/16000/*
+%{prefix}/sounds/en/us/callie/time/16000/*
+%{prefix}/sounds/en/us/callie/voicemail/16000/*
+%{prefix}/sounds/en/us/callie/zrtp/16000/*
+
+
+%files uhd-sounds-en-callie
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/32000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/32000
+%{prefix}/sounds/en/us/callie/ascii/32000/*
+%{prefix}/sounds/en/us/callie/base256/32000/*
+%{prefix}/sounds/en/us/callie/conference/32000/*
+%{prefix}/sounds/en/us/callie/currency/32000/*
+%{prefix}/sounds/en/us/callie/digits/32000/*
+%{prefix}/sounds/en/us/callie/ivr/32000/*
+%{prefix}/sounds/en/us/callie/misc/32000/*
+%{prefix}/sounds/en/us/callie/phonetic-ascii/32000/*
+%{prefix}/sounds/en/us/callie/time/32000/*
+%{prefix}/sounds/en/us/callie/voicemail/32000/*
+%{prefix}/sounds/en/us/callie/zrtp/32000/*
+
+
+%files cd-sounds-en-callie
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/48000
+%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/48000
+%{prefix}/sounds/en/us/callie/ascii/48000/*
+%{prefix}/sounds/en/us/callie/base256/48000/*
+%{prefix}/sounds/en/us/callie/conference/48000/*
+%{prefix}/sounds/en/us/callie/currency/48000/*
+%{prefix}/sounds/en/us/callie/digits/48000/*
+%{prefix}/sounds/en/us/callie/ivr/48000/*
+%{prefix}/sounds/en/us/callie/misc/48000/*
+%{prefix}/sounds/en/us/callie/phonetic-ascii/48000/*
+%{prefix}/sounds/en/us/callie/time/48000/*
+%{prefix}/sounds/en/us/callie/voicemail/48000/*
+%{prefix}/sounds/en/us/callie/zrtp/48000/*
+
+
+%changelog
+* Tue Jun 23 2009 - raulfragoso(a)gmail.com
+- Adjusted for the latest SVN trunk (13912)
+- Included new config and mod files to catch up with latest SVN
+- Included new sound files for base256 and zrtp
+- mod_unimrcp must be built after mod_sofia
+* Mon Feb 17 2009 - michal.bielicki(a)halokwadrat.de
+- added mod_python
+- added mod_fax
+- added mod_amrwb.so
+- added mod_celt.so
+- added mod_easyroute.so
+- added mod_http.so
+- added mod_lcr.so
+- added mod_loopback.so
+- added mod_siren.so
+- added mod/mod_stress.so
+- added mod_yaml.so
+- added mod_shout.so
+- added rpms or all sounds
+- openzap is now its own rpm
+- added french
+- added german
+- added missing dependencies
+- added soundfiles with separate rpms
+- added definition of all sourcefiles and added them to the SRPM
+- fixes to monit file
+- changes to redhat init file
+* Thu May 22 2008 - michal.bielicki(a)voiceworks.pl
+- disabled beta class language stuff
+- bumped revision up to rc6
+- added mod_lua
+- added mod_perl
+- Only bootstrap if no Makfile.in exists
+* Mon Feb 04 2008 - michal.bielicki(a)voiceworks.pl
+- More fixes to specfile
+- First go at SFE files
+* Sun Feb 03 2008 - michal.bielicki(a)voiceworks.pl
+- abstraction of prefix
+- more wrong stuff deleted
+- abstraction of mkdir, mv, rm, install etc into macros
+* Fri Jan 18 2008 - michal.bielicki(a)voiceworks.pl
+- fixes, fixes and more fixes in preparation for rc1
+* Thu Dec 5 2007 - michal.bielicki(a)voiceworks.pl
+- put in detail configfiles in to split of spidermonkey configs
+- created link from /opt/freesxwitch/conf to /etc%{prefix}
+* Thu Nov 29 2007 - michal.bielicki(a)voiceworks.pl
+- Added ifdefs for susealities
+- Added specifics for centos/redhat
+- Added specifics for fedora
+- Preparing to use it for adding it to SFE packaging for solaris
+- Added odbc stuff back in
+- made curl default
+- Separate package for mod_spidermonkey
+- got rid of modules.conf and stuffed everything in MODULES env var
+- got rid of handmade Cflags peter added ;)
+- fixed bin and libpaths
+- fixed locationof nspr and js libs
+- fixed odbc requirements
+- added all buildable modules
+- added redhat style init file
+- splitted off language dependant stuff into separate language files
+- disable non complete language modules
+* Tue Apr 24 2007 - peter+rpmspam(a)suntel.com.tr
+- Added a debug package
+- Split the passthrough codecs into separate packages
+* Fri Mar 16 2007 - peter+rpmspam(a)suntel.com.tr
+- Added devel package
+* Thu Mar 15 2007 - peter+rpmspam(a)suntel.com.tr
+- Initial RPM release
1
0
26 Jun '09
Author: mikej
Date: Fri Jun 26 15:18:39 2009
New Revision: 13987
Log:
update to current unimrcp https://unimrcp.googlecode.com/svn/trunk@1014
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Fri Jun 26 18:17:10 2009 +0000
Implemented START-INPUT-TIMERS
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1014 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Fri Jun 26 16:56:38 2009 +0000
Fixed grammar file creation (the existing file must be truncated/overridden)
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1013 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Fri Jun 26 15:31:47 2009 +0000
Added GET-RESULT processing, properly set completion causes in the responses to DEFINE-GRAMMAR and RECOGNIZE requests
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1012 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Thu Jun 25 19:21:34 2009 +0000
Implemented grammar load/unload (DEFINE-GRAMMAR requests), implemented recognition complete timeout, introduced properties (to be loaded from config file)
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1011 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Wed Jun 24 14:31:37 2009 +0000
Added the NOTICE corresponding to the section 4 d of the Apache License, Version 2.0
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1010 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Tue Jun 23 21:04:44 2009 +0000
Added identifier@pocketsphinx traces
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1009 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Tue Jun 23 21:03:02 2009 +0000
Added session identifier to engine channel (to be used for traces)
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1008 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Tue Jun 23 19:58:48 2009 +0000
Properly handled race between STOP request and RECOGNITION-COMPLETE event, other enhancements
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1007 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Tue Jun 23 19:55:57 2009 +0000
Added mpf_activity_detector_reset()
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1006 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Tue Jun 23 16:41:51 2009 +0000
Added 32kHz and 48kHz sampling rates (still no resampling support in MPF, also make sure RTP packet length <= 1500 bytes)
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1005 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Mon Jun 22 20:13:29 2009 +0000
Added flite m4 configure stuff
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1004 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Mon Jun 22 19:31:32 2009 +0000
Added pocketsphinx.vcproj and flite.vcproj project files into unimrcp.sln (disabled by default)
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1003 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Mon Jun 22 19:26:38 2009 +0000
Integrated utterance detection stuff (start-of-input, end-of-input), triggered partial and final recognition results
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1002 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: garmt.noname(a)gmail.com <garmt.noname@gmail.com@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Sun Jun 21 22:12:37 2009 +0000
First implementation of flite plugin - voice awb only
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1001 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Sun Jun 21 06:23:58 2009 +0000
Added framework for the development of flite plugin
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1000 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Sat Jun 20 19:52:22 2009 +0000
Added missing include paths and libs required for pocketsphinx
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@999 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Sat Jun 20 17:32:37 2009 +0000
Started actual implementation of pocketsphinx plugin
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@998 f001bc3a-424a-0410-80a0-a715b8f413a8
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Sat Jun 20 13:55:41 2009 +0000
Added acmacros for pocketsphinx libs (src and installed dirs are suppored), cleaned up ./configure related stuff a bit
git-svn-id: https://unimrcp.googlecode.com/svn/trunk@997 f001bc3a-424a-0410-80a0-a715b8f413a8
Added:
freeswitch/trunk/libs/unimrcp/NOTICE
freeswitch/trunk/libs/unimrcp/build/acmacros/flite.m4
freeswitch/trunk/libs/unimrcp/build/acmacros/pocketsphinx.m4
freeswitch/trunk/libs/unimrcp/build/acmacros/sphinxbase.m4
freeswitch/trunk/libs/unimrcp/build/vsprops/flite.vsprops
freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/
freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/Makefile.am
freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/mrcpflite.vcproj
freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/
freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c
Modified:
freeswitch/trunk/libs/unimrcp/.update
freeswitch/trunk/libs/unimrcp/acinclude.m4
freeswitch/trunk/libs/unimrcp/build/acmacros/sofia-sip.m4
freeswitch/trunk/libs/unimrcp/build/acmacros/swift.m4
freeswitch/trunk/libs/unimrcp/configure.ac
freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h
freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h
freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c
freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c
freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c
freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h
freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/src/mrcp_resource_engine.c
freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c
freeswitch/trunk/libs/unimrcp/plugins/Makefile.am
freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am
freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c
freeswitch/trunk/libs/unimrcp/unimrcp.sln
Modified: freeswitch/trunk/libs/unimrcp/.update
==============================================================================
--- freeswitch/trunk/libs/unimrcp/.update (original)
+++ freeswitch/trunk/libs/unimrcp/.update Fri Jun 26 15:18:39 2009
@@ -1 +1 @@
-Fri Jun 19 22:39:34 CDT 2009
+Fri Jun 26 15:16:40 CDT 2009
Added: freeswitch/trunk/libs/unimrcp/NOTICE
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/unimrcp/NOTICE Fri Jun 26 15:18:39 2009
@@ -0,0 +1,47 @@
+The UniMRCP Project (http://www.unimrcp.org)
+Copyright (C) 2008 Arsen Chaloyan
+Licensed under the Apache License, Version 2.0 (the "License").
+
+This product includes a number of subcomponents with
+separate copyright notices and license terms.
+
+
+Notice for APR (Apache Portable Runtime) library
+---------------------------------------------------
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/)
+
+Portions of this software were developed at the National Center
+for Supercomputing Applications (NCSA) at the University of
+Illinois at Urbana-Champaign.
+
+This software contains code derived from the RSA Data Security
+Inc. MD5 Message-Digest Algorithm.
+---------------------------------------------------
+
+
+Notice for Sofia-SIP library
+---------------------------------------------------
+Copyright (C) 2005-2006 Nokia Corporation and others (see the
+in individual files for a detailed list of copyright holders).
+Contact: Pekka Pessi <Pekka.Pessi(a)nokia.com>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public License
+as published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+---------------------------------------------------
+
+
+Notice for G711 implementation
+---------------------------------------------------
+g711.h/g711.c - A-law and u-law transcoding routines
+
+Written by Steve Underwood <steveu(a)coppice.org>
+Copyright (C) 2006 Steve Underwood
+
+Despite my general liking of the GPL, I place this code in the
+public domain for the benefit of all mankind - even the slimy
+ones who might try to proprietize my work and use it to my
+detriment.
+---------------------------------------------------
Modified: freeswitch/trunk/libs/unimrcp/acinclude.m4
==============================================================================
--- freeswitch/trunk/libs/unimrcp/acinclude.m4 (original)
+++ freeswitch/trunk/libs/unimrcp/acinclude.m4 Fri Jun 26 15:18:39 2009
@@ -4,3 +4,6 @@
m4_include([build/acmacros/find_apu.m4])
m4_include([build/acmacros/sofia-sip.m4])
m4_include([build/acmacros/swift.m4])
+m4_include([build/acmacros/sphinxbase.m4])
+m4_include([build/acmacros/pocketsphinx.m4])
+m4_include([build/acmacros/flite.m4])
Added: freeswitch/trunk/libs/unimrcp/build/acmacros/flite.m4
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/unimrcp/build/acmacros/flite.m4 Fri Jun 26 15:18:39 2009
@@ -0,0 +1,48 @@
+dnl UNIMRCP_CHECK_FLITE
+
+AC_DEFUN([UNIMRCP_CHECK_FLITE],
+[
+ AC_MSG_NOTICE([Flite library configuration])
+
+ AC_MSG_CHECKING([for Flite])
+ AC_ARG_WITH(flite,
+ [ --with-flite=PATH prefix for installed Flite or
+ path to Flite build tree],
+ [flite_path=$withval],
+ [flite_path="/usr/local"]
+ )
+
+ found_flite="no"
+
+ dnl TO BE DONE
+ flite_libdir="build/libs"
+ for dir in $flite_path ; do
+ cd $dir && flite_dir=`pwd` && cd - > /dev/null
+ if test -d "$dir/$flite_libdir"; then
+ found_flite="yes"
+ UNIMRCP_FLITE_INCLUDES="-I$flite_dir/include"
+ UNIMRCP_FLITE_LIBS="$dir/$flite_libdir/libflite_cmu_us_awb.a \
+ $dir/$flite_libdir/libflite_cmu_us_kal.a \
+ $dir/$flite_libdir/libflite_cmu_us_rms.a \
+ $dir/$flite_libdir/libflite_cmu_us_slt.a \
+ $dir/$flite_libdir/libflite_cmulex.a \
+ $dir/$flite_libdir/libflite_usenglish.a \
+ $dir/$flite_libdir/libflite.a"
+ break
+ fi
+ done
+
+ if test x_$found_flite != x_yes; then
+ AC_MSG_ERROR(Cannot find Flite - looked for srcdir:$flite_srcdir in $flite_path)
+ else
+ AC_MSG_RESULT([$found_flite])
+
+case "$host" in
+ *darwin*)
+ UNIMRCP_FLITE_LIBS="$UNIMRCP_FLITE_LIBS -framework CoreFoundation -framework SystemConfiguration" ;;
+esac
+
+ AC_SUBST(UNIMRCP_FLITE_INCLUDES)
+ AC_SUBST(UNIMRCP_FLITE_LIBS)
+ fi
+])
Added: freeswitch/trunk/libs/unimrcp/build/acmacros/pocketsphinx.m4
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/unimrcp/build/acmacros/pocketsphinx.m4 Fri Jun 26 15:18:39 2009
@@ -0,0 +1,50 @@
+dnl UNIMRCP_CHECK_POCKETSPHINX
+
+AC_DEFUN([UNIMRCP_CHECK_POCKETSPHINX],
+[
+ AC_MSG_NOTICE([PocketSphinx library configuration])
+
+ AC_MSG_CHECKING([for PocketSphinx])
+ AC_ARG_WITH(pocketsphinx,
+ [ --with-pocketsphinx=PATH prefix for installed PocketSphinx or
+ path to PocketSphinx build tree],
+ [pocketsphinx_path=$withval],
+ [pocketsphinx_path="/usr/local"]
+ )
+
+ found_pocketsphinx="no"
+ pocketsphinx_config="lib/pkgconfig/pocketsphinx.pc"
+ pocketsphinx_srcdir="src"
+ for dir in $pocketsphinx_path ; do
+ cd $dir && pocketsphinx_dir=`pwd` && cd - > /dev/null
+ if test -f "$dir/$pocketsphinx_config"; then
+ found_pocketsphinx="yes"
+ UNIMRCP_POCKETSPHINX_INCLUDES="`pkg-config --cflags $dir/$pocketsphinx_config`"
+ UNIMRCP_POCKETSPHINX_LIBS="`pkg-config --libs $dir/$pocketsphinx_config`"
+ pocketsphinx_version="`pkg-config --modversion $dir/$pocketsphinx_config`"
+ break
+ fi
+ if test -d "$dir/$pocketsphinx_srcdir"; then
+ found_pocketsphinx="yes"
+ UNIMRCP_POCKETSPHINX_INCLUDES="-I$pocketsphinx_dir/include"
+ UNIMRCP_POCKETSPHINX_LIBS="$pocketsphinx_dir/$pocketsphinx_srcdir/libpocketsphinx/libpocketsphinx.la"
+ pocketsphinx_version="`pkg-config --modversion $pocketsphinx_dir/pocketsphinx.pc`"
+ break
+ fi
+ done
+
+ if test x_$found_pocketsphinx != x_yes; then
+ AC_MSG_ERROR(Cannot find PocketSphinx - looked for pocketsphinx-config:$pocketsphinx_config and srcdir:$pocketsphinx_srcdir in $pocketsphinx_path)
+ else
+ AC_MSG_RESULT([$found_pocketsphinx])
+ AC_MSG_RESULT([$pocketsphinx_version])
+
+case "$host" in
+ *darwin*)
+ UNIMRCP_POCKETSPHINX_LIBS="$UNIMRCP_POCKETSPHINX_LIBS -framework CoreFoundation -framework SystemConfiguration" ;;
+esac
+
+ AC_SUBST(UNIMRCP_POCKETSPHINX_INCLUDES)
+ AC_SUBST(UNIMRCP_POCKETSPHINX_LIBS)
+ fi
+])
Modified: freeswitch/trunk/libs/unimrcp/build/acmacros/sofia-sip.m4
==============================================================================
--- freeswitch/trunk/libs/unimrcp/build/acmacros/sofia-sip.m4 (original)
+++ freeswitch/trunk/libs/unimrcp/build/acmacros/sofia-sip.m4 Fri Jun 26 15:18:39 2009
@@ -12,6 +12,7 @@
[sofia_path="/usr/local"]
)
+ found_sofia="no"
sofiaconfig="lib/pkgconfig/sofia-sip-ua.pc"
sofiasrcdir="libsofia-sip-ua"
for dir in $sofia_path ; do
Added: freeswitch/trunk/libs/unimrcp/build/acmacros/sphinxbase.m4
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/unimrcp/build/acmacros/sphinxbase.m4 Fri Jun 26 15:18:39 2009
@@ -0,0 +1,50 @@
+dnl UNIMRCP_CHECK_SPHINXBASE
+
+AC_DEFUN([UNIMRCP_CHECK_SPHINXBASE],
+[
+ AC_MSG_NOTICE([SphinxBase library configuration])
+
+ AC_MSG_CHECKING([for SphinxBase])
+ AC_ARG_WITH(sphinxbase,
+ [ --with-sphinxbase=PATH prefix for installed SphinxBase or
+ path to SphinxBase build tree],
+ [sphinxbase_path=$withval],
+ [sphinxbase_path="/usr/local"]
+ )
+
+ found_sphinxbase="no"
+ sphinxbase_config="lib/pkgconfig/sphinxbase.pc"
+ sphinxbase_srcdir="src"
+ for dir in $sphinxbase_path ; do
+ cd $dir && sphinxbase_dir=`pwd` && cd - > /dev/null
+ if test -f "$dir/$sphinxbase_config"; then
+ found_sphinxbase="yes"
+ UNIMRCP_SPHINXBASE_INCLUDES="`pkg-config --cflags $dir/$sphinxbase_config`"
+ UNIMRCP_SPHINXBASE_LIBS="`pkg-config --libs $dir/$sphinxbase_config`"
+ sphinxbase_version="`pkg-config --modversion $dir/$sphinxbase_config`"
+ break
+ fi
+ if test -d "$dir/$sphinxbase_srcdir"; then
+ found_sphinxbase="yes"
+ UNIMRCP_SPHINXBASE_INCLUDES="-I$sphinxbase_dir/include"
+ UNIMRCP_SPHINXBASE_LIBS="$sphinxbase_dir/$sphinxbase_srcdir/libsphinxbase/libsphinxbase.la $sphinxbase_dir/$sphinxbase_srcdir/libsphinxad/libsphinxad.la"
+ sphinxbase_version="`pkg-config --modversion $sphinxbase_dir/sphinxbase.pc`"
+ break
+ fi
+ done
+
+ if test x_$found_sphinxbase != x_yes; then
+ AC_MSG_ERROR(Cannot find SphinxBase - looked for sphinxbase-config:$sphinxbase_config and srcdir:$sphinxbase_srcdir in $sphinxbase_path)
+ else
+ AC_MSG_RESULT([$found_sphinxbase])
+ AC_MSG_RESULT([$sphinxbase_version])
+
+case "$host" in
+ *darwin*)
+ UNIMRCP_SPHINXBASE_LIBS="$UNIMRCP_SPHINXBASE_LIBS -framework CoreFoundation -framework SystemConfiguration" ;;
+esac
+
+ AC_SUBST(UNIMRCP_SPHINXBASE_INCLUDES)
+ AC_SUBST(UNIMRCP_SPHINXBASE_LIBS)
+ fi
+])
Modified: freeswitch/trunk/libs/unimrcp/build/acmacros/swift.m4
==============================================================================
--- freeswitch/trunk/libs/unimrcp/build/acmacros/swift.m4 (original)
+++ freeswitch/trunk/libs/unimrcp/build/acmacros/swift.m4 Fri Jun 26 15:18:39 2009
@@ -25,6 +25,4 @@
else
AC_MSG_WARN([not found - looked for $swift_path])
fi
-
- AM_CONDITIONAL([CEPSTRAL_PLUGIN], [test x_$found_swift = x_yes])
])
Added: freeswitch/trunk/libs/unimrcp/build/vsprops/flite.vsprops
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/unimrcp/build/vsprops/flite.vsprops Fri Jun 26 15:18:39 2009
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="flite"
+ InheritedPropertySheets=".\unibase.vsprops"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(FliteDir)\include""
+ PreprocessorDefinitions="APT_LIB_EXPORT"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="flite.lib"
+ AdditionalLibraryDirectories=""$(FliteDir)\$(ConfigurationName)""
+ />
+ <UserMacro
+ Name="FliteDir"
+ Value="$(LibRootDir)libs\flite"
+ />
+</VisualStudioPropertySheet>
Modified: freeswitch/trunk/libs/unimrcp/configure.ac
==============================================================================
--- freeswitch/trunk/libs/unimrcp/configure.ac (original)
+++ freeswitch/trunk/libs/unimrcp/configure.ac Fri Jun 26 15:18:39 2009
@@ -16,19 +16,19 @@
AM_INIT_AUTOMAKE(foreign)
-#Set default language
+# Set default language
AC_LANG_C
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
-#skip detection of Fortran
+# Skip detection of Fortran
m4_undefine([AC_PROG_F77])
m4_defun([AC_PROG_F77],[])
AC_PROG_LIBTOOL
-# get version information
+# Get version information
get_version="build/get-version.sh"
version_hdr="build/uni_version.h"
plugin_version_hdr="libs/mrcp-engine/include/mrcp_resource_plugin.h"
@@ -42,12 +42,13 @@
echo "UniMRCP Version: ${UNI_DOTTED_VERSION}"
+# Check APR
UNIMRCP_CHECK_APR
UNIMRCP_CHECK_APU
+# Check SOFIA
UNIMRCP_CHECK_SOFIA
-UNIMRCP_CHECK_SWIFT
AC_SUBST(ac_aux_dir)
@@ -74,7 +75,7 @@
AX_COMPILER_VENDOR
-
+#Enable maintainer mode
AC_ARG_ENABLE(maintainer-mode,
[AC_HELP_STRING([--enable-maintainer-mode ],[turn on debugging and compile time warnings])],
[enable_maintainer_mode="$enableval"],
@@ -87,6 +88,7 @@
fi
fi
+#Enable test suites
AC_ARG_ENABLE(test-suites,
[AC_HELP_STRING([--enable-test-suites ],[build test suites])],
[enable_test_suites="$enableval"],
@@ -94,6 +96,10 @@
AM_CONDITIONAL([TEST_SUITES],[test "${enable_test_suites}" != "no"])
+
+### Plugins ###
+
+#Enable demo synthesizer plugin
AC_ARG_ENABLE(demosynth-plugin,
[AC_HELP_STRING([--disable-demosynth-plugin ],[exclude demo synthesizer plugin from build])],
[enable_demosynth_plugin="$enableval"],
@@ -101,6 +107,8 @@
AM_CONDITIONAL([DEMOSYNTH_PLUGIN],[test "${enable_demosynth_plugin}" = "yes"])
+
+#Enable demo recognizer plugin
AC_ARG_ENABLE(demorecog-plugin,
[AC_HELP_STRING([--disable-demorecog-plugin ],[exclude demo recognizer plugin from build])],
[enable_demorecog_plugin="$enableval"],
@@ -108,6 +116,51 @@
AM_CONDITIONAL([DEMORECOG_PLUGIN],[test "${enable_demorecog_plugin}" = "yes"])
+
+#Enable Cepstral Swift plugin
+AC_ARG_ENABLE(cepstral-plugin,
+ [AC_HELP_STRING([--disable-cepstral-plugin ],[exclude cepstral plugin from build])],
+ [enable_cepstral_plugin="$enableval"],
+ [enable_cepstral_plugin="yes"])
+
+if test "${enable_cepstral_plugin}" != "no"; then
+ UNIMRCP_CHECK_SWIFT
+fi
+
+AM_CONDITIONAL([CEPSTRAL_PLUGIN],[test "${enable_cepstral_plugin}" = "yes" &&\
+ test "${found_swift}" = "yes"])
+
+
+#Enable PocketSphinx plugin
+AC_ARG_ENABLE(pocketsphinx-plugin,
+ [AC_HELP_STRING([--enable-pocketsphinx-plugin ],[enable pocketsphinx plugin])],
+ [enable_pocketsphinx_plugin="$enableval"],
+ [enable_pocketsphinx_plugin="no"])
+
+if test "${enable_pocketsphinx_plugin}" != "no"; then
+ UNIMRCP_CHECK_SPHINXBASE
+ UNIMRCP_CHECK_POCKETSPHINX
+fi
+
+AM_CONDITIONAL([POCKETSPHINX_PLUGIN],[test "${enable_pocketsphinx_plugin}" = "yes" &&\
+ test "${found_pocketsphinx}" = "yes" &&\
+ test "${found_sphinxbase}" = "yes"])
+
+
+#Enable Flite plugin
+AC_ARG_ENABLE(flite-plugin,
+ [AC_HELP_STRING([--enable-flite-plugin ],[enable flite plugin])],
+ [enable_flite_plugin="$enableval"],
+ [enable_flite_plugin="no"])
+
+if test "${enable_flite_plugin}" != "no"; then
+ UNIMRCP_CHECK_FLITE
+fi
+
+AM_CONDITIONAL([FLITE_PLUGIN],[test "${enable_flite_plugin}" = "yes" &&\
+ test "${found_flite}" = "yes"])
+
+
AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin])
AC_CONFIG_FILES([
@@ -127,6 +180,8 @@
modules/mrcp-unirtsp/Makefile
plugins/Makefile
plugins/mrcp-cepstral/Makefile
+ plugins/mrcp-pocketsphinx/Makefile
+ plugins/mrcp-flite/Makefile
plugins/demo-synth/Makefile
plugins/demo-recog/Makefile
platforms/Makefile
@@ -148,3 +203,16 @@
])
AC_OUTPUT
+
+AC_MSG_NOTICE
+AC_MSG_NOTICE([Report:])
+AC_MSG_NOTICE([ UniMRCP: $UNI_DOTTED_VERSION])
+AC_MSG_NOTICE([ APR: $apr_version])
+AC_MSG_NOTICE([ APR-Util: $apu_version])
+AC_MSG_NOTICE([ Sofia-SIP: $sofia_version])
+AC_MSG_NOTICE([Plugins:])
+AC_MSG_NOTICE([ Demo Synthesizer: $enable_demosynth_plugin])
+AC_MSG_NOTICE([ Demo Recognizer: $enable_demorecog_plugin])
+AC_MSG_NOTICE([ Cepstral: $enable_cepstral_plugin])
+AC_MSG_NOTICE([ PocketSphinx: $enable_pocketsphinx_plugin])
+AC_MSG_NOTICE([ Flite: $enable_flite_plugin])
Modified: freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h
==============================================================================
--- freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h (original)
+++ freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h Fri Jun 26 15:18:39 2009
@@ -42,6 +42,9 @@
/** Create activity detector */
MPF_DECLARE(mpf_activity_detector_t*) mpf_activity_detector_create(apr_pool_t *pool);
+/** Reset activity detector */
+MPF_DECLARE(void) mpf_activity_detector_reset(mpf_activity_detector_t *detector);
+
/** Set threshold of voice activity (silence) level */
MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold);
Modified: freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h
==============================================================================
--- freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h (original)
+++ freeswitch/trunk/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h Fri Jun 26 15:18:39 2009
@@ -39,7 +39,9 @@
typedef enum {
MPF_SAMPLE_RATE_NONE = 0x00,
MPF_SAMPLE_RATE_8000 = 0x01,
- MPF_SAMPLE_RATE_16000 = 0x02
+ MPF_SAMPLE_RATE_16000 = 0x02,
+ MPF_SAMPLE_RATE_32000 = 0x04,
+ MPF_SAMPLE_RATE_48000 = 0x08
} mpf_sample_rates_e;
/** Codec descriptor declaration */
Modified: freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c
==============================================================================
--- freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c (original)
+++ freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c Fri Jun 26 15:18:39 2009
@@ -53,6 +53,13 @@
return detector;
}
+/** Reset activity detector */
+MPF_DECLARE(void) mpf_activity_detector_reset(mpf_activity_detector_t *detector)
+{
+ detector->duration = 0;
+ detector->state = DETECTOR_STATE_INACTIVITY;
+}
+
/** Set threshold of voice activity (silence) level */
MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold)
{
Modified: freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c
==============================================================================
--- freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c (original)
+++ freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c Fri Jun 26 15:18:39 2009
@@ -140,15 +140,17 @@
};
static const mpf_codec_attribs_t g711u_attribs = {
- {G711u_CODEC_NAME, G711u_CODEC_NAME_LENGTH}, /* codec name */
- 8, /* bits per sample */
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 /* sampling rates */
+ {G711u_CODEC_NAME, G711u_CODEC_NAME_LENGTH}, /* codec name */
+ 8, /* bits per sample */
+ MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
+ MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
};
static const mpf_codec_attribs_t g711a_attribs = {
- {G711a_CODEC_NAME, G711a_CODEC_NAME_LENGTH}, /* codec name */
- 8, /* bits per sample */
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 /* sampling rates */
+ {G711a_CODEC_NAME, G711a_CODEC_NAME_LENGTH}, /* codec name */
+ 8, /* bits per sample */
+ MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
+ MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
};
mpf_codec_t* mpf_codec_g711u_create(apr_pool_t *pool)
Modified: freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c
==============================================================================
--- freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c (original)
+++ freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c Fri Jun 26 15:18:39 2009
@@ -84,15 +84,17 @@
};
static const mpf_codec_attribs_t lpcm_attribs = {
- {LPCM_CODEC_NAME, LPCM_CODEC_NAME_LENGTH}, /* codec name */
- 16, /* bits per sample */
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 /* sampling rates */
+ {LPCM_CODEC_NAME, LPCM_CODEC_NAME_LENGTH}, /* codec name */
+ 16, /* bits per sample */
+ MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
+ MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
};
static const mpf_codec_attribs_t l16_attribs = {
- {L16_CODEC_NAME, L16_CODEC_NAME_LENGTH}, /* codec name */
- 16, /* bits per sample */
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 /* sampling rates */
+ {L16_CODEC_NAME, L16_CODEC_NAME_LENGTH}, /* codec name */
+ 16, /* bits per sample */
+ MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
+ MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
};
mpf_codec_descriptor_t* mpf_codec_lpcm_descriptor_create(apr_uint16_t sampling_rate, apr_byte_t channel_count, apr_pool_t *pool)
Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h
==============================================================================
--- freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h (original)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h Fri Jun 26 15:18:39 2009
@@ -74,6 +74,8 @@
mpf_termination_t *termination;
/** Back pointer to resource engine */
mrcp_resource_engine_t *engine;
+ /** Unique identifier (useful for traces) */
+ apt_str_t id;
/** Pool to allocate memory from */
apr_pool_t *pool;
};
Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/src/mrcp_resource_engine.c
==============================================================================
--- freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/src/mrcp_resource_engine.c (original)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp-engine/src/mrcp_resource_engine.c Fri Jun 26 15:18:39 2009
@@ -51,6 +51,7 @@
channel->termination = termination;
channel->engine = engine;
channel->pool = pool;
+ apt_string_reset(&channel->id);
return channel;
}
Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c
==============================================================================
--- freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c (original)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c Fri Jun 26 15:18:39 2009
@@ -206,6 +206,7 @@
engine_channel = mrcp_server_engine_channel_create(session,resource_name);
if(engine_channel) {
+ engine_channel->id = session->base.id;
engine_channel->event_obj = channel;
engine_channel->event_vtable = &engine_channel_vtable;
channel->engine_channel = engine_channel;
Modified: freeswitch/trunk/libs/unimrcp/plugins/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/unimrcp/plugins/Makefile.am (original)
+++ freeswitch/trunk/libs/unimrcp/plugins/Makefile.am Fri Jun 26 15:18:39 2009
@@ -13,3 +13,11 @@
if CEPSTRAL_PLUGIN
SUBDIRS += mrcp-cepstral
endif
+
+if POCKETSPHINX_PLUGIN
+SUBDIRS += mrcp-pocketsphinx
+endif
+
+if FLITE_PLUGIN
+SUBDIRS += mrcp-flite
+endif
Added: freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/Makefile.am
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/Makefile.am Fri Jun 26 15:18:39 2009
@@ -0,0 +1,19 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+INCLUDES = -Iinclude \
+ -I$(top_srcdir)/libs/mrcp-engine/include \
+ -I$(top_srcdir)/libs/mrcp/include \
+ -I$(top_srcdir)/libs/mrcp/message/include \
+ -I$(top_srcdir)/libs/mrcp/control/include \
+ -I$(top_srcdir)/libs/mrcp/resources/include \
+ -I$(top_srcdir)/libs/mpf/include \
+ -I$(top_srcdir)/libs/apr-toolkit/include \
+ $(UNIMRCP_APR_INCLUDES) \
+ $(UNIMRCP_APU_INCLUDES) \
+ $(UNIMRCP_FLITE_INCLUDES)
+
+plugin_LTLIBRARIES = mrcpflite.la
+
+mrcpflite_la_SOURCES = src/mrcp_flite.c
+mrcpflite_la_LDFLAGS = -module $(PLUGIN_LT_VERSION)
+mrcpflite_la_LIBADD = $(UNIMRCP_FLITE_LIBS) -lm
Added: freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/mrcpflite.vcproj
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/mrcpflite.vcproj Fri Jun 26 15:18:39 2009
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="mrcpflite"
+ ProjectGUID="{56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556}"
+ RootNamespace="mrcpflite"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\flite.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="include"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\flite.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpplugin.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="include"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="include"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="src"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ >
+ <File
+ RelativePath=".\src\mrcp_flite.c"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c Fri Jun 26 15:18:39 2009
@@ -0,0 +1,749 @@
+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Some mandatory rules for plugin implementation.
+ * 1. Each plugin MUST contain the following function as an entry point of the plugin
+ * MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+ * 2. One and only one response MUST be sent back to the received request.
+ * 3. Methods (callbacks) of the MRCP engine channel MUST not block.
+ * (asynch response can be sent from the context of other thread)
+ * 4. Methods (callbacks) of the MPF engine stream MUST not block.
+ */
+
+#include "mrcp_resource_engine.h"
+#include "mrcp_synth_resource.h"
+#include "mrcp_synth_header.h"
+#include "mrcp_generic_header.h"
+#include "mrcp_message.h"
+#include "mpf_buffer.h"
+#include "apr_time.h"
+#include "apt_consumer_task.h"
+#include "apt_log.h"
+#include "flite.h"
+
+typedef struct flite_synth_engine_t flite_synth_engine_t;
+typedef struct flite_synth_channel_t flite_synth_channel_t;
+typedef struct flite_synth_msg_t flite_synth_msg_t;
+
+/** Declaration of synthesizer engine methods */
+static apt_bool_t flite_synth_engine_destroy(mrcp_resource_engine_t *engine);
+static apt_bool_t flite_synth_engine_open(mrcp_resource_engine_t *engine);
+static apt_bool_t flite_synth_engine_close(mrcp_resource_engine_t *engine);
+static mrcp_engine_channel_t* flite_synth_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool);
+
+static const struct mrcp_engine_method_vtable_t engine_vtable = {
+ flite_synth_engine_destroy,
+ flite_synth_engine_open,
+ flite_synth_engine_close,
+ flite_synth_engine_channel_create
+};
+
+/** Declaration of synthesizer channel methods */
+static apt_bool_t flite_synth_channel_destroy(mrcp_engine_channel_t *channel);
+static apt_bool_t flite_synth_channel_open(mrcp_engine_channel_t *channel);
+static apt_bool_t flite_synth_channel_close(mrcp_engine_channel_t *channel);
+static apt_bool_t flite_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
+
+static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
+ flite_synth_channel_destroy,
+ flite_synth_channel_open,
+ flite_synth_channel_close,
+ flite_synth_channel_request_process
+};
+
+/** Declaration of synthesizer audio stream methods */
+static apt_bool_t flite_synth_stream_destroy(mpf_audio_stream_t *stream);
+static apt_bool_t flite_synth_stream_open(mpf_audio_stream_t *stream);
+static apt_bool_t flite_synth_stream_close(mpf_audio_stream_t *stream);
+static apt_bool_t flite_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
+
+static const mpf_audio_stream_vtable_t audio_stream_vtable = {
+ flite_synth_stream_destroy,
+ flite_synth_stream_open,
+ flite_synth_stream_close,
+ flite_synth_stream_read,
+ NULL,
+ NULL,
+ NULL
+};
+
+/** Declaration of flite synthesizer engine */
+struct flite_synth_engine_t {
+ apt_consumer_task_t *task;
+ int iChannels;
+ apr_thread_mutex_t *guard;
+};
+
+// flite stuff
+APT_BEGIN_EXTERN_C
+
+cst_voice *register_cmu_us_awb(void);
+void unregister_cmu_us_awb(cst_voice * v);
+
+cst_voice *register_cmu_us_kal(void);
+void unregister_cmu_us_kal(cst_voice * v);
+
+cst_voice *register_cmu_us_rms(void);
+void unregister_cmu_us_rms(cst_voice * v);
+
+cst_voice *register_cmu_us_slt(void);
+void unregister_cmu_us_slt(cst_voice * v);
+
+APT_END_EXTERN_C
+
+static struct {
+ cst_voice *awb;
+ cst_voice *kal;
+ cst_voice *rms;
+ cst_voice *slt;
+} voices;
+
+/** Declaration of flite synthesizer channel */
+struct flite_synth_channel_t {
+ flite_synth_engine_t *flite_engine; // Back pointer to engine
+ mrcp_engine_channel_t *channel; // Engine channel base
+ mrcp_message_t *speak_request; // Active (in-progress) speak request
+ mrcp_message_t *stop_response; // Pending stop response
+ apt_bool_t paused; // Is paused
+ mpf_buffer_t *audio_buffer; // Audio buffer
+ int iId; // Synth channel simultaneous reference count
+ cst_voice *voice;
+ cst_wave *wave;
+ apr_pool_t *pool;
+ apt_consumer_task_t *task;
+};
+
+typedef enum flite_synth_msg_type_e {
+ flite_synth_MSG_OPEN_CHANNEL,
+ flite_synth_MSG_CLOSE_CHANNEL,
+ flite_synth_MSG_REQUEST_PROCESS
+} flite_synth_msg_type_e;
+
+/** Declaration of flite synthesizer task message */
+struct flite_synth_msg_t {
+ flite_synth_msg_type_e type;
+ mrcp_engine_channel_t *channel;
+ mrcp_message_t *request;
+};
+
+/* mutex: may be flite library is not thread safe*/
+static apr_thread_mutex_t *flite_mutex;
+
+struct flite_speak_msg_t {
+ flite_synth_channel_t *channel;
+ mrcp_message_t *request;
+};
+
+typedef struct flite_speak_msg_t flite_speak_msg_t;
+
+// all calls to the Flite API functions (after initialization)
+// will be carried out using a separate task
+static apt_bool_t flite_synth_msg_signal(flite_synth_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request);
+static apt_bool_t flite_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+static apt_bool_t flite_synth_channel_open_t(mrcp_engine_channel_t * channel);
+static apt_bool_t flite_synth_channel_close_t(mrcp_engine_channel_t * channel);
+
+// and we have a special task for the actual synthesis -
+// the task is created when a mrcp speak message is received
+static apt_bool_t flite_speak_msg_process(apt_task_t *task, apt_task_msg_t *msg);
+
+/** Declare this macro to use log routine of the server where the plugin is loaded from */
+MRCP_PLUGIN_LOGGER_IMPLEMENT
+
+/** Create flite synthesizer engine */
+MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
+{
+ /* create flite engine */
+ flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) apr_palloc(pool,sizeof(flite_synth_engine_t));
+ apt_task_msg_pool_t *msg_pool;
+ apt_task_vtable_t *task_vtable = 0;
+
+ flite_engine->iChannels = 0;
+
+ /* create task/thread to run flite engine in the context of this task */
+ msg_pool = apt_task_msg_pool_create_dynamic(sizeof(flite_synth_msg_t),pool);
+ flite_engine->task = apt_consumer_task_create(flite_engine,msg_pool,pool);
+ if (!flite_engine->task)
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_ERROR, "MRCP_PLUGIN_DECLARE cannot create task");
+ return NULL;
+ }
+ task_vtable = apt_consumer_task_vtable_get(flite_engine->task);
+ if (task_vtable)
+ {
+ task_vtable->process_msg = flite_synth_msg_process;
+ }
+ else
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_ERROR, "MRCP_PLUGIN_DECLARE cannot use task vtable");
+ return NULL;
+ }
+
+ /* create flite mutex */
+ if (apr_thread_mutex_create(&flite_mutex,APR_THREAD_MUTEX_DEFAULT,pool) != APR_SUCCESS)
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_ERROR,"Failed to create flite mutex");
+ return NULL;
+ }
+
+ /* create channel mutex */
+ if (apr_thread_mutex_create(&flite_engine->guard,APR_THREAD_MUTEX_DEFAULT,pool) != APR_SUCCESS)
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_ERROR, "Failed to create channel guard");
+ return NULL;
+ }
+
+ /* create resource engine base */
+ return mrcp_resource_engine_create(
+ MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */
+ flite_engine, /* object to associate */
+ &engine_vtable, /* virtual methods table of resource engine */
+ pool); /* pool to allocate memory from */
+}
+
+/** Destroy synthesizer engine */
+static apt_bool_t flite_synth_engine_destroy(mrcp_resource_engine_t *engine)
+{
+ flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) engine->obj;
+
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_engine_destroy");
+
+ if(flite_engine->task) {
+ apt_task_t *task = apt_consumer_task_base_get(flite_engine->task);
+ apt_task_destroy(task);
+ flite_engine->task = NULL;
+ }
+
+ apr_thread_mutex_destroy(flite_engine->guard);
+ return TRUE;
+}
+
+/** Open synthesizer engine */
+static apt_bool_t flite_synth_engine_open(mrcp_resource_engine_t *engine)
+{
+ flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) engine->obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_engine_open");
+
+ flite_init();
+ voices.awb = register_cmu_us_awb();
+ voices.kal = register_cmu_us_kal();
+ voices.rms = register_cmu_us_rms();
+ voices.slt = register_cmu_us_slt();
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "fliteInitialize success");
+
+ if (flite_engine->task) {
+ apt_task_t *task = apt_consumer_task_base_get(flite_engine->task);
+ apt_task_start(task);
+ }
+ return TRUE;
+}
+
+/** Close synthesizer engine */
+static apt_bool_t flite_synth_engine_close(mrcp_resource_engine_t *engine)
+{
+ flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) engine->obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_engine_close");
+
+ if (flite_engine->task)
+ {
+ apt_task_t *task = apt_consumer_task_base_get(flite_engine->task);
+ apt_task_terminate(task,TRUE);
+ }
+
+ unregister_cmu_us_awb(voices.awb);
+ unregister_cmu_us_kal(voices.kal);
+ unregister_cmu_us_rms(voices.rms);
+ unregister_cmu_us_slt(voices.slt);
+
+ return TRUE;
+}
+
+/** Create flite synthesizer channel derived from engine channel base */
+static mrcp_engine_channel_t* flite_synth_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool)
+{
+ /* create flite synth channel */
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) apr_palloc(pool,sizeof(flite_synth_channel_t));
+ mpf_codec_descriptor_t *codec_descriptor = NULL;
+
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_engine_channel_create");
+
+// codec_descriptor = (mpf_codec_descriptor_t *) apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
+// mpf_codec_descriptor_init(codec_descriptor);
+// codec_descriptor->channel_count = 1;
+// codec_descriptor->payload_type = 96;
+// apt_string_set(&codec_descriptor->name,"L16");
+// codec_descriptor->sampling_rate = 16000;
+//
+ synth_channel->flite_engine = (flite_synth_engine_t *) engine->obj;
+ synth_channel->speak_request = NULL; // no active speak request in progress
+ synth_channel->stop_response = NULL;
+ synth_channel->paused = FALSE;
+ synth_channel->pool = pool;
+ synth_channel->wave = NULL;
+ synth_channel->voice = NULL;
+ synth_channel->iId = 0;
+
+ /* create engine channel base */
+ synth_channel->channel = mrcp_engine_source_channel_create(
+ engine, /* resource engine */
+ &channel_vtable, /* virtual methods table of engine channel */
+ &audio_stream_vtable, /* virtual methods table of audio stream */
+ synth_channel, /* object to associate */
+ codec_descriptor, /* codec descriptor might be NULL by default */
+ pool); /* pool to allocate memory from */
+
+ if (!synth_channel->channel)
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "flite_synth_engine_channel_create failed");
+ return NULL;
+ }
+
+ synth_channel->audio_buffer = mpf_buffer_create(pool);
+ apr_thread_mutex_lock(synth_channel->flite_engine->guard);
+ synth_channel->iId = ++synth_channel->flite_engine->iChannels;
+ apr_thread_mutex_unlock(synth_channel->flite_engine->guard);
+
+ apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_engine_channel_create created channel %d", synth_channel->iId);
+
+ return synth_channel->channel;
+}
+
+/** Destroy engine channel */
+static apt_bool_t flite_synth_channel_destroy(mrcp_engine_channel_t *channel)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_destroy - channel %d", synth_channel->iId);
+ if(synth_channel->task)
+ {
+ apt_task_t *task = apt_consumer_task_base_get(synth_channel->task);
+ if (!apt_task_destroy(task))
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "Speak task destroy failed - channel %d", synth_channel->iId);
+ }
+ else
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "Speak task destroyed - channel %d", synth_channel->iId);
+ }
+ }
+ synth_channel->task = NULL;
+
+ apr_thread_mutex_lock(synth_channel->flite_engine->guard);
+ synth_channel->flite_engine->iChannels--;
+ apr_thread_mutex_unlock(synth_channel->flite_engine->guard);
+
+ return TRUE;
+}
+
+/** Open engine channel (asynchronous response MUST be sent)*/
+static apt_bool_t flite_synth_channel_open(mrcp_engine_channel_t *channel)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_open - channel %d", synth_channel->iId);
+ return flite_synth_msg_signal(flite_synth_MSG_OPEN_CHANNEL,channel,NULL);
+}
+
+/** Close engine channel (asynchronous response MUST be sent)*/
+static apt_bool_t flite_synth_channel_close(mrcp_engine_channel_t *channel)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_close - channel %d", synth_channel->iId);
+ return flite_synth_msg_signal(flite_synth_MSG_CLOSE_CHANNEL,channel,NULL);
+}
+
+/** Process MRCP channel request (asynchronous response MUST be sent)*/
+static apt_bool_t flite_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_request_process - channel %d", synth_channel->iId);
+ return flite_synth_msg_signal(flite_synth_MSG_REQUEST_PROCESS,channel,request);
+}
+
+/** Open engine channel */
+static apt_bool_t flite_synth_channel_open_t(mrcp_engine_channel_t *channel)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_open_t - channel %d", synth_channel->iId);
+
+ synth_channel->voice = voices.awb;
+ return TRUE;
+}
+
+static apt_bool_t flite_synth_channel_close_t(mrcp_engine_channel_t *channel)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_close_t - channel %d", synth_channel->iId);
+
+ if (synth_channel->task)
+ {
+ apt_task_t *task = apt_consumer_task_base_get(synth_channel->task);
+ if (!apt_task_terminate(task,TRUE))
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "Speak task terminate failed - channel %d", synth_channel->iId);
+ }
+ else
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "Speak task terminated - channel %d", synth_channel->iId);
+ apt_task_destroy(task);
+ synth_channel->task = 0;
+ }
+ }
+ if (synth_channel->wave)
+ {
+ delete_wave(synth_channel->wave);
+ synth_channel->wave = 0;
+ }
+ else
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "No wave buffer to delete - channel %d", synth_channel->iId);
+ }
+ return TRUE;
+}
+
+
+/** Process SPEAK request */
+static apt_bool_t flite_synth_channel_speak(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_speak - channel %d", synth_channel->iId);
+
+ if (!synth_channel->speak_request)
+ {
+ apt_task_msg_pool_t *msg_pool = apt_task_msg_pool_create_dynamic( sizeof(flite_speak_msg_t),synth_channel->pool);
+ apt_task_vtable_t *task_vtable = 0;
+ apt_task_t * task = 0;
+ apt_task_msg_t *msg = 0;
+ flite_speak_msg_t *flite_msg = 0;
+
+ /* create task/thread to run flite so this function is not blocking */
+ apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create flite speak task - channel: %d", synth_channel->iId);
+ synth_channel->task = apt_consumer_task_create(synth_channel, msg_pool, synth_channel->pool);
+ if (!synth_channel->task)
+ {
+ apt_log(APT_LOG_MARK,APT_PRIO_ERROR, "flite_synth_channel_speak failed to create flite speak task - channel:%d", synth_channel->iId);
+ return FALSE;
+ }
+
+ task_vtable = apt_consumer_task_vtable_get(synth_channel->task);
+ if (!task_vtable)
+ {
+ apt_log(APT_LOG_MARK,APT_PRIO_ERROR, "flite_synth_channel_speak cannot use flite speak task vtable - channel:%d", synth_channel->iId);
+ return FALSE;
+ }
+
+ task_vtable->process_msg = flite_speak_msg_process;
+ synth_channel->speak_request = request;
+
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO, "Start task - channel %d", synth_channel->iId);
+ task = apt_consumer_task_base_get(synth_channel->task);
+ if (apt_task_start(task) == FALSE)
+ {
+ apt_log(APT_LOG_MARK,APT_PRIO_ERROR, "flite_synth_channel_speak failed to start task - channel: %d", synth_channel->iId);
+ apt_task_destroy(task);
+ return FALSE;
+ }
+
+ msg = apt_task_msg_acquire(msg_pool);
+ msg->type = TASK_MSG_USER;
+ flite_msg = (flite_speak_msg_t*) msg->data;
+ flite_msg->channel = synth_channel;
+ flite_msg->request = request;
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO, "Send signal to start speech synthesis - channel:%d", synth_channel->iId);
+ if (apt_task_msg_signal(task,msg))
+ {
+ response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+ mrcp_engine_channel_message_send(channel,response);
+ }
+ else
+ {
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO, "Failed to send signal to start speech synthesis - channel:%d", synth_channel->iId);
+ apt_task_destroy(task);
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static apt_bool_t flite_speak_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+ flite_speak_msg_t *flite_msg = (flite_speak_msg_t*)msg->data;
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) flite_msg->channel;
+ apr_time_t start = 0;
+ apr_time_t elapsed = 0;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "< flite_speak_msg_process speak - channel %d", synth_channel->iId);
+
+ // probably not necessary !?
+ mpf_buffer_restart(synth_channel->audio_buffer);
+
+ // just sequential stuff
+ start = apr_time_now(); // in microsec
+ if (synth_channel->speak_request->body.length)
+ {
+ cst_wave * wave = synth_channel->wave;
+ wave = flite_text_to_wave(synth_channel->speak_request->body.buf, synth_channel->voice);
+ }
+
+ elapsed = (apr_time_now() - start)/1000;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "TTS (chan %d) took %ld millisec", synth_channel->iId, elapsed);
+
+ if (!synth_channel->stop_response)
+ {
+ // this will notify the callback that feeds the client that synthesis is complete
+ mpf_buffer_event_write(synth_channel->audio_buffer, MEDIA_FRAME_TYPE_EVENT);
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "> flite_speak_msg_process speak - end of TTS - %d", synth_channel->iId);
+ }
+ else
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "> flite_speak_msg_process speak - channel %d", synth_channel->iId);
+ }
+ return TRUE;
+}
+
+/** Process STOP request */
+static apt_bool_t flite_synth_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_stop - channel %d", synth_channel->iId);
+ /* store the request, make sure there is no more activity and only then send the response */
+
+ /* TODO this should probably be mutexed */
+ synth_channel->stop_response = response;
+ return TRUE;
+}
+
+/** Process PAUSE request */
+static apt_bool_t flite_synth_channel_pause(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_pause - channel %d", synth_channel->iId);
+
+ synth_channel->paused = TRUE;
+ /* send asynchronous response */
+ mrcp_engine_channel_message_send(channel,response);
+ return TRUE;
+}
+
+/** Process RESUME request */
+static apt_bool_t flite_synth_channel_resume(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_resume - channel %d", synth_channel->iId);
+
+ synth_channel->paused = FALSE;
+ /* send asynchronous response */
+ mrcp_engine_channel_message_send(channel,response);
+ return TRUE;
+}
+
+/** Dispatch MRCP request */
+static apt_bool_t flite_synth_channel_request_dispatch(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_bool_t processed = FALSE;
+ mrcp_message_t *response = mrcp_response_create(request,request->pool);
+
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_channel_request_dispatch - channel %d", synth_channel->iId);
+
+ switch(request->start_line.method_id) {
+ case SYNTHESIZER_SET_PARAMS:
+ // TODO set voices
+ // if (!strcasecmp(voice_name, "awb")) {
+ // synth_channel->voice = voices.awb;
+ // } else if (!strcasecmp(voice_name, "kal")) {
+ // synth_channel->voice = voices.awb;
+ // } else if (!strcasecmp(voice_name, "rms")) {
+ // synth_channel->voice = voices.awb;
+ // } else if (!strcasecmp(voice_name, "slt")) {
+ // synth_channel->voice = voices.awb;
+ // } else {
+ // apt_log(APT_LOG_MARK, APT_PRIO_INFO, "Valid voice names are awb, kal, rms or slt");
+ // }
+ break;
+ case SYNTHESIZER_GET_PARAMS:
+ break;
+ case SYNTHESIZER_SPEAK:
+ processed = flite_synth_channel_speak(channel,request,response);
+ break;
+ case SYNTHESIZER_STOP:
+ processed = flite_synth_channel_stop(channel,request,response);
+ break;
+ case SYNTHESIZER_PAUSE:
+ processed = flite_synth_channel_pause(channel,request,response);
+ break;
+ case SYNTHESIZER_RESUME:
+ processed = flite_synth_channel_resume(channel,request,response);
+ break;
+ case SYNTHESIZER_BARGE_IN_OCCURRED:
+ processed = flite_synth_channel_stop(channel,request,response);
+ break;
+ case SYNTHESIZER_CONTROL:
+ break;
+ case SYNTHESIZER_DEFINE_LEXICON:
+ break;
+ default:
+ break;
+ }
+ if(processed == FALSE) {
+ /* send asynchronous response for not handled request */
+ mrcp_engine_channel_message_send(channel,response);
+ }
+ return TRUE;
+}
+
+/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
+static apt_bool_t flite_synth_stream_destroy(mpf_audio_stream_t *stream)
+{
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_stream_destroy");
+ return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform any action before open */
+static apt_bool_t flite_synth_stream_open(mpf_audio_stream_t *stream)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) stream->obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_stream_open - channel %d", synth_channel->iId);
+ return TRUE;
+}
+
+/** Callback is called from MPF engine context to perform any action after close */
+static apt_bool_t flite_synth_stream_close(mpf_audio_stream_t *stream)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) stream->obj;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_stream_close - channel %d", synth_channel->iId);
+ return TRUE;
+}
+
+/** Raise SPEAK-COMPLETE event */
+static apt_bool_t flite_synth_speak_complete_raise(flite_synth_channel_t *synth_channel)
+{
+ mrcp_message_t *message = 0;
+ mrcp_synth_header_t * synth_header = 0;
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_speak_complete_raise - channel %d", synth_channel->iId);
+
+ if (!synth_channel->speak_request) {
+ return FALSE;
+ }
+
+ message = mrcp_event_create(
+ synth_channel->speak_request,
+ SYNTHESIZER_SPEAK_COMPLETE,
+ synth_channel->speak_request->pool);
+ if (!message) {
+ return FALSE;
+ }
+
+ /* get/allocate synthesizer header */
+ synth_header = (mrcp_synth_header_t *) mrcp_resource_header_prepare(message);
+ if (synth_header) {
+ /* set completion cause */
+ synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL;
+ mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
+ }
+ /* set request state */
+ message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
+
+ synth_channel->speak_request = NULL;
+ /* send asynch event */
+ return mrcp_engine_channel_message_send(synth_channel->channel,message);
+}
+
+/** Callback is called from MPF engine context to read/get new frame */
+static apt_bool_t flite_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) stream->obj;
+ cst_wave * wave = synth_channel->wave;
+ if (synth_channel->stop_response && synth_channel->speak_request)
+ {
+ /* send asynchronous response to STOP request */
+ mrcp_engine_channel_message_send(synth_channel->channel, synth_channel->stop_response);
+ synth_channel->speak_request = NULL;
+ synth_channel->paused = FALSE;
+ return TRUE;
+ }
+
+ if (wave && cst_wave_num_samples(wave))
+ {
+ mpf_buffer_audio_write(synth_channel->audio_buffer, cst_wave_samples(wave), cst_wave_num_samples(wave) * 2);
+ }
+
+ /* check if there is active SPEAK request and it isn't in paused state */
+ if (synth_channel->speak_request && synth_channel->paused == FALSE)
+ {
+ /* normal processing */
+ mpf_buffer_frame_read(synth_channel->audio_buffer,frame);
+// apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_stream_read - channel %d - size %d", synth_channel->iId, mpf_buffer_get_size(synth_channel->audio_buffer));
+
+ if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT)
+ {
+ flite_synth_speak_complete_raise(synth_channel);
+ }
+ }
+ return TRUE;
+}
+
+static apt_bool_t flite_synth_msg_signal(flite_synth_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel->method_obj;
+ apt_bool_t status = FALSE;
+ flite_synth_engine_t *flite_engine = synth_channel->flite_engine;
+ apt_task_t *task = apt_consumer_task_base_get(flite_engine->task);
+ apt_task_msg_t *msg = apt_task_msg_get(task);
+
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_msg_signal - channel %d", synth_channel->iId);
+
+ if (msg) {
+ flite_synth_msg_t *flite_msg;
+ msg->type = TASK_MSG_USER;
+ flite_msg = (flite_synth_msg_t*) msg->data;
+
+ flite_msg->type = type;
+ flite_msg->channel = channel;
+ flite_msg->request = request;
+ status = apt_task_msg_signal(task,msg);
+ }
+ else
+ {
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_msg_signal - task msg not found %d", synth_channel->iId);
+ }
+ return status;
+}
+
+static apt_bool_t flite_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg)
+{
+ flite_synth_msg_t *flite_msg = (flite_synth_msg_t*)msg->data;
+ flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) flite_msg->channel->method_obj;
+
+ apt_log(APT_LOG_MARK, APT_PRIO_INFO, "flite_synth_msg_process - channel %d", synth_channel->iId);
+
+ switch(flite_msg->type) {
+ case flite_synth_MSG_OPEN_CHANNEL:
+ /* open channel and send asynch response */
+ flite_synth_channel_open_t(flite_msg->channel);
+ mrcp_engine_channel_open_respond(flite_msg->channel,TRUE);
+ break;
+ case flite_synth_MSG_CLOSE_CHANNEL:
+ /* close channel, make sure there is no activity and send asynch response */
+ flite_synth_channel_close_t(flite_msg->channel);
+ mrcp_engine_channel_close_respond(flite_msg->channel);
+ break;
+ case flite_synth_MSG_REQUEST_PROCESS:
+ flite_synth_channel_request_dispatch(flite_msg->channel,flite_msg->request);
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
Modified: freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am (original)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am Fri Jun 26 15:18:39 2009
@@ -8,9 +8,13 @@
-I$(top_srcdir)/libs/mrcp/resources/include \
-I$(top_srcdir)/libs/mpf/include \
-I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
+ $(UNIMRCP_APR_INCLUDES) \
+ $(UNIMRCP_APU_INCLUDES) \
+ $(UNIMRCP_SPHINXBASE_INCLUDES) \
+ $(UNIMRCP_POCKETSPHINX_INCLUDES)
plugin_LTLIBRARIES = mrcppocketsphinx.la
-mrcppocketsphinx_la_SOURCES = src/mrcp_pocketsphinx.c.c
+mrcppocketsphinx_la_SOURCES = src/mrcp_pocketsphinx.c
mrcppocketsphinx_la_LDFLAGS = -module $(PLUGIN_LT_VERSION)
+mrcppocketsphinx_la_LIBADD = $(UNIMRCP_POCKETSPHINX_LIBS) $(UNIMRCP_SPHINXBASE_LIBS) -lm
Modified: freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c
==============================================================================
--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c (original)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c Fri Jun 26 15:18:39 2009
@@ -24,6 +24,11 @@
* 4. Methods (callbacks) of the MPF engine stream MUST not block.
*/
+#include <pocketsphinx.h>
+#include <apr_thread_cond.h>
+#include <apr_thread_proc.h>
+#include <apr_tables.h>
+#include <apr_file_io.h>
#include "mrcp_resource_engine.h"
#include "mrcp_recog_resource.h"
#include "mrcp_recog_header.h"
@@ -33,24 +38,27 @@
#include "apt_log.h"
+#define RECOGNIZER_SIDRES(recognizer) (recognizer)->channel->id.buf, "pocketsphinx"
+
typedef struct pocketsphinx_engine_t pocketsphinx_engine_t;
typedef struct pocketsphinx_recognizer_t pocketsphinx_recognizer_t;
+typedef struct pocketsphinx_properties_t pocketsphinx_properties_t;
-/** Declaration of recognizer engine methods */
+/** Methods of recognition engine */
static apt_bool_t pocketsphinx_engine_destroy(mrcp_resource_engine_t *engine);
static apt_bool_t pocketsphinx_engine_open(mrcp_resource_engine_t *engine);
static apt_bool_t pocketsphinx_engine_close(mrcp_resource_engine_t *engine);
-static mrcp_engine_channel_t* pocketsphinx_recognizer_create(mrcp_resource_engine_t *engine, apr_pool_t *pool);
+static mrcp_engine_channel_t* pocketsphinx_engine_recognizer_create(mrcp_resource_engine_t *engine, apr_pool_t *pool);
static const struct mrcp_engine_method_vtable_t engine_vtable = {
pocketsphinx_engine_destroy,
pocketsphinx_engine_open,
pocketsphinx_engine_close,
- pocketsphinx_recognizer_create
+ pocketsphinx_engine_recognizer_create
};
-/** Declaration of recognizer channel methods */
+/** Methods of recognition channel (recognizer) */
static apt_bool_t pocketsphinx_recognizer_destroy(mrcp_engine_channel_t *channel);
static apt_bool_t pocketsphinx_recognizer_open(mrcp_engine_channel_t *channel);
static apt_bool_t pocketsphinx_recognizer_close(mrcp_engine_channel_t *channel);
@@ -63,43 +71,94 @@
pocketsphinx_recognizer_request_process
};
-/** Declaration of recognizer audio stream methods */
-static apt_bool_t pocketsphinx_stream_destroy(mpf_audio_stream_t *stream);
-static apt_bool_t pocketsphinx_stream_open(mpf_audio_stream_t *stream);
-static apt_bool_t pocketsphinx_stream_close(mpf_audio_stream_t *stream);
+/** Methods of audio stream to recognize */
static apt_bool_t pocketsphinx_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
static const mpf_audio_stream_vtable_t audio_stream_vtable = {
- pocketsphinx_stream_destroy,
- NULL,
- NULL,
- NULL,
- pocketsphinx_stream_open,
- pocketsphinx_stream_close,
+ NULL, /* destroy */
+ NULL, /* open_rx */
+ NULL, /* close_rx */
+ NULL, /* read_frame */
+ NULL, /* open_tx */
+ NULL, /* close_tx */
pocketsphinx_stream_write
};
-/** Declaration of pocketsphinx engine */
+/** Pocketsphinx engine (engine is an aggregation of recognizers) */
struct pocketsphinx_engine_t {
mrcp_resource_engine_t *base;
};
-/** Declaration of pocketsphinx recognizer */
+/** Pocketsphinx properties */
+struct pocketsphinx_properties_t {
+ const char *dictionary;
+ const char *model_8k;
+ const char *model_16k;
+ apr_size_t noinput_timeout;
+ apr_size_t recognition_timeout;
+ apr_size_t partial_result_timeout;
+};
+
+/** Pocketsphinx channel (recognizer) */
struct pocketsphinx_recognizer_t {
/** Back pointer to engine */
- pocketsphinx_engine_t *engine;
+ pocketsphinx_engine_t *engine;
/** Engine channel base */
- mrcp_engine_channel_t *channel;
+ mrcp_engine_channel_t *channel;
+
+ /** Actual recognizer object */
+ ps_decoder_t *decoder;
+ /** Configuration */
+ cmd_ln_t *config;
+ /** Properties (to be loaded from config file) */
+ pocketsphinx_properties_t properties;
+ /** Is input timer started */
+ apt_bool_t is_input_timer_on;
+ /** Noinput timeout */
+ apr_size_t noinput_timeout;
+ /** Recognition timeout */
+ apr_size_t recognition_timeout;
+ /** Timeout elapsed since the last partial result checking */
+ apr_size_t partial_result_timeout;
+ /** Last (partially) recognized result */
+ const char *last_result;
+ /** Active grammar identifier (content-id) */
+ const char *grammar_id;
+ /** Table of defined grammars (key=content-id, value=grammar-file-path) */
+ apr_table_t *grammar_table;
+
+ /** Voice activity detector */
+ mpf_activity_detector_t *detector;
+
+ /** Thread to run recognition in */
+ apr_thread_t *thread;
+ /** Conditional wait object */
+ apr_thread_cond_t *wait_object;
+ /** Mutex of the wait object */
+ apr_thread_mutex_t *mutex;
+
+ /** Pending request from client stack to recognizer */
+ mrcp_message_t *request;
+ /** Pending event from mpf layer to recognizer */
+ mrcp_message_t *complete_event;
+ /** In-progress RECOGNIZE request */
+ mrcp_message_t *inprogress_recog;
+ /** Pending STOP response */
+ mrcp_message_t *stop_response;
+ /** Is recognition channel being closed */
+ apt_bool_t close_requested;
};
/** Declare this macro to use log routine of the server, plugin is loaded from */
MRCP_PLUGIN_LOGGER_IMPLEMENT
+static void* APR_THREAD_FUNC pocketsphinx_recognizer_run(apr_thread_t *thread, void *data);
/** Create pocketsphinx engine (engine is an aggregation of recognizers) */
MRCP_PLUGIN_DECLARE(mrcp_resource_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
{
pocketsphinx_engine_t *engine = apr_palloc(pool,sizeof(pocketsphinx_engine_t));
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create PocketSphinx Engine");
/* create resource engine base */
engine->base = mrcp_resource_engine_create(
@@ -110,27 +169,49 @@
return engine->base;
}
+/** Destroy pocketsphinx engine */
static apt_bool_t pocketsphinx_engine_destroy(mrcp_resource_engine_t *engine)
{
return TRUE;
}
+/** Open pocketsphinx engine */
static apt_bool_t pocketsphinx_engine_open(mrcp_resource_engine_t *engine)
{
return TRUE;
}
+/** Close pocketsphinx engine */
static apt_bool_t pocketsphinx_engine_close(mrcp_resource_engine_t *engine)
{
return TRUE;
}
/** Create pocketsphinx recognizer */
-static mrcp_engine_channel_t* pocketsphinx_recognizer_create(mrcp_resource_engine_t *engine, apr_pool_t *pool)
+static mrcp_engine_channel_t* pocketsphinx_engine_recognizer_create(mrcp_resource_engine_t *engine, apr_pool_t *pool)
{
mrcp_engine_channel_t *channel;
pocketsphinx_recognizer_t *recognizer = apr_palloc(pool,sizeof(pocketsphinx_recognizer_t));
-
+// recognizer->engine = engine;
+ recognizer->decoder = NULL;
+ recognizer->config = NULL;
+ recognizer->is_input_timer_on = FALSE;
+ recognizer->noinput_timeout = 0;
+ recognizer->recognition_timeout = 0;
+ recognizer->partial_result_timeout = 0;
+ recognizer->last_result = NULL;
+ recognizer->detector = NULL;
+ recognizer->thread = NULL;
+ recognizer->wait_object = NULL;
+ recognizer->mutex = NULL;
+ recognizer->request = NULL;
+ recognizer->complete_event = NULL;
+ recognizer->inprogress_recog = FALSE;
+ recognizer->stop_response = NULL;
+ recognizer->close_requested = FALSE;
+ recognizer->grammar_id = NULL;
+ recognizer->grammar_table = apr_table_make(pool,1);
+
/* create engine channel base */
channel = mrcp_engine_sink_channel_create(
engine, /* resource engine */
@@ -144,55 +225,452 @@
return channel;
}
-/** Destroy engine channel */
+/** Destroy pocketsphinx recognizer */
static apt_bool_t pocketsphinx_recognizer_destroy(mrcp_engine_channel_t *channel)
{
return TRUE;
}
-/** Open engine channel (asynchronous response MUST be sent)*/
+/** Open pocketsphinx recognizer (asynchronous response MUST be sent) */
static apt_bool_t pocketsphinx_recognizer_open(mrcp_engine_channel_t *channel)
{
- return mrcp_engine_channel_open_respond(channel,TRUE);
+ apr_status_t rv;
+ pocketsphinx_recognizer_t *recognizer = channel->method_obj;
+
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Channel "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+
+ apr_thread_mutex_create(&recognizer->mutex,APR_THREAD_MUTEX_DEFAULT,channel->pool);
+ apr_thread_cond_create(&recognizer->wait_object,channel->pool);
+
+ /* Launch a thread to run recognition in */
+ rv = apr_thread_create(&recognizer->thread,NULL,pocketsphinx_recognizer_run,recognizer,channel->pool);
+ if(rv != APR_SUCCESS) {
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Failed to Launch Thread "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+ apr_thread_mutex_destroy(recognizer->mutex);
+ recognizer->mutex = NULL;
+ apr_thread_cond_destroy(recognizer->wait_object);
+ recognizer->wait_object = NULL;
+ return mrcp_engine_channel_open_respond(channel,FALSE);
+ }
+
+ return TRUE;
}
-/** Close engine channel (asynchronous response MUST be sent)*/
+/** Close pocketsphinx recognizer (asynchronous response MUST be sent)*/
static apt_bool_t pocketsphinx_recognizer_close(mrcp_engine_channel_t *channel)
{
+ pocketsphinx_recognizer_t *recognizer = channel->method_obj;
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close Channel "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+ if(recognizer->thread) {
+ apr_status_t rv;
+
+ /* Signal recognition thread to terminate */
+ apr_thread_mutex_lock(recognizer->mutex);
+ recognizer->close_requested = TRUE;
+ apr_thread_cond_signal(recognizer->wait_object);
+ apr_thread_mutex_unlock(recognizer->mutex);
+
+ apr_thread_join(&rv,recognizer->thread);
+ recognizer->thread = NULL;
+
+ apr_thread_mutex_destroy(recognizer->mutex);
+ recognizer->mutex = NULL;
+ apr_thread_cond_destroy(recognizer->wait_object);
+ recognizer->wait_object = NULL;
+ }
+
return mrcp_engine_channel_close_respond(channel);
}
+/** Process MRCP request (asynchronous response MUST be sent)*/
+static apt_bool_t pocketsphinx_recognizer_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+{
+ pocketsphinx_recognizer_t *recognizer = channel->method_obj;
+
+ /* Store request and signal recognition thread to process the request */
+ apr_thread_mutex_lock(recognizer->mutex);
+ recognizer->request = request;
+ apr_thread_cond_signal(recognizer->wait_object);
+ apr_thread_mutex_unlock(recognizer->mutex);
+ return TRUE;
+}
+
+
+
+/** Load pocketsphinx properties [RECOG] */
+static apt_bool_t pocketsphinx_properties_load(pocketsphinx_recognizer_t *recognizer)
+{
+ mrcp_engine_channel_t *channel = recognizer->channel;
+ const apt_dir_layout_t *dir_layout = channel->engine->dir_layout;
+ pocketsphinx_properties_t *properties = &recognizer->properties;
+
+ properties->dictionary = apt_datadir_filepath_get(dir_layout,"pocketsphinx/default.dic",channel->pool);
+ properties->model_8k = apt_datadir_filepath_get(dir_layout,"pocketsphinx/communicator",channel->pool);
+ properties->model_16k = apt_datadir_filepath_get(dir_layout,"pocketsphinx/wsj1",channel->pool);
+
+ properties->noinput_timeout = 5000;
+ properties->recognition_timeout = 15000;
+ properties->partial_result_timeout = 100;
+
+ return TRUE;
+}
+
+/** Initialize pocketsphinx decoder [RECOG] */
+static apt_bool_t pocketsphinx_decoder_init(pocketsphinx_recognizer_t *recognizer, const char *grammar)
+{
+ apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Init Config "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+ recognizer->config = cmd_ln_init(recognizer->config, ps_args(), FALSE,
+ "-samprate", "8000",
+ "-hmm", recognizer->properties.model_8k,
+ "-jsgf", grammar,
+ "-dict", recognizer->properties.dictionary,
+ "-frate", "50",
+ "-silprob", "0.005",
+ NULL);
+ if(!recognizer->config) {
+ apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Init Config "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+ return FALSE;
+ }
+
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Init Decoder "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+ if(recognizer->decoder) {
+ if(ps_reinit(recognizer->decoder,recognizer->config) < 0) {
+ apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Reinit Decoder "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+ return FALSE;
+ }
+ }
+ else {
+ recognizer->decoder = ps_init(recognizer->config);
+ if(!recognizer->decoder) {
+ apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Init Decoder "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+ return FALSE;
+ }
+ }
+
+ if(!recognizer->detector) {
+ recognizer->detector = mpf_activity_detector_create(recognizer->channel->pool);
+ mpf_activity_detector_level_set(recognizer->detector,50);
+ }
+ return TRUE;
+}
+
+/** Build pocketsphinx recognized result [RECOG] */
+static apt_bool_t pocketsphinx_result_build(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *message)
+{
+ apt_str_t *body = &message->body;
+ if(!recognizer->last_result || !recognizer->grammar_id) {
+ return FALSE;
+ }
+
+ body->buf = apr_psprintf(message->pool,
+ "<?xml version=\"1.0\"?>\n"
+ "<result grammar=\"%s\">\n"
+ " <interpretation grammar=\"%s\" confidence=\"%d\">\n"
+ " <input mode=\"speech\">%s</input>\n"
+ " </interpretation>\n"
+ "</result>\n",
+ recognizer->grammar_id,
+ recognizer->grammar_id,
+ 99,
+ recognizer->last_result,
+ recognizer->last_result);
+ if(body->buf) {
+ mrcp_generic_header_t *generic_header;
+ generic_header = mrcp_generic_header_prepare(message);
+ if(generic_header) {
+ /* set content type */
+ apt_string_assign(&generic_header->content_type,"application/x-nlsml",message->pool);
+ mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE);
+ }
+
+ body->length = strlen(body->buf);
+ }
+ return TRUE;
+}
+
+/** Clear pocketsphinx grammars [RECOG] */
+static apt_bool_t pocketsphinx_grammars_clear(pocketsphinx_recognizer_t *recognizer)
+{
+ const apr_array_header_t *tarr = apr_table_elts(recognizer->grammar_table);
+ const apr_table_entry_t *telts = (const apr_table_entry_t*)tarr->elts;
+ int i;
+ for(i = 0; i < tarr->nelts; i++) {
+ const char *grammar_file_path = telts[i].val;
+ if(grammar_file_path) {
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Grammar File [%s] "APT_SIDRES_FMT,
+ grammar_file_path,RECOGNIZER_SIDRES(recognizer));
+ apr_file_remove(grammar_file_path,recognizer->channel->pool);
+ }
+ }
+ apr_table_clear(recognizer->grammar_table);
+ return TRUE;
+}
+
+/** Process DEFINE-GRAMMAR request [RECOG] */
+static apt_bool_t pocketsphinx_define_grammar(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
+{
+ const char *content_type = NULL;
+ const char *content_id = NULL;
+ apt_str_t *grammar = NULL;
+
+ mrcp_engine_channel_t *channel = recognizer->channel;
+
+ /* get recognizer header */
+ mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request);
+ mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(response);
+ if(!generic_header || !recog_header) {
+ return FALSE;
+ }
+
+ recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS;
+ mrcp_resource_header_property_add(response,RECOGNIZER_HEADER_COMPLETION_CAUSE);
+
+ /* content-id must be specified */
+ if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_ID) == TRUE) {
+ content_id = generic_header->content_id.buf;
+ }
+ if(!content_id) {
+ apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Content-Id "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+ response->start_line.status_code = MRCP_STATUS_CODE_MISSING_PARAM;
+ recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE;
+ return FALSE;
+ }
+
+ if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) {
+ grammar = &request->body;
+ }
+
+ if(grammar) {
+ /* load grammar */
+ const apt_dir_layout_t *dir_layout = channel->engine->dir_layout;
+ const char *grammar_file_path = NULL;
+ const char *grammar_file_name = NULL;
+ apr_file_t *fd = NULL;
+ apr_status_t rv;
+ apr_size_t size;
+
+ /* content-type must be specified */
+ if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_TYPE) == TRUE) {
+ content_type = generic_header->content_type.buf;
+ }
+ if(!content_type) {
+ apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Content-Type "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
+ response->start_line.status_code = MRCP_STATUS_CODE_MISSING_PARAM;
+ recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE;
+ return FALSE;
+ }
+
+ /* only JSGF grammar is supported */
+ if(strstr(content_type,"jsgf") == NULL) {
+ apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Not Supported Content-Type [%s] "APT_SIDRES_FMT,
+ content_type,RECOGNIZER_SIDRES(recognizer));
+ response->start_line.status_code = MRCP_STATUS_CODE_UNSUPPORTED_PARAM_VALUE;
+ recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE;
+ return FALSE;
+ }
+
+ grammar_file_name = apr_psprintf(channel->pool,"pocketsphinx/%s-%s.gram",channel->id.buf,content_id);
+ grammar_file_path = apt_datadir_filepath_get(dir_layout,grammar_file_name,channel->pool);
+
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Grammar File [%s] "APT_SIDRES_FMT,
+ grammar_file_path,RECOGNIZER_SIDRES(recognizer));
+ rv = apr_file_open(&fd,grammar_file_path,APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY,
+ APR_OS_DEFAULT,channel->pool);
+ if(rv != APR_SUCCESS) {
+ apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Grammar File to Write [%s] "APT_SIDRES_FMT,
+ grammar_file_path,RECOGNIZER_SIDRES(recognizer));
+ response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+ recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE;
+ return FALSE;
+ }
+
+ size = grammar->length;
+ apr_file_write(fd,grammar->buf,&size);
+ apr_file_close(fd);
+
+ /* init pocketsphinx decoder */
+ if(pocketsphinx_decoder_init(recognizer,grammar_file_path) == TRUE) {
+ recognizer->grammar_id = content_id;
+ apr_table_setn(recognizer->grammar_table,content_id,grammar_file_path);
+ }
+ else {
+ response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+ recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE;
+ apr_file_remove(grammar_file_path,channel->pool);
+ return FALSE;
+ }
+ }
+ else {
+ /* unload grammar */
+ const char *grammar_file_path = apr_table_get(recognizer->grammar_table,content_id);
+ if(grammar_file_path) {
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Grammar File [%s] "APT_SIDRES_FMT,
+ grammar_file_path,RECOGNIZER_SIDRES(recognizer));
+ apr_file_remove(grammar_file_path,channel->pool);
+ apr_table_unset(recognizer->grammar_table,content_id);
+ }
+ }
-/** Process RECOGNIZE request */
+ /* send asynchronous response */
+ mrcp_engine_channel_message_send(channel,response);
+ return TRUE;
+}
+
+/** Process RECOGNIZE request [RECOG] */
static apt_bool_t pocketsphinx_recognize(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
{
+ mrcp_recog_header_t *request_recog_header;
+ mrcp_recog_header_t *response_recog_header = mrcp_resource_header_prepare(response);
+ if(!response_recog_header) {
+ return FALSE;
+ }
+
+ response_recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS;
+ mrcp_resource_header_property_add(response,RECOGNIZER_HEADER_COMPLETION_CAUSE);
+
+ if(!recognizer->decoder || ps_start_utt(recognizer->decoder, NULL) < 0) {
+ response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+ response_recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_ERROR;
+ return FALSE;
+ }
+
+ recognizer->is_input_timer_on = TRUE;
+ /* get recognizer header */
+ request_recog_header = mrcp_resource_header_get(request);
+ if(request_recog_header) {
+ if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_START_INPUT_TIMERS) == TRUE) {
+ recognizer->is_input_timer_on = request_recog_header->start_input_timers;
+ }
+ }
+
+ response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+ /* send asynchronous response */
+ mrcp_engine_channel_message_send(recognizer->channel,response);
+
+
+ /* reset */
+ mpf_activity_detector_reset(recognizer->detector);
+ recognizer->noinput_timeout = 0;
+ recognizer->recognition_timeout = 0;
+ recognizer->partial_result_timeout = 0;
+ recognizer->last_result = NULL;
+ recognizer->complete_event = NULL;
+
+ recognizer->inprogress_recog = request;
return TRUE;
}
-/** Process STOP request */
+/** Process GET-RESULTS request [RECOG] */
+static apt_bool_t pocketsphinx_get_result(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
+{
+ if(pocketsphinx_result_build(recognizer,response) != TRUE) {
+ response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
+ }
+
+ /* send asynchronous response */
+ mrcp_engine_channel_message_send(recognizer->channel,response);
+ return TRUE;
+}
+
+/** Process START-INPUT-TIMERS request [RECOG] */
+static apt_bool_t pocketsphinx_start_input_timers(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
+{
+ recognizer->is_input_timer_on = TRUE;
+
+ /* send asynchronous response */
+ mrcp_engine_channel_message_send(recognizer->channel,response);
+ return TRUE;
+}
+
+
+/** Process STOP request [RECOG] */
static apt_bool_t pocketsphinx_stop(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
{
+ if(recognizer->inprogress_recog) {
+ /* store pending STOP response for further processing */
+ recognizer->stop_response = response;
+ return TRUE;
+ }
+
+ /* send asynchronous response */
+ mrcp_engine_channel_message_send(recognizer->channel,response);
return TRUE;
}
-static apt_bool_t pocketsphinx_recognizer_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
+/** Process RECOGNITION-COMPLETE event [RECOG] */
+static apt_bool_t pocketsphinx_recognition_complete(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *complete_event)
+{
+ mrcp_recog_header_t *recog_header;
+ if(!recognizer->inprogress_recog) {
+ /* false event */
+ return FALSE;
+ }
+
+ recognizer->inprogress_recog = NULL;
+ ps_end_utt(recognizer->decoder);
+
+ if(recognizer->stop_response) {
+ /* recognition has been stopped, send STOP response instead */
+ mrcp_message_t *response = recognizer->stop_response;
+ recognizer->stop_response = NULL;
+ if(recognizer->close_requested == FALSE) {
+ mrcp_engine_channel_message_send(recognizer->channel,response);
+ }
+ return TRUE;
+ }
+
+ recog_header = mrcp_resource_header_get(complete_event);
+ if(recog_header->completion_cause == RECOGNIZER_COMPLETION_CAUSE_SUCCESS ||
+ recog_header->completion_cause == RECOGNIZER_COMPLETION_CAUSE_RECOGNITION_TIMEOUT) {
+ int32 score;
+ char const *hyp;
+ char const *uttid;
+
+ hyp = ps_get_hyp(recognizer->decoder, &score, &uttid);
+ if(hyp && strlen(hyp) > 0) {
+ int32 prob;
+ recognizer->last_result = apr_pstrdup(recognizer->channel->pool,hyp);
+ prob = ps_get_prob(recognizer->decoder, &uttid);
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Recognition Final Result [%s] Prob [%d] Score [%d] "APT_SIDRES_FMT,
+ hyp,prob,score,RECOGNIZER_SIDRES(recognizer));
+ if(pocketsphinx_result_build(recognizer,complete_event) != TRUE) {
+ recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_ERROR;
+ }
+ }
+ else {
+ recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_NO_MATCH;
+ }
+ }
+
+ /* send asynchronous event */
+ mrcp_engine_channel_message_send(recognizer->channel,complete_event);
+ return TRUE;
+}
+
+/** Dispatch MRCP request [RECOG] */
+static apt_bool_t pocketsphinx_request_dispatch(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request)
{
- pocketsphinx_recognizer_t *recognizer = channel->method_obj;
apt_bool_t processed = FALSE;
mrcp_message_t *response = mrcp_response_create(request,request->pool);
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Dispatch Request %s "APT_SIDRES_FMT,
+ request->start_line.method_name.buf,
+ RECOGNIZER_SIDRES(recognizer));
switch(request->start_line.method_id) {
case RECOGNIZER_SET_PARAMS:
break;
case RECOGNIZER_GET_PARAMS:
break;
case RECOGNIZER_DEFINE_GRAMMAR:
+ processed = pocketsphinx_define_grammar(recognizer,request,response);
break;
case RECOGNIZER_RECOGNIZE:
processed = pocketsphinx_recognize(recognizer,request,response);
break;
case RECOGNIZER_GET_RESULT:
+ processed = pocketsphinx_get_result(recognizer,request,response);
break;
case RECOGNIZER_START_INPUT_TIMERS:
+ processed = pocketsphinx_start_input_timers(recognizer,request,response);
break;
case RECOGNIZER_STOP:
processed = pocketsphinx_stop(recognizer,request,response);
@@ -201,32 +679,200 @@
break;
}
if(processed == FALSE) {
- /* send asynchronous response for not handled request */
- mrcp_engine_channel_message_send(channel,response);
+ /* send asynchronous response for non handled request */
+ mrcp_engine_channel_message_send(recognizer->channel,response);
}
return TRUE;
}
+/** Recognition thread [RECOG] */
+static void* APR_THREAD_FUNC pocketsphinx_recognizer_run(apr_thread_t *thread, void *data)
+{
+ pocketsphinx_recognizer_t *recognizer = data;
+ apt_bool_t status;
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Run Recognition Thread "APT_SIDRES_FMT, RECOGNIZER_SIDRES(recognizer));
+ status = pocketsphinx_properties_load(recognizer);
+ /** Send response to channel_open request */
+ mrcp_engine_channel_open_respond(recognizer->channel,status);
+
+ do {
+ /** Wait for MRCP requests */
+ apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for incoming messages "APT_SIDRES_FMT, RECOGNIZER_SIDRES(recognizer));
+ apr_thread_mutex_lock(recognizer->mutex);
+ apr_thread_cond_wait(recognizer->wait_object,recognizer->mutex);
+ apr_thread_mutex_unlock(recognizer->mutex);
+
+ if(recognizer->request) {
+ /* store request message and further dispatch it */
+ mrcp_message_t *request = recognizer->request;
+ recognizer->request = NULL;
+ pocketsphinx_request_dispatch(recognizer,request);
+ }
+ if(recognizer->complete_event) {
+ /* end of input detected, get recognition result and raise recognition complete event */
+ pocketsphinx_recognition_complete(recognizer,recognizer->complete_event);
+ }
+ }
+ while(recognizer->close_requested == FALSE);
-static apt_bool_t pocketsphinx_stream_destroy(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
+ /* check if recognition is still active */
+ if(recognizer->inprogress_recog) {
+ apr_thread_mutex_lock(recognizer->mutex);
+ recognizer->stop_response = recognizer->inprogress_recog;
+ apr_thread_cond_wait(recognizer->wait_object,recognizer->mutex);
+ apr_thread_mutex_unlock(recognizer->mutex);
+ if(recognizer->complete_event) {
+ pocketsphinx_recognition_complete(recognizer,recognizer->complete_event);
+ }
+ }
-static apt_bool_t pocketsphinx_stream_open(mpf_audio_stream_t *stream)
-{
- return TRUE;
+ /** Clear all the defined grammars */
+ pocketsphinx_grammars_clear(recognizer);
+
+ if(recognizer->decoder) {
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Free Decoder "APT_SIDRES_FMT, RECOGNIZER_SIDRES(recognizer));
+ /** Free pocketsphinx decoder */
+ ps_free(recognizer->decoder);
+ recognizer->decoder = NULL;
+ }
+
+ /** Exit thread */
+ apr_thread_exit(thread,APR_SUCCESS);
+ return NULL;
}
-static apt_bool_t pocketsphinx_stream_close(mpf_audio_stream_t *stream)
+
+
+/* Start of input (utterance) [MPF] */
+static apt_bool_t pocketsphinx_start_of_input(pocketsphinx_recognizer_t *recognizer)
{
+ /* create START-OF-INPUT event */
+ mrcp_message_t *message = mrcp_event_create(
+ recognizer->inprogress_recog,
+ RECOGNIZER_START_OF_INPUT,
+ recognizer->inprogress_recog->pool);
+ if(!message) {
+ return FALSE;
+ }
+
+ /* set request state */
+ message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
+ /* send asynch event */
+ return mrcp_engine_channel_message_send(recognizer->channel,message);
+}
+
+/* End of input (utterance) [MPF] */
+static apt_bool_t pocketsphinx_end_of_input(pocketsphinx_recognizer_t *recognizer, mrcp_recog_completion_cause_e cause)
+{
+ mrcp_recog_header_t *recog_header;
+ /* create RECOGNITION-COMPLETE event */
+ mrcp_message_t *message = mrcp_event_create(
+ recognizer->inprogress_recog,
+ RECOGNIZER_RECOGNITION_COMPLETE,
+ recognizer->inprogress_recog->pool);
+ if(!message) {
+ return FALSE;
+ }
+
+ /* get/allocate recognizer header */
+ recog_header = mrcp_resource_header_prepare(message);
+ if(recog_header) {
+ /* set completion cause */
+ recog_header->completion_cause = cause;
+ mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE);
+ }
+ /* set request state */
+ message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
+
+ /* signal recognition thread first */
+ apr_thread_mutex_lock(recognizer->mutex);
+ recognizer->complete_event = message;
+ apr_thread_cond_signal(recognizer->wait_object);
+ apr_thread_mutex_unlock(recognizer->mutex);
return TRUE;
}
+/* Process audio frame [MPF] */
static apt_bool_t pocketsphinx_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
{
+ pocketsphinx_recognizer_t *recognizer = stream->obj;
+
+ /* check whether recognition has been started and not completed yet */
+ if(recognizer->inprogress_recog && !recognizer->complete_event) {
+ mpf_detector_event_e det_event;
+
+ /* first check if STOP has been requested */
+ if(recognizer->stop_response) {
+ /* recognition has been stopped -> acknowledge with complete-event */
+ pocketsphinx_end_of_input(recognizer,RECOGNIZER_COMPLETION_CAUSE_SUCCESS);
+ return TRUE;
+ }
+
+ if(ps_process_raw(
+ recognizer->decoder,
+ (const int16 *)frame->codec_frame.buffer,
+ frame->codec_frame.size / sizeof(int16),
+ FALSE,
+ FALSE) < 0) {
+
+ apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Process Raw Data "APT_SIDRES_FMT,
+ RECOGNIZER_SIDRES(recognizer));
+ }
+
+ recognizer->partial_result_timeout += CODEC_FRAME_TIME_BASE;
+ if(recognizer->partial_result_timeout == recognizer->properties.partial_result_timeout) {
+ int32 score;
+ char const *hyp;
+ char const *uttid;
+
+ recognizer->partial_result_timeout = 0;
+ hyp = ps_get_hyp(recognizer->decoder, &score, &uttid);
+ if(hyp && strlen(hyp) > 0) {
+ if(recognizer->last_result == NULL || 0 != strcmp(recognizer->last_result, hyp)) {
+ recognizer->last_result = apr_pstrdup(recognizer->channel->pool,hyp);
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Recognition Partial Result [%s] Score [%d] "APT_SIDRES_FMT,
+ hyp,score,RECOGNIZER_SIDRES(recognizer));
+ }
+ }
+ }
+
+ if(recognizer->is_input_timer_on) {
+ recognizer->noinput_timeout += CODEC_FRAME_TIME_BASE;
+ if(recognizer->noinput_timeout == recognizer->properties.noinput_timeout) {
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Noinput Timeout Elapsed "APT_SIDRES_FMT,
+ RECOGNIZER_SIDRES(recognizer));
+ pocketsphinx_end_of_input(recognizer,RECOGNIZER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT);
+ return TRUE;
+ }
+ }
+
+ recognizer->recognition_timeout += CODEC_FRAME_TIME_BASE;
+ if(recognizer->recognition_timeout == recognizer->properties.recognition_timeout) {
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Recognition Timeout Elapsed "APT_SIDRES_FMT,
+ RECOGNIZER_SIDRES(recognizer));
+ pocketsphinx_end_of_input(recognizer,RECOGNIZER_COMPLETION_CAUSE_RECOGNITION_TIMEOUT);
+ return TRUE;
+ }
+
+ det_event = mpf_activity_detector_process(recognizer->detector,frame);
+ switch(det_event) {
+ case MPF_DETECTOR_EVENT_ACTIVITY:
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Activity "APT_SIDRES_FMT,
+ RECOGNIZER_SIDRES(recognizer));
+ pocketsphinx_start_of_input(recognizer);
+ break;
+ case MPF_DETECTOR_EVENT_INACTIVITY:
+ apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Inactivity "APT_SIDRES_FMT,
+ RECOGNIZER_SIDRES(recognizer));
+ pocketsphinx_end_of_input(recognizer,RECOGNIZER_COMPLETION_CAUSE_SUCCESS);
+ break;
+ default:
+ break;
+ }
+ }
+
return TRUE;
}
Modified: freeswitch/trunk/libs/unimrcp/unimrcp.sln
==============================================================================
--- freeswitch/trunk/libs/unimrcp/unimrcp.sln (original)
+++ freeswitch/trunk/libs/unimrcp/unimrcp.sln Fri Jun 26 15:18:39 2009
@@ -27,27 +27,27 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsignaling", "libs\mrcp-signaling\mrcpsignaling.vcproj", "{12A49562-BAB9-43A3-A21D-15B60BBB4C31}"
ProjectSection(ProjectDependencies) = postProject
- {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
{1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56}
+ {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpserver", "libs\mrcp-server\mrcpserver.vcproj", "{18B1F35A-10F8-4287-9B37-2D10501B0B38}"
ProjectSection(ProjectDependencies) = postProject
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}
+ {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpserver", "platforms\libunimrcp-server\libunimrcpserver.vcproj", "{C98AF157-352E-4737-BD30-A24E2647F5AE}"
ProjectSection(ProjectDependencies) = postProject
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {DEB01ACB-D65F-4A62-AED9-58C1054499E9}
- {18B1F35A-10F8-4287-9B37-2D10501B0B38} = {18B1F35A-10F8-4287-9B37-2D10501B0B38}
{746F3632-5BB2-4570-9453-31D6D58A7D8E} = {746F3632-5BB2-4570-9453-31D6D58A7D8E}
+ {18B1F35A-10F8-4287-9B37-2D10501B0B38} = {18B1F35A-10F8-4287-9B37-2D10501B0B38}
+ {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {DEB01ACB-D65F-4A62-AED9-58C1054499E9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsofiasip", "modules\mrcp-sofiasip\mrcpsofiasip.vcproj", "{746F3632-5BB2-4570-9453-31D6D58A7D8E}"
ProjectSection(ProjectDependencies) = postProject
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}
+ {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpclient", "libs\mrcp-client\mrcpclient.vcproj", "{72782932-37CC-46AE-8C7F-9A7B1A6EE108}"
@@ -57,9 +57,9 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpclient", "platforms\libunimrcp-client\libunimrcpclient.vcproj", "{EE157390-1E85-416C-946E-620E32C9AD33}"
ProjectSection(ProjectDependencies) = postProject
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {DEB01ACB-D65F-4A62-AED9-58C1054499E9}
- {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {746F3632-5BB2-4570-9453-31D6D58A7D8E}
{72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {72782932-37CC-46AE-8C7F-9A7B1A6EE108}
+ {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {746F3632-5BB2-4570-9453-31D6D58A7D8E}
+ {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {DEB01ACB-D65F-4A62-AED9-58C1054499E9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpclient", "platforms\unimrcp-client\unimrcpclient.vcproj", "{57FAF32E-49FD-491F-895D-132D0D5EFE0A}"
@@ -74,8 +74,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpengine", "libs\mrcp-engine\mrcpengine.vcproj", "{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}"
ProjectSection(ProjectDependencies) = postProject
- {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
{1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56}
+ {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demosynth", "plugins\demo-synth\demosynth.vcproj", "{92BFA534-C419-4EB2-AAA3-510653F38F08}"
@@ -127,8 +127,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpunirtsp", "modules\mrcp-unirtsp\mrcpunirtsp.vcproj", "{DEB01ACB-D65F-4A62-AED9-58C1054499E9}"
ProjectSection(ProjectDependencies) = postProject
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
{504B3154-7A4F-459D-9877-B951021C3F1F} = {504B3154-7A4F-459D-9877-B951021C3F1F}
+ {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "prepare", "build\tools\prepare.vcproj", "{01D63BF5-7798-4746-852A-4B45229BB735}"
@@ -138,6 +138,16 @@
{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcppocketsphinx", "plugins\mrcp-pocketsphinx\mrcppocketsphinx.vcproj", "{3C614AE8-B611-4D43-A9AF-1CAA440A9F69}"
+ ProjectSection(ProjectDependencies) = postProject
+ {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpflite", "plugins\mrcp-flite\mrcpflite.vcproj", "{56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556}"
+ ProjectSection(ProjectDependencies) = postProject
+ {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -238,6 +248,10 @@
{01D63BF5-7798-4746-852A-4B45229BB735}.Release|Win32.ActiveCfg = Release|Win32
{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Debug|Win32.ActiveCfg = Debug|Win32
{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Release|Win32.ActiveCfg = Release|Win32
+ {3C614AE8-B611-4D43-A9AF-1CAA440A9F69}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3C614AE8-B611-4D43-A9AF-1CAA440A9F69}.Release|Win32.ActiveCfg = Release|Win32
+ {56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556}.Debug|Win32.ActiveCfg = Debug|Win32
+ {56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556}.Release|Win32.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -261,6 +275,8 @@
{92BFA534-C419-4EB2-AAA3-510653F38F08} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
{B495B6D9-AF84-479D-B30A-313C16EF8BFD} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
{729EF28E-38C9-40DE-A138-87785F021411} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
+ {3C614AE8-B611-4D43-A9AF-1CAA440A9F69} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
+ {56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
{79EF9F1D-E211-4ED1-91D2-FC935AB3A872} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
{DCF01B1C-5268-44F3-9130-D647FABFB663} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
1
0
[commit] r13986 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua
by FreeSWITCH SVN 26 Jun '09
by FreeSWITCH SVN 26 Jun '09
26 Jun '09
Author: mikej
Date: Fri Jun 26 14:56:10 2009
New Revision: 13986
Log:
Thu Jun 25 12:34:42 CDT 2009 Pekka Pessi <first.last(a)nokia.com>
* nua_server.c: replying 200 OK to BYE left unreplied upon nua_handle_destroy
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Fri Jun 26 14:56:10 2009
@@ -1 +1 @@
-Fri Jun 26 14:53:27 CDT 2009
+Fri Jun 26 14:54:58 CDT 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c Fri Jun 26 14:56:10 2009
@@ -299,8 +299,12 @@
if (SR_HAS_SAVED_SIGNAL(sr))
nua_destroy_signal(sr->sr_signal);
- if (sr->sr_irq)
+ if (sr->sr_irq) {
+ if (sr->sr_method == sip_method_bye && sr->sr_status < 200) {
+ nta_incoming_treply(sr->sr_irq, SIP_200_OK, TAG_END());
+ }
nta_incoming_destroy(sr->sr_irq), sr->sr_irq = NULL;
+ }
if (sr->sr_request.msg)
msg_destroy(sr->sr_request.msg), sr->sr_request.msg = NULL;
1
0
[commit] r13985 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/tport
by FreeSWITCH SVN 26 Jun '09
by FreeSWITCH SVN 26 Jun '09
26 Jun '09
Author: mikej
Date: Fri Jun 26 14:54:39 2009
New Revision: 13985
Log:
Wed Jun 3 12:25:35 CDT 2009 Pekka Pessi <first.last(a)nokia.com>
* tport_type_tls.c: added field names to tport_vtable_t initialization
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Fri Jun 26 14:54:39 2009
@@ -1 +1 @@
-Thu Jun 25 13:46:21 CDT 2009
+Fri Jun 26 14:53:27 CDT 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c Fri Jun 26 14:54:39 2009
@@ -98,38 +98,52 @@
tport_vtable_t const tport_tls_vtable =
{
- "tls", tport_type_local,
- sizeof (tport_tls_primary_t),
- tport_tls_init_primary,
- tport_tls_deinit_primary,
- tport_tls_accept,
- tport_tls_connect,
- sizeof (tport_tls_t),
- tport_tls_init_secondary,
- tport_tls_deinit_secondary,
- tport_tls_shutdown,
- tport_tls_set_events,
- tport_tls_events,
- tport_tls_recv,
- tport_tls_send,
+ /* vtp_name */ "tls",
+ /* vtp_public */ tport_type_local,
+ /* vtp_pri_size */ sizeof (tport_tls_primary_t),
+ /* vtp_init_primary */ tport_tls_init_primary,
+ /* vtp_deinit_primary */ tport_tls_deinit_primary,
+ /* vtp_wakeup_pri */ tport_tls_accept,
+ /* vtp_connect */ tport_tls_connect,
+ /* vtp_secondary_size */ sizeof (tport_tls_t),
+ /* vtp_init_secondary */ tport_tls_init_secondary,
+ /* vtp_deinit_secondary */ tport_tls_deinit_secondary,
+ /* vtp_shutdown */ tport_tls_shutdown,
+ /* vtp_set_events */ tport_tls_set_events,
+ /* vtp_wakeup */ tport_tls_events,
+ /* vtp_recv */ tport_tls_recv,
+ /* vtp_send */ tport_tls_send,
+ /* vtp_deliver */ NULL,
+ /* vtp_prepare */ NULL,
+ /* vtp_keepalive */ NULL,
+ /* vtp_stun_response */ NULL,
+ /* vtp_next_secondary_timer*/ NULL,
+ /* vtp_secondary_timer */ NULL,
};
tport_vtable_t const tport_tls_client_vtable =
{
- "tls", tport_type_client,
- sizeof (tport_tls_primary_t),
- tport_tls_init_client,
- tport_tls_deinit_primary,
- tport_tls_accept,
- tport_tls_connect,
- sizeof (tport_tls_t),
- tport_tls_init_secondary,
- tport_tls_deinit_secondary,
- tport_tls_shutdown,
- tport_tls_set_events,
- tport_tls_events,
- tport_tls_recv,
- tport_tls_send,
+ /* vtp_name */ "tls",
+ /* vtp_public */ tport_type_client,
+ /* vtp_pri_size */ sizeof (tport_tls_primary_t),
+ /* vtp_init_primary */ tport_tls_init_client,
+ /* vtp_deinit_primary */ tport_tls_deinit_primary,
+ /* vtp_wakeup_pri */ tport_tls_accept,
+ /* vtp_connect */ tport_tls_connect,
+ /* vtp_secondary_size */ sizeof (tport_tls_t),
+ /* vtp_init_secondary */ tport_tls_init_secondary,
+ /* vtp_deinit_secondary */ tport_tls_deinit_secondary,
+ /* vtp_shutdown */ tport_tls_shutdown,
+ /* vtp_set_events */ tport_tls_set_events,
+ /* vtp_wakeup */ tport_tls_events,
+ /* vtp_recv */ tport_tls_recv,
+ /* vtp_send */ tport_tls_send,
+ /* vtp_deliver */ NULL,
+ /* vtp_prepare */ NULL,
+ /* vtp_keepalive */ NULL,
+ /* vtp_stun_response */ NULL,
+ /* vtp_next_secondary_timer*/ NULL,
+ /* vtp_secondary_timer */ NULL,
};
static int tport_tls_init_primary(tport_primary_t *pri,
1
0
Author: brian
Date: Fri Jun 26 14:27:21 2009
New Revision: 13984
Log:
you use this patch if you're using opal SVN tree...otherwise you use stable ptlib/opal releases.
Added:
freeswitch/trunk/patches/MODOPAL-10-svn.diff
Added: freeswitch/trunk/patches/MODOPAL-10-svn.diff
==============================================================================
--- (empty file)
+++ freeswitch/trunk/patches/MODOPAL-10-svn.diff Fri Jun 26 14:27:21 2009
@@ -0,0 +1,60 @@
+Index: src/mod/endpoints/mod_opal/mod_opal.cpp
+===================================================================
+--- src/mod/endpoints/mod_opal/mod_opal.cpp (revision 13502)
++++ src/mod/endpoints/mod_opal/mod_opal.cpp (working copy)
+@@ -509,7 +509,7 @@
+ }
+
+
+-OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userData)
++OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void * userData, unsigned options, OpalConnection::StringOptions * stringOptions)
+ {
+ FSManager & mgr = (FSManager &) GetManager();
+ switch_core_session_t *fsSession = switch_core_session_request(mgr.GetSwitchInterface(),
+@@ -524,7 +524,7 @@
+ return NULL;
+ }
+
+- return new FSConnection(call, *this, (switch_caller_profile_t *)userData, fsSession, fsChannel);
++ return new FSConnection(call, *this, (switch_caller_profile_t *)userData, fsSession, fsChannel, options, stringOptions);
+ }
+
+
+@@ -557,8 +557,8 @@
+ ///////////////////////////////////////////////////////////////////////
+
+
+-FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel)
+- : OpalLocalConnection(call, endpoint, NULL)
++FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel, unsigned options, OpalConnection::StringOptions * stringOptions)
++ : OpalLocalConnection(call, endpoint, NULL, options, stringOptions)
+ , m_endpoint(endpoint)
+ , m_fsSession(fsSession)
+ , m_fsChannel(fsChannel)
+Index: src/mod/endpoints/mod_opal/mod_opal.h
+===================================================================
+--- src/mod/endpoints/mod_opal/mod_opal.h (revision 13502)
++++ src/mod/endpoints/mod_opal/mod_opal.h (working copy)
+@@ -148,7 +148,10 @@
+ FSEndPoint(FSManager & manager);
+
+ virtual bool OnIncomingCall(OpalLocalConnection &);
+- virtual OpalLocalConnection *CreateConnection(OpalCall &, void *);
++ virtual OpalLocalConnection *CreateConnection(OpalCall & call,
++ void * userData,
++ unsigned options,
++ OpalConnection::StringOptions * stringOptions);
+ };
+
+
+@@ -181,7 +184,9 @@
+ FSEndPoint & endpoint,
+ switch_caller_profile_t *outbound_profile,
+ switch_core_session_t *fsSession,
+- switch_channel_t *fsChannel);
++ switch_channel_t *fsChannel,
++ unsigned options,
++ OpalConnection::StringOptions * stringOptions);
+
+ virtual bool OnIncoming();
+ virtual void OnReleased();
1
0
[commit] r13983 - freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/include
by FreeSWITCH SVN 26 Jun '09
by FreeSWITCH SVN 26 Jun '09
26 Jun '09
Author: raulfragoso
Date: Fri Jun 26 14:11:03 2009
New Revision: 13983
Log:
Moved K3L API includes one level up
Removed:
freeswitch/trunk/contrib/mod/endpoints/mod_khomp/commons/include/
1
0
Author: brian
Date: Fri Jun 26 14:08:17 2009
New Revision: 13982
Log:
FSCORE-374
Modified:
freeswitch/trunk/src/switch_console.c
Modified: freeswitch/trunk/src/switch_console.c
==============================================================================
--- freeswitch/trunk/src/switch_console.c (original)
+++ freeswitch/trunk/src/switch_console.c Fri Jun 26 14:08:17 2009
@@ -432,6 +432,7 @@
{
if (*prompt_str == '\0') {
gethostname(hostname, sizeof(hostname));
+ switch_core_set_variable("hostname", hostname);
switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
}
1
0