Merge remote branch 'fsorig/master'

Conflicts:
	src/mod/applications/mod_commands/mod_commands.c
	src/mod/endpoints/mod_portaudio/mod_portaudio.c
	src/mod/endpoints/mod_portaudio/pablio.c
This commit is contained in:
System Administrator committed 2011-05-26 00:13:12 -04:00
commit 7eaef23955
671 files changed
+140614 -18658

No files matched your search

+2
View File
@@ -10,8 +10,10 @@ DING_DIR=$(BASE)/libs/libdingaling
LOCAL_CFLAGS += -I$(DING_DIR)/src -I$(BASE)/libs/iksemel/include
LOCAL_OBJS=$(DING_DIR)/src/libdingaling.o $(DING_DIR)/src/sha1.o $(IKS_LA)
LOCAL_SOURCES=$(DING_DIR)/src/libdingaling.c $(DING_DIR)/src/sha1.c
LOCAL_LDFLAGS=$(LIBGNUTLS_LIBS)
include $(BASE)/build/modmake.rules
$(IKS_LA): $(IKS_DIR) $(IKS_DIR)/.update
@cd $(IKS_DIR) && $(MAKE)
@$(TOUCH_TARGET)
+25 -32
View File
@@ -65,19 +65,20 @@ typedef enum {
TFLAG_CODEC_READY = (1 << 8),
TFLAG_TRANSPORT = (1 << 9),
TFLAG_ANSWER = (1 << 10),
TFLAG_VAD_IN = (1 << 11),
TFLAG_VAD_OUT = (1 << 12),
TFLAG_VAD = (1 << 13),
TFLAG_DO_CAND = (1 << 14),
TFLAG_DO_DESC = (1 << 15),
TFLAG_LANADDR = (1 << 16),
TFLAG_AUTO = (1 << 17),
TFLAG_DTMF = (1 << 18),
TFLAG_TIMER = (1 << 19),
TFLAG_TERM = (1 << 20),
TFLAG_TRANSPORT_ACCEPT = (1 << 21),
TFLAG_READY = (1 << 22),
TFLAG_NAT_MAP = (1 << 22)
TFLAG_VAD_NONE = (1 << 11),
TFLAG_VAD_IN = (1 << 12),
TFLAG_VAD_OUT = (1 << 13),
TFLAG_VAD = (1 << 14),
TFLAG_DO_CAND = (1 << 15),
TFLAG_DO_DESC = (1 << 16),
TFLAG_LANADDR = (1 << 17),
TFLAG_AUTO = (1 << 18),
TFLAG_DTMF = (1 << 19),
TFLAG_TIMER = (1 << 20),
TFLAG_TERM = (1 << 21),
TFLAG_TRANSPORT_ACCEPT = (1 << 22),
TFLAG_READY = (1 << 23),
TFLAG_NAT_MAP = (1 << 24)
} TFLAGS;
typedef enum {
@@ -966,7 +967,7 @@ static int do_candidates(struct private_object *tech_pvt, int force)
if (force || !switch_test_flag(tech_pvt, TFLAG_RTP_READY)) {
ldl_candidate_t cand[1];
char *advip = tech_pvt->profile->extip ? tech_pvt->profile->extip : tech_pvt->profile->ip;
char *err = NULL;
char *err = NULL, *address = NULL;
memset(cand, 0, sizeof(cand));
switch_stun_random_string(tech_pvt->local_user, 16, NULL);
@@ -975,10 +976,14 @@ static int do_candidates(struct private_object *tech_pvt, int force)
if (switch_test_flag(tech_pvt, TFLAG_LANADDR)) {
advip = tech_pvt->profile->ip;
}
address = advip;
if(address && !strncasecmp(address, "host:", 5)) {
address = address + 5;
}
cand[0].port = tech_pvt->adv_local_port;
cand[0].address = advip;
cand[0].address = address;
if (!strncasecmp(advip, "stun:", 5)) {
char *stun_ip = advip + 5;
@@ -1394,7 +1399,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
{
struct private_object *tech_pvt = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
int payload = 0;
//int payload = 0;
tech_pvt = (struct private_object *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
@@ -1438,7 +1443,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
payload = tech_pvt->read_frame.payload;
//payload = tech_pvt->read_frame.payload;
#if 0
elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000);
@@ -1568,22 +1573,8 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
channel_answer_channel(session);
break;
case SWITCH_MESSAGE_INDICATE_BRIDGE:
/*
if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
//switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
}
*/
break;
case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
/*
if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
//switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
}
*/
break;
default:
break;
@@ -2110,8 +2101,10 @@ static void set_profile_val(mdl_profile_t *profile, char *var, char *val)
} else if (!strcasecmp(val, "both")) {
switch_set_flag(profile, TFLAG_VAD_IN);
switch_set_flag(profile, TFLAG_VAD_OUT);
} else if (!strcasecmp(val, "none")) {
switch_set_flag(profile, TFLAG_VAD_NONE);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invald option %s for VAD\n", val);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
}
}
}
+20 -3
View File
@@ -1,7 +1,24 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_gsmopen
TIFF_DIR=$(switch_srcdir)/libs/tiff-3.8.2
TIFF_BUILDDIR=$(switch_builddir)/libs/tiff-3.8.2
TIFF_LA=$(TIFF_BUILDDIR)/libtiff/libtiff.la
SPANDSP_DIR=$(switch_srcdir)/libs/spandsp
SPANDSP_BUILDDIR=$(switch_builddir)/libs/spandsp
SPANDSP_LA=$(SPANDSP_BUILDDIR)/src/libspandsp.la
mod_LTLIBRARIES = mod_gsmopen.la
mod_gsmopen_la_SOURCES = mod_gsmopen.cpp gsmopen_protocol.cpp
mod_gsmopen_la_CFLAGS = $(AM_CFLAGS) -DGSMOPEN_SVN_VERSION=\"`cat $(switch_builddir)/.version`\"
mod_gsmopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_gsmopen_la_LDFLAGS = -avoid-version -module -no-undefined -lasound -lgsmme -lspandsp
mod_gsmopen_la_CFLAGS = $(AM_CFLAGS) -I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff -I. -DGSMOPEN_SVN_VERSION=\"`cat $(switch_builddir)/.version`\"
mod_gsmopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA) $(TIFF_LA)
mod_gsmopen_la_LDFLAGS = -avoid-version -module -no-undefined -lasound -lgsmme
$(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update
cd $(SPANDSP_BUILDDIR) && $(MAKE) -j1
$(TOUCH_TARGET)
$(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update
cd $(TIFF_BUILDDIR) && $(MAKE) -j1
$(TOUCH_TARGET)
+1 -13
View File
@@ -1,13 +1 @@
faststart and codecs v CallProceeding due to h323plus, grep "Very Frustrating - S.H." in h323plus
source and uncomment commented lines.
exploration form developer of h323plus:
Yes that should be mera.
The problem is that Callproceeding does not always come from the remote it
may be generated by the gatekeeper. MERA where sending fast start elements
in the Call proceeding and connect. The call proceeding where not valid and
causing the media to fail. Normally (although valid) EP's do not set Fast
Start in Call proceeding so the code was disabled to resolve the MERA issue.
seems none for now
+3
View File
@@ -1,3 +1,6 @@
make sure dtmfinband gets initialized
make gk-identifier and gk-interface settings optional (documentation sayed that about gk-identifier already)
fix race condition on destroying signaling thread in h323 library
Adds an extra switch_rtp_destroy or switch_rtp_release_port when a session ends
- to make sure the port is returned to FS. thx to Peter Olsson.
fix issues with Progress message type if pre_answer enabled
+1 -1
View File
@@ -9,7 +9,7 @@
<!-- <param name="ptime-override-value" value="20"/> --> <!-- Override negotiated ptime value with this value -->
<param name="gk-address" value=""/> <!-- empty to disable, "*" to search LAN -->
<param name="gk-identifer" value=""/> <!-- optional name of gk -->
<param name="gk-interface" value=""/> <!-- mandatory listener interface name -->
<param name="gk-interface" value=""/> <!-- optional UDP listener interface (IP:port) -->
<param name="gk-retry" value="30"/> <!-- optional GK register retry timer -->
<param name="faststart" value="true"/> <!-- optional -->
<param name="h245tunneling" value="true"/> <!-- optional -->
+23 -7
View File
@@ -1,9 +1,12 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
* H323 endpoint interface for Freeswitch Modular Media Switching Software Library /
* Soft-Switch Application
*
* Version: MPL 1.1
*
* Copyright (c) 2010 Ilnitskiy Mixim (max.h323@gmail.com)
* Copyright (c) 2010 Georgiewskiy Yuriy (bottleman@icf.org.ru)
*
* 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
@@ -14,6 +17,12 @@
* for the specific language governing rights and limitations under the
* License.
*
* Contributor(s):
* Jan Willamowius.
*
*
*
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
@@ -24,7 +33,7 @@
*
* mod_h323.cpp -- H323 endpoint
*
* Version 0.0.56
* Version 0.0.57
*/
//#define DEBUG_RTP_PACKETS
@@ -215,6 +224,7 @@ class FSTrace : public ostream {
public:
Buffer()
{
// leave 2 chars room at end: 1 for overflow char and1 for \0
setg(buffer, buffer, &buffer[sizeof(buffer)-2]);
setp(buffer, &buffer[sizeof(buffer)-2]);
}
@@ -432,8 +442,8 @@ bool FSH323EndPoint::Initialise(switch_loadable_module_interface_t *iface)
}
}
if (!m_gkAddress.IsEmpty() && !m_gkIdentifer.IsEmpty() && !m_gkInterface.IsEmpty()) {
m_thread = new FSGkRegThread(this,&m_gkAddress,&m_gkIdentifer,&m_gkInterface,m_gkretry);
if (!m_gkAddress.IsEmpty()) {
m_thread = new FSGkRegThread(this, &m_gkAddress, &m_gkIdentifer, &m_gkInterface, m_gkretry);
m_thread->SetAutoDelete();
m_thread->Resume();
}
@@ -584,6 +594,7 @@ FSH323EndPoint::FSH323EndPoint()
:m_faststart(true)
,m_h245tunneling(true)
,m_h245insetup(true)
,m_dtmfinband(false)
,m_thread(NULL)
,m_stop_gk(false)
,m_fax_old_asn(false)
@@ -708,6 +719,7 @@ FSH323Connection::FSH323Connection(FSH323EndPoint& endpoint, H323Transport* tran
h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt));
tech_pvt->me = this;
tech_pvt->active_connection = true;
switch_core_session_set_private(m_fsSession, tech_pvt);
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession));
@@ -748,8 +760,9 @@ FSH323Connection::~FSH323Connection()
} else if (m_RTPlocalPort) {
switch_rtp_release_port((const char *)m_RTPlocalIP.AsString(), m_RTPlocalPort);
}
tech_pvt->me = NULL;
tech_pvt->active_connection = false;
// switch_mutex_unlock(tech_pvt->h323_mutex);
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
}
@@ -2387,6 +2400,9 @@ static switch_status_t on_hangup(switch_core_session_t *session)
switch_mutex_lock(tech_pvt->h323_mutex);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
switch_mutex_unlock(tech_pvt->h323_mutex);
while (tech_pvt->active_connection){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Wait clear h323 connection\n");
h_timer(1);
}
return SWITCH_STATUS_SUCCESS;
}
+13 -3
View File
@@ -1,9 +1,12 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
* H323 endpoint interface for Freeswitch Modular Media Switching Software Library /
* Soft-Switch Application
*
* Version: MPL 1.1
*
* Copyright (c) 2010 Ilnitskiy Mixim (max.h323@gmail.com)
* Copyright (c) 2010 Georgiewskiy Yuriy (bottleman@icf.org.ru)
*
* 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
@@ -14,6 +17,11 @@
* for the specific language governing rights and limitations under the
* License.
*
* Contributor(s):
*
*
*
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
@@ -24,7 +32,8 @@
*
* mod_h323.h -- H323 endpoint
*
*/
* Version 0.0.57
*/
#if defined(__GNUC__) && defined(HAVE_VISIBILITY)
#pragma GCC visibility push(default)
@@ -184,6 +193,7 @@ typedef struct {
switch_mutex_t *h323_io_mutex;
FSH323Connection *me;
bool active_connection;
char *token;
} h323_private_t;
+56 -33
View File
@@ -41,28 +41,25 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
###############################################################################
K3L_FILE="k3l_2.1_client.sh"
PARAM="0"
clean()
if [ "$1" ]
then
PARAM=$1
fi
help()
{
printf "$1"
exit 1
echo "Usage: getk3l.sh [OPTION]"
echo
echo " -h, --help print this help"
echo " -d, --download only download the k3l package withou doing the installation"
echo
}
if [ `whoami` != 'root' ]
then
clean "Need to be root\n"
fi
#if [ "w$FREESWITCH_PATH" == "w" ]
#then
# clean "FreeSWITCH source PATH is needed: \n\tSet \"FREESWITCH_PATH=\"\n"
#fi
if ! which 'kserver' &> /dev/null
then
echo "k3l will be installed"
K3L_FILE="k3l_2.1_client.sh"
download()
{
if [ "w`uname -m | grep x86_64`" == "w" ]
then
echo "Downloading i686 package"
@@ -71,23 +68,49 @@ then
echo "Downloading x86_64 package"
wget -t15 -c --progress=bar:force -O $K3L_FILE.gz http://www.khomp.com.br/binaries/softpbx/freeswitch/k3l_2.1_client_x86-64.sh.gz
fi
}
gunzip $K3L_FILE.gz
chmod 0755 $K3L_FILE
clean()
{
printf "$1"
exit 1
}
(./$K3L_FILE) || clean "Error on k3l install\n"
rm $K3L_FILE
fi
install()
{
if [ `whoami` != 'root' ]
then
clean "Need to be root to install !\n"
exit 1
fi
if [ "w`kserver --version | grep 2.1`" == "w" ]
if ! which 'kserver' &> /dev/null
then
download
gunzip $K3L_FILE.gz
chmod 0755 $K3L_FILE
(./$K3L_FILE) || clean "Error on k3l install\n"
rm $K3L_FILE
fi
}
if [ $PARAM == '--help' -o $PARAM == '-h' ]
then
clean "k3l version 2.1 must be installed: \n\tUninstall the old version of k3l and try again\n"
help
exit 0
elif [ $PARAM == '--download' -o $PARAM == '-d' ]
then
download
exit 0
else
echo "k3l will be installed"
install
if [ "w`kserver --version | grep 2.1`" == "w" ]
then
clean "k3l version 2.1 must be installed: \n\tUninstall the old version of k3l and try again\n"
exit 1
fi
echo "Successfully installed!"
fi
#make || clean "Error on compilation\n"
#make install || clean "Error on installation\n"
echo "Successfully installed!"
+29 -37
View File
@@ -48,7 +48,7 @@ typedef enum {
TFLAG_LINKED = (1 << 0),
TFLAG_OUTBOUND = (1 << 1),
TFLAG_WRITE = (1 << 2),
TFLAG_CNG = (1 << 3),
TFLAG_USEME = (1 << 3),
TFLAG_BRIDGE = (1 << 4),
TFLAG_BOWOUT = (1 << 5),
TFLAG_BLEG = (1 << 6),
@@ -158,7 +158,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
tech_pvt->cng_frame.data = tech_pvt->cng_databuf;
tech_pvt->cng_frame.buflen = sizeof(tech_pvt->cng_databuf);
//switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);
tech_pvt->cng_frame.datalen = 2;
tech_pvt->bowout_frame_count = (tech_pvt->read_codec.implementation->actual_samples_per_second /
@@ -297,12 +297,10 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
static void do_reset(private_t *tech_pvt)
{
switch_clear_flag_locked(tech_pvt, TFLAG_WRITE);
switch_set_flag_locked(tech_pvt, TFLAG_CNG);
switch_mutex_lock(tech_pvt->mutex);
if (tech_pvt->other_tech_pvt) {
switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_CNG);
}
switch_mutex_unlock(tech_pvt->mutex);
}
@@ -446,12 +444,6 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
switch (sig) {
case SWITCH_SIG_BREAK:
switch_set_flag_locked(tech_pvt, TFLAG_CNG);
switch_mutex_lock(tech_pvt->mutex);
if (tech_pvt->other_tech_pvt) {
switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_CNG);
}
switch_mutex_unlock(tech_pvt->mutex);
break;
case SWITCH_SIG_KILL:
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
@@ -583,18 +575,12 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
tech_pvt->write_frame->codec = &tech_pvt->read_codec;
*frame = tech_pvt->write_frame;
tech_pvt->packet_count++;
switch_clear_flag_locked(tech_pvt, TFLAG_CNG);
switch_clear_flag(tech_pvt->write_frame, SFF_CNG);
} else {
switch_set_flag(tech_pvt, TFLAG_CNG);
}
if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
*frame = &tech_pvt->cng_frame;
tech_pvt->cng_frame.codec = &tech_pvt->read_codec;
tech_pvt->cng_frame.datalen = tech_pvt->read_codec.implementation->decoded_bytes_per_packet;
switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);
switch_clear_flag_locked(tech_pvt, TFLAG_CNG);
}
@@ -613,6 +599,17 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
return status;
}
static void clear_queue(private_t *tech_pvt)
{
void *pop;
while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
switch_frame_t *frame = (switch_frame_t *) pop;
switch_frame_free(&frame);
}
}
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;
@@ -626,7 +623,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
switch_assert(tech_pvt != NULL);
if (switch_test_flag(frame, SFF_CNG) ||
switch_test_flag(tech_pvt, TFLAG_CNG) || (switch_test_flag(tech_pvt, TFLAG_BOWOUT) && switch_test_flag(tech_pvt, TFLAG_BOWOUT_USED))) {
(switch_test_flag(tech_pvt, TFLAG_BOWOUT) && switch_test_flag(tech_pvt, TFLAG_BOWOUT_USED))) {
switch_core_timer_sync(&tech_pvt->timer);
switch_core_timer_sync(&tech_pvt->other_tech_pvt->timer);
return SWITCH_STATUS_SUCCESS;
@@ -672,23 +669,27 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
if (switch_test_flag(tech_pvt, TFLAG_LINKED) && tech_pvt->other_tech_pvt) {
switch_frame_t *clone;
if (frame->codec->implementation != tech_pvt->write_codec.implementation) {
/* change codecs to match */
tech_init(tech_pvt, session, frame->codec);
tech_init(tech_pvt->other_tech_pvt, tech_pvt->other_session, frame->codec);
}
if (switch_queue_size(tech_pvt->other_tech_pvt->frame_queue) < FRAME_QUEUE_LEN) {
if (switch_frame_dup(frame, &clone) != SWITCH_STATUS_SUCCESS) {
abort();
}
if (switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone) != SWITCH_STATUS_SUCCESS) {
switch_frame_free(&clone);
}
if (switch_frame_dup(frame, &clone) != SWITCH_STATUS_SUCCESS) {
abort();
}
if ((status = switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone)) != SWITCH_STATUS_SUCCESS) {
clear_queue(tech_pvt->other_tech_pvt);
status = switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone);
}
if (status == SWITCH_STATUS_SUCCESS) {
switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
} else {
switch_frame_free(&clone);
}
status = SWITCH_STATUS_SUCCESS;
@@ -747,22 +748,13 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
{
void *pop;
done = 1;
while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
switch_frame_t *frame = (switch_frame_t *) pop;
switch_frame_free(&frame);
}
while (switch_queue_trypop(tech_pvt->other_tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
switch_frame_t *frame = (switch_frame_t *) pop;
switch_frame_free(&frame);
}
clear_queue(tech_pvt);
clear_queue(tech_pvt->other_tech_pvt);
switch_core_timer_sync(&tech_pvt->timer);
switch_core_timer_sync(&tech_pvt->other_tech_pvt->timer);
}
break;
default:
@@ -1769,14 +1769,14 @@ static switch_status_t load_config(void)
if (globals.outdev > -1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Switching to default output device\n");
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find an input device\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find an output device\n");
status = SWITCH_STATUS_GENERR;
}
}
if (globals.ringdev < 0) {
if (globals.outdev > -1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No ring device configured, using output device\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid or no ring device configured, using output device as ring device\n");
globals.ringdev = globals.outdev;
}
}
@@ -3107,7 +3107,7 @@ SWITCH_STANDARD_API(pa_cmd)
} else if (!strcmp(action, "call")) {
switch_snprintf(cmd_buf, sizeof(cmd_buf), "call %s", wcmd);
cmd = cmd_buf;
} else if (!strcmp(action, "hangup") || !strcmp(action, "list") || !strcmp(action, "answer")) {
} else if (!strcmp(action, "hangup") || !strcmp(action, "list") || !strcmp(action, "devlist") || !strcmp(action, "answer")) {
cmd = action;
}
}
@@ -3239,6 +3239,7 @@ SWITCH_STANDARD_API(pa_cmd)
"<input name=action type=submit value=\"unmute\"> "
"<input name=action type=submit value=\"indev\"> "
"<input name=action type=submit value=\"outdev\"> "
"<input name=action type=submit value=\"devlist\"> <br> "
"<input name=action type=submit value=\"preparestream\"> "
"<input name=action type=submit value=\"switchstream\"> "
"<input name=action type=submit value=\"closestreams\"> "
+20 -10
View File
@@ -58,7 +58,10 @@ static char devices_sql[] =
" type INTEGER,\n"
" max_streams INTEGER,\n"
" port INTEGER,\n"
" codec_string VARCHAR(255)\n"
" codec_string VARCHAR(255),\n"
" headset INTEGER,\n"
" handset INTEGER,\n"
" speaker INTEGER\n"
");\n";
static char lines_sql[] =
@@ -459,7 +462,6 @@ uint32_t skinny_line_get_state(listener_t *listener, uint32_t line_instance, uin
switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
{
int ms;
switch_status_t status = SWITCH_STATUS_SUCCESS;
int resetting = 0;
@@ -539,7 +541,7 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
}
tech_pvt->read_frame.rate = tech_pvt->rm_rate;
ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000;
//ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000;
if (!switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
@@ -877,7 +879,6 @@ switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_
{
switch_channel_t *channel = switch_core_session_get_channel(session);
private_t *tech_pvt = switch_core_session_get_private(session);
int payload = 0;
while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) {
if (switch_channel_ready(channel)) {
@@ -905,7 +906,7 @@ switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_
return SWITCH_STATUS_FALSE;
}
payload = tech_pvt->read_frame.payload;
//payload = tech_pvt->read_frame.payload;
if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
switch_dtmf_t dtmf = { 0 };
@@ -1317,6 +1318,9 @@ static int dump_device_callback(void *pArg, int argc, char **argv, char **column
char *max_streams = argv[5];
char *port = argv[6];
char *codec_string = argv[7];
char *headset = argv[8];
char *handset = argv[9];
char *speaker = argv[10];
const char *line = "=================================================================================================";
stream->write_function(stream, "%s\n", line);
@@ -1329,6 +1333,12 @@ static int dump_device_callback(void *pArg, int argc, char **argv, char **column
stream->write_function(stream, "MaxStreams \t%s\n", max_streams);
stream->write_function(stream, "Port \t%s\n", port);
stream->write_function(stream, "Codecs \t%s\n", codec_string);
stream->write_function(stream, "HeadsetId \t%s\n", headset);
stream->write_function(stream, "Headset \t%s\n", skinny_accessory_state2str(atoi(headset)));
stream->write_function(stream, "HandsetId \t%s\n", handset);
stream->write_function(stream, "Handset \t%s\n", skinny_accessory_state2str(atoi(handset)));
stream->write_function(stream, "SpeakerId \t%s\n", speaker);
stream->write_function(stream, "Speaker \t%s\n", skinny_accessory_state2str(atoi(speaker)));
stream->write_function(stream, "%s\n", line);
return 0;
@@ -1337,7 +1347,7 @@ static int dump_device_callback(void *pArg, int argc, char **argv, char **column
switch_status_t dump_device(skinny_profile_t *profile, const char *device_name, switch_stream_handle_t *stream)
{
char *sql;
if ((sql = switch_mprintf("SELECT name, user_id, instance, ip, type, max_streams, port, codec_string "
if ((sql = switch_mprintf("SELECT name, user_id, instance, ip, type, max_streams, port, codec_string, headset, handset, speaker "
"FROM skinny_devices WHERE name='%s'",
device_name))) {
skinny_execute_sql_callback(profile, profile->sql_mutex, sql, dump_device_callback, stream);
@@ -1916,10 +1926,10 @@ static switch_status_t load_skinny_config(void)
switch_odbc_handle_exec(profile->master_odbc, active_lines_sql, NULL, NULL);
} else {
if ((db = switch_core_db_open_file(profile->dbname))) {
switch_core_db_test_reactive(db, "SELECT * FROM skinny_devices", NULL, devices_sql);
switch_core_db_test_reactive(db, "SELECT * FROM skinny_lines", NULL, lines_sql);
switch_core_db_test_reactive(db, "SELECT * FROM skinny_buttons", NULL, buttons_sql);
switch_core_db_test_reactive(db, "SELECT * FROM skinny_active_lines", NULL, active_lines_sql);
switch_core_db_test_reactive(db, "SELECT headset FROM skinny_devices", "DROP TABLE skinny_devices", devices_sql);
switch_core_db_test_reactive(db, "SELECT * FROM skinny_lines", "DROP TABLE skinny_lines", lines_sql);
switch_core_db_test_reactive(db, "SELECT * FROM skinny_buttons", "DROP TABLE skinny_buttons", buttons_sql);
switch_core_db_test_reactive(db, "SELECT * FROM skinny_active_lines", "DROP TABLE skinny_active_lines", active_lines_sql);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n");
continue;
+31 -2
View File
@@ -178,7 +178,7 @@ struct PACKED soft_key_event_message {
/* HeadsetStatusMessage */
#define HEADSET_STATUS_MESSAGE 0x002B
struct PACKED headset_status_message {
uint32_t mode;
uint32_t mode; /* 1=HeadsetOn; 2=HeadsetOff */
};
/* RegisterAvailableLinesMessage */
@@ -234,6 +234,23 @@ struct PACKED extended_data_message {
#define DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE 0x0042
/* See struct PACKED extended_data_message */
/* DialedPhoneBookMessage */
#define DIALED_PHONE_BOOK_MESSAGE 0x0048
struct PACKED dialed_phone_book_message {
uint32_t number_index; /* must be shifted 4 bits right */
uint32_t line_instance;
uint32_t unknown;
char phone_number[256];
};
/* AccessoryStatusMessage */
#define ACCESSORY_STATUS_MESSAGE 0x0049
struct PACKED accessory_status_message {
uint32_t accessory_id;
uint32_t accessory_status;
uint32_t unknown;
};
/* RegisterAckMessage */
#define REGISTER_ACK_MESSAGE 0x0081
struct PACKED register_ack_message {
@@ -507,7 +524,7 @@ struct PACKED display_prompt_status_message {
};
/* ClearPromptStatusMessage */
#define CLEAR_PROMPT_STATUS_MESSAGE 0x0113
#define CLEAR_PROMPT_STATUS_MESSAGE 0x0113
struct PACKED clear_prompt_status_message {
uint32_t line_instance;
uint32_t call_id;
@@ -573,6 +590,15 @@ struct PACKED service_url_stat_res_message {
#define USER_TO_DEVICE_DATA_VERSION1_MESSAGE 0x013F
/* See struct PACKED extended_data_message */
/* DialedPhoneBookAckMessage */
#define DIALED_PHONE_BOOK_ACK_MESSAGE 0x0152
struct PACKED dialed_phone_book_ack_message {
uint32_t number_index; /* must be shifted 4 bits right */
uint32_t line_instance;
uint32_t unknown;
uint32_t unknown2;
};
/* XMLAlarmMessage */
#define XML_ALARM_MESSAGE 0x015A
@@ -614,6 +640,8 @@ union skinny_data {
struct feature_stat_req_message feature_req;
/* see field "extended_data" for DEVICE_TO_USER_DATA_VERSION1_MESSAGE */
/* see field "extended_data" for DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE */
struct dialed_phone_book_message dialed_phone_book;
struct accessory_status_message accessory_status;
struct register_ack_message reg_ack;
struct start_tone_message start_tone;
struct stop_tone_message stop_tone;
@@ -651,6 +679,7 @@ union skinny_data {
struct display_pri_notify_message display_pri_notify;
struct service_url_stat_res_message service_url_res;
/* see field "extended_data" for USER_TO_DEVICE_DATA_VERSION1_MESSAGE */
struct dialed_phone_book_ack_message dialed_phone_book_ack;
struct data_message data;
struct extended_data_message extended_data;
+80 -18
View File
@@ -588,14 +588,12 @@ switch_call_cause_t skinny_ring_lines(private_t *tech_pvt, switch_core_session_t
switch_status_t skinny_session_ring_out(switch_core_session_t *session, listener_t *listener, uint32_t line_instance)
{
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
switch_assert(session);
switch_assert(listener);
switch_assert(listener->profile);
channel = switch_core_session_get_channel(session);
tech_pvt = switch_core_session_get_private(session);
send_start_tone(listener, SKINNY_TONE_ALERT, 0, line_instance, tech_pvt->call_id);
@@ -732,14 +730,12 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste
switch_status_t skinny_session_hold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance)
{
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
switch_assert(session);
switch_assert(listener);
switch_assert(listener->profile);
channel = switch_core_session_get_channel(session);
tech_pvt = switch_core_session_get_private(session);
skinny_session_stop_media(session, listener, line_instance);
@@ -760,17 +756,15 @@ switch_status_t skinny_session_hold_line(switch_core_session_t *session, listene
switch_status_t skinny_session_unhold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance)
{
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
switch_assert(session);
switch_assert(listener);
switch_assert(listener->profile);
channel = switch_core_session_get_channel(session);
tech_pvt = switch_core_session_get_private(session);
skinny_hold_active_calls(listener);
skinny_hold_active_calls(listener);
send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id);
send_set_speaker_mode(listener, SKINNY_SPEAKER_ON);
send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_RING_OUT, 0xffff);
@@ -825,14 +819,12 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener
switch_status_t skinny_session_stop_media(switch_core_session_t *session, listener_t *listener, uint32_t line_instance)
{
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
switch_assert(session);
switch_assert(listener);
switch_assert(listener->profile);
channel = switch_core_session_get_channel(session);
tech_pvt = switch_core_session_get_private(session);
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
@@ -1773,7 +1765,6 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
uint32_t call_id = 0;
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
skinny_check_data_length(request, sizeof(request->data.soft_key_event.event));
@@ -1790,7 +1781,6 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
break;
case SOFTKEY_NEWCALL:
status = skinny_create_incoming_session(listener, &line_instance, &session);
tech_pvt = switch_core_session_get_private(session);
skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
break;
@@ -1874,13 +1864,10 @@ switch_status_t skinny_handle_unregister(listener_t *listener, skinny_message_t
switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, skinny_message_t *request)
{
skinny_message_t *message;
skinny_profile_t *profile;
switch_assert(listener->profile);
switch_assert(listener->device_name);
profile = listener->profile;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.soft_key_template));
message->type = SOFT_KEY_TEMPLATE_RES_MESSAGE;
message->length = 4 + sizeof(message->data.soft_key_template);
@@ -1900,9 +1887,20 @@ switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, sk
switch_status_t skinny_headset_status_message(listener_t *listener, skinny_message_t *request)
{
char *sql;
skinny_check_data_length(request, sizeof(request->data.headset_status));
/* Nothing to do */
if ((sql = switch_mprintf(
"UPDATE skinny_devices SET headset=%d WHERE name='%s' and instance=%d",
(request->data.headset_status.mode==1) ? SKINNY_ACCESSORY_STATE_OFFHOOK : SKINNY_ACCESSORY_STATE_ONHOOK,
listener->device_name,
listener->device_instance
))) {
skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
switch_safe_free(sql);
}
return SWITCH_STATUS_SUCCESS;
}
@@ -2012,6 +2010,66 @@ switch_status_t skinny_handle_extended_data_message(listener_t *listener, skinny
return SWITCH_STATUS_SUCCESS;
}
switch_status_t skinny_handle_dialed_phone_book_message(listener_t *listener, skinny_message_t *request)
{
skinny_message_t *message;
skinny_check_data_length(request, sizeof(request->data.dialed_phone_book));
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.dialed_phone_book_ack));
message->type = DIALED_PHONE_BOOK_ACK_MESSAGE;
message->length = 4 + sizeof(message->data.dialed_phone_book_ack);
message->data.dialed_phone_book_ack.number_index = request->data.dialed_phone_book.number_index;
message->data.dialed_phone_book_ack.line_instance = request->data.dialed_phone_book.line_instance;
message->data.dialed_phone_book_ack.unknown = request->data.dialed_phone_book.unknown;
message->data.dialed_phone_book_ack.unknown2 = 0;
return SWITCH_STATUS_SUCCESS;
}
switch_status_t skinny_handle_accessory_status_message(listener_t *listener, skinny_message_t *request)
{
char *sql;
skinny_check_data_length(request, sizeof(request->data.accessory_status));
switch(request->data.accessory_status.accessory_id) {
case SKINNY_ACCESSORY_HEADSET:
if ((sql = switch_mprintf(
"UPDATE skinny_devices SET headset=%d WHERE name='%s' and instance=%d",
request->data.accessory_status.accessory_status,
listener->device_name,
listener->device_instance
))) {
skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
switch_safe_free(sql);
}
break;
case SKINNY_ACCESSORY_HANDSET:
if ((sql = switch_mprintf(
"UPDATE skinny_devices SET handset=%d WHERE name='%s' and instance=%d",
request->data.accessory_status.accessory_status,
listener->device_name,
listener->device_instance
))) {
skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
switch_safe_free(sql);
}
break;
case SKINNY_ACCESSORY_SPEAKER:
if ((sql = switch_mprintf(
"UPDATE skinny_devices SET speaker=%d WHERE name='%s' and instance=%d",
request->data.accessory_status.accessory_status,
listener->device_name,
listener->device_instance
))) {
skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
switch_safe_free(sql);
}
break;
}
return SWITCH_STATUS_SUCCESS;
}
switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t *request)
{
@@ -2041,8 +2099,8 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
listener->device_name, listener->device_instance);
}
if(zstr(listener->device_name) && request->type != REGISTER_MESSAGE && request->type != ALARM_MESSAGE && request->type != XML_ALARM_MESSAGE) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Device should send a register message first.\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Device should send a register message first. Received %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length);
return SWITCH_STATUS_FALSE;
}
switch(request->type) {
@@ -2106,11 +2164,15 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
return skinny_handle_extended_data_message(listener, request);
case DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE:
return skinny_handle_extended_data_message(listener, request);
case DIALED_PHONE_BOOK_MESSAGE:
return skinny_handle_dialed_phone_book_message(listener, request);
case ACCESSORY_STATUS_MESSAGE:
return skinny_handle_accessory_status_message(listener, request);
case XML_ALARM_MESSAGE:
return skinny_handle_xml_alarm(listener, request);
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Unhandled request %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length);
"Unhandled %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length);
return SWITCH_STATUS_SUCCESS;
}
}
+186 -163
View File
@@ -35,223 +35,246 @@
/* Translation tables */
struct skinny_table SKINNY_MESSAGE_TYPES[] = {
{"KeepAliveMessage", KEEP_ALIVE_MESSAGE},
{"RegisterMessage", REGISTER_MESSAGE},
{"PortMessage", PORT_MESSAGE},
{"KeypadButtonMessage", KEYPAD_BUTTON_MESSAGE},
{"EnblocCallMessage", ENBLOC_CALL_MESSAGE},
{"StimulusMessage", STIMULUS_MESSAGE},
{"OffHookMessage", OFF_HOOK_MESSAGE},
{"OnHookMessage", ON_HOOK_MESSAGE},
{"ForwardStatReqMessage", FORWARD_STAT_REQ_MESSAGE},
{"SpeedDialStatReqMessage", SPEED_DIAL_STAT_REQ_MESSAGE},
{"LineStatReqMessage", LINE_STAT_REQ_MESSAGE},
{"ConfigStatReqMessage", CONFIG_STAT_REQ_MESSAGE},
{"TimeDateReqMessage", TIME_DATE_REQ_MESSAGE},
{"ButtonTemplateReqMessage", BUTTON_TEMPLATE_REQ_MESSAGE},
{"VersionReqMessage", VERSION_REQ_MESSAGE},
{"CapabilitiesReqMessage", CAPABILITIES_RES_MESSAGE},
{"AlarmMessage", ALARM_MESSAGE},
{"OpenReceiveChannelAckMessage", OPEN_RECEIVE_CHANNEL_ACK_MESSAGE},
{"SoftKeySetReqMessage", SOFT_KEY_SET_REQ_MESSAGE},
{"SoftKeyEventMessage", SOFT_KEY_EVENT_MESSAGE},
{"UnregisterMessage", UNREGISTER_MESSAGE},
{"SoftKeyTemplateReqMessage", SOFT_KEY_TEMPLATE_REQ_MESSAGE},
{"HeadsetStatusMessage", HEADSET_STATUS_MESSAGE},
{"RegisterAvailableLinesMessage", REGISTER_AVAILABLE_LINES_MESSAGE},
{"DeviceToUserDataMessage", DEVICE_TO_USER_DATA_MESSAGE},
{"DeviceToUserDataResponseMessage", DEVICE_TO_USER_DATA_RESPONSE_MESSAGE},
{"ServiceUrlStatReqMessage", SERVICE_URL_STAT_REQ_MESSAGE},
{"FeatureStatReqMessage", FEATURE_STAT_REQ_MESSAGE},
{"DeviceToUserDataVersion1Message", DEVICE_TO_USER_DATA_VERSION1_MESSAGE},
{"DeviceToUserDataResponseVersion1Message", DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE},
{"RegisterAckMessage", REGISTER_ACK_MESSAGE},
{"StartToneMessage", START_TONE_MESSAGE},
{"StopToneMessage", STOP_TONE_MESSAGE},
{"SetRingerMessage", SET_RINGER_MESSAGE},
{"SetLampMessage", SET_LAMP_MESSAGE},
{"SetSpeakerModeMessage", SET_SPEAKER_MODE_MESSAGE},
{"StartMediaTransmissionMessage", START_MEDIA_TRANSMISSION_MESSAGE},
{"StopMediaTransmissionMessage", STOP_MEDIA_TRANSMISSION_MESSAGE},
{"CallInfoMessage", CALL_INFO_MESSAGE},
{"ForwardStatMessage", FORWARD_STAT_MESSAGE},
{"SpeedDialStatResMessage", SPEED_DIAL_STAT_RES_MESSAGE},
{"LineStatResMessage", LINE_STAT_RES_MESSAGE},
{"ConfigStatResMessage", CONFIG_STAT_RES_MESSAGE},
{"DefineTimeDateMessage", DEFINE_TIME_DATE_MESSAGE},
{"ButtonTemplateResMessage", BUTTON_TEMPLATE_RES_MESSAGE},
{"VersionMessage", VERSION_MESSAGE},
{"CapabilitiesReqMessage", CAPABILITIES_REQ_MESSAGE},
{"RegisterRejectMessage", REGISTER_REJECT_MESSAGE},
{"ResetMessage", RESET_MESSAGE},
{"KeepAliveAckMessage", KEEP_ALIVE_ACK_MESSAGE},
{"OpenReceiveChannelMessage", OPEN_RECEIVE_CHANNEL_MESSAGE},
{"CloseReceiveChannelMessage", CLOSE_RECEIVE_CHANNEL_MESSAGE},
{"SoftKeyTemplateResMessage", SOFT_KEY_TEMPLATE_RES_MESSAGE},
{"SoftKeySetResMessage", SOFT_KEY_SET_RES_MESSAGE},
{"SelectSoftKeysMessage", SELECT_SOFT_KEYS_MESSAGE},
{"CallStateMessage", CALL_STATE_MESSAGE},
{"DisplayPromptStatusMessage", DISPLAY_PROMPT_STATUS_MESSAGE},
{"ClearPromptStatusMessage", CLEAR_PROMPT_STATUS_MESSAGE},
{"ActivateCallPlaneMessage", ACTIVATE_CALL_PLANE_MESSAGE},
{"UnregisterAckMessage", UNREGISTER_ACK_MESSAGE},
{"BackSpaceReqMessage", BACK_SPACE_REQ_MESSAGE},
{"DialedNumberMessage", DIALED_NUMBER_MESSAGE},
{"UserToDeviceDataMessage", USER_TO_DEVICE_DATA_MESSAGE},
{"FeatureResMessage", FEATURE_STAT_RES_MESSAGE},
{"DisplayPriNotifyMessage", DISPLAY_PRI_NOTIFY_MESSAGE},
{"ServiceUrlStatMessage", SERVICE_URL_STAT_RES_MESSAGE},
{"UserToDeviceDataVersion1Message", USER_TO_DEVICE_DATA_VERSION1_MESSAGE},
{"XMLAlarmMessage", XML_ALARM_MESSAGE},
{NULL, 0}
{KEEP_ALIVE_MESSAGE, "KeepAliveMessage"},
{REGISTER_MESSAGE, "RegisterMessage"},
{PORT_MESSAGE, "PortMessage"},
{KEYPAD_BUTTON_MESSAGE, "KeypadButtonMessage"},
{ENBLOC_CALL_MESSAGE, "EnblocCallMessage"},
{STIMULUS_MESSAGE, "StimulusMessage"},
{OFF_HOOK_MESSAGE, "OffHookMessage"},
{ON_HOOK_MESSAGE, "OnHookMessage"},
{ FORWARD_STAT_REQ_MESSAGE, "ForwardStatReqMessage"},
{SPEED_DIAL_STAT_REQ_MESSAGE, "SpeedDialStatReqMessage"},
{LINE_STAT_REQ_MESSAGE, "LineStatReqMessage"},
{CONFIG_STAT_REQ_MESSAGE, "ConfigStatReqMessage"},
{TIME_DATE_REQ_MESSAGE, "TimeDateReqMessage"},
{BUTTON_TEMPLATE_REQ_MESSAGE, "ButtonTemplateReqMessage"},
{VERSION_REQ_MESSAGE, "VersionReqMessage"},
{CAPABILITIES_RES_MESSAGE, "CapabilitiesReqMessage"},
{ALARM_MESSAGE, "AlarmMessage"},
{OPEN_RECEIVE_CHANNEL_ACK_MESSAGE, "OpenReceiveChannelAckMessage"},
{SOFT_KEY_SET_REQ_MESSAGE, "SoftKeySetReqMessage"},
{SOFT_KEY_EVENT_MESSAGE, "SoftKeyEventMessage"},
{UNREGISTER_MESSAGE, "UnregisterMessage"},
{SOFT_KEY_TEMPLATE_REQ_MESSAGE, "SoftKeyTemplateReqMessage"},
{HEADSET_STATUS_MESSAGE, "HeadsetStatusMessage"},
{REGISTER_AVAILABLE_LINES_MESSAGE, "RegisterAvailableLinesMessage"},
{DEVICE_TO_USER_DATA_MESSAGE, "DeviceToUserDataMessage"},
{DEVICE_TO_USER_DATA_RESPONSE_MESSAGE, "DeviceToUserDataResponseMessage"},
{SERVICE_URL_STAT_REQ_MESSAGE, "ServiceUrlStatReqMessage"},
{FEATURE_STAT_REQ_MESSAGE, "FeatureStatReqMessage"},
{DEVICE_TO_USER_DATA_VERSION1_MESSAGE, "DeviceToUserDataVersion1Message"},
{DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE, "DeviceToUserDataResponseVersion1Message"},
{DIALED_PHONE_BOOK_MESSAGE, "DialedPhoneBookMessage"},
{ACCESSORY_STATUS_MESSAGE, "AccessoryStatusMessage"},
{REGISTER_ACK_MESSAGE, "RegisterAckMessage"},
{START_TONE_MESSAGE, "StartToneMessage"},
{STOP_TONE_MESSAGE, "StopToneMessage"},
{SET_RINGER_MESSAGE, "SetRingerMessage"},
{SET_LAMP_MESSAGE, "SetLampMessage"},
{SET_SPEAKER_MODE_MESSAGE, "SetSpeakerModeMessage"},
{START_MEDIA_TRANSMISSION_MESSAGE, "StartMediaTransmissionMessage"},
{STOP_MEDIA_TRANSMISSION_MESSAGE, "StopMediaTransmissionMessage"},
{CALL_INFO_MESSAGE, "CallInfoMessage"},
{FORWARD_STAT_MESSAGE, "ForwardStatMessage"},
{SPEED_DIAL_STAT_RES_MESSAGE, "SpeedDialStatResMessage"},
{LINE_STAT_RES_MESSAGE, "LineStatResMessage"},
{CONFIG_STAT_RES_MESSAGE, "ConfigStatResMessage"},
{DEFINE_TIME_DATE_MESSAGE, "DefineTimeDateMessage"},
{BUTTON_TEMPLATE_RES_MESSAGE, "ButtonTemplateResMessage"},
{VERSION_MESSAGE, "VersionMessage"},
{CAPABILITIES_REQ_MESSAGE, "CapabilitiesReqMessage"},
{REGISTER_REJECT_MESSAGE, "RegisterRejectMessage"},
{RESET_MESSAGE, "ResetMessage"},
{KEEP_ALIVE_ACK_MESSAGE, "KeepAliveAckMessage"},
{OPEN_RECEIVE_CHANNEL_MESSAGE, "OpenReceiveChannelMessage"},
{CLOSE_RECEIVE_CHANNEL_MESSAGE, "CloseReceiveChannelMessage"},
{SOFT_KEY_TEMPLATE_RES_MESSAGE, "SoftKeyTemplateResMessage"},
{SOFT_KEY_SET_RES_MESSAGE, "SoftKeySetResMessage"},
{SELECT_SOFT_KEYS_MESSAGE, "SelectSoftKeysMessage"},
{CALL_STATE_MESSAGE, "CallStateMessage"},
{DISPLAY_PROMPT_STATUS_MESSAGE, "DisplayPromptStatusMessage"},
{CLEAR_PROMPT_STATUS_MESSAGE, "ClearPromptStatusMessage"},
{ACTIVATE_CALL_PLANE_MESSAGE, "ActivateCallPlaneMessage"},
{UNREGISTER_ACK_MESSAGE, "UnregisterAckMessage"},
{BACK_SPACE_REQ_MESSAGE, "BackSpaceReqMessage"},
{DIALED_NUMBER_MESSAGE, "DialedNumberMessage"},
{USER_TO_DEVICE_DATA_MESSAGE, "UserToDeviceDataMessage"},
{FEATURE_STAT_RES_MESSAGE, "FeatureResMessage"},
{DISPLAY_PRI_NOTIFY_MESSAGE, "DisplayPriNotifyMessage"},
{SERVICE_URL_STAT_RES_MESSAGE, "ServiceUrlStatMessage"},
{USER_TO_DEVICE_DATA_VERSION1_MESSAGE, "UserToDeviceDataVersion1Message"},
{DIALED_PHONE_BOOK_ACK_MESSAGE, "DialedPhoneBookAckMessage"},
{XML_ALARM_MESSAGE, "XMLAlarmMessage"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage")
SKINNY_DECLARE_STR2ID(skinny_str2message_type, SKINNY_MESSAGE_TYPES, -1)
struct skinny_table SKINNY_DEVICE_TYPES[] = {
{"Cisco 30 SP+", 1},
{"Cisco 12 SP+", 2},
{"Cisco 12 SP", 3},
{"Cisco 12", 4},
{"Cisco 30 VIP", 5},
{"Cisco IP Phone 7910", 6},
{"Cisco IP Phone 7960", 7},
{"Cisco IP Phone 7940", 8},
{"Cisco IP Phone 7935", 9},
{"Cisco ATA 186", 12},
{"Cisco IP Phone CP-7962G", 404},
{"Cisco IP Phone CP-7965G", 436},
{"Cisco IP Phone CP-7961G", 30018},
{"Cisco IP Phone 7936", 30019},
{NULL, 0}
{1, "Cisco 30 SP+"},
{2, "Cisco 12 SP+"},
{3, "Cisco 12 SP"},
{4, "Cisco 12"},
{5, "Cisco 30 VIP"},
{6, "Cisco IP Phone 7910"},
{7, "Cisco IP Phone 7960"},
{8, "Cisco IP Phone 7940"},
{9, "Cisco IP Phone 7935"},
{12, "Cisco ATA 186"},
{365, "Cisco IP Phone CP-7921G"},
{404, "Cisco IP Phone CP-7962G"},
{436, "Cisco IP Phone CP-7965G"},
{30018, "Cisco IP Phone CP-7961G"},
{30019, "Cisco IP Phone 7936"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType")
SKINNY_DECLARE_STR2ID(skinny_str2device_type, SKINNY_DEVICE_TYPES, -1)
struct skinny_table SKINNY_RING_TYPES[] = {
{"RingOff", SKINNY_RING_OFF},
{"RingInside", SKINNY_RING_INSIDE},
{"RingOutside", SKINNY_RING_OUTSIDE},
{"RingFeature", SKINNY_RING_FEATURE},
{NULL, 0}
{SKINNY_RING_OFF, "RingOff"},
{SKINNY_RING_INSIDE, "RingInside"},
{SKINNY_RING_OUTSIDE, "RingOutside"},
{SKINNY_RING_FEATURE, "RingFeature"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, "RingTypeUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2ring_type, SKINNY_RING_TYPES, -1)
struct skinny_table SKINNY_RING_MODES[] = {
{"RingForever", SKINNY_RING_FOREVER},
{"RingOnce", SKINNY_RING_ONCE},
{NULL, 0}
{SKINNY_RING_FOREVER, "RingForever"},
{SKINNY_RING_ONCE, "RingOnce"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, "RingModeUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1)
struct skinny_table SKINNY_BUTTONS[] = {
{"Unknown", SKINNY_BUTTON_UNKNOWN},
{"LastNumberRedial", SKINNY_BUTTON_LAST_NUMBER_REDIAL},
{"SpeedDial", SKINNY_BUTTON_SPEED_DIAL},
{"Hold", SKINNY_BUTTON_HOLD},
{"Transfer", SKINNY_BUTTON_TRANSFER},
{"Line", SKINNY_BUTTON_LINE},
{"Voicemail", SKINNY_BUTTON_VOICEMAIL},
{"Privacy", SKINNY_BUTTON_PRIVACY},
{"ServiceUrl", SKINNY_BUTTON_SERVICE_URL},
{"Undefined", SKINNY_BUTTON_UNDEFINED},
{NULL, 0}
{SKINNY_BUTTON_UNKNOWN, "Unknown"},
{SKINNY_BUTTON_LAST_NUMBER_REDIAL, "LastNumberRedial"},
{SKINNY_BUTTON_SPEED_DIAL, "SpeedDial"},
{SKINNY_BUTTON_HOLD, "Hold"},
{SKINNY_BUTTON_TRANSFER, "Transfer"},
{SKINNY_BUTTON_LINE, "Line"},
{SKINNY_BUTTON_VOICEMAIL, "Voicemail"},
{SKINNY_BUTTON_PRIVACY, "Privacy"},
{SKINNY_BUTTON_SERVICE_URL, "ServiceUrl"},
{SKINNY_BUTTON_UNDEFINED, "Undefined"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown")
SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1)
struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = {
{"SoftkeyRedial", SOFTKEY_REDIAL},
{"SoftkeyNewcall", SOFTKEY_NEWCALL},
{"SoftkeyHold", SOFTKEY_HOLD},
{"SoftkeyTransfer", SOFTKEY_TRANSFER},
{"SoftkeyCfwdall", SOFTKEY_CFWDALL},
{"SoftkeyCfwdbusy", SOFTKEY_CFWDBUSY},
{"SoftkeyCfwdnoanswer", SOFTKEY_CFWDNOANSWER},
{"SoftkeyBackspace", SOFTKEY_BACKSPACE},
{"SoftkeyEndcall", SOFTKEY_ENDCALL},
{"SoftkeyResume", SOFTKEY_RESUME},
{"SoftkeyAnswer", SOFTKEY_ANSWER },
{"SoftkeyInfo", SOFTKEY_INFO},
{"SoftkeyConfrm", SOFTKEY_CONFRM},
{"SoftkeyPark", SOFTKEY_PARK},
{"SoftkeyJoin", SOFTKEY_JOIN},
{"SoftkeyMeetmeconfrm", SOFTKEY_MEETMECONFRM},
{"SoftkeyCallpickup", SOFTKEY_CALLPICKUP},
{"SoftkeyGrpcallpickup", SOFTKEY_GRPCALLPICKUP},
{"SoftkeyDnd", SOFTKEY_DND},
{"SoftkeyIdivert", SOFTKEY_IDIVERT},
{NULL, 0}
{SOFTKEY_REDIAL, "SoftkeyRedial"},
{SOFTKEY_NEWCALL, "SoftkeyNewcall"},
{SOFTKEY_HOLD, "SoftkeyHold"},
{SOFTKEY_TRANSFER, "SoftkeyTransfer"},
{SOFTKEY_CFWDALL, "SoftkeyCfwdall"},
{SOFTKEY_CFWDBUSY, "SoftkeyCfwdbusy"},
{SOFTKEY_CFWDNOANSWER, "SoftkeyCfwdnoanswer"},
{SOFTKEY_BACKSPACE, "SoftkeyBackspace"},
{SOFTKEY_ENDCALL, "SoftkeyEndcall"},
{SOFTKEY_RESUME, "SoftkeyResume"},
{SOFTKEY_ANSWER , "SoftkeyAnswer"},
{SOFTKEY_INFO, "SoftkeyInfo"},
{SOFTKEY_CONFRM, "SoftkeyConfrm"},
{SOFTKEY_PARK, "SoftkeyPark"},
{SOFTKEY_JOIN, "SoftkeyJoin"},
{SOFTKEY_MEETMECONFRM, "SoftkeyMeetmeconfrm"},
{SOFTKEY_CALLPICKUP, "SoftkeyCallpickup"},
{SOFTKEY_GRPCALLPICKUP, "SoftkeyGrpcallpickup"},
{SOFTKEY_DND, "SoftkeyDnd"},
{SOFTKEY_IDIVERT, "SoftkeyIdivert"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, 0)
struct skinny_table SKINNY_LAMP_MODES[] = {
{"Off", SKINNY_LAMP_OFF},
{"On", SKINNY_LAMP_ON},
{"Wink", SKINNY_LAMP_WINK},
{"Flash", SKINNY_LAMP_FLASH},
{"Blink", SKINNY_LAMP_BLINK},
{NULL, 0}
{SKINNY_LAMP_OFF, "Off"},
{SKINNY_LAMP_ON, "On"},
{SKINNY_LAMP_WINK, "Wink"},
{SKINNY_LAMP_FLASH, "Flash"},
{SKINNY_LAMP_BLINK, "Blink"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, "Unknown")
SKINNY_DECLARE_STR2ID(skinny_str2lamp_mode, SKINNY_LAMP_MODES, -1)
struct skinny_table SKINNY_SPEAKER_MODES[] = {
{"SpeakerOn", SKINNY_SPEAKER_ON},
{"SpeakerOff", SKINNY_SPEAKER_OFF},
{NULL, 0}
{SKINNY_SPEAKER_ON, "SpeakerOn"},
{SKINNY_SPEAKER_OFF, "SpeakerOff"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, "Unknown")
SKINNY_DECLARE_STR2ID(skinny_str2speaker_mode, SKINNY_SPEAKER_MODES, -1)
struct skinny_table SKINNY_KEY_SETS[] = {
{"KeySetOnHook", SKINNY_KEY_SET_ON_HOOK},
{"KeySetConnected", SKINNY_KEY_SET_CONNECTED},
{"KeySetOnHold", SKINNY_KEY_SET_ON_HOLD},
{"KeySetRingIn", SKINNY_KEY_SET_RING_IN},
{"KeySetOffHook", SKINNY_KEY_SET_OFF_HOOK},
{"KeySetConnectedWithTransfer", SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER},
{"KeySetDigitsAfterDialingFirstDigit", SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT},
{"KeySetConnectedWithConference", SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE},
{"KeySetRingOut", SKINNY_KEY_SET_RING_OUT},
{"KeySetOffHookWithFeatures", SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES},
{"KeySetInUseHint", SKINNY_KEY_SET_IN_USE_HINT},
{NULL, 0}
{SKINNY_KEY_SET_ON_HOOK, "KeySetOnHook"},
{SKINNY_KEY_SET_CONNECTED, "KeySetConnected"},
{SKINNY_KEY_SET_ON_HOLD, "KeySetOnHold"},
{SKINNY_KEY_SET_RING_IN, "KeySetRingIn"},
{SKINNY_KEY_SET_OFF_HOOK, "KeySetOffHook"},
{SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER, "KeySetConnectedWithTransfer"},
{SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, "KeySetDigitsAfterDialingFirstDigit"},
{SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE, "KeySetConnectedWithConference"},
{SKINNY_KEY_SET_RING_OUT, "KeySetRingOut"},
{SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES, "KeySetOffHookWithFeatures"},
{SKINNY_KEY_SET_IN_USE_HINT, "KeySetInUseHint"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, "UNKNOWN_SOFT_KEY_SET")
SKINNY_DECLARE_STR2ID(skinny_str2soft_key_set, SKINNY_KEY_SETS, -1)
struct skinny_table SKINNY_CALL_STATES[] = {
{"OffHook", SKINNY_OFF_HOOK},
{"OnHook", SKINNY_ON_HOOK},
{"RingOut", SKINNY_RING_OUT},
{"RingIn", SKINNY_RING_IN},
{"Connected", SKINNY_CONNECTED},
{"Busy", SKINNY_BUSY},
{"LineInUse", SKINNY_LINE_IN_USE},
{"Hold", SKINNY_HOLD},
{"CallWaiting", SKINNY_CALL_WAITING},
{"CallTransfer", SKINNY_CALL_TRANSFER},
{"CallPark", SKINNY_CALL_PARK},
{"Proceed", SKINNY_PROCEED},
{"InUseRemotely", SKINNY_IN_USE_REMOTELY},
{"InvalidNumber", SKINNY_INVALID_NUMBER},
{NULL, 0}
{SKINNY_OFF_HOOK, "OffHook"},
{SKINNY_ON_HOOK, "OnHook"},
{SKINNY_RING_OUT, "RingOut"},
{SKINNY_RING_IN, "RingIn"},
{SKINNY_CONNECTED, "Connected"},
{SKINNY_BUSY, "Busy"},
{SKINNY_LINE_IN_USE, "LineInUse"},
{SKINNY_HOLD, "Hold"},
{SKINNY_CALL_WAITING, "CallWaiting"},
{SKINNY_CALL_TRANSFER, "CallTransfer"},
{SKINNY_CALL_PARK, "CallPark"},
{SKINNY_PROCEED, "Proceed"},
{SKINNY_IN_USE_REMOTELY, "InUseRemotely"},
{SKINNY_INVALID_NUMBER, "InvalidNumber"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, "CallStateUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2call_state, SKINNY_CALL_STATES, -1)
struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = {
{"DeviceReset", SKINNY_DEVICE_RESET},
{"DeviceRestart", SKINNY_DEVICE_RESTART},
{NULL, 0}
{SKINNY_DEVICE_RESET, "DeviceReset"},
{SKINNY_DEVICE_RESTART, "DeviceRestart"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2device_reset_type, SKINNY_DEVICE_RESET_TYPES, -1)
struct skinny_table SKINNY_ACCESSORY_TYPES[] = {
{SKINNY_ACCESSORY_NONE, "AccessoryNone"},
{SKINNY_ACCESSORY_HEADSET, "Headset"},
{SKINNY_ACCESSORY_HANDSET, "Handset"},
{SKINNY_ACCESSORY_SPEAKER, "Speaker"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_accessory_type2str, SKINNY_ACCESSORY_TYPES, "AccessoryUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2accessory_type, SKINNY_ACCESSORY_TYPES, -1)
struct skinny_table SKINNY_ACCESSORY_STATES[] = {
{SKINNY_ACCESSORY_STATE_NONE, "AccessoryNoState"},
{SKINNY_ACCESSORY_STATE_OFFHOOK, "OffHook"},
{SKINNY_ACCESSORY_STATE_ONHOOK, "OnHook"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_accessory_state2str, SKINNY_ACCESSORY_STATES, "AccessoryStateUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2accessory_state, SKINNY_ACCESSORY_STATES, -1)
/* For Emacs:
* Local Variables:
* mode:c
+24 -3
View File
@@ -36,8 +36,8 @@
/* SKINNY TABLES */
/*****************************************************************************/
struct skinny_table {
const char *name;
uint32_t id;
const char *name;
};
#define SKINNY_DECLARE_ID2STR(func, TABLE, DEFAULT_STR) \
@@ -87,12 +87,12 @@ uint32_t func(const char *str)\
}
extern struct skinny_table SKINNY_MESSAGE_TYPES[69];
extern struct skinny_table SKINNY_MESSAGE_TYPES[72];
const char *skinny_message_type2str(uint32_t id);
uint32_t skinny_str2message_type(const char *str);
#define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES)
extern struct skinny_table SKINNY_DEVICE_TYPES[15];
extern struct skinny_table SKINNY_DEVICE_TYPES[16];
const char *skinny_device_type2str(uint32_t id);
uint32_t skinny_str2device_type(const char *str);
#define SKINNY_PUSH_DEVICE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_DEVICE_TYPES)
@@ -248,6 +248,27 @@ const char *skinny_device_reset_type2str(uint32_t id);
uint32_t skinny_str2device_reset_type(const char *str);
#define SKINNY_PUSH_DEVICE_RESET_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_DEVICE_RESET_TYPES)
enum skinny_accessory_types {
SKINNY_ACCESSORY_NONE = 0x00,
SKINNY_ACCESSORY_HEADSET = 0x01,
SKINNY_ACCESSORY_HANDSET = 0x02,
SKINNY_ACCESSORY_SPEAKER = 0x03
};
extern struct skinny_table SKINNY_ACCESSORY_TYPES[5];
const char *skinny_accessory_type2str(uint32_t id);
uint32_t skinny_str2accessory_type(const char *str);
#define SKINNY_PUSH_ACCESSORY_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_ACCESSORY_TYPES)
enum skinny_accessory_states {
SKINNY_ACCESSORY_STATE_NONE = 0x00,
SKINNY_ACCESSORY_STATE_OFFHOOK = 0x01,
SKINNY_ACCESSORY_STATE_ONHOOK = 0x02
};
extern struct skinny_table SKINNY_ACCESSORY_STATES[4];
const char *skinny_accessory_state2str(uint32_t id);
uint32_t skinny_str2accessory_state(const char *str);
#define SKINNY_PUSH_ACCESSORY_STATES SKINNY_DECLARE_PUSH_MATCH(SKINNY_ACCESSORY_STATES)
#endif /* _SKINNY_TABLES_H */
/* For Emacs:
+20 -3
View File
@@ -1,7 +1,24 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_skypopen
TIFF_DIR=$(switch_srcdir)/libs/tiff-3.8.2
TIFF_BUILDDIR=$(switch_builddir)/libs/tiff-3.8.2
TIFF_LA=$(TIFF_BUILDDIR)/libtiff/libtiff.la
SPANDSP_DIR=$(switch_srcdir)/libs/spandsp
SPANDSP_BUILDDIR=$(switch_builddir)/libs/spandsp
SPANDSP_LA=$(SPANDSP_BUILDDIR)/src/libspandsp.la
mod_LTLIBRARIES = mod_skypopen.la
mod_skypopen_la_SOURCES = mod_skypopen.c skypopen_protocol.c
mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -DSKYPOPEN_C_VER=\"`git log -1 --format="%h" skypopen_protocol.c`\" -DMODSKYPOPEN_C_VER=\"`git log -1 --format="%h" mod_skypopen.c`\" -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff
mod_skypopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_skypopen_la_LDFLAGS = -L../../../../libs/spandsp/src -avoid-version -module -no-undefined -shared -lX11 -lspandsp
mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff -I. -DSKYPOPEN_C_VER=\"`git log -1 --format="%h" skypopen_protocol.c`\" -DMODSKYPOPEN_C_VER=\"`git log -1 --format="%h" mod_skypopen.c`\"
mod_skypopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA) $(TIFF_LA)
mod_skypopen_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lX11
$(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update
cd $(SPANDSP_BUILDDIR) && $(MAKE) -j1
$(TOUCH_TARGET)
$(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update
cd $(TIFF_BUILDDIR) && $(MAKE) -j1
$(TOUCH_TARGET)
@@ -1 +0,0 @@
./dummy.c
@@ -0,0 +1,99 @@
<?xml version="1.0"?>
<config version="1.0" serial="3885" timestamp="1303333464.70">
<Lib>
<BCM>
<_2>00001000A563932E7DE5A581942041A820F8437512A079C7ACB1B73281F191D109521E265BCD38C4133596B834AD9AA1D6BB5E1AC3D59E8675785321F722D39FBFAFB9A24E6482FA3030FFA3692D2C4A53BBCE9DC63F25D10207A20FA969982FEDC1DCC2A7C599071F4735E52AB2E06E34CA232C08B3AA2FB88A0C4A5763E0CD23C3AA37D1D2A7D6EED691EE99BA08BE294F68C24F9AE777DAF294F0AEB8346325A978DC6CF7C210AD11EF3F38111F6D98F388CF41CCBA40ABE9F0D6CBBD3118BA0588344953DF3C5E88B2CCAEDE2E692F320D20EBF16D7DB36156E617C0CC9FB2855D7FDB4C7F8638CC9830E7448D5EAE301A2810277062989841EE679E00E4E277615FEC038DE3A0A20DD7C6A2A00DFBC6A2A00DA6E2B6F404FDC6A2A00DFEC6A2A00DF7FBBB990CF2C6A2A00D8EB4FE8A0C8FB4FE8A0C95C7A6E00CF5FBBB990CD6C7A6E00CD0F896950CCCE2B6F40485CCA2A00DA1D8EEA50DFDFBBB990CA7C7A6E00CA8C7A6E00CA9C7A6E00C97C7A6E00C90B4FE8A0CFE90D59308C290D59308D1E2B6F404C5E2B6F404C6AAF18705C7AAF18705C8AAF18705BBD8EEA50DBCD8EEA50DBDD8EEA50D93CCA2A00D94CCA2A00DEFE2B6F40491B4FE8A0CE2FBBB990CE3FBBB990CBED8EEA50DA0CCA2A00DA1CCA2A00DA6B4FE8A0CA7B4FE8A0CCED8EEA50DA3CCA2A00DA4CCA2A00D84E698AD0DB8C7A6E00CD9E2B6F404E0E2B6F40486E698AD0DFDF896950C0013A60400173D0018DE0200190300AB01F40300449875044518C15F9A278109D4BBAC4E8109D408A6238109D5A63304810904460CC15F9A26303ED408A624303E0047B054004801004980A305004A80E90F004BE0A801004C80A305004D01005CAC02045E5A50FC55465BA050FC55475BA050FC55485BA0C32EFDEE5BA0C32EFDEF5BA0C2A5BC4A5BA0C2A5BC4B5BA0D4BBAC055BA0D4BBAC145BA0D4BBAC215BA0D408A3575BA0D408A37D5BA0D408A37E5BA08275487E5BA0827548425BA00060B817046506CC09A3D6303E04AE018C0125F8D500021A25F9D500011A162102200301220125FFD50025FAD5000C03E4000D2580D6000F060125F8D5000302172105050103080D06010501011C210302060125FCD50025F9D5000A25FDD50025FED5000A0D06020502050119211305020380808080100C05010D0380808080100B25FDD5000C01080005000380808080100D060307010503220101220104AC01BF012597CE002597CE002590CE0019152590CE002597CE000B033C1815210220030122012593CE0014212E2594CE002103030B220125A5CE00030F172103030B22012596CE00142103030B22012597CE00142103030B22012599CE00142103030A220125A5CE00030A1A2590CE002592CE000B031E1B15142103030A220125A4CE000380201D14210303092201259BCE0014210A2594CE002103030B2201259DCE00142103030822012593CE002103012201259ECE001421030306220103022201006800006901006A01006C987504740CC2A5BC4C303ED408A34C303E007828047912CC09A3D3303E82754864303E4E8DB16F303E047DBF010203020800050003020D0B0601030308000500020501030508000500021A03060800050003041A16030508000500021D160C0A0C060203D00F251205020A03020D0A050103D00F0C0A0603010800050003FFFFFFFF0F18030208000500021D141506042512020800050003030D05040C10030205040B0C06050306050505020A0C060603040800050003050800050003E400180C0607050703E400250A0B250A011C0C0A0314100608050303C03E0F03B8171005060388270F03DC0B100508047E5E0380010304080005000B03040D250403E4000F03140D0A2503250203030D0A0B0110060101080005000380020D0302080005000380020D172103010601250A03E4001B210D0501030A03E400250A210303DF002002250A0B0D0F0601050100800180EA49008101E003036F3139352E34362E3235332E3235333A313233353000038201706F6F6C313D2A2E6C6976657461622E736B7970653B706F6F6C323D7765622E6578747261732E736B7970653B706F6F6C333D6578747261732E646F776E6C6F6164732E736B7970653B706F6F6C343D2A2E736B79706566696E642E736B7970653B706F6F6C353D2A2E7072656D69756D2E736B7970653B706F6F6C363D2A2E6D756C74696D656469612E736B7970653B706F6F6C373D2A2E6D756C74696D656469612E6D657461636166653B706F6F6C383D2A2E6D756C74696D656469612E6461696C796D6F74696F6E3B706F6F6C393D2A2E6D756C74696D656469612E6D6574616F6D6E69747572653B706F6F6C31303D77686174736E65772E736B7970653B706F6F6C31313D7061792E736B7970653B706F6F6C31323D7365637572652E7061792E736B7970653B706F6F6C31333D2A2E70696373746F72653B706F6F6C31343D2A2E6D796163636F756E742E736B7970653B706F6F6C31353D2A2E62696269743B706F6F6C31363D2A2E70726F6363796265723B706F6F6C31373D747261636B696E672E6F6D6E69747572653B706F6F6C31383D676F2E736B7970653B706F6F6C31393D747261636B2E736B7970657C706F6F6C313D3139342E3139322E3139392E3235313A31323335303B706F6F6C323D3139342E3139322E3139392E3235323A31323335303B706F6F6C333D3139342E3139322E3139392E3235323A31323335303B706F6F6C343D3139342E3136352E3138382E3130313A31323335303B706F6F6C353D3139332E39352E3135342E31353A31323335313B706F6F6C363D3139342E3136352E3138382E3130303A31323335303B706F6F6C373D3139342E3136352E3138382E3130303A31323335303B706F6F6C383D3139342E3136352E3138382E3130303A31323335303B706F6F6C393D3139342E3136352E3138382E3130303A31323335303B706F6F6C31303D3230342E392E3136332E3134313A31323335303B706F6F6C31313D3139352E34362E3235332E3234353A31323335303B706F6F6C31323D3139352E34362E3235332E3234353A31323335303B706F6F6C31333D3139332E39352E3135342E31343A31323335313B706F6F6C31343D3139332E39352E3135342E31343A31323335313B706F6F6C31353D3139332E39352E3135342E31343A31323335313B706F6F6C31363D3139332E39352E3135342E31343A31323335313B706F6F6C31373D3139342E3136352E3138382E3130303A31323335303B706F6F6C31383D3139342E3136352E3138382E3130303A31323335303B706F6F6C31393D3139332E39352E3135342E31343A31323335310003B101706F6F6C313D2A2E6C6976657461622E736B7970653B706F6F6C323D7765622E6578747261732E736B797065206578747261732E646F776E6C6F6164732E736B7970653B706F6F6C333D2A2Line truncated
<_256>000010011AC0AA3BA66DF7FB48228AE35F9BB4A032FE4A6A898DA7A1A5AE37DC59FB3D09607F1CACD46A5DBC008DABF8F09C797DF5A8903307D04C318825CEA7C481303C655A9EEE099E9A0AF1158373B458BB8FDACB336A6EC63C043E6782688E2350B417DDDDFF96B474DAEA7D1DF3742303B79111FC752BFB5D6887A5B822F945CC761FAF6E80DE5EC60868768CB8A9F9C876137806DCEA0DD1300181558ABFDBA26592078F5F84195C526D8C7F339EF82700FD93F8FB71ADA5ED3E977D27FA52D1F489EF5DA0A9E00B146BADCBDEBFB0DFEBCD61E5B8352A49893357E0DC3A736743929DA975782EA4D8184605FD064641986C47706D264281C876F926BF58003E9E</_256>
<_3>0000100498ECF8A7A4585F76C930739A1EAE590DE96D9EF3AA9B231E67965F3F08ECFC493E1DA23ECDE17A85C94CBE034E88F9414E9BBC82F32AAFCFFB2C09F6F57A478238BAEC9EEF2BB9C67F71257722E6786D88D6400F6B7D81450FB3B6CCCC3986E3782D2387E354EBA9099331AEF510D479C6601D2383D866E2B5B525DF0BA975D58C120EFAE88C89EE365FC696CC891B77F67CFA18FDE8E95DDAC25A7C7D70FA7A1414BAE593856A658888C622836006C1C131B4B2E805554DCFA52F3EFD34C1B759BF8A302E491835DCE701E84D37ED150C8ADD699AD3DCA9F515123C5B5AD94E253E173BA3465E64A0079D5EF4E6075E66D0F5FBC3D9BC25C4E80C4CB2FE9B87040003000004D00F0005D00F050041040400B80125C20003141B14230025D50003031B14230024E100142300250003191714230025EA0003141714230025EA00011724EA00140A14230025E400030F1C14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025E10025E10003A006100A0309031725000325180C0A25C20003140B0C03040D0A03882725C3000C0A03E43225C4000C0A0602050228038407DC08FA1E0601050102050203FA1E1C0603250028061D1E1F202122060105010205010503050141060300636F756E74206279207175616C697479000001CC080002040003000004010005010501410603006261647175616C69747920636F756E742062792076657273696F6E000001D6080002070003000004010005010501410603006261647175616C6974792073756D2062792076657273696F6E000001E0080002070003000004010005010500410304005424E400142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025E40025E40028043CB401D804901C060105010205014106030073756D206F66206C61737463616C6C206475726174696F6E73000001B009000201000300000480A3050005B054050141060300636F756E74206279206C61737463616C6C206475726174696F6E000001BA090002050003000004010005010500410204005025EB00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EB0028031E32D0000601050102050141060300636F756E742062792073797374656D20637075207573616765000001940A0002040003000004010005010500410204004F25EC00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EC0028030F1E320601050102050141060300636F756E742062792070726F63657373206370752075736167650000019E0A0002040003000004010005010500410304006824C20014230024E60014230025E600011A14230025EC00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EC0028030F1E320601050102050125C2000501410603006A6974746572636F756E742062792070726F6365737320637075207573616765000001F80A0002040003000004010005010501410603006A69747465722062792070726F6365737320637075207573616765000001820B0002040003000004D00F0005D00F0500410304004424E700142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A1423000225E700050141060300706F74656E7469616C207463702066616C6C6261636B73000001DC0B00020100030000040100050105014106030061637475616C207463702066616C6C6261636B73000001E60B00020100030000040100050105004103040056240C142300250C030A1814230025EA0003141714230025EA00011724EA00140A14230024E70014230025E700011A14230024E50014230025E500011C0602250C29050306070809280401020405060105010205010502050141060300636F756E74206279206E617474797065000001C00C0002050003000004010005010501410603007564706661696C75726573206279206E617474797065000001CA0C0002050003000004010005010500410204001B25D90014230025D90025DA000B0602050228030102040601050102050141060300636F756E74206279206E726F666D756C74696368617473000001A40D0002040003000004010005010500410304001425F700011C14230025000319171423000225F90005014106030075736572732077686F206861766520636F6D706C65746564204943000001880E0002010003000004010005010501410603006C617374204943207969656C6420676C6F62616C73756D000001920E0002010003000004E8070005500500410304001224F60014230025000319171423000225F60005014106030075736572732077686F206861766520494320737570706F7274000001EC0E0002010003000004010005010501410603004943207374617274757020636F756E7420676C6F62616C73756D000001F60E00020100030000046400051405004102040025240C142300250C030A18142300250C011C142300250C280802030405060708090601050102050141060300636F756E74206279206E617474797065000001D00F0002090003000004010005010500410404001A250003191714230025E20025E30025FC00280201020601050102050141060300766964656F2073656E642063617061626C650000019811000201000300000401000501050141060300766964656F20706172616C6C656C2063616C6C730000019911000201000300000414000502050141060300636F756E7420627920766964656F2063616C6C73206D616465000001A2110002030003000004010005010500410204003A250003191714230025EA0003141714230025EA00011724EA00140A14230024E50014230025E50003031914230025E50028030102030601050102050141060300636F756E742062792073747265616D7472616E73706F7274000001FC11000204000300000401000501050041090400E00125C20003141B25E400030F1C1514230024E100142300250003191714230025EA0003141725EA0001171514230025FF002580010A011A14230025E60003031A25E50003031A1514230024F5001423002412142300249F0114230025C30025E10025E10003A006100A03A0060B0309031725000325180C0A25C20003140B0C03040D0A2512030A0C251025F5001703CC080C0A1C160602020502250003231B241D150603050305020503150503251D03808080808Line truncated
<_4>000010052A0B6759B71FBC1EF05BE97DFEA4EE6C1E15AF19ED70DEC1130B14C13CE41246D302B9662592907E3CA508A57702B5C00C2A05170857FA22012E0F235B425B4D919B23A541D3AD6E948FC634DE71A29493634884DFD5E9D89C5D951CBCD71B9B3ABFD3C4E2779BB1817D76E7C223CA36BD75A6A05B730AF138057E4048B2FFDD522BB588EC0B9D3E014BF9E354EB608150BC613C739D9E8C7465F05F047FAF7AFA3EE89B9B58BF0FC35F07B55CF3E4B59A7C4ED48B1C0C7F0305E6AC2E80AAEAD6064EB6ACDC1806FCE0B5CB66F0840DA7F0FE7B228E3898E3E42A9AFEFE13DDF019EF8D8F02A631AF2615BBC6E1EDB65C89A775F642C88109E6247EC4B463DC302E2A2E323000050541020006020307322E302E2A2E3100050541030006020307322E302E2A2E3200000AE4ED8009050541030006020307322E302E2A2E33000009B3E6CC990B050541040006020307322E302E2A2E3400000AE4ED8009000BA00B050541030006020308322E302E2A2E35000307322E302E2A2E3900050541040006020308322E302E2A2E39000307322E302E2A2E313100000AE4ED8009050541040006020308322E302E2A2E3131000307322E302E2A2E3135000009E6CC99B306050541050006020308322E302E2A2E3135000307322E302E2A2E323000000AE4ED8009000BA00B050041050303557067726164655465737433000301332E302E302E3130300003044E6963654272616E6400050541040006020307332E302E302E2A0003074E6963654272616E6400000AE4ED8009050541040006020307322E302E302E2A0003074E6963654272616E6400000AE4ED80090500410E0303557067726164655465737433000301332E302E302E31303000050541040006020307332E302E302E39390003074F746865724272616E6400000AE4ED8009050541040006020307322E302E302E39390003074F746865724272616E6400000AE4ED8009050541040006020307332E302E302E39380003074F746865724272616E64000009B3E6CC990B050541040006020307322E302E302E39380003074F746865724272616E64000009B3E6CC990B050541050006020307332E302E302E39370003074F746865724272616E6400000AE4ED8009000BA00B050541050006020307322E302E302E39370003074F746865724272616E6400000AE4ED8009000BA00B050541030006020307332E302E302E393900000AE4ED8009050541030006020307322E302E302E393900000AE4ED8009050541030006020307332E302E302E3938000009B3E6CC990B050541030006020307322E302E302E3938000009B3E6CC990B050541040006020307332E302E302E393700000AE4ED8009000BA00B050541040006020307322E302E302E393700000AE4ED8009000BA00B0500410303033130303031000301302E302E302E313000050541020006020307302E302E302E3900</_4>
<_5>00001006739CA527EF827847E16F23CD52458C3EBA3460A42935EC6948BEFA626B49E3BDF279FC62486E2DDBCA19609ED23D31F4E5175920F282AD74A74A997C3909E67B622480C68A058E886C7D5F3C40954880D7798CD61CEA0FBAFB389BE5B2B8A887348F7AADB4DF642B194B814047CDA0E698EDDE61DFA731DCA5883A76F913D8C94066718054E85ADA7AE009F2B2A9AF762FDCB9B6CAF64C156911E3AB172CFD795F66FB6E8E15048A54E4AB17979D6C447DEBADE75CC6F606050D980061112AFF9AE7C7BF8065D711949E41FA4C8B6CBF0916BB395B3E186A7D617D353C6BFFC687FE79475DFA095D113D70B828FB597BC3665B7C9C3669CA9CBE5D308D3FC23803044E45544745415200050541020006040307302E392E302E2A000500410503033130303033000301312E302E302E3137000304534D4300050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E312E302E313000030442454C4B494E00050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E302E302E3137000304454447452D434F524500050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E302E302E31330003044C4F474954454300050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303035000301312E342E38382E31333636000304544F50434F4D00050541020006040307312E342E38382E3133353600050541020006020307312E342E38382E31333635000500410503033130303035000301312E342E38382E313336360003045043484F4D4500050541020006040307312E342E38382E3133353600050541020006020307312E342E38382E31333635000500410403033130303036000301302E302E302E313000050541020006040307302E302E302E3500050541020006020307302E302E302E39000500410503033130303037000301312E302E312E330003045445434F00050541020006040307312E302E302E3800050541020006020307312E302E312E31000500410503033130303038000301302E392E332E3339370003044C494E4B53595300050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410503033130303038000301302E392E332E3339370003044E45544745415200050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410503033130303038000301302E392E332E3339370003045048494C49505300050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410403033130303130000301302E392E302E31310003044C494E4B53595300050541020006040307302E392E302E3130000500410403033130303130000301302E392E302E313100030442554646414C4F00050541020006040307302E392E302E3130000500410503033130303132000301312E302E302E310003044353544E00050541020006040307302E302E302E3500050541020006020307302E302E302E39000500410503033130303133000301302E302E332E3234000304414B00050541020006040307302E302E312E323400050541020006020307302E302E322E3234000500410303033130303134000301312E372E34332E33382E3200050541020006040307312E372E32332E32372E34000500410503033130303135000301312E322E31372E30000304415A5445434800050541020006040307312E322E31312E3000050541020006020307312E322E31352E30000500410303033130303230000301312E302E302E343700050541030006020308312E302E302E3233000307312E302E302E3233000500410403033130303234000301332E322E302E323800050541030006040308332E302E302E35000307332E302E302E3500050541030006020308332E312E302E31000307332E322E302E38000500410503033130303232000301302E302E302E3900030450414E41534F4E494300050541020006040307302E302E302E3100050541020006020307302E302E302E38000500410503033130303232000301302E302E302E3900030450414E41534F4E4943434F4E53554D455200050541020006040307302E302E302E3100050541020006020307302E302E302E3800</_5>
</BCM>
<BackboneInited>1</BackboneInited>
<Chat>
<FriendlyNameMaxSize>400</FriendlyNameMaxSize>
</Chat>
<Connection>
<Bandwidth>
<CurSlotLength>8118</CurSlotLength>
<InHistory>39,64,8184</InHistory>
<OutHistory>37,50,13164</OutHistory>
</Bandwidth>
<DisablePort80>1</DisablePort80>
<EventServers>
<DirectlyConnected>1</DirectlyConnected>
</EventServers>
<Firewall>
<TcpInHistory>-1431699456</TcpInHistory>
<UdpInHistory>-1431699456</UdpInHistory>
<UdpOutHistory>1610612735</UdpOutHistory>
</Firewall>
<HostCache>41C801050041050200D9AF0D45D9E900010400028788BCED0400038788BCED04000400050041050200BB0AB3FDD1A40001040002B7DCBCED040003B7DCBCED040004000500410502005C3766C2DA6B00010400029FB2BCED0400039FB2BCED04000400050041050200D9F8DC20CA33000104000296DAAAED04000396DAAAED0400040005004105020063847B3765900001040002D794BDED040003D794BDED040004000500410502004E80142FD3C70001040002CF86BDED040003CF86BDED04000400050041050200C3B213EA24A50001040002BF89BBED040003BF89BBED040004000500410502006FFEF1BA804C0001040002CF86BDED040003CF86BDED0400040005004105020052ED923CB3A700010400028788BCED0400038788BCED040004000500410502005243330D305B000104000283FFB2ED04000383FFB2ED040004000500410502006FF9438E9E5D0001040002CF86BDED040003CF86BDED04000400050041050200585515F19D77000104000283FFB2ED04000383FFB2ED04000400050041050200729EE3A8DD460001040002CF86BDED040003CF86BDED040004000500410502004572795D3BB300010400029FB2BCED0400039FB2BCED040004000500410502009F94D72CABA40001040002CF86BDED040003CF86BDED0400040005004105020095052D9C81090001040002B7DCBCED040003B7DCBCED040004000500410502005859A15FD7FC0001040002DC8FB5ED040003DC8FB5ED0400040005004105020059D7AB3EBBFB0001020002F8FABCED040003CF86BDED04000400050041050200BB2481B9390E0001040002CF86BDED040003CF86BDED0400040005004105020059D7F395A7BA0001040002B7DCBCED040003B7DCBCED040004000500410502006DC4BEF5D52E0001040002B0DFBAED040003B0DFBAED040004000500410502004B6E709CF4290001040002B7DCBCED040003B7DCBCED040004000500410502007A7D5CEC2B8D0001040002CF86BDED040003CF86BDED040004000500410502006FFFA8AFB19D0001040002B7DCBCED040003B7DCBCED040004000500410502003E4475A07A6F0001040002B7DCBCED040003B7DCBCED040004000500410502003EDD8384A4F90001040002BF89BBED040003BF89BBED04000400050041050200560FBFA4E4900001040002B7DCBCED040003B7DCBCED04000400050041050200C24FAEEE43F10001040002B3CEB5ED040003B3CEB5ED040004000500410502004F378778C6F30001040002CF86BDED040003CF86BDED04000400050041050200C94418BB0EDF0001040002B7DCBCED040003B7DCBCED040004000500410502003B75A58BECB30001040002CF86BDED040003CF86BDED04000400050041050200772A7A0908890001040002CF86BDED040003CF86BDED0400040005004105020048BB63586DE100010400029088BCED0400039088BCED040004000500410502005544F881BEDA000104000283FFB2ED04000383FFB2ED040004000500410502005B4C1468EDF80001040002B7DCBCED040003B7DCBCED04000400050041050200538BAF3F934F0001040002B3CEB5ED040003B3CEB5ED0400040005004105020055D6F93A4FD70001040002D7B3BBED040003D7B3BBED04000400050041050200D5D64561E55F00010400028788BCED0400038788BCED0400040005004105020046ADF229B8570001040002CF86BDED040003CF86BDED04000400050041050200D5151C19FFD600010200029FB2BCED040003B7DCBCED04000400050041050200973CA35DB82400010400029FB2BCED0400039FB2BCED04000400050041050200C249E5B953700001040002CF86BDED040003CF86BDED04000400050041050200722C69D8C4F500010400029FB2BCED0400039FB2BCED0400040005004105020058CBB311F2400001040002DC8FB5ED040003DC8FB5ED040004000500410502004BB7A090766E0001040002CF86BDED040003CF86BDED040004000500410502007DEF80FBEBD90001040002EFDDBBED040003EFDDBBED0400040005004105020076A03698F87A0001040002CF86BDED040003CF86BDED0400040005004105020050E5DFDD0C700001040002CF86BDED040003CF86BDED040004000500410502004D4C85E0CEC80001040002CF86BDED040003CF86BDED040004000500410502006FEA6BCD92A10001020002F8FABCED040003CF86BDED0400040005004105020043BAA930F28600010400029FB2BCED0400039FB2BCED04000400050041050200722DB82DDB780001040002CF86BDED040003CF86BDED0400040005004105020052E995118B9F0001040002CF86BDED040003CF86BDED040004000500410502005403013B36D20001040002EFDDBBED040003EFDDBBED04000400050041050200B27C0C920B260001040002B7DCBCED040003B7DCBCED04000400050041050200D9AF0997A7450001040002BCD9AAED040003BCD9AAED04000400050041050200BC00130BB5F60001040002CF86BDED040003CF86BDED04000400050041050200591FF23B53830001040002CF86BDED040003CF86BDED04000400050041050200557EB01367590001040002CF86BDED040003CF86BDED04000400050041050200505F157093A2000102000297A4BCED04000397A4BCED040004000500410502003A036C495C670001040002CF86BDED040003CF86BDED0400040005004105020050D8CF0B7D480001040002B7DCBCED040003B7DCBCED040004000500410502004E34E4D0FF250001040002B7DCBCED040003B7DCBCED040004000500410502007A1E50A46E770001040002CF86BDED040003CF86BDED040004000500410502005F18C666CBB80001040002EFDDBBED040003EFDDBBED04000400050041050200C19335603A9E0001040002DC8FB5ED040003DC8FB5ED0400040005004105020097142BD7DF890001040002AFDFBAED040003AFDFBAED0400040005004105020052F3355FFED400010400029FB2BCED0400039FB2BCED04000400050041050200BCBA857EECDF0001040002D7B3BBED040003D7B3BBED04000400050041050200729259D605EF0001040002CF86BDED040003CF86BDED04000400050041050200BEC2F57655B300010400029FB2BCED0400039FB2BCED040004000500410502005BD905C8304B0001020002A8EEBBED0400038788BCED0400040005004105020055F2C0360F360001040002EFDDBBED040003EFDDBBED0400040005004105020082C01DB9605D00010400028788BCED0400038788BCED04000400050041050200BC73B8FB30360001040002CF86BDED040003CF86BDED0400040005004105020050390E32DF8B0001040002B0DFBAED040003B0DFBAED040004000500410502005BCE8A2D7B8000010400028788BCED0400038788BCED0400040005004105020042292BB45D2D0001040002CF86BDED040003Line truncated
<HttpsProxy>
<Enable>0</Enable>
</HttpsProxy>
<LastIP>-645574544</LastIP>
<LastProbingFailed>0</LastProbingFailed>
<ListeningPort>47500</ListeningPort>
<LoginServers>
<DirectlyConnected>1</DirectlyConnected>
</LoginServers>
<NatTracker>
<ContraProbeResults>217.133.80.112:1076 217.133.80.112:47500 217.133.80.112:1083 217.133.80.112:1083 217.133.80.112:49734</ContraProbeResults>
<PreviousNatType>7</PreviousNatType>
<ProbeResults>
<_1303289856>6C81442204F3D9855070B98CAE5879A505F3D9855070B98C4D4320134B66D9855070B98C5F4E60ED0D34D98550700434</_1303289856>
<_1303293952>4287274ED659D9855070B98C4287274ED74BD9855070B98C4287274EC15CD9855070B98C4287274ECE92D9855070B98C4287274EA75BD9855070B98C4287274E4B98D9855070B98C4287274EAA2DD9855070B98C4287274EA175D9855070B98C4287274ED735D9855070B98C4287274EAE25D9855070B98C4287274E1A2BD9855070B98C3D7D44372576D9855070B98CCF86DF304366D9855070B98C3D2E02A2259CD9855070B98C4287274EB98CD9855070B98C</_1303293952>
<_1303298048>2E3363049108D9855070B98C2E3795FA3202D9855070B98C2E2F6F42E86DD9855070B98CB4B0620AA528D9855070B98C</_1303298048>
<_1303306240>5F1894D8122BD9855070B98C2E40484969A3D9855070B98CD592A70A5566D9855070B98C2E26119F8DBED9855070B98C2E3754264E48D9855070B98C</_1303306240>
<_1303314432>4D2BFFCAEC6CD9855070043B54BAD08D05E0D9855070B98C9D9D4DA11995D9855070B98C59584CCBB5CED9855070B98C972AC71733DDD9855070B98C</_1303314432>
<_1303322624>5F3B0DCEB535D9855070043BD5150C1746D3D9855070B98C4D4B8646EF29D9855070B98CD5152F4D12BBD9855070B98C</_1303322624>
<_1303326720>59D0D11D89DCD9855070C2462E755D8E1E97D9855070B98C2E492F875789D9855070B98C2E378784E9C6D9855070B98C2E2F6F6B48FCD9855070B98C</_1303326720>
</ProbeResults>
<UsedIPList>
<_1303289856>9A4A56D31C619325C6601C71B23E13FDFAF5CA49F15C34A4E33F239B524D6BBC226021F010D2270A3B48DFA2E8CDB6FD37531B1118DB2D471CB980D0</_1303289856>
<_1303293952>D5A2186D0B45088ADDFA7B626C0904CED47E3DF13172672AED483E1EAD69DB781ABEC0D8812B1B5EFF91BC28C67FB5A3404D875A</_1303293952>
<_1303298048>DB0EC5161D10171C7C6A4C7109DD</_1303298048>
<_1303302144>5379BD98</_1303302144>
<_1303306240>88B19442A48D863ED54D712EEC36D53127BCE36653FE</_1303306240>
<_1303310336>1908404B0F7BA3BE952CB1C533456D3CDA410BCB774AF93880FB8BD8C110</_1303310336>
<_1303314432>4B015AD444DD027FD3F61B2A51A53BA0</_1303314432>
<_1303322624>878BAF81A9F053B39E35081485E24B4EDA5F79D37E176C409B6E237A336451F42CFA7CEC013C98A18B51</_1303322624>
<_1303326720>CFB137906F6CCE77246BD5B6B434875570B1F9B9140C85D5114EE6953110B04F3557C0D1686D46A9F69106521979AE49E19F8622F93A</_1303326720>
<_1303330816>BA4B81F735FDCDA4E4EF57ACF8A37051C66401E41CA4E562A5A49ACC2E246CCE</_1303330816>
</UsedIPList>
</NatTracker>
<PresenceServers>
<DirectlyConnected>1</DirectlyConnected>
</PresenceServers>
<SipServers>
<DirectlyConnected>1</DirectlyConnected>
</SipServers>
<SocksProxy>
<Enable>0</Enable>
</SocksProxy>
<StatsServers>
<DirectlyConnected>1</DirectlyConnected>
</StatsServers>
</Connection>
<Localnode>
<NodeID>9BF92EA4B417A7F6</NodeID>
</Localnode>
<PropsManager>
<PermaProps>4102030E322F322E302E302E37322F31373400000FF6EB9ADC04</PermaProps>
</PropsManager>
<VoiceEng>
<AGC>0</AGC>
</VoiceEng>
</Lib>
<UI>
<Installed>2</Installed>
<Language>en</Language>
<Pos>
<Height>357</Height>
<Width>258</Width>
<X>0</X>
<Y>0</Y>
</Pos>
<SavePassword>0</SavePassword>
</UI>
</config>
@@ -0,0 +1,74 @@
<?xml version="1.0"?>
<config version="1.0" serial="3315" timestamp="1303209780.1">
<Lib>
<Account>
<IdleTimeForAway>300</IdleTimeForAway>
<IdleTimeForNA>1800</IdleTimeForNA>
<Migration>63</Migration>
</Account>
<Call>
<DPC>41010300676D6172757A7A3400</DPC>
<FirstSkypeoutTime>1268962216</FirstSkypeoutTime>
</Call>
<CentralStorage>
<LastBackoff>0</LastBackoff>
<LastFailure>0</LastFailure>
<LastSync>1303202372</LastSync>
<NeedSync>0</NeedSync>
<SyncSet>
<p>
<email>35716ecf:2</email>
<profile>98e6c103:0</profile>
</p>
<u>&#10; </u>
</SyncSet>
</CentralStorage>
<Chat>
<ActivityTS>1</ActivityTS>
<DialogPartner>3</DialogPartner>
<HistoryDays>65535</HistoryDays>
<MigrationDone>1266110339</MigrationDone>
</Chat>
<Contacts>
<Migration>1</Migration>
</Contacts>
<Message>
<DisableHistory>1</DisableHistory>
</Message>
<Notification>
<LastID>1000000166</LastID>
<LastPoll>1303166852</LastPoll>
<LastSearch>1303209779</LastSearch>
</Notification>
<PM>
<pslut>1267114269</pslut>
</PM>
<ProfilePopulated>2</ProfilePopulated>
<PropsManager>
<PermaProps>4109008620EBA4DDDB0400FA0100009E2001009420FB09008520B1A58BDD04008120CCD9E6E3040093209B0A00F501820200F801A3B608</PermaProps>
</PropsManager>
<StatsSender>
<CollectorLastSent>1267114267</CollectorLastSent>
<CollectorSeq>11</CollectorSeq>
<Saved>4263C0064DD5ACF9A03594DAB928D2B81510</Saved>
</StatsSender>
<Video>
<AdvertPolicy>noone</AdvertPolicy>
<Disable>1</Disable>
<RecvPolicy>noone</RecvPolicy>
</Video>
<table_insert_history>
<_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>1303296179 23160:21600:1303209779 9589:7200:1303209779 8707:21600:1303209779</_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>
</table_insert_history>
</Lib>
<UI>
<API>
<Authorizations>skypopen</Authorizations>
<BlockedPrograms></BlockedPrograms>
</API>
<AutoUpdate>0</AutoUpdate>
<CaptureDevice>2</CaptureDevice>
<RingDevice>2</RingDevice>
<SoundDevice>2</SoundDevice>
</UI>
</config>
@@ -0,0 +1,74 @@
<?xml version="1.0"?>
<config version="1.0" serial="3315" timestamp="1303209780.1">
<Lib>
<Account>
<IdleTimeForAway>300</IdleTimeForAway>
<IdleTimeForNA>1800</IdleTimeForNA>
<Migration>63</Migration>
</Account>
<Call>
<DPC>41010300676D6172757A7A3400</DPC>
<FirstSkypeoutTime>1268962216</FirstSkypeoutTime>
</Call>
<CentralStorage>
<LastBackoff>0</LastBackoff>
<LastFailure>0</LastFailure>
<LastSync>1303202372</LastSync>
<NeedSync>0</NeedSync>
<SyncSet>
<p>
<email>35716ecf:2</email>
<profile>98e6c103:0</profile>
</p>
<u>&#10; </u>
</SyncSet>
</CentralStorage>
<Chat>
<ActivityTS>1</ActivityTS>
<DialogPartner>3</DialogPartner>
<HistoryDays>65535</HistoryDays>
<MigrationDone>1266110339</MigrationDone>
</Chat>
<Contacts>
<Migration>1</Migration>
</Contacts>
<Message>
<DisableHistory>1</DisableHistory>
</Message>
<Notification>
<LastID>1000000166</LastID>
<LastPoll>1303166852</LastPoll>
<LastSearch>1303209779</LastSearch>
</Notification>
<PM>
<pslut>1267114269</pslut>
</PM>
<ProfilePopulated>2</ProfilePopulated>
<PropsManager>
<PermaProps>4109008620EBA4DDDB0400FA0100009E2001009420FB09008520B1A58BDD04008120CCD9E6E3040093209B0A00F501820200F801A3B608</PermaProps>
</PropsManager>
<StatsSender>
<CollectorLastSent>1267114267</CollectorLastSent>
<CollectorSeq>11</CollectorSeq>
<Saved>4263C0064DD5ACF9A03594DAB928D2B81510</Saved>
</StatsSender>
<Video>
<AdvertPolicy>noone</AdvertPolicy>
<Disable>1</Disable>
<RecvPolicy>noone</RecvPolicy>
</Video>
<table_insert_history>
<_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>1303296179 23160:21600:1303209779 9589:7200:1303209779 8707:21600:1303209779</_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>
</table_insert_history>
</Lib>
<UI>
<API>
<Authorizations>skypopen</Authorizations>
<BlockedPrograms></BlockedPrograms>
</API>
<AutoUpdate>0</AutoUpdate>
<CaptureDevice>2</CaptureDevice>
<RingDevice>2</RingDevice>
<SoundDevice>2</SoundDevice>
</UI>
</config>
@@ -0,0 +1,99 @@
<?xml version="1.0"?>
<config version="1.0" serial="3885" timestamp="1303333464.70">
<Lib>
<BCM>
<_2>00001000A563932E7DE5A581942041A820F8437512A079C7ACB1B73281F191D109521E265BCD38C4133596B834AD9AA1D6BB5E1AC3D59E8675785321F722D39FBFAFB9A24E6482FA3030FFA3692D2C4A53BBCE9DC63F25D10207A20FA969982FEDC1DCC2A7C599071F4735E52AB2E06E34CA232C08B3AA2FB88A0C4A5763E0CD23C3AA37D1D2A7D6EED691EE99BA08BE294F68C24F9AE777DAF294F0AEB8346325A978DC6CF7C210AD11EF3F38111F6D98F388CF41CCBA40ABE9F0D6CBBD3118BA0588344953DF3C5E88B2CCAEDE2E692F320D20EBF16D7DB36156E617C0CC9FB2855D7FDB4C7F8638CC9830E7448D5EAE301A2810277062989841EE679E00E4E277615FEC038DE3A0A20DD7C6A2A00DFBC6A2A00DA6E2B6F404FDC6A2A00DFEC6A2A00DF7FBBB990CF2C6A2A00D8EB4FE8A0C8FB4FE8A0C95C7A6E00CF5FBBB990CD6C7A6E00CD0F896950CCCE2B6F40485CCA2A00DA1D8EEA50DFDFBBB990CA7C7A6E00CA8C7A6E00CA9C7A6E00C97C7A6E00C90B4FE8A0CFE90D59308C290D59308D1E2B6F404C5E2B6F404C6AAF18705C7AAF18705C8AAF18705BBD8EEA50DBCD8EEA50DBDD8EEA50D93CCA2A00D94CCA2A00DEFE2B6F40491B4FE8A0CE2FBBB990CE3FBBB990CBED8EEA50DA0CCA2A00DA1CCA2A00DA6B4FE8A0CA7B4FE8A0CCED8EEA50DA3CCA2A00DA4CCA2A00D84E698AD0DB8C7A6E00CD9E2B6F404E0E2B6F40486E698AD0DFDF896950C0013A60400173D0018DE0200190300AB01F40300449875044518C15F9A278109D4BBAC4E8109D408A6238109D5A63304810904460CC15F9A26303ED408A624303E0047B054004801004980A305004A80E90F004BE0A801004C80A305004D01005CAC02045E5A50FC55465BA050FC55475BA050FC55485BA0C32EFDEE5BA0C32EFDEF5BA0C2A5BC4A5BA0C2A5BC4B5BA0D4BBAC055BA0D4BBAC145BA0D4BBAC215BA0D408A3575BA0D408A37D5BA0D408A37E5BA08275487E5BA0827548425BA00060B817046506CC09A3D6303E04AE018C0125F8D500021A25F9D500011A162102200301220125FFD50025FAD5000C03E4000D2580D6000F060125F8D5000302172105050103080D06010501011C210302060125FCD50025F9D5000A25FDD50025FED5000A0D06020502050119211305020380808080100C05010D0380808080100B25FDD5000C01080005000380808080100D060307010503220101220104AC01BF012597CE002597CE002590CE0019152590CE002597CE000B033C1815210220030122012593CE0014212E2594CE002103030B220125A5CE00030F172103030B22012596CE00142103030B22012597CE00142103030B22012599CE00142103030A220125A5CE00030A1A2590CE002592CE000B031E1B15142103030A220125A4CE000380201D14210303092201259BCE0014210A2594CE002103030B2201259DCE00142103030822012593CE002103012201259ECE001421030306220103022201006800006901006A01006C987504740CC2A5BC4C303ED408A34C303E007828047912CC09A3D3303E82754864303E4E8DB16F303E047DBF010203020800050003020D0B0601030308000500020501030508000500021A03060800050003041A16030508000500021D160C0A0C060203D00F251205020A03020D0A050103D00F0C0A0603010800050003FFFFFFFF0F18030208000500021D141506042512020800050003030D05040C10030205040B0C06050306050505020A0C060603040800050003050800050003E400180C0607050703E400250A0B250A011C0C0A0314100608050303C03E0F03B8171005060388270F03DC0B100508047E5E0380010304080005000B03040D250403E4000F03140D0A2503250203030D0A0B0110060101080005000380020D0302080005000380020D172103010601250A03E4001B210D0501030A03E400250A210303DF002002250A0B0D0F0601050100800180EA49008101E003036F3139352E34362E3235332E3235333A313233353000038201706F6F6C313D2A2E6C6976657461622E736B7970653B706F6F6C323D7765622E6578747261732E736B7970653B706F6F6C333D6578747261732E646F776E6C6F6164732E736B7970653B706F6F6C343D2A2E736B79706566696E642E736B7970653B706F6F6C353D2A2E7072656D69756D2E736B7970653B706F6F6C363D2A2E6D756C74696D656469612E736B7970653B706F6F6C373D2A2E6D756C74696D656469612E6D657461636166653B706F6F6C383D2A2E6D756C74696D656469612E6461696C796D6F74696F6E3B706F6F6C393D2A2E6D756C74696D656469612E6D6574616F6D6E69747572653B706F6F6C31303D77686174736E65772E736B7970653B706F6F6C31313D7061792E736B7970653B706F6F6C31323D7365637572652E7061792E736B7970653B706F6F6C31333D2A2E70696373746F72653B706F6F6C31343D2A2E6D796163636F756E742E736B7970653B706F6F6C31353D2A2E62696269743B706F6F6C31363D2A2E70726F6363796265723B706F6F6C31373D747261636B696E672E6F6D6E69747572653B706F6F6C31383D676F2E736B7970653B706F6F6C31393D747261636B2E736B7970657C706F6F6C313D3139342E3139322E3139392E3235313A31323335303B706F6F6C323D3139342E3139322E3139392E3235323A31323335303B706F6F6C333D3139342E3139322E3139392E3235323A31323335303B706F6F6C343D3139342E3136352E3138382E3130313A31323335303B706F6F6C353D3139332E39352E3135342E31353A31323335313B706F6F6C363D3139342E3136352E3138382E3130303A31323335303B706F6F6C373D3139342E3136352E3138382E3130303A31323335303B706F6F6C383D3139342E3136352E3138382E3130303A31323335303B706F6F6C393D3139342E3136352E3138382E3130303A31323335303B706F6F6C31303D3230342E392E3136332E3134313A31323335303B706F6F6C31313D3139352E34362E3235332E3234353A31323335303B706F6F6C31323D3139352E34362E3235332E3234353A31323335303B706F6F6C31333D3139332E39352E3135342E31343A31323335313B706F6F6C31343D3139332E39352E3135342E31343A31323335313B706F6F6C31353D3139332E39352E3135342E31343A31323335313B706F6F6C31363D3139332E39352E3135342E31343A31323335313B706F6F6C31373D3139342E3136352E3138382E3130303A31323335303B706F6F6C31383D3139342E3136352E3138382E3130303A31323335303B706F6F6C31393D3139332E39352E3135342E31343A31323335310003B101706F6F6C313D2A2E6C6976657461622E736B7970653B706F6F6C323D7765622E6578747261732E736B797065206578747261732E646F776E6C6F6164732E736B7970653B706F6F6C333D2A2Line truncated
<_256>000010011AC0AA3BA66DF7FB48228AE35F9BB4A032FE4A6A898DA7A1A5AE37DC59FB3D09607F1CACD46A5DBC008DABF8F09C797DF5A8903307D04C318825CEA7C481303C655A9EEE099E9A0AF1158373B458BB8FDACB336A6EC63C043E6782688E2350B417DDDDFF96B474DAEA7D1DF3742303B79111FC752BFB5D6887A5B822F945CC761FAF6E80DE5EC60868768CB8A9F9C876137806DCEA0DD1300181558ABFDBA26592078F5F84195C526D8C7F339EF82700FD93F8FB71ADA5ED3E977D27FA52D1F489EF5DA0A9E00B146BADCBDEBFB0DFEBCD61E5B8352A49893357E0DC3A736743929DA975782EA4D8184605FD064641986C47706D264281C876F926BF58003E9E</_256>
<_3>0000100498ECF8A7A4585F76C930739A1EAE590DE96D9EF3AA9B231E67965F3F08ECFC493E1DA23ECDE17A85C94CBE034E88F9414E9BBC82F32AAFCFFB2C09F6F57A478238BAEC9EEF2BB9C67F71257722E6786D88D6400F6B7D81450FB3B6CCCC3986E3782D2387E354EBA9099331AEF510D479C6601D2383D866E2B5B525DF0BA975D58C120EFAE88C89EE365FC696CC891B77F67CFA18FDE8E95DDAC25A7C7D70FA7A1414BAE593856A658888C622836006C1C131B4B2E805554DCFA52F3EFD34C1B759BF8A302E491835DCE701E84D37ED150C8ADD699AD3DCA9F515123C5B5AD94E253E173BA3465E64A0079D5EF4E6075E66D0F5FBC3D9BC25C4E80C4CB2FE9B87040003000004D00F0005D00F050041040400B80125C20003141B14230025D50003031B14230024E100142300250003191714230025EA0003141714230025EA00011724EA00140A14230025E400030F1C14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025E10025E10003A006100A0309031725000325180C0A25C20003140B0C03040D0A03882725C3000C0A03E43225C4000C0A0602050228038407DC08FA1E0601050102050203FA1E1C0603250028061D1E1F202122060105010205010503050141060300636F756E74206279207175616C697479000001CC080002040003000004010005010501410603006261647175616C69747920636F756E742062792076657273696F6E000001D6080002070003000004010005010501410603006261647175616C6974792073756D2062792076657273696F6E000001E0080002070003000004010005010500410304005424E400142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025E40025E40028043CB401D804901C060105010205014106030073756D206F66206C61737463616C6C206475726174696F6E73000001B009000201000300000480A3050005B054050141060300636F756E74206279206C61737463616C6C206475726174696F6E000001BA090002050003000004010005010500410204005025EB00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EB0028031E32D0000601050102050141060300636F756E742062792073797374656D20637075207573616765000001940A0002040003000004010005010500410204004F25EC00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EC0028030F1E320601050102050141060300636F756E742062792070726F63657373206370752075736167650000019E0A0002040003000004010005010500410304006824C20014230024E60014230025E600011A14230025EC00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EC0028030F1E320601050102050125C2000501410603006A6974746572636F756E742062792070726F6365737320637075207573616765000001F80A0002040003000004010005010501410603006A69747465722062792070726F6365737320637075207573616765000001820B0002040003000004D00F0005D00F0500410304004424E700142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A1423000225E700050141060300706F74656E7469616C207463702066616C6C6261636B73000001DC0B00020100030000040100050105014106030061637475616C207463702066616C6C6261636B73000001E60B00020100030000040100050105004103040056240C142300250C030A1814230025EA0003141714230025EA00011724EA00140A14230024E70014230025E700011A14230024E50014230025E500011C0602250C29050306070809280401020405060105010205010502050141060300636F756E74206279206E617474797065000001C00C0002050003000004010005010501410603007564706661696C75726573206279206E617474797065000001CA0C0002050003000004010005010500410204001B25D90014230025D90025DA000B0602050228030102040601050102050141060300636F756E74206279206E726F666D756C74696368617473000001A40D0002040003000004010005010500410304001425F700011C14230025000319171423000225F90005014106030075736572732077686F206861766520636F6D706C65746564204943000001880E0002010003000004010005010501410603006C617374204943207969656C6420676C6F62616C73756D000001920E0002010003000004E8070005500500410304001224F60014230025000319171423000225F60005014106030075736572732077686F206861766520494320737570706F7274000001EC0E0002010003000004010005010501410603004943207374617274757020636F756E7420676C6F62616C73756D000001F60E00020100030000046400051405004102040025240C142300250C030A18142300250C011C142300250C280802030405060708090601050102050141060300636F756E74206279206E617474797065000001D00F0002090003000004010005010500410404001A250003191714230025E20025E30025FC00280201020601050102050141060300766964656F2073656E642063617061626C650000019811000201000300000401000501050141060300766964656F20706172616C6C656C2063616C6C730000019911000201000300000414000502050141060300636F756E7420627920766964656F2063616C6C73206D616465000001A2110002030003000004010005010500410204003A250003191714230025EA0003141714230025EA00011724EA00140A14230024E50014230025E50003031914230025E50028030102030601050102050141060300636F756E742062792073747265616D7472616E73706F7274000001FC11000204000300000401000501050041090400E00125C20003141B25E400030F1C1514230024E100142300250003191714230025EA0003141725EA0001171514230025FF002580010A011A14230025E60003031A25E50003031A1514230024F5001423002412142300249F0114230025C30025E10025E10003A006100A03A0060B0309031725000325180C0A25C20003140B0C03040D0A2512030A0C251025F5001703CC080C0A1C160602020502250003231B241D150603050305020503150503251D03808080808Line truncated
<_4>000010052A0B6759B71FBC1EF05BE97DFEA4EE6C1E15AF19ED70DEC1130B14C13CE41246D302B9662592907E3CA508A57702B5C00C2A05170857FA22012E0F235B425B4D919B23A541D3AD6E948FC634DE71A29493634884DFD5E9D89C5D951CBCD71B9B3ABFD3C4E2779BB1817D76E7C223CA36BD75A6A05B730AF138057E4048B2FFDD522BB588EC0B9D3E014BF9E354EB608150BC613C739D9E8C7465F05F047FAF7AFA3EE89B9B58BF0FC35F07B55CF3E4B59A7C4ED48B1C0C7F0305E6AC2E80AAEAD6064EB6ACDC1806FCE0B5CB66F0840DA7F0FE7B228E3898E3E42A9AFEFE13DDF019EF8D8F02A631AF2615BBC6E1EDB65C89A775F642C88109E6247EC4B463DC302E2A2E323000050541020006020307322E302E2A2E3100050541030006020307322E302E2A2E3200000AE4ED8009050541030006020307322E302E2A2E33000009B3E6CC990B050541040006020307322E302E2A2E3400000AE4ED8009000BA00B050541030006020308322E302E2A2E35000307322E302E2A2E3900050541040006020308322E302E2A2E39000307322E302E2A2E313100000AE4ED8009050541040006020308322E302E2A2E3131000307322E302E2A2E3135000009E6CC99B306050541050006020308322E302E2A2E3135000307322E302E2A2E323000000AE4ED8009000BA00B050041050303557067726164655465737433000301332E302E302E3130300003044E6963654272616E6400050541040006020307332E302E302E2A0003074E6963654272616E6400000AE4ED8009050541040006020307322E302E302E2A0003074E6963654272616E6400000AE4ED80090500410E0303557067726164655465737433000301332E302E302E31303000050541040006020307332E302E302E39390003074F746865724272616E6400000AE4ED8009050541040006020307322E302E302E39390003074F746865724272616E6400000AE4ED8009050541040006020307332E302E302E39380003074F746865724272616E64000009B3E6CC990B050541040006020307322E302E302E39380003074F746865724272616E64000009B3E6CC990B050541050006020307332E302E302E39370003074F746865724272616E6400000AE4ED8009000BA00B050541050006020307322E302E302E39370003074F746865724272616E6400000AE4ED8009000BA00B050541030006020307332E302E302E393900000AE4ED8009050541030006020307322E302E302E393900000AE4ED8009050541030006020307332E302E302E3938000009B3E6CC990B050541030006020307322E302E302E3938000009B3E6CC990B050541040006020307332E302E302E393700000AE4ED8009000BA00B050541040006020307322E302E302E393700000AE4ED8009000BA00B0500410303033130303031000301302E302E302E313000050541020006020307302E302E302E3900</_4>
<_5>00001006739CA527EF827847E16F23CD52458C3EBA3460A42935EC6948BEFA626B49E3BDF279FC62486E2DDBCA19609ED23D31F4E5175920F282AD74A74A997C3909E67B622480C68A058E886C7D5F3C40954880D7798CD61CEA0FBAFB389BE5B2B8A887348F7AADB4DF642B194B814047CDA0E698EDDE61DFA731DCA5883A76F913D8C94066718054E85ADA7AE009F2B2A9AF762FDCB9B6CAF64C156911E3AB172CFD795F66FB6E8E15048A54E4AB17979D6C447DEBADE75CC6F606050D980061112AFF9AE7C7BF8065D711949E41FA4C8B6CBF0916BB395B3E186A7D617D353C6BFFC687FE79475DFA095D113D70B828FB597BC3665B7C9C3669CA9CBE5D308D3FC23803044E45544745415200050541020006040307302E392E302E2A000500410503033130303033000301312E302E302E3137000304534D4300050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E312E302E313000030442454C4B494E00050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E302E302E3137000304454447452D434F524500050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E302E302E31330003044C4F474954454300050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303035000301312E342E38382E31333636000304544F50434F4D00050541020006040307312E342E38382E3133353600050541020006020307312E342E38382E31333635000500410503033130303035000301312E342E38382E313336360003045043484F4D4500050541020006040307312E342E38382E3133353600050541020006020307312E342E38382E31333635000500410403033130303036000301302E302E302E313000050541020006040307302E302E302E3500050541020006020307302E302E302E39000500410503033130303037000301312E302E312E330003045445434F00050541020006040307312E302E302E3800050541020006020307312E302E312E31000500410503033130303038000301302E392E332E3339370003044C494E4B53595300050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410503033130303038000301302E392E332E3339370003044E45544745415200050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410503033130303038000301302E392E332E3339370003045048494C49505300050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410403033130303130000301302E392E302E31310003044C494E4B53595300050541020006040307302E392E302E3130000500410403033130303130000301302E392E302E313100030442554646414C4F00050541020006040307302E392E302E3130000500410503033130303132000301312E302E302E310003044353544E00050541020006040307302E302E302E3500050541020006020307302E302E302E39000500410503033130303133000301302E302E332E3234000304414B00050541020006040307302E302E312E323400050541020006020307302E302E322E3234000500410303033130303134000301312E372E34332E33382E3200050541020006040307312E372E32332E32372E34000500410503033130303135000301312E322E31372E30000304415A5445434800050541020006040307312E322E31312E3000050541020006020307312E322E31352E30000500410303033130303230000301312E302E302E343700050541030006020308312E302E302E3233000307312E302E302E3233000500410403033130303234000301332E322E302E323800050541030006040308332E302E302E35000307332E302E302E3500050541030006020308332E312E302E31000307332E322E302E38000500410503033130303232000301302E302E302E3900030450414E41534F4E494300050541020006040307302E302E302E3100050541020006020307302E302E302E38000500410503033130303232000301302E302E302E3900030450414E41534F4E4943434F4E53554D455200050541020006040307302E302E302E3100050541020006020307302E302E302E3800</_5>
</BCM>
<BackboneInited>1</BackboneInited>
<Chat>
<FriendlyNameMaxSize>400</FriendlyNameMaxSize>
</Chat>
<Connection>
<Bandwidth>
<CurSlotLength>8118</CurSlotLength>
<InHistory>39,64,8184</InHistory>
<OutHistory>37,50,13164</OutHistory>
</Bandwidth>
<DisablePort80>1</DisablePort80>
<EventServers>
<DirectlyConnected>1</DirectlyConnected>
</EventServers>
<Firewall>
<TcpInHistory>-1431699456</TcpInHistory>
<UdpInHistory>-1431699456</UdpInHistory>
<UdpOutHistory>1610612735</UdpOutHistory>
</Firewall>
<HostCache>41C801050041050200D9AF0D45D9E900010400028788BCED0400038788BCED04000400050041050200BB0AB3FDD1A40001040002B7DCBCED040003B7DCBCED040004000500410502005C3766C2DA6B00010400029FB2BCED0400039FB2BCED04000400050041050200D9F8DC20CA33000104000296DAAAED04000396DAAAED0400040005004105020063847B3765900001040002D794BDED040003D794BDED040004000500410502004E80142FD3C70001040002CF86BDED040003CF86BDED04000400050041050200C3B213EA24A50001040002BF89BBED040003BF89BBED040004000500410502006FFEF1BA804C0001040002CF86BDED040003CF86BDED0400040005004105020052ED923CB3A700010400028788BCED0400038788BCED040004000500410502005243330D305B000104000283FFB2ED04000383FFB2ED040004000500410502006FF9438E9E5D0001040002CF86BDED040003CF86BDED04000400050041050200585515F19D77000104000283FFB2ED04000383FFB2ED04000400050041050200729EE3A8DD460001040002CF86BDED040003CF86BDED040004000500410502004572795D3BB300010400029FB2BCED0400039FB2BCED040004000500410502009F94D72CABA40001040002CF86BDED040003CF86BDED0400040005004105020095052D9C81090001040002B7DCBCED040003B7DCBCED040004000500410502005859A15FD7FC0001040002DC8FB5ED040003DC8FB5ED0400040005004105020059D7AB3EBBFB0001020002F8FABCED040003CF86BDED04000400050041050200BB2481B9390E0001040002CF86BDED040003CF86BDED0400040005004105020059D7F395A7BA0001040002B7DCBCED040003B7DCBCED040004000500410502006DC4BEF5D52E0001040002B0DFBAED040003B0DFBAED040004000500410502004B6E709CF4290001040002B7DCBCED040003B7DCBCED040004000500410502007A7D5CEC2B8D0001040002CF86BDED040003CF86BDED040004000500410502006FFFA8AFB19D0001040002B7DCBCED040003B7DCBCED040004000500410502003E4475A07A6F0001040002B7DCBCED040003B7DCBCED040004000500410502003EDD8384A4F90001040002BF89BBED040003BF89BBED04000400050041050200560FBFA4E4900001040002B7DCBCED040003B7DCBCED04000400050041050200C24FAEEE43F10001040002B3CEB5ED040003B3CEB5ED040004000500410502004F378778C6F30001040002CF86BDED040003CF86BDED04000400050041050200C94418BB0EDF0001040002B7DCBCED040003B7DCBCED040004000500410502003B75A58BECB30001040002CF86BDED040003CF86BDED04000400050041050200772A7A0908890001040002CF86BDED040003CF86BDED0400040005004105020048BB63586DE100010400029088BCED0400039088BCED040004000500410502005544F881BEDA000104000283FFB2ED04000383FFB2ED040004000500410502005B4C1468EDF80001040002B7DCBCED040003B7DCBCED04000400050041050200538BAF3F934F0001040002B3CEB5ED040003B3CEB5ED0400040005004105020055D6F93A4FD70001040002D7B3BBED040003D7B3BBED04000400050041050200D5D64561E55F00010400028788BCED0400038788BCED0400040005004105020046ADF229B8570001040002CF86BDED040003CF86BDED04000400050041050200D5151C19FFD600010200029FB2BCED040003B7DCBCED04000400050041050200973CA35DB82400010400029FB2BCED0400039FB2BCED04000400050041050200C249E5B953700001040002CF86BDED040003CF86BDED04000400050041050200722C69D8C4F500010400029FB2BCED0400039FB2BCED0400040005004105020058CBB311F2400001040002DC8FB5ED040003DC8FB5ED040004000500410502004BB7A090766E0001040002CF86BDED040003CF86BDED040004000500410502007DEF80FBEBD90001040002EFDDBBED040003EFDDBBED0400040005004105020076A03698F87A0001040002CF86BDED040003CF86BDED0400040005004105020050E5DFDD0C700001040002CF86BDED040003CF86BDED040004000500410502004D4C85E0CEC80001040002CF86BDED040003CF86BDED040004000500410502006FEA6BCD92A10001020002F8FABCED040003CF86BDED0400040005004105020043BAA930F28600010400029FB2BCED0400039FB2BCED04000400050041050200722DB82DDB780001040002CF86BDED040003CF86BDED0400040005004105020052E995118B9F0001040002CF86BDED040003CF86BDED040004000500410502005403013B36D20001040002EFDDBBED040003EFDDBBED04000400050041050200B27C0C920B260001040002B7DCBCED040003B7DCBCED04000400050041050200D9AF0997A7450001040002BCD9AAED040003BCD9AAED04000400050041050200BC00130BB5F60001040002CF86BDED040003CF86BDED04000400050041050200591FF23B53830001040002CF86BDED040003CF86BDED04000400050041050200557EB01367590001040002CF86BDED040003CF86BDED04000400050041050200505F157093A2000102000297A4BCED04000397A4BCED040004000500410502003A036C495C670001040002CF86BDED040003CF86BDED0400040005004105020050D8CF0B7D480001040002B7DCBCED040003B7DCBCED040004000500410502004E34E4D0FF250001040002B7DCBCED040003B7DCBCED040004000500410502007A1E50A46E770001040002CF86BDED040003CF86BDED040004000500410502005F18C666CBB80001040002EFDDBBED040003EFDDBBED04000400050041050200C19335603A9E0001040002DC8FB5ED040003DC8FB5ED0400040005004105020097142BD7DF890001040002AFDFBAED040003AFDFBAED0400040005004105020052F3355FFED400010400029FB2BCED0400039FB2BCED04000400050041050200BCBA857EECDF0001040002D7B3BBED040003D7B3BBED04000400050041050200729259D605EF0001040002CF86BDED040003CF86BDED04000400050041050200BEC2F57655B300010400029FB2BCED0400039FB2BCED040004000500410502005BD905C8304B0001020002A8EEBBED0400038788BCED0400040005004105020055F2C0360F360001040002EFDDBBED040003EFDDBBED0400040005004105020082C01DB9605D00010400028788BCED0400038788BCED04000400050041050200BC73B8FB30360001040002CF86BDED040003CF86BDED0400040005004105020050390E32DF8B0001040002B0DFBAED040003B0DFBAED040004000500410502005BCE8A2D7B8000010400028788BCED0400038788BCED0400040005004105020042292BB45D2D0001040002CF86BDED040003Line truncated
<HttpsProxy>
<Enable>0</Enable>
</HttpsProxy>
<LastIP>-645574544</LastIP>
<LastProbingFailed>0</LastProbingFailed>
<ListeningPort>47500</ListeningPort>
<LoginServers>
<DirectlyConnected>1</DirectlyConnected>
</LoginServers>
<NatTracker>
<ContraProbeResults>217.133.80.112:1076 217.133.80.112:47500 217.133.80.112:1083 217.133.80.112:1083 217.133.80.112:49734</ContraProbeResults>
<PreviousNatType>7</PreviousNatType>
<ProbeResults>
<_1303289856>6C81442204F3D9855070B98CAE5879A505F3D9855070B98C4D4320134B66D9855070B98C5F4E60ED0D34D98550700434</_1303289856>
<_1303293952>4287274ED659D9855070B98C4287274ED74BD9855070B98C4287274EC15CD9855070B98C4287274ECE92D9855070B98C4287274EA75BD9855070B98C4287274E4B98D9855070B98C4287274EAA2DD9855070B98C4287274EA175D9855070B98C4287274ED735D9855070B98C4287274EAE25D9855070B98C4287274E1A2BD9855070B98C3D7D44372576D9855070B98CCF86DF304366D9855070B98C3D2E02A2259CD9855070B98C4287274EB98CD9855070B98C</_1303293952>
<_1303298048>2E3363049108D9855070B98C2E3795FA3202D9855070B98C2E2F6F42E86DD9855070B98CB4B0620AA528D9855070B98C</_1303298048>
<_1303306240>5F1894D8122BD9855070B98C2E40484969A3D9855070B98CD592A70A5566D9855070B98C2E26119F8DBED9855070B98C2E3754264E48D9855070B98C</_1303306240>
<_1303314432>4D2BFFCAEC6CD9855070043B54BAD08D05E0D9855070B98C9D9D4DA11995D9855070B98C59584CCBB5CED9855070B98C972AC71733DDD9855070B98C</_1303314432>
<_1303322624>5F3B0DCEB535D9855070043BD5150C1746D3D9855070B98C4D4B8646EF29D9855070B98CD5152F4D12BBD9855070B98C</_1303322624>
<_1303326720>59D0D11D89DCD9855070C2462E755D8E1E97D9855070B98C2E492F875789D9855070B98C2E378784E9C6D9855070B98C2E2F6F6B48FCD9855070B98C</_1303326720>
</ProbeResults>
<UsedIPList>
<_1303289856>9A4A56D31C619325C6601C71B23E13FDFAF5CA49F15C34A4E33F239B524D6BBC226021F010D2270A3B48DFA2E8CDB6FD37531B1118DB2D471CB980D0</_1303289856>
<_1303293952>D5A2186D0B45088ADDFA7B626C0904CED47E3DF13172672AED483E1EAD69DB781ABEC0D8812B1B5EFF91BC28C67FB5A3404D875A</_1303293952>
<_1303298048>DB0EC5161D10171C7C6A4C7109DD</_1303298048>
<_1303302144>5379BD98</_1303302144>
<_1303306240>88B19442A48D863ED54D712EEC36D53127BCE36653FE</_1303306240>
<_1303310336>1908404B0F7BA3BE952CB1C533456D3CDA410BCB774AF93880FB8BD8C110</_1303310336>
<_1303314432>4B015AD444DD027FD3F61B2A51A53BA0</_1303314432>
<_1303322624>878BAF81A9F053B39E35081485E24B4EDA5F79D37E176C409B6E237A336451F42CFA7CEC013C98A18B51</_1303322624>
<_1303326720>CFB137906F6CCE77246BD5B6B434875570B1F9B9140C85D5114EE6953110B04F3557C0D1686D46A9F69106521979AE49E19F8622F93A</_1303326720>
<_1303330816>BA4B81F735FDCDA4E4EF57ACF8A37051C66401E41CA4E562A5A49ACC2E246CCE</_1303330816>
</UsedIPList>
</NatTracker>
<PresenceServers>
<DirectlyConnected>1</DirectlyConnected>
</PresenceServers>
<SipServers>
<DirectlyConnected>1</DirectlyConnected>
</SipServers>
<SocksProxy>
<Enable>0</Enable>
</SocksProxy>
<StatsServers>
<DirectlyConnected>1</DirectlyConnected>
</StatsServers>
</Connection>
<Localnode>
<NodeID>9BF92EA4B417A7F6</NodeID>
</Localnode>
<PropsManager>
<PermaProps>4102030E322F322E302E302E37322F31373400000FF6EB9ADC04</PermaProps>
</PropsManager>
<VoiceEng>
<AGC>0</AGC>
</VoiceEng>
</Lib>
<UI>
<Installed>2</Installed>
<Language>en</Language>
<Pos>
<Height>357</Height>
<Width>258</Width>
<X>0</X>
<Y>0</Y>
</Pos>
<SavePassword>0</SavePassword>
</UI>
</config>
@@ -0,0 +1,74 @@
<?xml version="1.0"?>
<config version="1.0" serial="3315" timestamp="1303209780.1">
<Lib>
<Account>
<IdleTimeForAway>300</IdleTimeForAway>
<IdleTimeForNA>1800</IdleTimeForNA>
<Migration>63</Migration>
</Account>
<Call>
<DPC>41010300676D6172757A7A3400</DPC>
<FirstSkypeoutTime>1268962216</FirstSkypeoutTime>
</Call>
<CentralStorage>
<LastBackoff>0</LastBackoff>
<LastFailure>0</LastFailure>
<LastSync>1303202372</LastSync>
<NeedSync>0</NeedSync>
<SyncSet>
<p>
<email>35716ecf:2</email>
<profile>98e6c103:0</profile>
</p>
<u>&#10; </u>
</SyncSet>
</CentralStorage>
<Chat>
<ActivityTS>1</ActivityTS>
<DialogPartner>3</DialogPartner>
<HistoryDays>65535</HistoryDays>
<MigrationDone>1266110339</MigrationDone>
</Chat>
<Contacts>
<Migration>1</Migration>
</Contacts>
<Message>
<DisableHistory>1</DisableHistory>
</Message>
<Notification>
<LastID>1000000166</LastID>
<LastPoll>1303166852</LastPoll>
<LastSearch>1303209779</LastSearch>
</Notification>
<PM>
<pslut>1267114269</pslut>
</PM>
<ProfilePopulated>2</ProfilePopulated>
<PropsManager>
<PermaProps>4109008620EBA4DDDB0400FA0100009E2001009420FB09008520B1A58BDD04008120CCD9E6E3040093209B0A00F501820200F801A3B608</PermaProps>
</PropsManager>
<StatsSender>
<CollectorLastSent>1267114267</CollectorLastSent>
<CollectorSeq>11</CollectorSeq>
<Saved>4263C0064DD5ACF9A03594DAB928D2B81510</Saved>
</StatsSender>
<Video>
<AdvertPolicy>noone</AdvertPolicy>
<Disable>1</Disable>
<RecvPolicy>noone</RecvPolicy>
</Video>
<table_insert_history>
<_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>1303296179 23160:21600:1303209779 9589:7200:1303209779 8707:21600:1303209779</_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>
</table_insert_history>
</Lib>
<UI>
<API>
<Authorizations>skypopen</Authorizations>
<BlockedPrograms></BlockedPrograms>
</API>
<AutoUpdate>0</AutoUpdate>
<CaptureDevice>2</CaptureDevice>
<RingDevice>2</RingDevice>
<SoundDevice>2</SoundDevice>
</UI>
</config>
@@ -0,0 +1,74 @@
<?xml version="1.0"?>
<config version="1.0" serial="3315" timestamp="1303209780.1">
<Lib>
<Account>
<IdleTimeForAway>300</IdleTimeForAway>
<IdleTimeForNA>1800</IdleTimeForNA>
<Migration>63</Migration>
</Account>
<Call>
<DPC>41010300676D6172757A7A3400</DPC>
<FirstSkypeoutTime>1268962216</FirstSkypeoutTime>
</Call>
<CentralStorage>
<LastBackoff>0</LastBackoff>
<LastFailure>0</LastFailure>
<LastSync>1303202372</LastSync>
<NeedSync>0</NeedSync>
<SyncSet>
<p>
<email>35716ecf:2</email>
<profile>98e6c103:0</profile>
</p>
<u>&#10; </u>
</SyncSet>
</CentralStorage>
<Chat>
<ActivityTS>1</ActivityTS>
<DialogPartner>3</DialogPartner>
<HistoryDays>65535</HistoryDays>
<MigrationDone>1266110339</MigrationDone>
</Chat>
<Contacts>
<Migration>1</Migration>
</Contacts>
<Message>
<DisableHistory>1</DisableHistory>
</Message>
<Notification>
<LastID>1000000166</LastID>
<LastPoll>1303166852</LastPoll>
<LastSearch>1303209779</LastSearch>
</Notification>
<PM>
<pslut>1267114269</pslut>
</PM>
<ProfilePopulated>2</ProfilePopulated>
<PropsManager>
<PermaProps>4109008620EBA4DDDB0400FA0100009E2001009420FB09008520B1A58BDD04008120CCD9E6E3040093209B0A00F501820200F801A3B608</PermaProps>
</PropsManager>
<StatsSender>
<CollectorLastSent>1267114267</CollectorLastSent>
<CollectorSeq>11</CollectorSeq>
<Saved>4263C0064DD5ACF9A03594DAB928D2B81510</Saved>
</StatsSender>
<Video>
<AdvertPolicy>noone</AdvertPolicy>
<Disable>1</Disable>
<RecvPolicy>noone</RecvPolicy>
</Video>
<table_insert_history>
<_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>1303296179 23160:21600:1303209779 9589:7200:1303209779 8707:21600:1303209779</_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>
</table_insert_history>
</Lib>
<UI>
<API>
<Authorizations>skypopen</Authorizations>
<BlockedPrograms></BlockedPrograms>
</API>
<AutoUpdate>0</AutoUpdate>
<CaptureDevice>2</CaptureDevice>
<RingDevice>2</RingDevice>
<SoundDevice>2</SoundDevice>
</UI>
</config>
@@ -0,0 +1,74 @@
<?xml version="1.0"?>
<config version="1.0" serial="3315" timestamp="1303209780.1">
<Lib>
<Account>
<IdleTimeForAway>300</IdleTimeForAway>
<IdleTimeForNA>1800</IdleTimeForNA>
<Migration>63</Migration>
</Account>
<Call>
<DPC>41010300676D6172757A7A3400</DPC>
<FirstSkypeoutTime>1268962216</FirstSkypeoutTime>
</Call>
<CentralStorage>
<LastBackoff>0</LastBackoff>
<LastFailure>0</LastFailure>
<LastSync>1303202372</LastSync>
<NeedSync>0</NeedSync>
<SyncSet>
<p>
<email>35716ecf:2</email>
<profile>98e6c103:0</profile>
</p>
<u>&#10; </u>
</SyncSet>
</CentralStorage>
<Chat>
<ActivityTS>1</ActivityTS>
<DialogPartner>3</DialogPartner>
<HistoryDays>65535</HistoryDays>
<MigrationDone>1266110339</MigrationDone>
</Chat>
<Contacts>
<Migration>1</Migration>
</Contacts>
<Message>
<DisableHistory>1</DisableHistory>
</Message>
<Notification>
<LastID>1000000166</LastID>
<LastPoll>1303166852</LastPoll>
<LastSearch>1303209779</LastSearch>
</Notification>
<PM>
<pslut>1267114269</pslut>
</PM>
<ProfilePopulated>2</ProfilePopulated>
<PropsManager>
<PermaProps>4109008620EBA4DDDB0400FA0100009E2001009420FB09008520B1A58BDD04008120CCD9E6E3040093209B0A00F501820200F801A3B608</PermaProps>
</PropsManager>
<StatsSender>
<CollectorLastSent>1267114267</CollectorLastSent>
<CollectorSeq>11</CollectorSeq>
<Saved>4263C0064DD5ACF9A03594DAB928D2B81510</Saved>
</StatsSender>
<Video>
<AdvertPolicy>noone</AdvertPolicy>
<Disable>1</Disable>
<RecvPolicy>noone</RecvPolicy>
</Video>
<table_insert_history>
<_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>1303296179 23160:21600:1303209779 9589:7200:1303209779 8707:21600:1303209779</_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>
</table_insert_history>
</Lib>
<UI>
<API>
<Authorizations>skypopen</Authorizations>
<BlockedPrograms></BlockedPrograms>
</API>
<AutoUpdate>0</AutoUpdate>
<CaptureDevice>2</CaptureDevice>
<RingDevice>2</RingDevice>
<SoundDevice>2</SoundDevice>
</UI>
</config>
@@ -1,6 +1,5 @@
<configuration name="skypopen.conf" description="Skypopen Configuration">
<global_settings>
<param name="debug" value="8"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="destination" value="5000"/>
@@ -8,6 +7,7 @@
<param name="report_incoming_chatmessages" value="true"/>
<param name="silent_mode" value="false"/>
<param name="write_silence_when_idle" value="true"/>
<param name="setsockopt" value="true"/>
</global_settings>
<!-- one entry here per each skypopen interface -->
<per_interface_settings>
+373
View File
@@ -0,0 +1,373 @@
#!/usr/bin/perl
my $myname ;
my $skype_download_url = "http://mirrors.kernel.org/archlinux/community/os/i686/skype-oss-2.0.0.72-2-i686.pkg.tar.gz";
my $skype_download_pkg = "skype-oss-2.0.0.72-2-i686.pkg.tar.gz";
my $skype_binary_dir = "/usr/bin";
my $skype_download_dir = "/tmp/skype_download";
my $skype_share_dir = "/usr/share/skype";
my $freeswitch_modules_config_dir = "/usr/local/freeswitch/conf/autoload_configs";
my $skypopen_sound_driver_dir = "/usr/local/freeswitch/skypopen/skypopen-sound-driver-dir";
my $skype_config_dir = "/usr/local/freeswitch/skypopen/skype-clients-configuration-dir";
my $skype_startup_dir = "/usr/local/freeswitch/skypopen/skype-clients-startup-dir";
my $skype_symlinks_dir = "/usr/local/freeswitch/skypopen/skype-clients-symlinks-dir";
my $skype_clients_to_be_launched = "5";
my $skype_clients_starting_number = "100";
my $multi_skypeusername = "one";
my $skype_username = "your_own_skype_username";
my $skype_password = "your_own_skype_password";
my @skype_username_array;
my @skype_password_array;
my $sure = "nope";
### PRESENTATION ###
system("clear");
printf("\n");
printf("This is the interactive installation helper for Skypopen\n");
printf("(http://wiki.freeswitch.org/wiki/Mod_skypopen_Skype_Endpoint_and_Trunk)\n");
printf("\n");
printf("Especially designed for FreeSWITCH\n");
printf("by Giovanni Maruzzelli\n");
printf("\n");
printf("Please direct all questions or issues to the FreeSWITCH mailing list or Jira\n");
printf("(http://lists.freeswitch.org/mailman/listinfo or http://jira.freeswitch.org)\n");
printf("\n");
printf("\n");
printf("I'll ask you questions, giving default answers in square brackets [] if any\n");
printf("To accept the default, just press Enter\n");
printf("You'll be prompted to confirm your answer at each step\n");
printf("At the end of questions, before I do anything, I'll let you review it all\n");
printf("To abort, press Ctrl-C\n");
printf("\n");
printf("\n");
printf("Let's start asking your name, so you see how the question/answer works\n");
printf("To accept the default, just press Enter\n");
$myname = &promptUser("Enter your name ", "Giovanni");
system("clear");
printf("\n");
printf("OK %s, GREAT! Let's start real questions! (At any time, Ctrl-C to abort)\n", $myname);
printf("\n");
printf("At the end of questions, before I do anything, I'll let you review all your answers, don't worry! :)\n");
printf("\n");
printf("\n");
### ASKING QUESTIONS ###
printf("I'm about to download the Skype client for Linux version 2.0.0.72 for OSS\n");
printf("nicely repackaged by Arch Linux with official Skype permission.\n");
printf("I need to create a directory to download and unpack the Skype client\n");
printf("To accept the default, just press Enter\n");
$skype_download_dir = &promptUser("Enter the full path of the Skype download directory ", "$skype_download_dir");
system("clear");
printf("\n");
printf("I'm about to install the Skype client\n");
printf("I would put the binary in $skype_binary_dir and the associated files in $skype_share_dir\n");
printf("Location of associated files is mandatory ($skype_share_dir)\n");
printf("Location of binary is recommended ($skype_binary_dir)\n");
printf("To accept the default, just press Enter\n");
$skype_binary_dir = &promptUser("Enter the directory full path for Skype client binary ", "$skype_binary_dir");
system("clear");
printf("\n");
printf("I'm about to create the FreeSWITCH configuration file for mod_skypopen (skypopen.conf.xml)\n");
printf("I need to know where to put it, eg: where is the FreeSWITCH modules' config dir\n");
printf("To accept the default, just press Enter\n");
$freeswitch_modules_config_dir = &promptUser("Enter the directory full path for FreeSWITCH modules' config files ", "$freeswitch_modules_config_dir");
system("clear");
printf("\n");
printf("I'm about to create the directory where to put our fake sound driver\n");
printf("Location of fake sound driver directory is where you like it more :)\n");
printf("To accept the default, just press Enter\n");
$skypopen_sound_driver_dir = &promptUser("Enter the directory full path for fake sound driver ", "$skypopen_sound_driver_dir");
system("clear");
printf("\n");
printf("I'm about to create the configuration directory needed by the Skype clients\n");
printf("Location of Skype clients configuration directory is where you like it more :)\n");
printf("To accept the default, just press Enter\n");
$skype_config_dir = &promptUser("Enter the directory full path for Skype clients config ", "$skype_config_dir");
system("clear");
printf("\n");
printf("I'm about to create a directory where I'll put the Skype clients startup script\n");
printf("Location of Skype clients startup script directory is where you like it more :)\n");
printf("To accept the default, just press Enter\n");
$skype_startup_dir = &promptUser("Enter the directory full path for Skype clients startup script ", "$skype_startup_dir");
system("clear");
printf("\n");
printf("I'm about to create the directory for symlinks needed by the Skype clients startup script\n");
printf("Location of symlinks directory is where you like it more :)\n");
printf("To accept the default, just press Enter\n");
$skype_symlinks_dir = &promptUser("Enter the directory full path for Skype clients symlinks ", "$skype_symlinks_dir");
system("clear");
printf("\n");
printf("How many Skype clients (channels) do you want to launch?\n");
printf("Each Skype client will be one channel to FreeSWITCH and use approx 70MB of ram\n");
printf("A quad core CPU can very easily support 20 or more Skype clients\n");
printf("Each Skype client allows one concurrent call\n");
printf("Eg: if you plan to have a max of 10 concurrent (outbound and/or inbound) Skype calls then enter 10\n");
printf("To accept the default, just press Enter\n");
$skype_clients_to_be_launched = &promptUser("Enter how many Skype clients will be launched ", "$skype_clients_to_be_launched");
system("clear");
printf("\n");
while(1){
printf("You want all of the Skype clients to use the same Skype login (skypeusername)?\n");
printf("eg: you want all of your skypopen channels to be Bob on the Skype network, or you want channel skype01 to be Bob, channel skype02 to be Alice, etc?\n");
printf("Please answer 'one' for all channels using the same Skype login (you'll be asked just one time for Skype login and password) or 'multi' for being asked for each channel\n");
printf("\n");
$multi_skypeusername = &promptUser("Enter 'one' or 'multi' ", "$multi_skypeusername");
system("clear");
printf("\n");
if($multi_skypeusername eq "one" or $multi_skypeusername eq "multi"){
last;
}
}
if($multi_skypeusername eq "one"){
printf("I need the Skype username which will be used by ALL the Skype clients to be launched\n");
printf("(That's the one-word you registered as login to the Skype network)\n");
printf("This installer will create the needed files to launch concurrently many (or one) instances of it\n");
printf("\n");
printf("NB: DON'T ACCEPT the DEFAULT, write YOUR OWN\n");
$skype_username = &promptUser("Enter the Skype clients username ", "$skype_username");
for($count=1; $count <= $skype_clients_to_be_launched ; $count++){
$skype_username_array[$count] = $skype_username;
}
system("clear");
printf("\n");
printf("I need the Skype password which will be used by ALL the Skype clients to be launched\n");
printf("(That's the one-word you registered as password to the Skype network)\n");
printf("\n");
printf("NB: DON'T ACCEPT the DEFAULT, write YOUR OWN\n");
$skype_password = &promptUser("Enter the Skype clients password ", "$skype_password");
for($count=1; $count <= $skype_clients_to_be_launched ; $count++){
$skype_password_array[$count] = $skype_password;
}
system("clear");
} else {
for($count=1; $count <= $skype_clients_to_be_launched ; $count++){
$skype_client_extension = $skype_clients_starting_number + $count ;
printf("I need the Skype username which will be used by the Skype client for channel 'skype$skype_client_extension'\n");
printf("(That's the one-word you registered as login to the Skype network)\n");
printf("\n");
printf("NB: DON'T ACCEPT the DEFAULT, write YOUR OWN\n");
$skype_username = &promptUser("Enter the Skype username for channel 'skype$skype_client_extension'", "$skype_username");
$skype_username_array[$count] = $skype_username;
system("clear");
printf("\n");
printf("I need the Skype password which will be used by the Skype client 'skype$skype_client_extension'\n");
printf("(That's the one-word you registered as password to the Skype network)\n");
printf("\n");
printf("NB: DON'T ACCEPT the DEFAULT, write YOUR OWN\n");
$skype_password = &promptUser("Enter the Skype password for '$skype_username'", "$skype_password");
$skype_password_array[$count] = $skype_password;
system("clear");
}
}
### GETTING FINAL APPROVAL ###
printf("\n");
printf("Please check the following values:\n");
printf("\n");
printf("directory for downloading and unpacking Skype client:\n'$skype_download_dir'\n");
printf("directory for Skype client binary:\n'$skype_binary_dir'\n");
printf("directory for FreeSWITCH modules' configs:\n'$freeswitch_modules_config_dir'\n");
printf("directory for fake sound driver:\n'$skypopen_sound_driver_dir'\n");
printf("directory for Skype clients configs:\n'$skype_config_dir'\n");
printf("directory for Skype clients startup script:\n'$skype_startup_dir'\n");
printf("directory for Skype clients symlinks:\n'$skype_symlinks_dir'\n");
printf("how many Skype clients to launch: '$skype_clients_to_be_launched'\n");
if($multi_skypeusername eq "one"){
printf("Skype login: '$skype_username'\n");
printf("Skype password: '$skype_password'\n");
}else {
for($count=1; $count <= $skype_clients_to_be_launched ; $count++){
$skype_client_extension = $skype_clients_starting_number + $count ;
printf("channel='skype$skype_client_extension' Skype login='$skype_username_array[$count]' Skype password='$skype_password_array[$count]'\n");
}
}
$sure = &promptUser("Are you sure you like the values? Write 'sure' for yes ", "$sure");
if($sure ne "sure"){
printf("No problem, please relaunch the installer and begin again\n");
exit 0;
}
system("clear");
printf("\n");
printf("GREAT! Please stand back, I'm working...\n");
printf("\n");
#### EXECUTION ###
system("mkdir -p $skype_download_dir");
system("cd $skype_download_dir ; wget -c $skype_download_url");
system("cd $skype_download_dir ; tar -xzf $skype_download_pkg");
system("mkdir -p $skype_binary_dir");
system("cd $skype_download_dir/usr/bin ; cp skype $skype_binary_dir/");
system("mkdir -p $skype_share_dir");
system("cd $skype_download_dir/usr/share/skype ; cp -a avatars $skype_share_dir/");
system("cd $skype_download_dir/usr/share/skype ; cp -a sounds $skype_share_dir/");
system("cd $skype_download_dir/usr/share/skype ; cp -a lang $skype_share_dir/");
system("mkdir -p $skypopen_sound_driver_dir");
system("cp ../oss/skypopen.ko $skypopen_sound_driver_dir/");
system("mkdir -p $skype_config_dir");
system("mkdir -p $skype_startup_dir");
system("mkdir -p $skype_symlinks_dir");
system("echo \"<configuration name=\\\"skypopen.conf\\\" description=\\\"Skypopen Configuration\\\">\" > $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \"<global_settings>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \" <param name=\\\"dialplan\\\" value=\\\"XML\\\"/>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \" <param name=\\\"context\\\" value=\\\"default\\\"/>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \" <param name=\\\"destination\\\" value=\\\"5000\\\"/>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \" <param name=\\\"skype_user\\\" value=\\\"$skype_username\\\"/>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \" <param name=\\\"report_incoming_chatmessages\\\" value=\\\"false\\\"/>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \" <param name=\\\"write_silence_when_idle\\\" value=\\\"false\\\"/>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \" <param name=\\\"setsockopt\\\" value=\\\"true\\\"/>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \"</global_settings>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \"<!-- one entry follows per each skypopen interface -->\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \"<per_interface_settings>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \"#!/bin/sh\" > $skype_startup_dir/start_skype_clients.sh");
system("echo \"#Unload possible ALSA sound modules that would conflict with our OSS fake module\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"rmmod snd_pcm_oss\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"rmmod snd_mixer_oss\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"rmmod snd_seq_oss\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"sleep 1\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"#Create the inode our fake sound driver will use\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"mknod /dev/dsp c 14 3\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"#Load our OSS fake module\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"insmod $skypopen_sound_driver_dir/skypopen.ko\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo >> $skype_startup_dir/start_skype_clients.sh");
system("echo >> $skype_startup_dir/start_skype_clients.sh");
for ($count = 1; $count <= $skype_clients_to_be_launched; $count++) {
$skype_client_extension = $skype_clients_starting_number + $count ;
$skype_login=$skype_username_array[$count];
$skype_passwd=$skype_password_array[$count];
system("ln -s $skype_binary_dir/skype $skype_symlinks_dir/skype$skype_client_extension");
system("mkdir -p $skype_config_dir/skype$skype_client_extension");
system("cp -a ../configs/skype-client-configuration-dir-template/skypeclient01/shared.* $skype_config_dir/skype$skype_client_extension");
system("cp -a ../configs/skype-client-configuration-dir-template/skypeclient01/skypenameA $skype_config_dir/skype$skype_client_extension/$skype_login");
system("echo \" <interface id=\\\"$count\\\" name=\\\"skype$skype_client_extension\\\">\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
if($multi_skypeusername ne "one"){
system("echo \" <param name=\\\"skype_user\\\" value=\\\"$skype_login\\\"/>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
}
system("echo \" <param name=\\\"X11-display\\\" value=\\\":$skype_client_extension\\\"/>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \" </interface>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \"#start the fake X server on the given port\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"/usr/bin/Xvfb :$skype_client_extension -ac -nolisten tcp -screen 0 640x480x8 &\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"sleep 3\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"# start a Skype client instance that will connect to the X server above, and will login to the Skype network using the 'username password' you send to it on stdin.\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"su root -c \\\"/bin/echo '$skype_login $skype_passwd'| DISPLAY=:$skype_client_extension $skype_symlinks_dir/skype$skype_client_extension --dbpath=$skype_config_dir/skype$skype_client_extension --pipelogin &\\\"\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo \"sleep 7\" >> $skype_startup_dir/start_skype_clients.sh");
system("echo >> $skype_startup_dir/start_skype_clients.sh");
}
system("echo \"</per_interface_settings>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \"</configuration>\" >> $freeswitch_modules_config_dir/skypopen.conf.xml");
system("echo \"exit 0\" >> $skype_startup_dir/start_skype_clients.sh");
printf("\n");
printf("SUCCESS!!!\n");
printf("\n");
#=========================================================================#
#-------------------------------------------------------------------------#
# promptUser, a Perl subroutine to prompt a user for input.
# Copyright 2010 Alvin Alexander, devdaily.com.
# This code is shared here under the
# Creative Commons Attribution-ShareAlike Unported 3.0 license.
# See http://creativecommons.org/licenses/by-sa/3.0/ for more information.
#-------------------------------------------------------------------------#
# Original at: http://www.devdaily.com/perl/edu/articles/pl010005
# Modified to get confirmations by Giovanni Maruzzelli
#----------------------------( promptUser )-----------------------------#
# #
# FUNCTION: promptUser #
# #
# PURPOSE: Prompt the user for some type of input, and return the #
# input back to the calling program. #
# #
# ARGS: $promptString - what you want to prompt the user with #
# $defaultValue - (optional) a default value for the prompt #
# #
#-------------------------------------------------------------------------#
sub promptUser {
#-------------------------------------------------------------------#
# two possible input arguments - $promptString, and $defaultValue #
# make the input arguments local variables. #
#-------------------------------------------------------------------#
local($promptString,$defaultValue) = @_;
local $input;
local $confirm;
local $gave;
#-------------------------------------------------------------------#
# if there is a default value, use the first print statement; if #
# no default is provided, print the second string. #
#-------------------------------------------------------------------#
while(1){
printf("\n");
if ($defaultValue) {
print $promptString, "\n[", $defaultValue, "]: ";
} else {
print $promptString, ": ";
}
$| = 1; # force a flush after our print
$input = <STDIN>; # get the input from STDIN (presumably the keyboard)
#------------------------------------------------------------------#
# remove the newline character from the end of the input the user #
# gave us. #
#------------------------------------------------------------------#
chomp($input);
$gave = $input ? $input : $defaultValue;
print("You gave: '$gave'\nIt's OK? Please answer 'Y' for yes or 'N' for not [N]: ");
$| = 1; # force a flush after our print
$confirm = <STDIN>;
chomp($confirm);
if($confirm eq "Y" or $confirm eq "y"){
last;
}
}
#-----------------------------------------------------------------#
# if we had a $default value, and the user gave us input, then #
# return the input; if we had a default, and they gave us no #
# no input, return the $defaultValue. #
# #
# if we did not have a default value, then just return whatever #
# the user gave us. if they just hit the <enter> key, #
# the calling routine will have to deal with that. #
#-----------------------------------------------------------------#
if ("$defaultValue") {
return $input ? $input : $defaultValue; # return $_ if it has a value
} else {
return $input;
}
}
+52 -37
View File
@@ -462,6 +462,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
left in the initial state, nothing will happen. */
switch_channel_set_state(channel, CS_ROUTING);
DEBUGA_SKYPE("%s CHANNEL INIT %s\n", SKYPOPEN_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session));
switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(session), sizeof(tech_pvt->session_uuid_str));
return SWITCH_STATUS_SUCCESS;
}
@@ -937,16 +938,21 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
char *p = digit_str;
switch_channel_t *channel = switch_core_session_get_channel(session);
while (p && *p) {
switch_dtmf_t dtmf;
dtmf.digit = *p;
dtmf.duration = SWITCH_DEFAULT_DTMF_DURATION;
switch_channel_queue_dtmf(channel, &dtmf);
p++;
if(channel){
while (p && *p) {
switch_dtmf_t dtmf;
dtmf.digit = *p;
dtmf.duration = SWITCH_DEFAULT_DTMF_DURATION;
switch_channel_queue_dtmf(channel, &dtmf);
p++;
}
NOTICA("DTMF DETECTED: [%s] new_dtmf_timestamp: %u, delta_t: %u\n", SKYPOPEN_P_LOG, digit_str, (unsigned int) new_dtmf_timestamp,
(unsigned int) (new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp));
tech_pvt->old_dtmf_timestamp = new_dtmf_timestamp;
}else{
WARNINGA("NO CHANNEL ?\n", SKYPOPEN_P_LOG);
}
NOTICA("DTMF DETECTED: [%s] new_dtmf_timestamp: %u, delta_t: %u\n", SKYPOPEN_P_LOG, digit_str, (unsigned int) new_dtmf_timestamp,
(unsigned int) (new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp));
tech_pvt->old_dtmf_timestamp = new_dtmf_timestamp;
}
}
}
@@ -1733,6 +1739,7 @@ static switch_status_t load_config(int reload_type)
switch_threadattr_create(&skypopen_api_thread_attr, skypopen_module_pool);
switch_threadattr_detach_set(skypopen_api_thread_attr, 0);
switch_threadattr_stacksize_set(skypopen_api_thread_attr, SWITCH_THREAD_STACKSIZE);
//switch_threadattr_priority_increase(skypopen_api_thread_attr);
switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id].skypopen_api_thread,
skypopen_api_thread_attr, skypopen_do_skypeapi_thread, &globals.SKYPOPEN_INTERFACES[interface_id],
skypopen_module_pool);
@@ -1742,6 +1749,7 @@ static switch_status_t load_config(int reload_type)
switch_threadattr_create(&skypopen_signaling_thread_attr, skypopen_module_pool);
switch_threadattr_detach_set(skypopen_signaling_thread_attr, 0);
switch_threadattr_stacksize_set(skypopen_signaling_thread_attr, SWITCH_THREAD_STACKSIZE);
//switch_threadattr_priority_increase(skypopen_signaling_thread_attr);
switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id].
skypopen_signaling_thread, skypopen_signaling_thread_attr,
skypopen_signaling_thread_func, &globals.SKYPOPEN_INTERFACES[interface_id], skypopen_module_pool);
@@ -2135,40 +2143,45 @@ int dtmf_received(private_t *tech_pvt, char *value)
switch_channel_t *channel = NULL;
session = switch_core_session_locate(tech_pvt->session_uuid_str);
channel = switch_core_session_get_channel(session);
if (session) {
channel = switch_core_session_get_channel(session);
if (channel) {
if (channel) {
if (switch_channel_test_flag(channel, CF_BRIDGED)
&& !switch_true(switch_channel_get_variable(channel, "skype_add_outband_dtmf_also_when_bridged"))) {
if (switch_channel_test_flag(channel, CF_BRIDGED)
&& !switch_true(switch_channel_get_variable(channel, "skype_add_outband_dtmf_also_when_bridged"))) {
NOTICA
("received DTMF '%c' on channel %s, but we're BRIDGED, so we DO NOT relay it out of band. If you DO want to relay it out of band when bridged too, on top of audio DTMF, set the channel variable 'skype_add_outband_dtmf_also_when_bridged=true' \n",
SKYPOPEN_P_LOG, value[0], switch_channel_get_name(channel));
NOTICA
("received DTMF '%c' on channel %s, but we're BRIDGED, so we DO NOT relay it out of band. If you DO want to relay it out of band when bridged too, on top of audio DTMF, set the channel variable 'skype_add_outband_dtmf_also_when_bridged=true' \n",
SKYPOPEN_P_LOG, value[0], switch_channel_get_name(channel));
} else {
switch_dtmf_t dtmf = { (char) value[0], switch_core_default_dtmf_duration(0) };
DEBUGA_SKYPE("received DTMF %c on channel %s\n", SKYPOPEN_P_LOG, dtmf.digit, switch_channel_get_name(channel));
switch_mutex_lock(tech_pvt->flag_mutex);
switch_channel_queue_dtmf(channel, &dtmf);
switch_set_flag(tech_pvt, TFLAG_DTMF);
switch_mutex_unlock(tech_pvt->flag_mutex);
}
} else {
switch_dtmf_t dtmf = { (char) value[0], switch_core_default_dtmf_duration(0) };
DEBUGA_SKYPE("received DTMF %c on channel %s\n", SKYPOPEN_P_LOG, dtmf.digit, switch_channel_get_name(channel));
switch_mutex_lock(tech_pvt->flag_mutex);
switch_channel_queue_dtmf(channel, &dtmf);
switch_set_flag(tech_pvt, TFLAG_DTMF);
switch_mutex_unlock(tech_pvt->flag_mutex);
WARNINGA("received %c DTMF, but no channel?\n", SKYPOPEN_P_LOG, value[0]);
}
} else {
WARNINGA("received %c DTMF, but no channel?\n", SKYPOPEN_P_LOG, value[0]);
switch_core_session_rwunlock(session);
}else{
WARNINGA("received %c DTMF, but no session?\n", SKYPOPEN_P_LOG, value[0]);
}
switch_core_session_rwunlock(session);
return 0;
}
int start_audio_threads(private_t *tech_pvt)
{
switch_threadattr_t *thd_attr = NULL;
switch_threadattr_t *tcp_srv_thread_thd_attr = NULL;
switch_threadattr_t *tcp_cli_thread_thd_attr = NULL;
tech_pvt->begin_to_write = 0;
tech_pvt->begin_to_read = 0;
@@ -2194,12 +2207,13 @@ int start_audio_threads(private_t *tech_pvt)
switch_core_timer_sync(&tech_pvt->timer_write);
switch_threadattr_create(&thd_attr, skypopen_module_pool);
switch_threadattr_detach_set(thd_attr, 0);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_threadattr_create(&tcp_srv_thread_thd_attr, skypopen_module_pool);
switch_threadattr_detach_set(tcp_srv_thread_thd_attr, 0);
switch_threadattr_stacksize_set(tcp_srv_thread_thd_attr, SWITCH_THREAD_STACKSIZE);
switch_threadattr_priority_increase(tcp_srv_thread_thd_attr);
switch_mutex_lock(tech_pvt->mutex_thread_audio_srv);
//DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG);
if (switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypopen_do_tcp_srv_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) {
if (switch_thread_create(&tech_pvt->tcp_srv_thread, tcp_srv_thread_thd_attr, skypopen_do_tcp_srv_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) {
DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPOPEN_P_LOG);
} else {
ERRORA("failed to start tcp_srv_thread thread.\n", SKYPOPEN_P_LOG);
@@ -2210,12 +2224,13 @@ int start_audio_threads(private_t *tech_pvt)
switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv);
//DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG);
switch_threadattr_create(&thd_attr, skypopen_module_pool);
switch_threadattr_detach_set(thd_attr, 0);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_threadattr_create(&tcp_cli_thread_thd_attr, skypopen_module_pool);
switch_threadattr_detach_set(tcp_cli_thread_thd_attr, 0);
switch_threadattr_stacksize_set(tcp_cli_thread_thd_attr, SWITCH_THREAD_STACKSIZE);
switch_threadattr_priority_increase(tcp_cli_thread_thd_attr);
switch_mutex_lock(tech_pvt->mutex_thread_audio_cli);
//DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG);
if (switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypopen_do_tcp_cli_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) {
if (switch_thread_create(&tech_pvt->tcp_cli_thread, tcp_cli_thread_thd_attr, skypopen_do_tcp_cli_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) {
DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPOPEN_P_LOG);
} else {
ERRORA("failed to start tcp_cli_thread thread.\n", SKYPOPEN_P_LOG);
+1 -1
View File
@@ -1,6 +1,6 @@
# Comment/uncomment the following line to disable/enable debugging
#DEBUG = y
#LDDINC=/usr/src/linux-headers-2.6.32-26-server/include
#LDDINC=
# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
+8 -56
View File
@@ -43,12 +43,13 @@
#include "skypopen.h" /* local definitions */
/*
* Our parameters which can be set at load time.
*/
int skypopen_major = SKYPOPEN_MAJOR;
int skypopen_minor = 3;
int skypopen_minor = SKYPOPEN_MINOR;
int skypopen_nr_devs = SKYPOPEN_NR_DEVS; /* number of bare skypopen devices */
module_param(skypopen_major, int, S_IRUGO);
@@ -61,9 +62,6 @@ MODULE_LICENSE("Dual BSD/GPL");
static struct skypopen_dev *skypopen_devices; /* allocated in skypopen_init_module */
static int unload = 0;
#ifdef CENTOS
#define HRTIMER_MODE_REL HRTIMER_REL
#endif// CENTOS
#ifndef WANT_HRTIMER
void my_timer_callback_inq( unsigned long data )
@@ -84,7 +82,7 @@ void my_timer_callback_outq( unsigned long data )
}
#else// WANT_HRTIMER
#ifndef CENTOS
#ifndef CENTOS_5
static enum hrtimer_restart my_hrtimer_callback_inq( struct hrtimer *timer_inq )
{
struct skypopen_dev *dev = container_of(timer_inq, struct skypopen_dev, timer_inq);
@@ -113,7 +111,7 @@ static enum hrtimer_restart my_hrtimer_callback_outq( struct hrtimer *timer_outq
return HRTIMER_RESTART;
}
#else// CENTOS
#else// CENTOS_5
static int my_hrtimer_callback_inq( struct hrtimer *timer_inq )
{
struct skypopen_dev *dev = container_of(timer_inq, struct skypopen_dev, timer_inq);
@@ -138,7 +136,7 @@ static int my_hrtimer_callback_outq( struct hrtimer *timer_outq )
return HRTIMER_RESTART;
}
#endif// CENTOS
#endif// CENTOS_5
#endif// WANT_HRTIMER
/* The clone-specific data structure includes a key field */
@@ -159,10 +157,6 @@ static struct skypopen_dev *skypopen_c_lookfor_device(dev_t key)
{
struct skypopen_listitem *lptr;
#ifdef WANT_HRTIMER
#if 0
ktime_t ktime_inq;
ktime_t ktime_outq;
#endif //0
#endif// WANT_HRTIMER
list_for_each_entry(lptr, &skypopen_c_list, list) {
@@ -181,6 +175,7 @@ static struct skypopen_dev *skypopen_c_lookfor_device(dev_t key)
init_waitqueue_head(&lptr->device.inq);
init_waitqueue_head(&lptr->device.outq);
#ifndef WANT_HRTIMER
setup_timer( &lptr->device.timer_inq, my_timer_callback_inq, (long int)lptr );
setup_timer( &lptr->device.timer_outq, my_timer_callback_outq, (long int)lptr );
@@ -188,19 +183,6 @@ static struct skypopen_dev *skypopen_c_lookfor_device(dev_t key)
mod_timer( &lptr->device.timer_inq, jiffies + msecs_to_jiffies(SKYPOPEN_SLEEP) );
printk( "Starting skypopen OSS driver write timer (%dms) skype client:(%d)\n", SKYPOPEN_SLEEP, current->tgid );
mod_timer( &lptr->device.timer_outq, jiffies + msecs_to_jiffies(SKYPOPEN_SLEEP) );
#else// WANT_HRTIMER
#if 0
ktime_inq = ktime_set( 0, SKYPOPEN_SLEEP * 1000000);
hrtimer_init( &lptr->device.timer_inq, CLOCK_MONOTONIC, HRTIMER_MODE_REL );
lptr->device.timer_inq.function = &my_hrtimer_callback_inq;
hrtimer_start( &lptr->device.timer_inq, ktime_inq, HRTIMER_MODE_REL );
ktime_outq = ktime_set( 0, SKYPOPEN_SLEEP * 1000000);
hrtimer_init( &lptr->device.timer_outq, CLOCK_MONOTONIC, HRTIMER_MODE_REL );
lptr->device.timer_outq.function = &my_hrtimer_callback_outq;
hrtimer_start( &lptr->device.timer_outq, ktime_outq, HRTIMER_MODE_REL );
#endif
#endif// WANT_HRTIMER
/* place it in the list */
@@ -249,14 +231,12 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count,
loff_t *f_pos)
{
DEFINE_WAIT(wait);
size_t written;
struct skypopen_dev *dev = filp->private_data;
if(unload)
return -1;
#ifdef WANT_HRTIMER
#if 1
if(dev->timer_inq_started == 0){
ktime_t ktime_inq;
@@ -266,39 +246,13 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count,
hrtimer_start( &dev->timer_inq, ktime_inq, HRTIMER_MODE_REL );
dev->timer_inq_started = 1;
}
#endif
#endif// WANT_HRTIMER
//printk("READ\n");
prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE);
schedule();
finish_wait(&dev->inq, &wait);
if (!count)
return 0;
if (!access_ok(VERIFY_WRITE, buf, count))
return -EFAULT;
written = 0;
while (count) {
unsigned long unwritten;
size_t chunk = count;
if (chunk > PAGE_SIZE)
chunk = PAGE_SIZE; /* Just for latency reasons */
unwritten = __clear_user(buf, chunk);
written += chunk - unwritten;
if (unwritten)
break;
if (signal_pending(current))
return written ? written : -ERESTARTSYS;
buf += chunk;
count -= chunk;
cond_resched();
}
return written ? written : -EFAULT;
return count;
}
static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count,
@@ -311,7 +265,6 @@ static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t
return -1;
#ifdef WANT_HRTIMER
#if 1
if(dev->timer_outq_started == 0){
ktime_t ktime_outq;
@@ -321,10 +274,8 @@ static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t
hrtimer_start( &dev->timer_outq, ktime_outq, HRTIMER_MODE_REL );
dev->timer_outq_started = 1;
}
#endif
#endif// WANT_HRTIMER
//printk("WRITE\n");
prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE);
schedule();
@@ -448,6 +399,7 @@ int skypopen_init_module(void)
dev_t dev = 0;
printk("skypopen OSS driver loading (www.freeswitch.org)\n");
/*
* Get a range of minor numbers to work with, asking for a dynamic
* major unless directed otherwise at load time.
+21 -24
View File
@@ -1,6 +1,7 @@
/*
* skypopen.h -- definitions for the char module
*
* Copyright (C) 2010 Giovanni Maruzzelli
* Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet
* Copyright (C) 2001 O'Reilly & Associates
*
@@ -18,22 +19,30 @@
#ifndef _SKYPOPEN_H_
#define _SKYPOPEN_H_
#include <linux/version.h>
#include <linux/ioctl.h> /* needed for the _IOW etc stuff used later */
#define SKYPOPEN_BLK 960
#define SKYPOPEN_SLEEP 10
#define CENTOS
#ifndef SKYPOPEN_MAJOR
#define SKYPOPEN_MAJOR 14 /* dynamic major by default */
#endif
#ifndef SKYPOPEN_NR_DEVS
#define SKYPOPEN_NR_DEVS 1 /* skypopen0 through skypopen3 */
#endif
#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 18)
#define CENTOS_5
#define WANT_HRTIMER /* undef this only if you don't want to use High Resolution Timers (why?) */
#endif /* CentOS 5.x */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
#define WANT_HRTIMER
#endif /* HRTIMER */
#define SKYPOPEN_BLK 1920
#define SKYPOPEN_SLEEP 20
#define SKYPOPEN_MAJOR 14 /* dynamic major by default */
#define SKYPOPEN_MINOR 3 /* dynamic major by default */
#define SKYPOPEN_NR_DEVS 1 /* not useful, I'm too lazy to remove it */
#ifdef CENTOS_5
#define HRTIMER_MODE_REL HRTIMER_REL
#endif// CENTOS_5
struct skypopen_dev {
struct cdev cdev; /* Char device structure */
wait_queue_head_t inq; /* read and write queues */
@@ -56,16 +65,4 @@ struct skypopen_dev {
extern int skypopen_major; /* main.c */
extern int skypopen_nr_devs;
/*
* Prototypes for shared functions
*/
//ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count,
//loff_t *f_pos);
//ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count,
//loff_t *f_pos);
//int skypopen_ioctl(struct inode *inode, struct file *filp,
//unsigned int cmd, unsigned long arg);
#endif /* _SKYPOPEN_H_ */
@@ -1,7 +0,0 @@
# Since these devices are not part of 'sound' subsystem the group is forced
# to audio by name
# /dev/cuse can stay mode 0660 root:root since osspd is run as root
# and drops privileges to user level when opened by user
KERNEL=="dsp", GROUP="audio"
KERNEL=="mixer", GROUP="audio"
KERNEL=="adsp", GROUP="audio"
@@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
@@ -1,69 +0,0 @@
# These can be overridden if needed
# DESTDIR is completely respected
CC := gcc
AR := ar
CFLAGS := -Wall $(CFLAGS)
XLDFLAGS := $(LDFLAGS)
LDFLAGS := -L. -lossp $(LDFLAGS)
prefix := /usr/local
DESTDIR :=
UDEVDIR := /etc/udev/rules.d
ifeq "$(origin OSSPD_CFLAGS)" "undefined"
OSSPD_CFLAGS := $(shell pkg-config --cflags fuse)
endif
ifeq "$(origin OSSPD_LDFLAGS)" "undefined"
OSSPD_LDFLAGS := $(shell pkg-config --libs fuse)
endif
ifeq "$(origin OSSP_PADSP_CFLAGS)" "undefined"
OSSP_PADSP_CFLAGS := $(shell pkg-config --cflags libpulse)
endif
ifeq "$(origin OSSP_PADSP_LDFLAGS)" "undefined"
OSSP_PADSP_LDFLAGS := $(shell pkg-config --libs libpulse)
endif
ifeq "$(origin OSSP_ALSAP_CFLAGS)" "undefined"
OSSP_ALSAP_CFLAGS := $(shell pkg-config --libs alsa)
endif
ifeq "$(origin OSSP_ALSAP_LDFLAGS)" "undefined"
OSSP_ALSAP_LDFLAGS := $(shell pkg-config --libs alsa)
endif
headers := ossp.h ossp-util.h ossp-slave.h
#all: osspd ossp-padsp ossp-alsap
all: osspd ossp-alsap
install:
mkdir -p $(DESTDIR)$(prefix)/sbin
install -m755 osspd ossp-padsp ossp-alsap $(DESTDIR)$(prefix)/sbin
mkdir -p $(DESTDIR)$(UDEVDIR)
install -m644 98-osscuse.rules $(DESTDIR)$(UDEVDIR)
libossp.a: ossp.c ossp.h ossp-util.c ossp-util.h ossp-slave.c ossp-slave.h
$(CC) $(CFLAGS) -c -o ossp.o ossp.c
$(CC) $(CFLAGS) -c -o ossp-util.o ossp-util.c
$(CC) $(CFLAGS) -c -o ossp-slave.o ossp-slave.c
$(AR) rc $@ ossp.o ossp-util.o ossp-slave.o
osspd: osspd.c libossp.a $(headers)
$(CC) $(CFLAGS) $(OSSPD_CFLAGS) -o $@ $< $(OSSPD_LDFLAGS) $(LDFLAGS)
ossp-padsp: ossp-padsp.c libossp.a $(headers)
$(CC) $(CFLAGS) $(OSSP_PADSP_CFLAGS) -o $@ $< $(OSSP_PADSP_LDFLAGS) $(LDFLAGS)
ossp-alsap: ossp-alsap.c libossp.a $(headers)
$(CC) $(CFLAGS) $(OSSP_ALSAP_CFLAGS) -o $@ $< $(OSSP_ALSAP_LDFLAGS) $(LDFLAGS)
osstest: osstest.c
$(CC) $(CFLAGS) -o $@ $< $(XLDFLAGS)
test: osstest
@./osstest
clean:
rm -f *.o *.a osspd ossp-padsp ossp-alsap osstest
@@ -1,119 +0,0 @@
OSS Proxy - emulate OSS device using CUSE
Copyright (C) 2008-2009 SUSE Linux Products GmbH
Copyright (C) 2008-2009 Tejun Heo <tj@kernel.org>
1. What is it?
--------------
Well, first, OSS refers to Open Sound System. If it still doesn't
ring a bell, think /dev/dsp, /dev/adsp and /dev/mixer.
Currently, Linux supports two audio programming interface - ALSA and
OSS. The latter one is deprecated and has been that way for a long
time but there still are applications which still use them including
UML (usermode Linux) host sound support.
ALSA contains OSS emulation but sadly the emulation is behind
multiplexing layer (which is in userland) which means that if your
sound card doesn't support multiple audio streams, only either one of
ALSA or OSS interface would be usable at any given moment.
There have been also attempts to emulate OSS in userland using dynamic
library preloading - aoss and more recently padsp. This works for
many applications but it's just not easy to emulate everything using
the technique. Things like polling, signals, forking, privilege
changes make it very difficult to emulate things reliably.
OSS Proxy uses CUSE (extension of FUSE allowing character devices to
be implemented in userspace) to implement OSS interface - /dev/dsp,
/dev/adsp and /dev/mixer. From the POV of the applications, these
devices are proper character devices and behave exactly the same way
so it can be made quite versatile.
2. Hmmm... So, how does the whole thing work?
---------------------------------------------
The OSS Proxy daemon - osspd - should be started first. Note that
osspd will fail to start if sound device number regions are already
occupied. You'll need to turn off OSS or its emulation[1].
On startup, osspd creates /dev/dsp, /dev/adsp and /dev/mixer using
CUSE. When an application access one of the devices, all IOs are
redirected to osspd via CUSE. Upon receiving a new DSP open request,
osspd creates a slave process which drops the root privilege and
assumes the opening process's credentials. After handshaking, osspd
forwards all relevant IOs to the slave which is responsible for
actually playing the sound.
Currently there's only one slave implemented - ossp-padsp, which as
the name suggests forwards (again) the sound to pulseaudio. To sum
up, the whole pipe looks like the following.
App <-> /dev/dsp <-> CUSE <-> osspd <-> ossp-padsp <-> pulseaudio
Which is a lot of forwarding, but on modern machines, it won't be too
noticeable.
3. What works?
--------------
Well, MIDI part isn't implemented and I doubt it will be in any near
future but except that everything should work. Playing, recording,
5.1ch, A-V syncing, all should work. If not, it's a bug, so please
report.
The mixer behaves a bit differently tho. In the original OSS,
/dev/mixer is the hardware mixer, so adjusting volumes there affects
all audio streams. When using ossp, each process group gets its own
mixer and the mixer always contains only two knobs - PCM and IGAIN.
Combined with per-stream volume control of pulseaudio, this scheme
works quite well for applications with embedded volume control
although it makes standalone OSS mixer programs virtually useless[2].
4. How do I use it?
-------------------
First you need CUSE support in kernel which might land on 2.6.28 with
sufficient luck[3] and then you also need libfuse which supports
CUSE[4]. Once you have both, it should be easy. First build it by
running `make'. You can set OSSPD_CFLAGS, OSSPD_LDFLAGS,
OSSP_PADSP_CFLAGS and OSSP_PADSP_LDFLAGS if you have stuff at
non-default locations.
After build completes, there will be two executables - `osspd' and
`ossp-padsp'. Just copy them to where other system executables live.
Specific location doesn't matter as long as both files end up in the
same directory.
Execute `osspd'. It will create the device files and you're all set.
`osspd' uses syslog with LOG_DAEMON facility, so if something doesn't
work take a look at what osspd complains about.
[1] As of this writing, turning on any sound support makes the
soundcore module claim OSS device regions. Patch to make it claim
OSS device regions only when OSS support or emulation is enabled
is scheduled for 2.6.28. Even with the patch, soundcore will
claim OSS device regions if OSS support or ALSA OSS emulation is
enabled. Make sure they're turned off.
[2] If you have a strong reason to use standalone OSS mixer program,
you can play some shell tricks to put it into the same process
group as the target audio application. e.g. To use aumix with
mpg123 - `(mpg123 asdf.mp3 > /dev/null 2>&1 & aumix)', but
seriously, just use PA or ALSA one.
[3] For the time being, here's the git tree with all the necessary
changes. This tree is base on top of 2.6.27-rc3.
http://git.kernel.org/?p=linux/kernel/git/tj/misc.git;a=shortlog;h=cuse
git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git cuse
[4] And libfuse with the modifications can be found at...
http://userweb.kernel.org/~tj/ossp/fuse-cuse.tar.gz
@@ -1,613 +0,0 @@
/*
* ossp-alsap - ossp DSP slave which forwards to alsa
*
* Copyright (C) 2009 Maarten Lankhorst <m.b.lankhorst@gmail.com>
*
* This file is released under the GPLv2.
*
* Why an alsa plugin as well? Just to show how much
* the alsa userspace api sucks ;-)
*/
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <libgen.h>
#include <limits.h>
#include <poll.h>
#include <pthread.h>
#include <pwd.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <alsa/asoundlib.h>
#include <sys/soundcard.h>
#include "ossp-slave.h"
enum {
AFMT_FLOAT = 0x00004000,
AFMT_S32_LE = 0x00001000,
AFMT_S32_BE = 0x00002000,
};
static size_t page_size;
/* alsa structures */
static snd_pcm_t *pcm[2];
static snd_pcm_hw_params_t *hw_params;
static snd_pcm_sw_params_t *sw_params;
static int block;
static unsigned int byte_counter[2];
static snd_pcm_uframes_t mmap_pos[2];
static int stream_corked[2];
static int stream_notify;
static struct format {
snd_pcm_format_t format;
snd_pcm_sframes_t rate;
int channels;
} hw_format = { SND_PCM_FORMAT_U8, 8000, 1 };
#if 0
/* future mmap stuff */
static size_t mmap_raw_size, mmap_size;
static int mmap_fd[2] = { -1, -1 };
static void *mmap_map[2];
static uint64_t mmap_idx[2]; /* mmap pointer */
static uint64_t mmap_last_idx[2]; /* last idx for get_ptr */
static struct ring_buf mmap_stg[2]; /* staging ring buffer */
static size_t mmap_lead[2]; /* lead bytes */
static int mmap_sync[2]; /* sync with backend stream */
#endif
static snd_pcm_format_t fmt_oss_to_alsa(int fmt)
{
switch (fmt) {
case AFMT_U8: return SND_PCM_FORMAT_U8;
case AFMT_A_LAW: return SND_PCM_FORMAT_A_LAW;
case AFMT_MU_LAW: return SND_PCM_FORMAT_MU_LAW;
case AFMT_S16_LE: return SND_PCM_FORMAT_S16_LE;
case AFMT_S16_BE: return SND_PCM_FORMAT_S16_BE;
case AFMT_FLOAT: return SND_PCM_FORMAT_FLOAT;
case AFMT_S32_LE: return SND_PCM_FORMAT_S32_LE;
case AFMT_S32_BE: return SND_PCM_FORMAT_S32_BE;
default: return SND_PCM_FORMAT_U8;
}
}
static int fmt_alsa_to_oss(snd_pcm_format_t fmt)
{
switch (fmt) {
case SND_PCM_FORMAT_U8: return AFMT_U8;
case SND_PCM_FORMAT_A_LAW: return AFMT_A_LAW;
case SND_PCM_FORMAT_MU_LAW: return AFMT_MU_LAW;
case SND_PCM_FORMAT_S16_LE: return AFMT_S16_LE;
case SND_PCM_FORMAT_S16_BE: return AFMT_S16_BE;
case SND_PCM_FORMAT_FLOAT: return AFMT_FLOAT;
case SND_PCM_FORMAT_S32_LE: return AFMT_S32_LE;
case SND_PCM_FORMAT_S32_BE: return AFMT_S32_BE;
default: return AFMT_U8;
}
}
static void flush_streams(int drain)
{
/* FIXME: snd_pcm_drain appears to be able to deadlock,
* always drop or check state? */
if (drain) {
if (pcm[PLAY])
snd_pcm_drain(pcm[PLAY]);
if (pcm[REC])
snd_pcm_drain(pcm[REC]);
} else {
if (pcm[PLAY])
snd_pcm_drop(pcm[PLAY]);
if (pcm[REC])
snd_pcm_drop(pcm[REC]);
}
/* XXX: Really needed? */
#if 0
if (pcm[PLAY]) {
snd_pcm_close(pcm[PLAY]);
snd_pcm_open(&pcm[PLAY], "default",
SND_PCM_STREAM_PLAYBACK, block);
}
if (pcm[REC]) {
snd_pcm_close(pcm[REC]);
snd_pcm_open(&pcm[REC], "default",
SND_PCM_STREAM_CAPTURE, block);
}
#endif
}
static void kill_streams(void)
{
flush_streams(0);
}
static int trigger_streams(int play, int rec)
{
int ret = 0;
if (pcm[PLAY] && play >= 0) {
ret = snd_pcm_sw_params_set_start_threshold(pcm[PLAY], sw_params,
play ? 1 : -1);
if (ret >= 0)
snd_pcm_sw_params(pcm[PLAY], sw_params);
}
if (ret >= 0 && pcm[REC] && rec >= 0) {
ret = snd_pcm_sw_params_set_start_threshold(pcm[REC], sw_params,
rec ? 1 : -1);
if (ret >= 0)
snd_pcm_sw_params(pcm[REC], sw_params);
}
return ret;
}
static ssize_t alsap_mixer(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
return -EBUSY;
}
static int set_hw_params(snd_pcm_t *pcm)
{
int ret;
unsigned rate;
ret = snd_pcm_hw_params_any(pcm, hw_params);
if (ret >= 0)
ret = snd_pcm_hw_params_set_access(pcm, hw_params,
SND_PCM_ACCESS_RW_INTERLEAVED);
rate = hw_format.rate;
if (ret >= 0)
ret = snd_pcm_hw_params_set_rate_minmax(pcm, hw_params,
&rate, NULL,
&rate, NULL);
if (ret >= 0)
ret = snd_pcm_hw_params_set_format(pcm, hw_params, hw_format.format);
if (ret >= 0)
ret = snd_pcm_hw_params_set_channels(pcm, hw_params,
hw_format.channels);
if (ret >= 0)
ret = snd_pcm_hw_params(pcm, hw_params);
if (ret >= 0)
ret = snd_pcm_sw_params_current(pcm, sw_params);
if (ret >= 0)
ret = snd_pcm_sw_params(pcm, sw_params);
return ret;
}
static ssize_t alsap_open(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
struct ossp_dsp_open_arg *arg = carg;
int ret;
block = arg->flags & O_NONBLOCK ? SND_PCM_NONBLOCK : 0;
int access;
// block |= SND_PCM_ASYNC;
/* Woop dee dooo.. I love handling things in SIGIO (PAIN!!)
* Probably needed for MMAP
*/
if (!hw_params)
ret = snd_pcm_hw_params_malloc(&hw_params);
if (ret < 0)
return ret;
if (!sw_params)
ret = snd_pcm_sw_params_malloc(&sw_params);
if (ret < 0)
return ret;
if (pcm[PLAY])
snd_pcm_close(pcm[PLAY]);
if (pcm[REC])
snd_pcm_close(pcm[REC]);
pcm[REC] = pcm[PLAY] = NULL;
access = arg->flags & O_ACCMODE;
if (access == O_WRONLY || access == O_RDWR) {
ret = snd_pcm_open(&pcm[PLAY], "default",
SND_PCM_STREAM_PLAYBACK, block);
if (ret >= 0)
ret = set_hw_params(pcm[PLAY]);
}
if (ret >= 0 && (access == O_RDONLY || access == O_RDWR)) {
ret = snd_pcm_open(&pcm[REC], "default",
SND_PCM_STREAM_CAPTURE, block);
if (ret >= 0)
ret = set_hw_params(pcm[REC]);
}
if (ret < 0) {
if (pcm[PLAY])
snd_pcm_close(pcm[PLAY]);
if (pcm[REC])
snd_pcm_close(pcm[REC]);
pcm[REC] = pcm[PLAY] = NULL;
return ret;
}
return 0;
}
#define GIOVANNI
#ifdef GIOVANNI
#define GIOVA_SLEEP 40000
#define GIOVA_BLK 3840
static ssize_t alsap_write(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
usleep((GIOVA_SLEEP/GIOVA_BLK)* din_sz);
return din_sz;
}
static ssize_t alsap_read(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
usleep((GIOVA_SLEEP/GIOVA_BLK)* *dout_szp);
return *dout_szp;
}
#else// GIOVANNI
static ssize_t alsap_write(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
// struct ossp_dsp_rw_arg *arg = carg;
int ret, insize;
insize = snd_pcm_bytes_to_frames(pcm[PLAY], din_sz);
if (snd_pcm_state(pcm[PLAY]) == SND_PCM_STATE_SETUP)
snd_pcm_prepare(pcm[PLAY]);
// snd_pcm_start(pcm[PLAY]);
ret = snd_pcm_writei(pcm[PLAY], din, insize);
if (ret < 0)
ret = snd_pcm_recover(pcm[PLAY], ret, 1);
if (ret >= 0)
return snd_pcm_frames_to_bytes(pcm[PLAY], ret);
else
return ret;
}
static ssize_t alsap_read(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
// struct ossp_dsp_rw_arg *arg = carg;
int ret, outsize;
outsize = snd_pcm_bytes_to_frames(pcm[REC], *dout_szp);
if (snd_pcm_state(pcm[REC]) == SND_PCM_STATE_SETUP)
snd_pcm_prepare(pcm[REC]);
ret = snd_pcm_readi(pcm[REC], dout, outsize);
if (ret < 0)
ret = snd_pcm_recover(pcm[REC], ret, 1);
if (ret >= 0)
*dout_szp = ret = snd_pcm_frames_to_bytes(pcm[REC], ret);
else
*dout_szp = 0;
return ret;
}
#endif// GIOVANNI
static ssize_t alsap_poll(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
unsigned revents = 0;
stream_notify |= *(int *)carg;
if (pcm[PLAY])
revents |= POLLOUT;
if (pcm[REC])
revents |= POLLIN;
*(unsigned *)rarg = revents;
return 0;
}
static ssize_t alsap_flush(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
flush_streams(opcode == OSSP_DSP_SYNC);
return 0;
}
static ssize_t alsap_post(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
int ret;
ret = trigger_streams(1, 1);
if (ret >= 0 && pcm[PLAY])
ret = snd_pcm_start(pcm[PLAY]);
if (pcm[REC])
ret = snd_pcm_start(pcm[REC]);
return ret;
}
static ssize_t alsap_get_param(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp,
int tfd)
{
int v = 0;
switch (opcode) {
case OSSP_DSP_GET_RATE:
return hw_format.rate;
case OSSP_DSP_GET_CHANNELS:
return hw_format.channels;
case OSSP_DSP_GET_FORMAT: {
v = fmt_alsa_to_oss(hw_format.format);
break;
}
case OSSP_DSP_GET_BLKSIZE: {
snd_pcm_uframes_t psize;
snd_pcm_hw_params_get_period_size(hw_params, &psize, NULL);
v = psize;
break;
}
case OSSP_DSP_GET_FORMATS:
v = AFMT_U8 | AFMT_A_LAW | AFMT_MU_LAW | AFMT_S16_LE |
AFMT_S16_BE | AFMT_FLOAT | AFMT_S32_LE | AFMT_S32_BE;
break;
case OSSP_DSP_GET_TRIGGER:
if (!stream_corked[PLAY])
v |= PCM_ENABLE_OUTPUT;
if (!stream_corked[REC])
v |= PCM_ENABLE_INPUT;
break;
default:
assert(0);
}
*(int *)rarg = v;
return 0;
}
static ssize_t alsap_set_param(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp,
int tfd)
{
int v = *(int *)carg;
int ret = 0;
/* kill the streams before changing parameters */
kill_streams();
switch (opcode) {
case OSSP_DSP_SET_RATE: {
hw_format.rate = v;
break;
}
case OSSP_DSP_SET_CHANNELS: {
hw_format.channels = v;
break;
}
case OSSP_DSP_SET_FORMAT: {
snd_pcm_format_t format = fmt_oss_to_alsa(v);
hw_format.format = format;
break;
}
case OSSP_DSP_SET_SUBDIVISION:
if (!v)
v = 1;
#if 0
if (!v) {
v = user_subdivision ?: 1;
break;
}
user_frag_size = 0;
user_subdivision = v;
break;
case OSSP_DSP_SET_FRAGMENT:
user_subdivision = 0;
user_frag_size = 1 << (v & 0xffff);
user_max_frags = (v >> 16) & 0xffff;
if (user_frag_size < 4)
user_frag_size = 4;
if (user_max_frags < 2)
user_max_frags = 2;
#else
case OSSP_DSP_SET_FRAGMENT:
#endif
break;
default:
assert(0);
}
if (pcm[PLAY])
ret = set_hw_params(pcm[PLAY]);
if (ret >= 0 && pcm[REC])
ret = set_hw_params(pcm[REC]);
if (rarg)
*(int *)rarg = v;
return 0;
}
static ssize_t alsap_set_trigger(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp,
int fd)
{
int enable = *(int *)carg;
stream_corked[PLAY] = !!(enable & PCM_ENABLE_OUTPUT);
stream_corked[REC] = !!(enable & PCM_ENABLE_INPUT);
return trigger_streams(enable & PCM_ENABLE_OUTPUT,
enable & PCM_ENABLE_INPUT);
}
static ssize_t alsap_get_space(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
int dir = (opcode == OSSP_DSP_GET_OSPACE) ? PLAY : REC;
int underrun = 0;
struct audio_buf_info info = { };
unsigned long bufsize;
snd_pcm_uframes_t avail, fragsize;
snd_pcm_state_t state;
if (!pcm[dir])
return -EINVAL;
state = snd_pcm_state(pcm[dir]);
if (state == SND_PCM_STATE_XRUN) {
snd_pcm_recover(pcm[dir], -EPIPE, 0);
underrun = 1;
} else if (state == SND_PCM_STATE_SUSPENDED) {
snd_pcm_recover(pcm[dir], -ESTRPIPE, 0);
underrun = 1;
}
snd_pcm_hw_params_current(pcm[dir], hw_params);
snd_pcm_hw_params_get_period_size(hw_params, &fragsize, NULL);
snd_pcm_hw_params_get_buffer_size(hw_params, &bufsize);
info.fragsize = snd_pcm_frames_to_bytes(pcm[dir], fragsize);
info.fragstotal = bufsize / fragsize;
if (!underrun) {
avail = snd_pcm_avail_update(pcm[dir]);
info.fragments = avail / fragsize;
} else
info.fragments = info.fragstotal;
info.bytes = info.fragsize * info.fragments;
*(struct audio_buf_info *)rarg = info;
return 0;
}
static ssize_t alsap_get_ptr(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp, int tfd)
{
int dir = (opcode == OSSP_DSP_GET_OPTR) ? PLAY : REC;
struct count_info info = { };
if (!pcm[dir])
return -EIO;
snd_pcm_hw_params_current(pcm[dir], hw_params);
info.bytes = byte_counter[dir];
snd_pcm_hw_params_get_periods(hw_params, (unsigned int *)&info.blocks, NULL);
info.ptr = mmap_pos[dir];
*(struct count_info *)rarg = info;
return 0;
}
static ssize_t alsap_get_odelay(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp,
int fd)
{
snd_pcm_sframes_t delay;
if (!pcm[PLAY])
return -EIO;
if (snd_pcm_delay(pcm[PLAY], &delay) < 0)
return -EIO;
*(int *)rarg = snd_pcm_frames_to_bytes(pcm[PLAY], delay);
return 0;
}
static ossp_action_fn_t action_fn_tbl[OSSP_NR_OPCODES] = {
[OSSP_MIXER] = alsap_mixer,
[OSSP_DSP_OPEN] = alsap_open,
[OSSP_DSP_READ] = alsap_read,
[OSSP_DSP_WRITE] = alsap_write,
[OSSP_DSP_POLL] = alsap_poll,
#if 0
[OSSP_DSP_MMAP] = alsap_mmap,
[OSSP_DSP_MUNMAP] = alsap_munmap,
#endif
[OSSP_DSP_RESET] = alsap_flush,
[OSSP_DSP_SYNC] = alsap_flush,
[OSSP_DSP_POST] = alsap_post,
[OSSP_DSP_GET_RATE] = alsap_get_param,
[OSSP_DSP_GET_CHANNELS] = alsap_get_param,
[OSSP_DSP_GET_FORMAT] = alsap_get_param,
[OSSP_DSP_GET_BLKSIZE] = alsap_get_param,
[OSSP_DSP_GET_FORMATS] = alsap_get_param,
[OSSP_DSP_SET_RATE] = alsap_set_param,
[OSSP_DSP_SET_CHANNELS] = alsap_set_param,
[OSSP_DSP_SET_FORMAT] = alsap_set_param,
[OSSP_DSP_SET_SUBDIVISION] = alsap_set_param,
[OSSP_DSP_SET_FRAGMENT] = alsap_set_param,
[OSSP_DSP_GET_TRIGGER] = alsap_get_param,
[OSSP_DSP_SET_TRIGGER] = alsap_set_trigger,
[OSSP_DSP_GET_OSPACE] = alsap_get_space,
[OSSP_DSP_GET_ISPACE] = alsap_get_space,
[OSSP_DSP_GET_OPTR] = alsap_get_ptr,
[OSSP_DSP_GET_IPTR] = alsap_get_ptr,
[OSSP_DSP_GET_ODELAY] = alsap_get_odelay,
};
static int action_pre(void)
{
return 0;
}
static void action_post(void)
{
}
int main(int argc, char **argv)
{
int rc;
ossp_slave_init(argc, argv);
page_size = sysconf(_SC_PAGE_SIZE);
/* Okay, now we're open for business */
rc = 0;
do {
rc = ossp_slave_process_command(ossp_cmd_fd, action_fn_tbl,
action_pre, action_post);
} while (rc > 0);
return rc ? 1 : 0;
}
@@ -1,250 +0,0 @@
/*
* ossp-slave - OSS Proxy: Common codes for slaves
*
* Copyright (C) 2008-2010 SUSE Linux Products GmbH
* Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
#include <signal.h>
#include "ossp-slave.h"
static const char *usage =
"usage: ossp-SLAVE [options]\n"
"\n"
"proxies commands from osspd to pulseaudio\n"
"\n"
"options:\n"
" -u UID uid to use\n"
" -g GID gid to use\n"
" -c CMD_FD fd to receive commands from osspd\n"
" -n NOTIFY_FD fd to send async notifications to osspd\n"
" -m MMAP_FD fd to use for mmap\n"
" -o MMAP_OFFSET mmap offset\n"
" -s MMAP_SIZE mmap size\n"
" -l LOG_LEVEL set log level\n"
" -t enable log timestamps\n";
char ossp_user_name[OSSP_USER_NAME_LEN];
int ossp_cmd_fd = -1, ossp_notify_fd = -1;
void *ossp_mmap_addr[2];
void ossp_slave_init(int argc, char **argv)
{
int have_uid = 0, have_gid = 0;
uid_t uid;
gid_t gid;
int mmap_fd = -1;
off_t mmap_off = 0;
size_t mmap_size = 0;
int opt;
struct passwd *pw, pw_buf;
struct sigaction sa;
char pw_sbuf[sysconf(_SC_GETPW_R_SIZE_MAX)];
while ((opt = getopt(argc, argv, "u:g:c:n:m:o:s:l:t")) != -1) {
switch (opt) {
case 'u':
have_uid = 1;
uid = strtol(optarg, NULL, 0);
break;
case 'g':
have_gid = 1;
gid = strtol(optarg, NULL, 0);
break;
case 'c':
ossp_cmd_fd = strtol(optarg, NULL, 0);
break;
case 'n':
ossp_notify_fd = strtol(optarg, NULL, 0);
break;
case 'm':
mmap_fd = strtol(optarg, NULL, 0);
break;
case 'o':
mmap_off = strtoull(optarg, NULL, 0);
break;
case 's':
mmap_size = strtoul(optarg, NULL, 0);
break;
case 'l':
ossp_log_level = strtol(optarg, NULL, 0);
break;
case 't':
ossp_log_timestamp = 1;
break;
}
}
if (!have_uid || !have_gid || ossp_cmd_fd < 0 || ossp_notify_fd < 0) {
fprintf(stderr, usage);
_exit(1);
}
snprintf(ossp_user_name, sizeof(ossp_user_name), "uid%d", uid);
if (getpwuid_r(uid, &pw_buf, pw_sbuf, sizeof(pw_sbuf), &pw) == 0)
snprintf(ossp_user_name, sizeof(ossp_user_name), "%s",
pw->pw_name);
snprintf(ossp_log_name, sizeof(ossp_log_name), "ossp-padsp[%s:%d]",
ossp_user_name, getpid());
if (mmap_fd >= 0) {
void *p;
if (!mmap_off || !mmap_size) {
fprintf(stderr, usage);
_exit(1);
}
p = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED,
mmap_fd, mmap_off);
if (p == MAP_FAILED)
fatal_e(-errno, "mmap failed");
ossp_mmap_addr[PLAY] = p;
ossp_mmap_addr[REC] = p + mmap_size / 2;
close(mmap_fd);
}
/* mmap done, drop privileges */
if (setresgid(gid, gid, gid) || setresuid(uid, uid, uid))
fatal_e(-errno, "failed to drop privileges");
/* block SIGPIPE */
memset(&sa, 0, sizeof(sa));
sa.sa_handler = SIG_IGN;
if (sigaction(SIGPIPE, &sa, NULL))
fatal_e(-errno, "failed to ignore SIGPIPE");
}
int ossp_slave_process_command(int cmd_fd,
ossp_action_fn_t const *action_fn_tbl,
int (*action_pre_fn)(void),
void (*action_post_fn)(void))
{
static struct sized_buf carg_sbuf = { }, rarg_sbuf = { };
static struct sized_buf din_sbuf = { }, dout_sbuf = { };
struct ossp_cmd cmd;
int fd = -1;
char cmsg_buf[CMSG_SPACE(sizeof(fd))];
struct iovec iov = { &cmd, sizeof(cmd) };
struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1,
.msg_control = cmsg_buf,
.msg_controllen = sizeof(cmsg_buf) };
struct cmsghdr *cmsg;
size_t carg_size, din_size, rarg_size, dout_size;
char *carg = NULL, *din = NULL, *rarg = NULL, *dout = NULL;
struct ossp_reply reply = { .magic = OSSP_REPLY_MAGIC };
ssize_t ret;
ret = recvmsg(cmd_fd, &msg, 0);
if (ret == 0)
return 0;
if (ret < 0) {
ret = -errno;
err_e(ret, "failed to read command channel");
return ret;
}
if (ret != sizeof(cmd)) {
err("command struct size mismatch (%zu, should be %zu)",
ret, sizeof(cmd));
return -EINVAL;
}
if (cmd.magic != OSSP_CMD_MAGIC) {
err("illegal command magic 0x%x", cmd.magic);
return -EINVAL;
}
for (cmsg = CMSG_FIRSTHDR(&msg); cmsg;
cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (cmsg->cmsg_level == SOL_SOCKET &&
cmsg->cmsg_type == SCM_RIGHTS)
fd = *(int *)CMSG_DATA(cmsg);
else {
err("unknown cmsg %d:%d received (opcode %d)",
cmsg->cmsg_level, cmsg->cmsg_type, cmd.opcode);
return -EINVAL;
}
}
if (cmd.opcode >= OSSP_NR_OPCODES) {
err("unknown opcode %d", cmd.opcode);
return -EINVAL;
}
carg_size = ossp_arg_sizes[cmd.opcode].carg_size;
din_size = cmd.din_size;
rarg_size = ossp_arg_sizes[cmd.opcode].rarg_size;
dout_size = cmd.dout_size;
if ((fd >= 0) != ossp_arg_sizes[cmd.opcode].has_fd) {
err("fd=%d unexpected for opcode %d", fd, cmd.opcode);
return -EINVAL;
}
if (ensure_sbuf_size(&carg_sbuf, carg_size) ||
ensure_sbuf_size(&din_sbuf, din_size) ||
ensure_sbuf_size(&rarg_sbuf, rarg_size) ||
ensure_sbuf_size(&dout_sbuf, dout_size)) {
err("failed to allocate command buffers");
return -ENOMEM;
}
if (carg_size) {
carg = carg_sbuf.buf;
ret = read_fill(cmd_fd, carg, carg_size);
if (ret < 0)
return ret;
}
if (din_size) {
din = din_sbuf.buf;
ret = read_fill(cmd_fd, din, din_size);
if (ret < 0)
return ret;
}
if (rarg_size)
rarg = rarg_sbuf.buf;
if (dout_size)
dout = dout_sbuf.buf;
ret = -EINVAL;
if (action_fn_tbl[cmd.opcode]) {
ret = action_pre_fn();
if (ret == 0) {
ret = action_fn_tbl[cmd.opcode](cmd.opcode, carg,
din, din_size, rarg,
dout, &dout_size, fd);
action_post_fn();
}
}
reply.result = ret;
if (ret >= 0)
reply.dout_size = dout_size;
else {
rarg_size = 0;
dout_size = 0;
}
if (write_fill(cmd_fd, &reply, sizeof(reply)) < 0 ||
write_fill(cmd_fd, rarg, rarg_size) < 0 ||
write_fill(cmd_fd, dout, dout_size) < 0)
return -EIO;
return 1;
}
@@ -1,28 +0,0 @@
/*
* ossp-slave - OSS Proxy: Common codes for slaves
*
* Copyright (C) 2008-2010 SUSE Linux Products GmbH
* Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
#ifndef _OSSP_SLAVE_H
#define _OSSP_SLAVE_H
#include "ossp.h"
#include "ossp-util.h"
#define OSSP_USER_NAME_LEN 128
extern char ossp_user_name[OSSP_USER_NAME_LEN];
extern int ossp_cmd_fd, ossp_notify_fd;
extern void *ossp_mmap_addr[2];
void ossp_slave_init(int argc, char **argv);
int ossp_slave_process_command(int cmd_fd,
ossp_action_fn_t const *action_fn_tbl,
int (*action_pre_fn)(void),
void (*action_post_fn)(void));
#endif /* _OSSP_SLAVE_H */
@@ -1,369 +0,0 @@
/*
* ossp-util - OSS Proxy: Common utilities
*
* Copyright (C) 2008-2010 SUSE Linux Products GmbH
* Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
#include <ctype.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <syslog.h>
#include <unistd.h>
#include "ossp-util.h"
#define BIT(nr) (1UL << (nr))
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
char ossp_log_name[OSSP_LOG_NAME_LEN];
int ossp_log_level = OSSP_LOG_DFL;
int ossp_log_timestamp;
static const char *severity_strs[] = {
[OSSP_LOG_CRIT] = "CRIT",
[OSSP_LOG_ERR] = " ERR",
[OSSP_LOG_WARN] = "WARN",
[OSSP_LOG_INFO] = NULL,
[OSSP_LOG_DBG0] = "DBG0",
[OSSP_LOG_DBG1] = "DBG1",
};
static int severity_map[] = {
[OSSP_LOG_CRIT] = LOG_ERR,
[OSSP_LOG_ERR] = LOG_ERR,
[OSSP_LOG_WARN] = LOG_WARNING,
[OSSP_LOG_INFO] = LOG_INFO,
[OSSP_LOG_DBG0] = LOG_DEBUG,
[OSSP_LOG_DBG1] = LOG_DEBUG,
};
void log_msg(int severity, const char *fmt, ...)
{
static int syslog_opened = 0;
char buf[1024];
size_t len = sizeof(buf), off = 0;
va_list ap;
if (severity > abs(ossp_log_level))
return;
if (ossp_log_level < 0 && !syslog_opened)
openlog(ossp_log_name, 0, LOG_DAEMON);
assert(severity >= 0 && severity < ARRAY_SIZE(severity_strs));
if (ossp_log_timestamp) {
static uint64_t start;
uint64_t now;
struct timeval tv;
gettimeofday(&tv, NULL);
now = tv.tv_sec * 1000 + tv.tv_usec / 1000;
if (!start)
start = now;
off += snprintf(buf + off, len - off, "<%08"PRIu64"> ",
now - start);
}
if (ossp_log_level > 0) {
char sev_buf[16] = "";
if (severity_strs[severity])
snprintf(sev_buf, sizeof(sev_buf), " %s",
severity_strs[severity]);
off += snprintf(buf + off, len - off, "%s%s: ",
ossp_log_name, sev_buf);
} else if (severity_strs[severity])
off += snprintf(buf + off, len - off, "%s ",
severity_strs[severity]);
va_start(ap, fmt);
off += vsnprintf(buf + off, len - off, fmt, ap);
va_end(ap);
off += snprintf(buf + off, len - off, "\n");
if (ossp_log_level > 0)
fputs(buf, stderr);
else
syslog(severity_map[severity], "%s", buf);
}
int read_fill(int fd, void *buf, size_t size)
{
while (size) {
ssize_t ret;
int rc;
ret = read(fd, buf, size);
if (ret <= 0) {
if (ret == 0)
rc = -EIO;
else
rc = -errno;
err_e(rc, "failed to read_fill %zu bytes from fd %d",
size, fd);
return rc;
}
buf += ret;
size -= ret;
}
return 0;
}
int write_fill(int fd, const void *buf, size_t size)
{
while (size) {
ssize_t ret;
int rc;
ret = write(fd, buf, size);
if (ret <= 0) {
if (ret == 0)
rc = -EIO;
else
rc = -errno;
err_e(rc, "failed to write_fill %zu bytes to fd %d",
size, fd);
return rc;
}
buf += ret;
size -= ret;
}
return 0;
}
void ring_fill(struct ring_buf *ring, const void *buf, size_t size)
{
size_t tail;
assert(ring_space(ring) >= size);
tail = (ring->head + ring->size - ring->bytes) % ring->size;
if (ring->head >= tail) {
size_t todo = min(size, ring->size - ring->head);
memcpy(ring->buf + ring->head, buf, todo);
ring->head = (ring->head + todo) % ring->size;
ring->bytes += todo;
buf += todo;
size -= todo;
}
assert(ring->size - ring->head >= size);
memcpy(ring->buf + ring->head, buf, size);
ring->head += size;
ring->bytes += size;
}
void *ring_data(struct ring_buf *ring, size_t *sizep)
{
size_t tail;
if (!ring->bytes)
return NULL;
tail = (ring->head + ring->size - ring->bytes) % ring->size;
*sizep = min(ring->bytes, ring->size - tail);
return ring->buf + tail;
}
int ring_resize(struct ring_buf *ring, size_t new_size)
{
struct ring_buf new_ring = { .size = new_size };
void *p;
size_t size;
if (ring_bytes(ring) > new_size)
return -ENOSPC;
new_ring.buf = calloc(1, new_size);
if (new_size && !new_ring.buf)
return -ENOMEM;
while ((p = ring_data(ring, &size))) {
ring_fill(&new_ring, p, size);
ring_consume(ring, size);
}
free(ring->buf);
*ring = new_ring;
return 0;
}
int ensure_sbuf_size(struct sized_buf *sbuf, size_t size)
{
char *new_buf;
if (sbuf->size >= size)
return 0;
new_buf = realloc(sbuf->buf, size);
if (size && !new_buf)
return -ENOMEM;
sbuf->buf = new_buf;
sbuf->size = size;
return 0;
}
static unsigned long __ffs(unsigned long word)
{
int num = 0;
if (BITS_PER_LONG == 64) {
if ((word & 0xffffffff) == 0) {
num += 32;
word >>= 32;
}
}
if ((word & 0xffff) == 0) {
num += 16;
word >>= 16;
}
if ((word & 0xff) == 0) {
num += 8;
word >>= 8;
}
if ((word & 0xf) == 0) {
num += 4;
word >>= 4;
}
if ((word & 0x3) == 0) {
num += 2;
word >>= 2;
}
if ((word & 0x1) == 0)
num += 1;
return num;
}
#define ffz(x) __ffs(~(x))
unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
unsigned long offset)
{
const unsigned long *p = addr + BITOP_WORD(offset);
unsigned long result = offset & ~(BITS_PER_LONG-1);
unsigned long tmp;
if (offset >= size)
return size;
size -= result;
offset %= BITS_PER_LONG;
if (offset) {
tmp = *(p++);
tmp |= ~0UL >> (BITS_PER_LONG - offset);
if (size < BITS_PER_LONG)
goto found_first;
if (~tmp)
goto found_middle;
size -= BITS_PER_LONG;
result += BITS_PER_LONG;
}
while (size & ~(BITS_PER_LONG-1)) {
if (~(tmp = *(p++)))
goto found_middle;
result += BITS_PER_LONG;
size -= BITS_PER_LONG;
}
if (!size)
return result;
tmp = *p;
found_first:
tmp |= ~0UL << size;
if (tmp == ~0UL) /* Are any bits zero? */
return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
}
void __set_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = BIT_MASK(nr);
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
*p |= mask;
}
void __clear_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = BIT_MASK(nr);
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
*p &= ~mask;
}
int get_proc_self_info(pid_t pid, pid_t *ppid_r,
char *cmd_buf, size_t cmd_buf_sz)
{
char path[64], buf[4096];
int fd = -1;
char *cmd_start, *cmd_end, *ppid_start, *end;
ssize_t ret;
pid_t ppid;
int i, rc;
snprintf(path, sizeof(path), "/proc/%ld/stat", (long)pid);
fd = open(path, O_RDONLY);
if (fd < 0) {
rc = -errno;
goto out;
}
ret = read(fd, buf, sizeof(buf));
if (ret < 0)
goto out;
if (ret == sizeof(buf)) {
rc = -EOVERFLOW;
goto out;
}
buf[ret] = '\0';
rc = -EINVAL;
cmd_start = strchr(buf, '(');
cmd_end = strrchr(buf, ')');
if (!cmd_start || !cmd_end)
goto out;
cmd_start++;
ppid_start = cmd_end;
for (i = 0; i < 3; i++) {
ppid_start = strchr(ppid_start, ' ');
if (!ppid_start)
goto out;
ppid_start++;
}
ppid = strtoul(ppid_start, &end, 10);
if (end == ppid_start || *end != ' ')
goto out;
if (ppid_r)
*ppid_r = ppid;
if (cmd_buf) {
size_t len = min_t(size_t, cmd_end - cmd_start, cmd_buf_sz - 1);
memcpy(cmd_buf, cmd_start, len);
cmd_buf[len] = '\0';
}
rc = 0;
out:
close(fd);
return rc;
}
@@ -1,609 +0,0 @@
/*
* ossp-util - OSS Proxy: Common utilities
*
* Copyright (C) 2008-2010 SUSE Linux Products GmbH
* Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
#ifndef _OSSP_UTIL_H
#define _OSSP_UTIL_H
#include <assert.h>
#include <stddef.h>
#include <string.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include "ossp.h"
#define OSSP_LOG_NAME_LEN 128
enum {
OSSP_LOG_CRIT = 1,
OSSP_LOG_ERR,
OSSP_LOG_WARN,
OSSP_LOG_INFO,
OSSP_LOG_DFL = OSSP_LOG_INFO, /* default log level */
OSSP_LOG_DBG0,
OSSP_LOG_DBG1,
OSSP_LOG_MAX = OSSP_LOG_DBG1,
};
extern char ossp_log_name[OSSP_LOG_NAME_LEN];
extern int ossp_log_level;
extern int ossp_log_timestamp;
#define BITS_PER_BYTE 8
#define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long))
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
/* ARRAY_SIZE and min/max macros stolen from linux/kernel.h */
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define min(x, y) ({ \
typeof(x) _min1 = (x); \
typeof(y) _min2 = (y); \
(void) (&_min1 == &_min2); \
_min1 < _min2 ? _min1 : _min2; })
#define max(x, y) ({ \
typeof(x) _max1 = (x); \
typeof(y) _max2 = (y); \
(void) (&_max1 == &_max2); \
_max1 > _max2 ? _max1 : _max2; })
#define min_t(type, x, y) ({ \
type __min1 = (x); \
type __min2 = (y); \
__min1 < __min2 ? __min1: __min2; })
#define max_t(type, x, y) ({ \
type __max1 = (x); \
type __max2 = (y); \
__max1 > __max2 ? __max1: __max2; })
void log_msg(int severity, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
#define fatal(fmt, args...) do { \
log_msg(OSSP_LOG_CRIT, fmt , ##args); \
_exit(1); \
} while (0)
#define err(fmt, args...) log_msg(OSSP_LOG_ERR, fmt , ##args)
#define warn(fmt, args...) log_msg(OSSP_LOG_WARN, fmt , ##args)
#define info(fmt, args...) log_msg(OSSP_LOG_INFO, fmt , ##args)
#define dbg0(fmt, args...) log_msg(OSSP_LOG_DBG0, fmt , ##args)
#define dbg1(fmt, args...) log_msg(OSSP_LOG_DBG1, fmt , ##args)
#define fatal_e(e, fmt, args...) \
fatal(fmt" (%s)" , ##args, strerror(-(e)))
#define err_e(e, fmt, args...) \
err(fmt" (%s)" , ##args, strerror(-(e)))
#define warn_e(e, fmt, args...) \
warn(fmt" (%s)" , ##args, strerror(-(e)))
#define info_e(e, fmt, args...) \
info(fmt" (%s)" , ##args, strerror(-(e)))
#define dbg0_e(e, fmt, args...) \
dbg0(fmt" (%s)" , ##args, strerror(-(e)))
#define dbg1_e(e, fmt, args...) \
dbg1(fmt" (%s)" , ##args, strerror(-(e)))
struct ring_buf {
char *buf;
size_t size;
size_t head;
size_t bytes;
};
static inline size_t ring_size(struct ring_buf *ring)
{
return ring->size;
}
static inline size_t ring_bytes(struct ring_buf *ring)
{
return ring->bytes;
}
static inline size_t ring_space(struct ring_buf *ring)
{
return ring->size - ring->bytes;
}
static inline void ring_consume(struct ring_buf *ring, size_t size)
{
assert(ring->bytes >= size);
ring->bytes -= size;
}
static inline void ring_manual_init(struct ring_buf *ring, void *buf,
size_t size, size_t head, size_t bytes)
{
ring->buf = buf;
ring->size = size;
ring->head = head;
ring->bytes = bytes;
}
void ring_fill(struct ring_buf *ring, const void *buf, size_t size);
void *ring_data(struct ring_buf *ring, size_t *sizep);
int ring_resize(struct ring_buf *ring, size_t new_size);
struct sized_buf {
char *buf;
size_t size;
};
int ensure_sbuf_size(struct sized_buf *sbuf, size_t size);
int read_fill(int fd, void *buf, size_t size);
int write_fill(int fd, const void *buf, size_t size);
/*
* Bitops lifted from linux asm-generic implementation.
*/
unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
long size, unsigned long offset);
#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
extern void __set_bit(int nr, volatile unsigned long *addr);
extern void __clear_bit(int nr, volatile unsigned long *addr);
typedef ssize_t (*ossp_action_fn_t)(enum ossp_opcode opcode,
void *carg, void *din, size_t din_sz,
void *rarg, void *dout, size_t *dout_szp,
int fd);
int get_proc_self_info(pid_t tid, pid_t *pgrp,
char *cmd_buf, size_t cmd_buf_sz);
/*
* Doubly linked list handling code shamelessly stolen from the Linux
* kernel 2.6.26 include/linux/list.h.
*/
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
*
*/
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
#define LIST_POISON1 ((void *) 0x00100100)
#define LIST_POISON2 ((void *) 0x00200200)
/*
* Simple doubly linked list implementation.
*
* Some of the internal functions ("__xxx") are useful when
* manipulating whole lists rather than single entries, as
* sometimes we already know the next/prev entries and we can
* generate better code by using them directly rather than
* using the generic single-entry routines.
*/
struct list_head {
struct list_head *next, *prev;
};
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
static inline void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}
/*
* Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
/**
* list_add - add a new entry
* @new: new entry to be added
* @head: list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
static inline void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
/**
* list_add_tail - add a new entry
* @new: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
static inline void list_add_tail(struct list_head *new, struct list_head *head)
{
__list_add(new, head->prev, head);
}
/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_del(struct list_head * prev, struct list_head * next)
{
next->prev = prev;
prev->next = next;
}
/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* Note: list_empty() on entry does not return true after this, the entry is
* in an undefined state.
*/
static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = LIST_POISON1;
entry->prev = LIST_POISON2;
}
/**
* list_replace - replace old entry by new one
* @old : the element to be replaced
* @new : the new element to insert
*
* If @old was empty, it will be overwritten.
*/
static inline void list_replace(struct list_head *old,
struct list_head *new)
{
new->next = old->next;
new->next->prev = new;
new->prev = old->prev;
new->prev->next = new;
}
static inline void list_replace_init(struct list_head *old,
struct list_head *new)
{
list_replace(old, new);
INIT_LIST_HEAD(old);
}
/**
* list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
*/
static inline void list_del_init(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
}
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
* @head: the head that will precede our entry
*/
static inline void list_move(struct list_head *list, struct list_head *head)
{
__list_del(list->prev, list->next);
list_add(list, head);
}
/**
* list_move_tail - delete from one list and add as another's tail
* @list: the entry to move
* @head: the head that will follow our entry
*/
static inline void list_move_tail(struct list_head *list,
struct list_head *head)
{
__list_del(list->prev, list->next);
list_add_tail(list, head);
}
/**
* list_is_last - tests whether @list is the last entry in list @head
* @list: the entry to test
* @head: the head of the list
*/
static inline int list_is_last(const struct list_head *list,
const struct list_head *head)
{
return list->next == head;
}
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
*/
static inline int list_empty(const struct list_head *head)
{
return head->next == head;
}
/**
* list_empty_careful - tests whether a list is empty and not being modified
* @head: the list to test
*
* Description:
* tests whether a list is empty _and_ checks that no other CPU might be
* in the process of modifying either member (next or prev)
*
* NOTE: using list_empty_careful() without synchronization
* can only be safe if the only activity that can happen
* to the list entry is list_del_init(). Eg. it cannot be used
* if another CPU could re-list_add() it.
*/
static inline int list_empty_careful(const struct list_head *head)
{
struct list_head *next = head->next;
return (next == head) && (next == head->prev);
}
/**
* list_is_singular - tests whether a list has just one entry.
* @head: the list to test.
*/
static inline int list_is_singular(const struct list_head *head)
{
return !list_empty(head) && (head->next == head->prev);
}
static inline void __list_splice(const struct list_head *list,
struct list_head *head)
{
struct list_head *first = list->next;
struct list_head *last = list->prev;
struct list_head *at = head->next;
first->prev = head;
head->next = first;
last->next = at;
at->prev = last;
}
/**
* list_splice - join two lists
* @list: the new list to add.
* @head: the place to add it in the first list.
*/
static inline void list_splice(const struct list_head *list,
struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head);
}
/**
* list_splice_init - join two lists and reinitialise the emptied list.
* @list: the new list to add.
* @head: the place to add it in the first list.
*
* The list at @list is reinitialised
*/
static inline void list_splice_init(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list)) {
__list_splice(list, head);
INIT_LIST_HEAD(list);
}
}
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
/**
* list_first_entry - get the first element from a list
* @ptr: the list head to take the element from.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*
* Note, that list is expected to be not empty.
*/
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*/
#define list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
/**
* list_for_each_prev - iterate over a list backwards
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*/
#define list_for_each_prev(pos, head) \
for (pos = (head)->prev; pos != (head); pos = pos->prev)
/**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop cursor.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
/**
* list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
* @pos: the &struct list_head to use as a loop cursor.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_prev_safe(pos, n, head) \
for (pos = (head)->prev, n = pos->prev; \
pos != (head); pos = n, n = pos->prev)
/**
* list_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_reverse - iterate backwards over list of given type.
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_reverse(pos, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.prev, typeof(*pos), member))
/**
* list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
* @pos: the type * to use as a start point
* @head: the head of the list
* @member: the name of the list_struct within the struct.
*
* Prepares a pos entry for use as a start point in list_for_each_entry_continue().
*/
#define list_prepare_entry(pos, head, member) \
((pos) ? : list_entry(head, typeof(*pos), member))
/**
* list_for_each_entry_continue - continue iteration over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Continue to iterate over list of given type, continuing after
* the current position.
*/
#define list_for_each_entry_continue(pos, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_continue_reverse - iterate backwards from the given point
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Start to iterate over list of given type backwards, continuing after
* the current position.
*/
#define list_for_each_entry_continue_reverse(pos, head, member) \
for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.prev, typeof(*pos), member))
/**
* list_for_each_entry_from - iterate over list of given type from the current point
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type, continuing from current position.
*/
#define list_for_each_entry_from(pos, head, member) \
for (; &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe(pos, n, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_continue
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type, continuing after current point,
* safe against removal of list entry.
*/
#define list_for_each_entry_safe_continue(pos, n, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_from
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type from current point, safe against
* removal of list entry.
*/
#define list_for_each_entry_safe_from(pos, n, head, member) \
for (n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_reverse
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate backwards over list of given type, safe against removal
* of list entry.
*/
#define list_for_each_entry_safe_reverse(pos, n, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member), \
n = list_entry(pos->member.prev, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.prev, typeof(*n), member))
#endif /*_OSSP_UTIL_H*/
@@ -1,83 +0,0 @@
/*
* ossp - OSS Proxy: emulate OSS device using CUSE
*
* Copyright (C) 2008-2010 SUSE Linux Products GmbH
* Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
#include "ossp.h"
const struct ossp_arg_size ossp_arg_sizes[OSSP_NR_OPCODES] = {
[OSSP_MIXER] = { sizeof(struct ossp_mixer_arg),
sizeof(struct ossp_mixer_arg), 0 },
[OSSP_DSP_OPEN] = { sizeof(struct ossp_dsp_open_arg), 0, 0 },
[OSSP_DSP_READ] = { sizeof(struct ossp_dsp_rw_arg), 0, 0 },
[OSSP_DSP_WRITE] = { sizeof(struct ossp_dsp_rw_arg), 0, 0 },
[OSSP_DSP_POLL] = { sizeof(int), sizeof(unsigned), 0 },
[OSSP_DSP_MMAP] = { sizeof(struct ossp_dsp_mmap_arg), 0, 0 },
[OSSP_DSP_MUNMAP] = { sizeof(int), 0, 0 },
[OSSP_DSP_RESET] = { 0, 0, 0 },
[OSSP_DSP_SYNC] = { 0, 0, 0 },
[OSSP_DSP_POST] = { 0, 0, 0 },
[OSSP_DSP_GET_RATE] = { 0, sizeof(int), 0 },
[OSSP_DSP_GET_CHANNELS] = { 0, sizeof(int), 0 },
[OSSP_DSP_GET_FORMAT] = { 0, sizeof(int), 0 },
[OSSP_DSP_GET_BLKSIZE] = { 0, sizeof(int), 0 },
[OSSP_DSP_GET_FORMATS] = { 0, sizeof(int), 0 },
[OSSP_DSP_SET_RATE] = { sizeof(int), sizeof(int), 0 },
[OSSP_DSP_SET_CHANNELS] = { sizeof(int), sizeof(int), 0 },
[OSSP_DSP_SET_FORMAT] = { sizeof(int), sizeof(int), 0 },
[OSSP_DSP_SET_SUBDIVISION] = { sizeof(int), sizeof(int), 0 },
[OSSP_DSP_SET_FRAGMENT] = { sizeof(int), 0, 0 },
[OSSP_DSP_GET_TRIGGER] = { 0, sizeof(int), 0 },
[OSSP_DSP_SET_TRIGGER] = { sizeof(int), 0, 0 },
[OSSP_DSP_GET_OSPACE] = { 0, sizeof(struct audio_buf_info), 0 },
[OSSP_DSP_GET_ISPACE] = { 0, sizeof(struct audio_buf_info), 0 },
[OSSP_DSP_GET_OPTR] = { 0, sizeof(struct count_info), 0 },
[OSSP_DSP_GET_IPTR] = { 0, sizeof(struct count_info), 0 },
[OSSP_DSP_GET_ODELAY] = { 0, sizeof(int), 0 },
};
const char *ossp_cmd_str[OSSP_NR_OPCODES] = {
[OSSP_MIXER] = "MIXER",
[OSSP_DSP_OPEN] = "OPEN",
[OSSP_DSP_READ] = "READ",
[OSSP_DSP_WRITE] = "WRITE",
[OSSP_DSP_POLL] = "POLL",
[OSSP_DSP_MMAP] = "MMAP",
[OSSP_DSP_MUNMAP] = "MUNMAP",
[OSSP_DSP_RESET] = "RESET",
[OSSP_DSP_SYNC] = "SYNC",
[OSSP_DSP_POST] = "POST",
[OSSP_DSP_GET_RATE] = "GET_RATE",
[OSSP_DSP_GET_CHANNELS] = "GET_CHANNELS",
[OSSP_DSP_GET_FORMAT] = "GET_FORMAT",
[OSSP_DSP_GET_BLKSIZE] = "GET_BLKSIZE",
[OSSP_DSP_GET_FORMATS] = "GET_FORMATS",
[OSSP_DSP_SET_RATE] = "SET_RATE",
[OSSP_DSP_SET_CHANNELS] = "SET_CHANNELS",
[OSSP_DSP_SET_FORMAT] = "SET_FORMAT",
[OSSP_DSP_SET_SUBDIVISION] = "SET_BUSDIVISION",
[OSSP_DSP_SET_FRAGMENT] = "SET_FRAGMENT",
[OSSP_DSP_GET_TRIGGER] = "GET_TRIGGER",
[OSSP_DSP_SET_TRIGGER] = "SET_TRIGGER",
[OSSP_DSP_GET_OSPACE] = "GET_OSPACE",
[OSSP_DSP_GET_ISPACE] = "GET_ISPACE",
[OSSP_DSP_GET_OPTR] = "GET_OPTR",
[OSSP_DSP_GET_IPTR] = "GET_IPTR",
[OSSP_DSP_GET_ODELAY] = "GET_ODELAY",
};
const char *ossp_notify_str[OSSP_NR_NOTIFY_OPCODES] = {
[OSSP_NOTIFY_POLL] = "POLL",
[OSSP_NOTIFY_OBITUARY] = "OBITUARY",
[OSSP_NOTIFY_VOLCHG] = "VOLCHG",
};
@@ -1,117 +0,0 @@
/*
* ossp - OSS Proxy: emulate OSS device using CUSE
*
* Copyright (C) 2008-2010 SUSE Linux Products GmbH
* Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
#ifndef _OSSP_H
#define _OSSP_H
#include <sys/types.h>
#include <inttypes.h>
#include <sys/soundcard.h>
#define OSSP_VERSION "1.3.2"
#define OSSP_CMD_MAGIC 0xdeadbeef
#define OSSP_REPLY_MAGIC 0xbeefdead
#define OSSP_NOTIFY_MAGIC 0xbebebebe
#define PLAY 0
#define REC 1
#define LEFT 0
#define RIGHT 1
enum ossp_opcode {
OSSP_MIXER,
OSSP_DSP_OPEN,
OSSP_DSP_READ,
OSSP_DSP_WRITE,
OSSP_DSP_POLL,
OSSP_DSP_MMAP,
OSSP_DSP_MUNMAP,
OSSP_DSP_RESET,
OSSP_DSP_SYNC,
OSSP_DSP_POST,
OSSP_DSP_GET_RATE,
OSSP_DSP_GET_CHANNELS,
OSSP_DSP_GET_FORMAT,
OSSP_DSP_GET_BLKSIZE,
OSSP_DSP_GET_FORMATS,
OSSP_DSP_SET_RATE,
OSSP_DSP_SET_CHANNELS,
OSSP_DSP_SET_FORMAT,
OSSP_DSP_SET_SUBDIVISION,
OSSP_DSP_SET_FRAGMENT,
OSSP_DSP_GET_TRIGGER,
OSSP_DSP_SET_TRIGGER,
OSSP_DSP_GET_OSPACE,
OSSP_DSP_GET_ISPACE,
OSSP_DSP_GET_OPTR,
OSSP_DSP_GET_IPTR,
OSSP_DSP_GET_ODELAY,
OSSP_NR_OPCODES,
};
enum ossp_notify_opcode {
OSSP_NOTIFY_POLL,
OSSP_NOTIFY_OBITUARY,
OSSP_NOTIFY_VOLCHG,
OSSP_NR_NOTIFY_OPCODES,
};
struct ossp_mixer_arg {
int vol[2][2];
};
struct ossp_dsp_open_arg {
int flags;
pid_t opener_pid;
};
struct ossp_dsp_rw_arg {
unsigned nonblock:1;
};
struct ossp_dsp_mmap_arg {
int dir;
size_t size;
};
struct ossp_cmd {
unsigned magic;
enum ossp_opcode opcode;
size_t din_size;
size_t dout_size;
};
struct ossp_reply {
unsigned magic;
int result;
size_t dout_size; /* <= cmd.data_in_size */
};
struct ossp_notify {
unsigned magic;
enum ossp_notify_opcode opcode;
};
struct ossp_arg_size {
ssize_t carg_size;
ssize_t rarg_size;
unsigned has_fd:1;
};
extern const struct ossp_arg_size ossp_arg_sizes[OSSP_NR_OPCODES];
extern const char *ossp_cmd_str[OSSP_NR_OPCODES];
extern const char *ossp_notify_str[OSSP_NR_NOTIFY_OPCODES];
#endif /* _OSSP_H */
File diff suppressed because it is too large. Load diff
@@ -1739,19 +1739,23 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
if (session) {
switch_channel_t *channel = switch_core_session_get_channel(session);
if(channel){
switch_mutex_lock(tech_pvt->flag_mutex);
switch_clear_flag(tech_pvt, TFLAG_IO);
switch_clear_flag(tech_pvt, TFLAG_VOICE);
if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) {
switch_clear_flag(tech_pvt, TFLAG_PROGRESS);
switch_mutex_lock(tech_pvt->flag_mutex);
switch_clear_flag(tech_pvt, TFLAG_IO);
switch_clear_flag(tech_pvt, TFLAG_VOICE);
if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) {
switch_clear_flag(tech_pvt, TFLAG_PROGRESS);
}
switch_mutex_unlock(tech_pvt->flag_mutex);
switch_core_session_rwunlock(session);
WARNINGA("Closing session for %s\n", SKYPOPEN_P_LOG, interfacename);
switch_channel_hangup(channel, SWITCH_CAUSE_CRASH);
} else {
WARNINGA("NO CHANNEL ?\n", SKYPOPEN_P_LOG);
}
switch_mutex_unlock(tech_pvt->flag_mutex);
switch_core_session_rwunlock(session);
WARNINGA("Closing session for %s\n", SKYPOPEN_P_LOG, interfacename);
switch_channel_hangup(channel, SWITCH_CAUSE_CRASH);
}
WARNINGA("Removing skype interface %s\n", SKYPOPEN_P_LOG, interfacename);
@@ -1772,19 +1776,23 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_mutex_lock(tech_pvt->flag_mutex);
switch_clear_flag(tech_pvt, TFLAG_IO);
switch_clear_flag(tech_pvt, TFLAG_VOICE);
if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) {
switch_clear_flag(tech_pvt, TFLAG_PROGRESS);
if(channel){
switch_mutex_lock(tech_pvt->flag_mutex);
switch_clear_flag(tech_pvt, TFLAG_IO);
switch_clear_flag(tech_pvt, TFLAG_VOICE);
if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) {
switch_clear_flag(tech_pvt, TFLAG_PROGRESS);
}
switch_mutex_unlock(tech_pvt->flag_mutex);
switch_core_session_rwunlock(session);
WARNINGA("Closing session for %s\n", SKYPOPEN_P_LOG, interfacename);
switch_channel_hangup(channel, SWITCH_CAUSE_CRASH);
} else {
WARNINGA("NO CHANNEL ?\n", SKYPOPEN_P_LOG);
}
switch_mutex_unlock(tech_pvt->flag_mutex);
switch_core_session_rwunlock(session);
WARNINGA("Closing session for %s\n", SKYPOPEN_P_LOG, interfacename);
switch_channel_hangup(channel, SWITCH_CAUSE_CRASH);
//skypopen_sleep(500000);
}
+163 -30
View File
@@ -37,6 +37,7 @@
/*************************************************************************************************************************************************************/
#include "mod_sofia.h"
#include "sofia-sip/sip_extra.h"
SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown);
SWITCH_MODULE_DEFINITION(mod_sofia, mod_sofia_load, mod_sofia_shutdown, NULL);
@@ -766,7 +767,6 @@ static switch_status_t sofia_read_video_frame(switch_core_session_t *session, sw
{
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_channel_t *channel = switch_core_session_get_channel(session);
int payload = 0;
switch_assert(tech_pvt != NULL);
@@ -810,8 +810,6 @@ static switch_status_t sofia_read_video_frame(switch_core_session_t *session, sw
return status;
}
payload = tech_pvt->video_read_frame.payload;
if (tech_pvt->video_read_frame.datalen > 0) {
break;
}
@@ -867,7 +865,6 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
{
private_object_t *tech_pvt = switch_core_session_get_private(session);
switch_channel_t *channel = switch_core_session_get_channel(session);
int payload = 0;
uint32_t sanity = 1000;
switch_rtcp_frame_t rtcp_frame;
@@ -979,8 +976,6 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
return SWITCH_STATUS_SUCCESS;
}
payload = tech_pvt->read_frame.payload;
if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
switch_dtmf_t dtmf = { 0 };
switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf);
@@ -1247,6 +1242,7 @@ static void start_udptl(private_object_t *tech_pvt, switch_t38_options_t *t38_op
switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session);
const char *err, *val;
sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
switch_rtp_udptl_mode(tech_pvt->rtp_session);
if (!t38_options || !t38_options->remote_ip) {
@@ -1373,6 +1369,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
if ((len = atoi(msg->string_arg))) {
qlen = len / (tech_pvt->read_impl.microseconds_per_packet / 1000);
if (qlen < 1) {
qlen = 3;
}
}
if (qlen) {
@@ -1393,6 +1392,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
}
if (qlen) {
if (maxqlen < qlen) {
maxqlen = qlen * 5;
}
if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen,
tech_pvt->read_impl.samples_per_packet,
tech_pvt->read_impl.samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) {
@@ -1480,7 +1482,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
if (ok) {
switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
sofia_set_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
}
@@ -1527,8 +1529,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
}
if (sofia_test_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE)) {
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
if (!switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_UDPTL) &&
!switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
}
sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
}
@@ -1649,6 +1654,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
const char *ip = NULL, *port = NULL;
switch_channel_set_flag(channel, CF_PROXY_MODE);
if (tech_pvt->rm_encoding) {
tech_pvt->rm_encoding = NULL;
}
sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
@@ -1850,13 +1858,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
const char *name = msg->string_array_arg[0], *number = msg->string_array_arg[1];
char *arg = NULL;
char *argv[2] = { 0 };
int argc;
//int argc;
if (zstr(name) && !zstr(msg->string_arg)) {
arg = strdup(msg->string_arg);
switch_assert(arg);
argc = switch_separate_string(arg, '|', argv, (sizeof(argv) / sizeof(argv[0])));
switch_separate_string(arg, '|', argv, (sizeof(argv) / sizeof(argv[0])));
name = argv[0];
number = argv[1];
@@ -1878,6 +1886,17 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
if (switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote)) {
snprintf(message, sizeof(message), "X-FS-Display-Name: %s\nX-FS-Display-Number: %s\n", name, number);
if (switch_channel_test_flag(tech_pvt->channel, CF_LAZY_ATTENDED_TRANSFER)) {
snprintf(message + strlen(message), sizeof(message) - strlen(message), "X-FS-Lazy-Attended-Transfer: true\n");
switch_channel_clear_flag(tech_pvt->channel, CF_LAZY_ATTENDED_TRANSFER);
switch_channel_clear_flag(tech_pvt->channel, CF_ATTENDED_TRANSFER);
}
if (switch_channel_test_flag(tech_pvt->channel, CF_ATTENDED_TRANSFER)) {
snprintf(message + strlen(message), sizeof(message) - strlen(message), "X-FS-Attended-Transfer: true\n");
switch_channel_clear_flag(tech_pvt->channel, CF_ATTENDED_TRANSFER);
}
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/update_display"),
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
@@ -2139,6 +2158,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
if (t38_options) {
sofia_glue_set_image_sdp(tech_pvt, t38_options, 0);
if (switch_rtp_ready(tech_pvt->rtp_session)) {
sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
switch_rtp_udptl_mode(tech_pvt->rtp_session);
}
}
@@ -3463,6 +3483,96 @@ SWITCH_STANDARD_API(sofia_count_reg_function)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_API(sofia_username_of_function)
{
char *data;
char *user = NULL;
char *domain = NULL;
char *profile_name = NULL;
char *p;
char *reply = "";
sofia_profile_t *profile = NULL;
if (!cmd) {
stream->write_function(stream, "%s", "");
return SWITCH_STATUS_SUCCESS;
}
data = strdup(cmd);
switch_assert(data);
if ((p = strchr(data, '/'))) {
profile_name = data;
*p++ = '\0';
user = p;
} else {
user = data;
}
if ((domain = strchr(user, '@'))) {
*domain++ = '\0';
}
if (!profile_name && domain) {
profile_name = domain;
}
if (user && profile_name) {
char *sql;
if (!(profile = sofia_glue_find_profile(profile_name))) {
profile_name = domain;
domain = NULL;
}
if (!profile && profile_name) {
profile = sofia_glue_find_profile(profile_name);
}
if (profile) {
struct cb_helper_sql2str cb;
char username[256] = "";
cb.buf = username;
cb.len = sizeof(username);
if (!domain || !strchr(domain, '.')) {
domain = profile->name;
}
switch_assert(!zstr(user));
sql = switch_mprintf("select sip_username "
"from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
user, domain, domain);
switch_assert(sql);
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sql2str_callback, &cb);
switch_safe_free(sql);
if (!zstr(username)) {
stream->write_function(stream, "%s", username);
} else {
stream->write_function(stream, "");
}
reply = NULL;
}
}
if (reply) {
stream->write_function(stream, "%s", reply);
}
switch_safe_free(data);
if (profile) {
sofia_glue_release_profile(profile);
}
return SWITCH_STATUS_SUCCESS;
}
static void select_from_profile(sofia_profile_t *profile,
const char *user,
const char *domain,
@@ -3673,22 +3783,22 @@ SWITCH_STANDARD_API(sofia_function)
switch_status_t status = SWITCH_STATUS_SUCCESS;
sofia_command_t func = NULL;
int lead = 1;
const char *usage_string = "USAGE:\n"
static const char usage_string[] = "USAGE:\n"
"--------------------------------------------------------------------------------\n"
"sofia help\n"
"sofia profile <profile_name> [[start|stop|restart|rescan]|"
"flush_inbound_reg [<call_id>|<[user]@domain>] [reboot]|"
"[register|unregister] [<gateway name>|all]|"
"killgw <gateway name>|"
"[stun-auto-disable|stun-enabled] [true|false]]|"
"siptrace <on|off>|"
"watchdog <on|off>\n"
"sofia status|xmlstatus profile <name> [ reg <contact str> ] | [ pres <pres str> ] | [ user <user@domain> ]\n"
"sofia status|xmlstatus gateway <name>\n"
"sofia global siptrace <on|off>\n"
" watchdog <on|off>\n\n"
"sofia profile <name> [start | stop | restart | rescan]\n"
" flush_inbound_reg [<call_id> | <[user]@domain>] [reboot]\n"
" [register | unregister] [<gateway name> | all]\n"
" killgw <gateway name>\n"
" [stun-auto-disable | stun-enabled] [true | false]]\n"
" siptrace <on|off>\n"
" watchdog <on|off>\n\n"
"sofia <status|xmlstatus> profile <name> [reg <contact str>] | [pres <pres str>] | [user <user@domain>]\n"
"sofia <status|xmlstatus> gateway <name>\n\n"
"sofia loglevel <all|default|tport|iptsec|nea|nta|nth_client|nth_server|nua|soa|sresolv|stun> [0-9]\n"
"sofia tracelevel <console|alert|crit|err|warning|notice|info|debug>\n"
"sofia global siptrace <on|off>|"
"watchdog <on|off>\n"
"sofia tracelevel <console|alert|crit|err|warning|notice|info|debug>\n\n"
"sofia help\n"
"--------------------------------------------------------------------------------\n";
if (zstr(cmd)) {
@@ -3873,6 +3983,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
const char *hval = NULL;
char *not_const = NULL;
int cid_locked = 0;
switch_channel_t *o_channel = NULL;
*new_session = NULL;
@@ -3901,6 +4012,11 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
nchannel = switch_core_session_get_channel(nsession);
if (session) {
o_channel = switch_core_session_get_channel(session);
}
if ((hval = switch_event_get_header(var_event, "sip_invite_to_uri"))) {
dest_to = switch_core_session_strdup(nsession, hval);
}
@@ -4007,7 +4123,23 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
gateway_ptr->ob_calls++;
if (!zstr(gateway_ptr->from_domain) && !switch_channel_get_variable(nchannel, "sip_invite_domain")) {
switch_channel_set_variable(nchannel, "sip_invite_domain", gateway_ptr->from_domain);
if (!strcasecmp(gateway_ptr->from_domain, "auto-aleg-full")) {
const char *sip_full_from = switch_channel_get_variable(o_channel, "sip_full_from");
if (!zstr(sip_full_from)) {
switch_channel_set_variable(nchannel, "sip_force_full_from", sip_full_from);
}
} else if (!strcasecmp(gateway_ptr->from_domain, "auto-aleg-domain")) {
const char *sip_from_host = switch_channel_get_variable(o_channel, "sip_from_host");
if (!zstr(sip_from_host)) {
switch_channel_set_variable(nchannel, "sip_invite_domain", sip_from_host);
}
} else {
switch_channel_set_variable(nchannel, "sip_invite_domain", gateway_ptr->from_domain);
}
}
if (!zstr(gateway_ptr->outbound_sticky_proxy) && !switch_channel_get_variable(nchannel, "sip_route_uri")) {
@@ -4206,7 +4338,6 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
}
if (session) {
switch_channel_t *o_channel = switch_core_session_get_channel(session);
const char *vval = NULL;
if ((vval = switch_channel_get_variable(o_channel, "sip_auto_answer")) && switch_true(vval)) {
@@ -4779,7 +4910,7 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor
switch_console_callback_match_t *my_matches = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
char *dup = NULL;
int argc;
//int argc;
char *argv[4] = { 0 };
if (zstr(line)) {
@@ -4787,7 +4918,7 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor
}
dup = strdup(line);
argc = switch_split(dup, ' ', argv);
switch_split(dup, ' ', argv);
if (zstr(argv[2]) || !strcmp(argv[2], " ")) {
goto end;
@@ -4831,7 +4962,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), &mod_sofia_globals.guess_mask, AF_INET);
in.s_addr = mod_sofia_globals.guess_mask;
switch_set_string(mod_sofia_globals.guess_mask_str, inet_ntoa(in));
gethostname(mod_sofia_globals.hostname, sizeof(mod_sofia_globals.hostname));
strcpy(mod_sofia_globals.hostname, switch_core_get_switchname());
switch_core_hash_init(&mod_sofia_globals.profile_hash, mod_sofia_globals.pool);
@@ -4976,6 +5108,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
switch_console_add_complete_func("::sofia::list_profile_gateway", list_profile_gateway);
SWITCH_ADD_API(api_interface, "sofia_username_of", "Sofia Username Lookup", sofia_username_of_function, "[profile/]<user>@<domain>");
SWITCH_ADD_API(api_interface, "sofia_contact", "Sofia Contacts", sofia_contact_function, "[profile/]<user>@<domain>");
SWITCH_ADD_API(api_interface, "sofia_count_reg", "Count Sofia registration", sofia_count_reg_function, "[profile/]<user>@<domain>");
SWITCH_ADD_API(api_interface, "sofia_dig", "SIP DIG", sip_dig_function, "<url>");
+3 -1
View File
@@ -231,6 +231,7 @@ typedef enum {
PFLAG_PRESENCE_ON_FIRST_REGISTER,
PFLAG_NO_CONNECTION_REUSE,
PFLAG_RENEG_ON_HOLD,
PFLAG_RENEG_ON_REINVITE,
PFLAG_RTP_NOTIMER_DURING_BRIDGE,
/* No new flags below this line */
PFLAG_MAX
@@ -563,7 +564,8 @@ struct sofia_profile {
uint32_t reg_acl_count;
char *nat_acl[SOFIA_MAX_ACL];
uint32_t nat_acl_count;
int rport_level;
int server_rport_level;
int client_rport_level;
sofia_presence_type_t pres_type;
sofia_media_options_t media_options;
uint32_t force_subscription_expires;
+1 -11
View File
@@ -210,17 +210,14 @@ void _usage(int exitcode, switch_stream_handle_t *stream)
switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream)
{
int exitcode = 0;
int o_sctp = 1, o_tls_sctp = 1, o_verbatim = 1;
int family = 0, multiple = 0;
char const *dnsserver = NULL;
char const *string;
url_t *uri = NULL;
char const *host;
char const *port;
char *transport = NULL, tport[32];
int argc;
char *argv_[25] = { 0 };
char *mycmd = NULL;
char **argv;
@@ -239,7 +236,7 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
mycmd = strdup(cmd);
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv_) / sizeof(argv_[0])) - 1);
switch_separate_string(mycmd, ' ', argv, (sizeof(argv_) / sizeof(argv_[0])) - 1);
argv = argv_;
@@ -321,10 +318,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
if (!family)
dig->ip4 = 1, dig->ip6 = 2;
if (argv[1] && argv[1][0] == '@')
dnsserver = argv++[1] + 1;
if (!argv[1])
{usage(2);}
@@ -360,7 +353,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
if (!uri || (uri->url_type != url_sip && uri->url_type != url_sips)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: invalid uri\n", string);
exitcode = 1;
continue;
}
@@ -387,7 +379,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
if (!host_is_domain(host)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: invalid host\n", string);
exitcode = 1;
continue;
}
@@ -402,7 +393,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
continue /* resolved a/aaaa */;
stream->write_function(stream, "-ERR: %s: not found\n", string);
exitcode = 1;
}
if (xml) {
+121 -49
View File
@@ -76,14 +76,15 @@ void sofia_handle_sip_r_notify(switch_core_session_t *session, int status,
char const *phrase,
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
#if 0
if (status >= 300 && sip && sip->sip_call_id) {
char *sql;
sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", sip->sip_call_id->i_id);
switch_assert(sql != NULL);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
nua_handle_destroy(nh);
}
#endif
}
#define url_set_chanvars(session, url, varprefix) _url_set_chanvars(session, url, #varprefix "_user", #varprefix "_host", #varprefix "_port", #varprefix "_uri", #varprefix "_params")
@@ -518,6 +519,14 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
cause = sofia_glue_sip_cause_to_freeswitch(status);
}
if (sip->sip_content_type && sip->sip_content_type->c_type) {
switch_channel_set_variable(channel, "sip_bye_content_type", sip->sip_content_type->c_type);
}
if (sip->sip_payload && sip->sip_payload->pl_data) {
switch_channel_set_variable(channel, "sip_bye_payload", sip->sip_payload->pl_data);
}
switch_snprintf(st, sizeof(st), "%d", status);
switch_channel_set_variable(channel, "sip_term_status", st);
switch_snprintf(st, sizeof(st), "sip:%d", status);
@@ -637,7 +646,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro
char *dup = NULL;
switch_event_t *event;
const char *val;
int fs = 0;
int fs = 0, lazy = 0, att = 0;
if (switch_true(switch_channel_get_variable(channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE))) {
return;
@@ -656,6 +665,16 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro
name = (char *) val;
fs++;
}
if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Lazy-Attended-Transfer"))) {
lazy = switch_true(val);
fs++;
}
if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Attended-Transfer"))) {
att = switch_true(val);
fs++;
}
if (!fs) {
if ((passerted = sip_p_asserted_identity(sip))) {
@@ -727,6 +746,10 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro
caller_profile->callee_id_name = switch_sanitize_number(switch_core_strdup(caller_profile->pool, name));
caller_profile->callee_id_number = switch_sanitize_number(switch_core_strdup(caller_profile->pool, number));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Update Callee ID to \"%s\" <%s>\n", switch_channel_get_name(channel), name, number);
if (lazy || (att && !switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_channel_flip_cid(channel);
}
}
if (send) {
@@ -1261,6 +1284,11 @@ static void sofia_perform_profile_start_failure(sofia_profile_t *profile, char *
}
}
/* not a static function so that it's still visible on stacktraces */
void watchdog_triggered_abort(void) {
abort();
}
#define sofia_profile_start_failure(p, xp) sofia_perform_profile_start_failure(p, xp, __FILE__, __LINE__)
@@ -1376,10 +1404,10 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
}
if (event_fail || step_fail) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED!\n"
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED BY WATCHDOG!\n"
"GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE\n", profile->name);
switch_yield(2000000);
abort();
watchdog_triggered_abort();
}
}
@@ -1437,7 +1465,7 @@ switch_thread_t *launch_sofia_worker_thread(sofia_profile_t *profile)
void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj)
{
sofia_profile_t *profile = (sofia_profile_t *) obj;
switch_memory_pool_t *pool;
//switch_memory_pool_t *pool;
sip_alias_node_t *node;
switch_event_t *s_event;
int use_100rel = !sofia_test_pflag(profile, PFLAG_DISABLE_100REL);
@@ -1502,7 +1530,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_NAPTR),
NTATAG_USE_NAPTR(0)),
NTATAG_DEFAULT_PROXY(profile->outbound_proxy),
NTATAG_SERVER_RPORT(profile->rport_level),
NTATAG_SERVER_RPORT(profile->server_rport_level),
NTATAG_CLIENT_RPORT(profile->client_rport_level),
TPTAG_LOG(sofia_test_flag(profile, TFLAG_TPORT_LOG)),
TAG_IF(sofia_test_pflag(profile, PFLAG_SIPCOMPACT),
NTATAG_SIPFLAGS(MSG_DO_COMPACT)),
@@ -1565,7 +1594,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
node->nua = nua_create(profile->s_root, /* Event loop */
sofia_event_callback, /* Callback for processing events */
profile, /* Additional data to pass to callback */
NTATAG_SERVER_RPORT(profile->rport_level), NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */
NTATAG_SERVER_RPORT(profile->server_rport_level), NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */
nua_set_params(node->nua,
NUTAG_APPL_METHOD("OPTIONS"),
@@ -1696,7 +1725,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
su_home_unref(profile->home);
su_root_destroy(profile->s_root);
pool = profile->pool;
//pool = profile->pool;
sofia_glue_del_profile(profile);
switch_core_hash_destroy(&profile->chat_hash);
@@ -2328,7 +2357,6 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
}
/* you could change profile->foo here if it was a minor change like context or dialplan ... */
profile->rport_level = 1; /* default setting */
profile->acl_count = 0;
profile->reg_acl_count = 0;
profile->proxy_acl_count = 0;
@@ -2442,6 +2470,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
} else {
sofia_clear_pflag(profile, PFLAG_RENEG_ON_HOLD);
}
} else if (!strcasecmp(var, "renegotiate-codec-on-reinvite")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_RENEG_ON_REINVITE);
} else {
sofia_clear_pflag(profile, PFLAG_RENEG_ON_REINVITE);
}
} else if (!strcasecmp(var, "presence-probe-on-register")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER);
@@ -2473,12 +2507,6 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
} else {
profile->dtmf_type = DTMF_NONE;
}
} else if (!strcasecmp(var, "NDLB-force-rport")) {
if (val && !strcasecmp(val, "safe")) {
profile->rport_level = 3;
} else if (switch_true(val)) {
profile->rport_level = 2;
}
} else if (!strcasecmp(var, "caller-id-type")) {
profile->cid_type = sofia_cid_name2type(val);
} else if (!strcasecmp(var, "record-template")) {
@@ -3044,7 +3072,8 @@ switch_status_t config_sofia(int reload, char *profile_name)
profile->dtmf_duration = 100;
profile->tls_version = 0;
profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
profile->rport_level = 1;
profile->server_rport_level = 1;
profile->client_rport_level = 1;
sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
sofia_set_pflag(profile, PFLAG_DISABLE_100REL);
profile->auto_restart = 1;
@@ -3137,6 +3166,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
} else {
sofia_clear_pflag(profile, PFLAG_RENEG_ON_HOLD);
}
} else if (!strcasecmp(var, "renegotiate-codec-on-reinvite")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_RENEG_ON_REINVITE);
} else {
sofia_clear_pflag(profile, PFLAG_RENEG_ON_REINVITE);
}
} else if (!strcasecmp(var, "presence-probe-on-register")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER);
@@ -3180,9 +3215,19 @@ switch_status_t config_sofia(int reload, char *profile_name)
}
} else if (!strcasecmp(var, "NDLB-force-rport")) {
if (val && !strcasecmp(val, "safe")) {
profile->rport_level = 3;
profile->server_rport_level = 3;
profile->client_rport_level = 1;
} else if (val && !strcasecmp(val, "disabled")) {
profile->server_rport_level = 0;
profile->client_rport_level = 0;
} else if (val && !strcasecmp(val, "client-only")) {
profile->client_rport_level = 1;
} else if (val && !strcasecmp(val, "server-only")) {
profile->client_rport_level = 0;
profile->client_rport_level = 1;
} else if (switch_true(val)) {
profile->rport_level = 2;
profile->server_rport_level = 2;
profile->client_rport_level = 1;
}
} else if (!strcasecmp(var, "auto-rtp-bugs")) {
sofia_glue_parse_rtp_bugs(&profile->auto_rtp_bugs, val);
@@ -4378,7 +4423,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
if (switch_channel_test_flag(channel, CF_PROXY_MODE) ||
switch_channel_test_flag(channel, CF_PROXY_MEDIA) ||
(sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38)) {
(sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && (has_t38 || status > 299))) {
if (sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
@@ -4387,6 +4432,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
const char *r_sdp = NULL;
switch_core_session_message_t *msg;
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
if (sip->sip_payload && sip->sip_payload->pl_data &&
sip->sip_content_type && sip->sip_content_type->c_subtype && switch_stristr("sdp", sip->sip_content_type->c_subtype)) {
@@ -4396,10 +4442,20 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase);
if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) {
if (sip->sip_payload && sip->sip_payload->pl_data) {
switch_t38_options_t *t38_options = sofia_glue_extract_t38_options(session, sip->sip_payload->pl_data);
if (status > 299) {
switch_channel_set_private(channel, "t38_options", NULL);
switch_channel_set_private(other_channel, "t38_options", NULL);
sofia_clear_flag(tech_pvt, TFLAG_T38_PASSTHRU);
sofia_clear_flag(other_tech_pvt, TFLAG_T38_PASSTHRU);
} else if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38 && sip->sip_payload && sip->sip_payload->pl_data) {
switch_t38_options_t *t38_options = sofia_glue_extract_t38_options(session, sip->sip_payload->pl_data);
if (!t38_options) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_WARNING, "%s Error parsing SDP:\n%s\n",
switch_channel_get_name(tech_pvt->channel), sip->sip_payload->pl_data);
goto end;
} else {
char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session);
switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session);
char tmp[32] = "";
@@ -4458,6 +4514,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) {
if (switch_rtp_ready(tech_pvt->rtp_session) && switch_rtp_ready(other_tech_pvt->rtp_session)) {
sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
switch_rtp_udptl_mode(tech_pvt->rtp_session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating T38 Passthru\n");
}
@@ -4742,7 +4799,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
if (status == 183 && !r_sdp) {
if ((channel && switch_true(switch_channel_get_variable(channel, "sip_ignore_183nosdp"))) || sofia_test_pflag(profile, PFLAG_IGNORE_183NOSDP)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Ignoring 183 w/o sdp\n", switch_channel_get_name(channel));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Ignoring 183 w/o sdp\n", channel ? switch_channel_get_name(channel) : "None");
goto done;
}
status = 180;
@@ -4881,7 +4938,11 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
match = sofia_glue_negotiate_sdp(session, r_sdp);
}
if (match) {
if (!match) {
if (switch_channel_get_state(channel) != CS_NEW) {
nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
}
} else {
nua_handle_t *bnh;
sip_replaces_t *replaces;
su_home_t *home = NULL;
@@ -4889,6 +4950,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_channel_get_state(channel) == CS_NEW) {
switch_channel_set_state(channel, CS_INIT);
} else {
nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
}
sofia_set_flag(tech_pvt, TFLAG_SDP);
if (replaces_str) {
@@ -5496,13 +5559,6 @@ nua_handle_t *sofia_global_nua_handle_by_replaces(sip_replaces_t *replaces)
const void *var;
void *val;
sofia_profile_t *profile;
switch_xml_t xml_root;
const char *err;
if ((xml_root = switch_xml_open_root(1, &err))) {
switch_xml_free(xml_root);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Reload XML [%s]\n", err);
}
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if (mod_sofia_globals.profile_hash) {
@@ -5527,7 +5583,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
{
/* Incoming refer */
sip_from_t const *from;
sip_to_t const *to;
//sip_to_t const *to;
sip_refer_to_t const *refer_to;
private_object_t *tech_pvt = switch_core_session_get_private(session);
char *etmp = NULL, *exten = NULL;
@@ -5550,7 +5606,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
}
from = sip->sip_from;
to = sip->sip_to;
//to = sip->sip_to;
home = su_home_new(sizeof(*home));
switch_assert(home != NULL);
@@ -5657,6 +5713,11 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
switch_core_event_hook_add_state_change(a_session, xfer_hanguphook);
switch_channel_set_variable(a_channel, "att_xfer_kill_uuid", switch_core_session_get_uuid(b_session));
if (profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER) {
switch_channel_set_flag(a_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
}
if ((tmp = switch_channel_get_hold_music(a_channel))) {
moh = tmp;
}
@@ -5705,7 +5766,18 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n",
switch_str_nil(br_a), switch_str_nil(br_b));
if ((profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER) && (tmp = switch_core_session_locate(br_b))) {
if ((tmp = switch_core_session_locate(br_b))) {
switch_channel_t *tchannel = switch_core_session_get_channel(tmp);
if ((profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER)) {
switch_channel_set_flag(tchannel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
}
switch_channel_set_flag(tchannel, CF_ATTENDED_TRANSFER);
switch_core_session_rwunlock(tmp);
}
if ((profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER) && (tmp = switch_core_session_locate(br_a))) {
switch_channel_t *tchannel = switch_core_session_get_channel(tmp);
switch_channel_set_flag(tchannel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
switch_core_session_rwunlock(tmp);
@@ -6093,7 +6165,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
/* Barf if we didn't get our private */
assert(switch_core_session_get_private(session));
if (sip->sip_content_type && sip->sip_content_type->c_subtype && sip->sip_content_type->c_type &&
if (sip && sip->sip_content_type && sip->sip_content_type->c_subtype && sip->sip_content_type->c_type &&
!strncasecmp(sip->sip_content_type->c_type, "message", 7) &&
!strcasecmp(sip->sip_content_type->c_subtype, "update_display")) {
sofia_update_callee_id(session, profile, sip, SWITCH_TRUE);
@@ -6304,7 +6376,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
const char *displayname = NULL;
const char *destination_number = NULL;
const char *from_user = NULL, *from_host = NULL;
const char *referred_by_user = NULL, *referred_by_host = NULL;
const char *referred_by_user = NULL;//, *referred_by_host = NULL;
const char *context = NULL;
const char *dialplan = NULL;
char network_ip[80];
@@ -6835,7 +6907,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
if (sip->sip_referred_by) {
referred_by_user = sip->sip_referred_by->b_url->url_user;
referred_by_host = sip->sip_referred_by->b_url->url_host;
//referred_by_host = sip->sip_referred_by->b_url->url_host;
channel_name = url_set_chanvars(session, sip->sip_referred_by->b_url, sip_referred_by);
check_decode(referred_by_user, session);
@@ -6977,8 +7049,9 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
}
if (!gateway && gw_param_name) {
gateway = sofia_reg_find_gateway(gw_param_name);
extension = gateway->real_extension;
if ((gateway = sofia_reg_find_gateway(gw_param_name))) {
extension = gateway->real_extension;
}
}
if (gateway) {
@@ -7079,7 +7152,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
const char *data = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE);
if (app && data && !strcasecmp(app, "conference")) {
destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s", data);
destination_number = switch_core_session_sprintf(session, "answer,conference:%s", data);
dialplan = "inline";
} else {
if (switch_core_session_check_interface(b_session, sofia_endpoint_interface)) {
@@ -7087,8 +7160,6 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
}
if ((uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_channel_set_variable(b_channel, "presence_call_info", NULL);
switch_channel_set_variable(b_channel, "presence_call_info_full", NULL);
one_leg = 0;
} else {
uuid = switch_core_session_get_uuid(b_session);
@@ -7117,7 +7188,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
if (!one_leg &&
(!b_tech_pvt || !sofia_test_flag(b_tech_pvt, TFLAG_SIP_HOLD)) &&
(!c_tech_pvt || !sofia_test_flag(c_tech_pvt, TFLAG_SIP_HOLD))) {
char *ext = switch_core_session_sprintf(b_session, "answer,conference:%s@sla+flags{mintwo}", uuid);
char *ext = switch_core_session_sprintf(session, "answer,conference:%s@sla+flags{mintwo}", uuid);
switch_channel_set_flag(c_channel, CF_REDIRECT);
switch_ivr_session_transfer(b_session, ext, "inline", NULL);
@@ -7129,16 +7200,17 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
}
if (do_conf) {
destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s@sla+flags{mintwo}", uuid);
destination_number = switch_core_session_sprintf(session, "answer,conference:%s@sla+flags{mintwo}", uuid);
} else {
if (one_leg && c_app) {
if (c_data) {
destination_number = switch_core_session_sprintf(b_session, "answer,%s:%s", c_app, c_data);
destination_number = switch_core_session_sprintf(session, "answer,%s:%s", c_app, c_data);
} else {
destination_number = switch_core_session_sprintf(b_session, "answer,%s", c_app);
destination_number = switch_core_session_sprintf(session, "answer,%s", c_app);
}
} else {
destination_number = switch_core_session_sprintf(b_session, "answer,intercept:%s", uuid);
switch_channel_mark_hold(b_channel, SWITCH_FALSE);
destination_number = switch_core_session_sprintf(session, "answer,intercept:%s", uuid);
}
}
+127 -48
View File
@@ -187,7 +187,7 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t *
static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen,
switch_port_t port,
int cur_ptime, const char *append_audio, const char *sr, int use_cng, int cng_type, switch_event_t *map, int verbose_sdp)
int cur_ptime, const char *append_audio, const char *sr, int use_cng, int cng_type, switch_event_t *map, int verbose_sdp, int secure)
{
int i = 0;
int rate;
@@ -195,7 +195,7 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen,
int ptime = 0, noptime = 0;
switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "m=audio %d RTP/%sAVP",
port, (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) ? "S" : "");
port, secure ? "S" : "");
@@ -312,6 +312,11 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen,
switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
}
if (secure) {
switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key);
//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
}
if (!cng_type) {
//switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d CN/8000\n", cng_type);
//} else {
@@ -333,7 +338,6 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen,
if (sr) {
switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=%s\n", sr);
}
}
void sofia_glue_check_dtmf_type(private_object_t *tech_pvt)
@@ -505,7 +509,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
ptime = tech_pvt->read_codec.implementation->microseconds_per_packet / 1000;
}
if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
}
@@ -529,7 +533,11 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
if (sr) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr);
}
if (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key);
//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
}
} else if (tech_pvt->num_codecs) {
int i;
@@ -545,7 +553,15 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
}
if (!switch_true(switch_channel_get_variable(tech_pvt->channel, "sdp_m_per_ptime"))) {
generate_m(tech_pvt, buf, sizeof(buf), port, 0, append_audio, sr, use_cng, cng_type, map, verbose_sdp);
char *bp = buf;
if ((!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE))) {
generate_m(tech_pvt, buf, sizeof(buf), port, 0, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 1);
bp = (buf + strlen(buf));
}
generate_m(tech_pvt, bp, sizeof(buf) - strlen(buf), port, 0, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 0);
} else {
for (i = 0; i < tech_pvt->num_codecs; i++) {
@@ -558,8 +574,15 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
this_ptime = imp->microseconds_per_packet / 1000;
if (cur_ptime != this_ptime) {
cur_ptime = this_ptime;
generate_m(tech_pvt, buf, sizeof(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp);
char *bp = buf;
cur_ptime = this_ptime;
if ((!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE))) {
generate_m(tech_pvt, buf, sizeof(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 1);
bp = (buf + strlen(buf));
}
generate_m(tech_pvt, bp, sizeof(buf) - strlen(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 0);
}
}
@@ -567,11 +590,6 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
}
if (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key);
//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
}
if (sofia_test_flag(tech_pvt, TFLAG_VIDEO)) {
if (!tech_pvt->local_sdp_video_port) {
sofia_glue_tech_choose_video_port(tech_pvt, 0);
@@ -729,6 +747,8 @@ void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt)
return;
}
tech_pvt->payload_space = 0;
switch_assert(tech_pvt->session != NULL);
if ((abs = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) {
@@ -1259,7 +1279,9 @@ int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip)
{
switch_assert(network_ip);
return (profile->extsipip && !switch_check_network_list_ip(network_ip, profile->local_network));
return (profile->extsipip &&
!switch_check_network_list_ip(network_ip, "loopback.auto") &&
!switch_check_network_list_ip(network_ip, profile->local_network));
}
int sofia_glue_transport_has_tls(const sofia_transport_t tp)
@@ -1893,6 +1915,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
const char *invite_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_to");
const char *handle_full_from = switch_channel_get_variable(tech_pvt->channel, "sip_handle_full_from");
const char *handle_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_handle_full_to");
const char *force_full_from = switch_channel_get_variable(tech_pvt->channel, "sip_force_full_from");
const char *force_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_force_full_to");
char *mp = NULL, *mp_type = NULL;
rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
@@ -2106,8 +2130,9 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
if (!from_display && !strcasecmp(tech_pvt->caller_profile->caller_id_name, "_undef_")) {
from_str = switch_core_session_sprintf(session, "<%s>", use_from_str);
} else {
from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", from_display ? from_display :
tech_pvt->caller_profile->caller_id_name, use_from_str);
char *name = switch_core_session_strdup(session, from_display ? from_display : tech_pvt->caller_profile->caller_id_name);
check_decode(name, session);
from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", name, use_from_str);
}
if (!(call_id = switch_channel_get_variable(channel, "sip_invite_call_id"))) {
@@ -2125,6 +2150,15 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
}
if (force_full_from) {
from_str = (char *) force_full_from;
}
if (force_full_to) {
to_str = (char *) force_full_to;
}
if (invite_req_uri) {
url_str = (char *) invite_req_uri;
}
@@ -2137,6 +2171,15 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
if (!strncasecmp(url_str, "sips:", 5)) {
s = url_str + 5;
}
/* tel: patch from jaybinks, added by MC
It compiles but I don't have a way to test it
*/
if (!strncasecmp(url_str, "tel:", 4)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
SWITCH_LOG_ERROR, "URL Error! tel: uri's not supported at this time\n");
return SWITCH_STATUS_FALSE;
}
if (!s) {
s = url_str;
}
@@ -2520,6 +2563,7 @@ static void set_stats(switch_rtp_t *rtp_session, private_object_t *tech_pvt, con
add_stat(stats->inbound.dtmf_packet_count, "in_dtmf_packet_count");
add_stat(stats->inbound.cng_packet_count, "in_cng_packet_count");
add_stat(stats->inbound.flush_packet_count, "in_flush_packet_count");
add_stat(stats->inbound.largest_jb_size, "in_largest_jb_size");
add_stat(stats->outbound.raw_bytes, "out_raw_bytes");
add_stat(stats->outbound.media_bytes, "out_media_bytes");
@@ -2630,9 +2674,7 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
return SWITCH_STATUS_FALSE;
} else {
int ms;
tech_pvt->video_read_frame.rate = tech_pvt->video_rm_rate;
ms = tech_pvt->video_write_codec.implementation->microseconds_per_packet / 1000;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set VIDEO Codec %s %s/%ld %d ms\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate, tech_pvt->video_codec_ms);
tech_pvt->video_read_frame.codec = &tech_pvt->video_read_codec;
@@ -2657,7 +2699,6 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int
switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
{
int ms;
switch_status_t status = SWITCH_STATUS_SUCCESS;
int resetting = 0;
@@ -2750,7 +2791,6 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
}
tech_pvt->read_frame.rate = tech_pvt->rm_rate;
ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000;
if (!switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
@@ -2833,7 +2873,6 @@ switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, s
switch_status_t sofia_glue_add_crypto(private_object_t *tech_pvt, const char *key_str, switch_rtp_crypto_direction_t direction)
{
unsigned char key[SWITCH_RTP_MAX_CRYPTO_LEN];
int index;
switch_rtp_crypto_key_type_t type;
char *p;
@@ -2842,8 +2881,6 @@ switch_status_t sofia_glue_add_crypto(private_object_t *tech_pvt, const char *ke
goto bad;
}
index = atoi(key_str);
p = strchr(key_str, ' ');
if (p && *p && *(p + 1)) {
@@ -2890,7 +2927,6 @@ switch_status_t sofia_glue_add_crypto(private_object_t *tech_pvt, const char *ke
switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_flag_t myflags)
{
int bw, ms;
const char *err = NULL;
const char *val = NULL;
switch_rtp_flag_t flags;
@@ -2931,9 +2967,6 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
goto end;
}
bw = tech_pvt->read_impl.bits_per_second;
ms = tech_pvt->read_impl.microseconds_per_packet;
if (myflags) {
flags = myflags;
} else if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
@@ -2965,6 +2998,17 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
flags |= SWITCH_RTP_FLAG_AUTO_CNG;
}
#if __BYTE_ORDER == __LITTLE_ENDIAN
if (!strcasecmp(tech_pvt->read_impl.iananame, "L16")) {
flags |= SWITCH_RTP_FLAG_BYTESWAP;
}
#endif
if ((flags & SWITCH_RTP_FLAG_BYTESWAP) && (val = switch_channel_get_variable(tech_pvt->channel, "rtp_disable_byteswap")) && switch_true(val)) {
flags &= ~SWITCH_RTP_FLAG_BYTESWAP;
}
if (tech_pvt->rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
//const char *ip = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
//const char *port = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
@@ -2974,6 +3018,21 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_audio_ip) && remote_port == tech_pvt->remote_sdp_audio_port) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Audio params are unchanged for %s.\n",
switch_channel_get_name(tech_pvt->channel));
if (switch_rtp_ready(tech_pvt->rtp_session)) {
if (tech_pvt->audio_recv_pt != tech_pvt->agreed_pt) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
"%s Set audio receive payload in Re-INVITE for non-matching dynamic PT to %u\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->audio_recv_pt);
switch_rtp_set_recv_pt(tech_pvt->rtp_session, tech_pvt->audio_recv_pt);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
"%s Setting audio receive payload in Re-INVITE to %u\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->audio_recv_pt);
switch_rtp_set_recv_pt(tech_pvt->rtp_session, tech_pvt->agreed_pt);
}
}
goto video;
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Audio params changed for %s from %s:%d to %s:%d\n",
@@ -3176,7 +3235,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec")) || (val = tech_pvt->profile->jb_msec)) {
int jb_msec = atoi(val);
int maxlen = 0, max_drift = 1000;
int maxlen = 0, max_drift = 0;
char *p, *q;
if ((p = strchr(val, ':'))) {
@@ -3196,10 +3255,17 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
qlen = jb_msec / (tech_pvt->read_impl.microseconds_per_packet / 1000);
if (qlen < 1) {
qlen = 3;
}
if (maxlen) {
maxqlen = maxlen / (tech_pvt->read_impl.microseconds_per_packet / 1000);
}
if (maxqlen < qlen) {
maxqlen = qlen * 5;
}
if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen,
tech_pvt->read_impl.samples_per_packet,
tech_pvt->read_impl.samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) {
@@ -3394,9 +3460,9 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) && !switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) &&
!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
} else {
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
}
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
@@ -4045,7 +4111,7 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp)
sdp_session_t *sdp;
private_object_t *tech_pvt = switch_core_session_get_private(session);
sdp_attribute_t *attr;
int ptime = 0, dptime = 0, dmaxptime = 0, maxptime = 0;
int ptime = 0, dptime = 0;
if (!(parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
return;
@@ -4066,8 +4132,6 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp)
if (!strcasecmp(attr->a_name, "ptime")) {
dptime = atoi(attr->a_value);
} else if (!strcasecmp(attr->a_name, "maxptime")) {
dmaxptime = atoi(attr->a_value);
}
}
@@ -4075,7 +4139,7 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp)
for (m = sdp->sdp_media; m; m = m->m_next) {
ptime = dptime;
maxptime = dmaxptime;
//maxptime = dmaxptime;
if (m->m_proto == sdp_proto_rtp) {
sdp_rtpmap_t *map;
@@ -4083,7 +4147,7 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp)
if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
ptime = atoi(attr->a_value);
} else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) {
maxptime = atoi(attr->a_value);
//maxptime = atoi(attr->a_value);
}
}
@@ -4290,7 +4354,15 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
}
}
if (!reneg) {
if (reneg) {
reneg = sofia_test_pflag(tech_pvt->profile, PFLAG_RENEG_ON_REINVITE);
if ((val = switch_channel_get_variable(tech_pvt->channel, "sip_renegotiate_codec_on_reinvite"))) {
reneg = switch_true(val);
}
}
if (!reneg && tech_pvt->num_negotiated_codecs) {
codec_array = tech_pvt->negotiated_codecs;
total_codecs = tech_pvt->num_negotiated_codecs;
}
@@ -4688,6 +4760,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
tech_pvt->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
tech_pvt->remote_sdp_audio_port = (switch_port_t) m->m_port;
tech_pvt->agreed_pt = (switch_payload_t) map->rm_pt;
tech_pvt->num_negotiated_codecs = 0;
tech_pvt->negotiated_codecs[tech_pvt->num_negotiated_codecs++] = mimp;
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
@@ -4727,6 +4800,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
switch_rtp_set_telephony_recv_event(tech_pvt->rtp_session, te);
}
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Disable 2833 dtmf\n");
switch_channel_set_variable(tech_pvt->channel, "dtmf_type", "none");
tech_pvt->dtmf_type = DTMF_NONE;
te = tech_pvt->recv_te = 0;
}
@@ -4739,7 +4817,6 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
} else if (m->m_type == sdp_media_video && m->m_port) {
sdp_rtpmap_t *map;
const char *rm_encoding;
int framerate = 0;
const switch_codec_implementation_t *mimp = NULL;
int vmatch = 0, i;
switch_channel_set_variable(tech_pvt->channel, "video_possible", "true");
@@ -4759,7 +4836,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
for (attr = m->m_attributes; attr; attr = attr->a_next) {
if (!strcasecmp(attr->a_name, "framerate") && attr->a_value) {
framerate = atoi(attr->a_value);
//framerate = atoi(attr->a_value);
}
if (!strcasecmp(attr->a_name, "rtcp") && attr->a_value) {
switch_channel_set_variable(tech_pvt->channel, "sip_remote_video_rtcp_port", attr->a_value);
@@ -5183,12 +5260,14 @@ void sofia_glue_del_profile(sofia_profile_t *profile)
}
for (gp = profile->gateways; gp; gp = gp->next) {
char *pkey = switch_mprintf("%s::%s", profile->name, gp->name);
switch_core_hash_delete(mod_sofia_globals.gateway_hash, gp->name);
switch_core_hash_delete(mod_sofia_globals.gateway_hash, gp->register_from);
switch_core_hash_delete(mod_sofia_globals.gateway_hash, gp->register_contact);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "deleted gateway %s\n", gp->name);
profile->gateways = NULL;
switch_core_hash_delete(mod_sofia_globals.gateway_hash, pkey);
switch_safe_free(pkey);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "deleted gateway %s from profile %s\n", gp->name, profile->name);
}
profile->gateways = NULL;
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
}
@@ -5253,11 +5332,11 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_from_uri"));
if (!switch_channel_get_variable_dup(channel, "sip_handle_full_from", SWITCH_FALSE)) {
if (!switch_channel_get_variable_dup(channel, "sip_handle_full_from", SWITCH_FALSE, -1)) {
switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, "sip_full_to"));
}
if (!switch_channel_get_variable_dup(channel, "sip_handle_full_to", SWITCH_FALSE)) {
if (!switch_channel_get_variable_dup(channel, "sip_handle_full_to", SWITCH_FALSE, -1)) {
switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_from"));
}
}
@@ -6187,7 +6266,7 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
contact = sofia_glue_get_url_from_contact((char *) o_contact, 1);
if (!zstr(network_ip) && sofia_glue_check_nat(profile, network_ip)) {
char *ptr = NULL;
const char *transport_str = NULL;
//const char *transport_str = NULL;
id = switch_mprintf("sip:%s@%s", user, profile->extsipip);
@@ -6195,7 +6274,7 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) {
sofia_transport_t transport = sofia_glue_str2transport(ptr);
transport_str = sofia_glue_transport2str(transport);
//transport_str = sofia_glue_transport2str(transport);
switch (transport) {
case SOFIA_TRANSPORT_TCP:
contact_str = profile->tcp_public_contact;
@@ -6403,7 +6482,7 @@ void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str)
char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_nat_parse_t *np)
{
char *contact_str = NULL;
const char *contact_host, *contact_user;
const char *contact_host;//, *contact_user;
sip_contact_t const *contact;
char *port;
const char *display = "\"user\"";
@@ -6431,7 +6510,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sof
port = (char *) contact->m_url->url_port;
contact_host = sip->sip_contact->m_url->url_host;
contact_user = sip->sip_contact->m_url->url_user;
//contact_user = sip->sip_contact->m_url->url_user;
display = contact->m_display;
+89 -74
View File
@@ -195,23 +195,17 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
}
if (dst->route_uri) {
remote_host = strdup(dst->route_uri);
if (!zstr(remote_host)) {
switch_split_user_domain(remote_host, NULL, &remote_ip);
}
}
if (zstr(remote_ip)) {
switch_split_user_domain(dup_dest, NULL, &remote_ip);
remote_host = strdup(dup_dest);
if (!zstr(remote_host)) {
switch_split_user_domain(remote_host, NULL, &remote_ip);
}
if (!zstr(remote_ip) && sofia_glue_check_nat(profile, remote_ip)) {
char *ptr = NULL;
const char *transport_str = NULL;
//const char *transport_str = NULL;
if ((ptr = sofia_glue_find_parameter(dst->contact, "transport="))) {
sofia_transport_t transport = sofia_glue_str2transport(ptr);
transport_str = sofia_glue_transport2str(transport);
//transport_str = sofia_glue_transport2str(transport);
switch (transport) {
case SOFIA_TRANSPORT_TCP:
contact_str = profile->tcp_public_contact;
@@ -1417,6 +1411,11 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
}
if (!(nh = nua_handle_by_call_id(profile->nua, call_id))) {
if (mod_sofia_globals.debug_presence > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find handle for call id %s\n", call_id);
}
goto end;
}
@@ -1468,12 +1467,18 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
const char *astate = switch_str_nil(switch_event_get_header(helper->event, "astate"));
const char *answer_state = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
const char *dft_state;
const char *from_id = switch_str_nil(switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number"));
const char *from_id;
const char *to_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_to_user"));
const char *from_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_from_user"));
char *clean_to_user = NULL;
char *clean_from_user = NULL;
int force_status = 0;
if (!strcasecmp(direction, "inbound")) {
from_id = switch_str_nil(switch_event_get_header(helper->event, "Caller-Destination-Number"));
} else {
from_id = switch_str_nil(switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number"));
}
#if 0
char *buf;
switch_event_serialize(helper->event, &buf, SWITCH_FALSE);
@@ -1506,9 +1511,9 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
stream.write_function(&stream,
"<?xml version=\"1.0\"?>\n"
"<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" "
"version=\"%s\" state=\"%s\" entity=\"%s\">\n",
version,
zstr(uuid) ? "partial" : "full", clean_id);
"version=\"%s\" state=\"partial\" entity=\"%s\">\n", version, clean_id);
}
//if (strcasecmp(event_status, "Registered")) {
@@ -2004,7 +2009,7 @@ static void sync_sla(sofia_profile_t *profile, const char *to_user, const char *
switch_core_hash_init(&sh->hash, sh->pool);
sql = switch_mprintf("select sip_from_user,sip_from_host,call_info,call_info_state,uuid from sip_dialogs "
"where hostname='%q' and ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')",
"where call_info_state is not null and hostname='%q' and ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')",
mod_sofia_globals.hostname, to_user, to_host, to_user, to_host);
@@ -2059,7 +2064,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
tagi_t tags[])
{
long exp_abs, exp_delta;
long exp_delta;
char exp_delta_str[30] = "";
sip_to_t const *to;
const char *from_user = NULL, *from_host = NULL;
@@ -2080,7 +2085,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
int sent_reply = 0;
sip_contact_t const *contact;
const char *ipv6;
const char *contact_host, *contact_user;
const char *contact_user;
sofia_nat_parse_t np = { { 0 } };
if (!sip) {
@@ -2095,7 +2100,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
return;
}
contact_host = sip->sip_contact->m_url->url_host;
//contact_host = sip->sip_contact->m_url->url_host;
contact_user = sip->sip_contact->m_url->url_user;
tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
@@ -2142,10 +2147,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
}
}
if (exp_delta) {
exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta;
} else {
exp_abs = 0;
if (!exp_delta) {
sub_state = nua_substate_terminated;
}
@@ -2178,58 +2180,79 @@ void sofia_presence_handle_sip_i_subscribe(int status,
sip->sip_expires->ex_delta = 31536000;
}
if (sofia_test_pflag(profile, PFLAG_MULTIREG)) {
sql = switch_mprintf("delete from sip_subscriptions where call_id='%q' "
"or (proto='%q' and sip_user='%q' and sip_host='%q' "
"and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q' "
"and contact='%q')",
call_id, proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname, contact_str);
} else {
sql = switch_mprintf("delete from sip_subscriptions where "
"proto='%q' and sip_user='%q' and sip_host='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q'",
proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname);
}
switch_mutex_lock(profile->ireg_mutex);
switch_assert(sql != NULL);
sofia_glue_actually_execute_sql(profile, sql, NULL);
switch_safe_free(sql);
if (sub_state == nua_substate_terminated) {
sstr = switch_mprintf("terminated");
} else {
sip_accept_t *ap = sip->sip_accept;
char accept[256] = "";
full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent);
while (ap) {
switch_snprintf(accept + strlen(accept), sizeof(accept) - strlen(accept), "%s%s ", ap->ac_type, ap->ac_next ? "," : "");
ap = ap->ac_next;
}
sql = switch_mprintf("insert into sip_subscriptions "
"(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from,"
"full_via,expires,user_agent,accept,profile_name,hostname,network_port,network_ip) "
"values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%d','%q')",
proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host,
event, contact_str, call_id, full_from, full_via,
//sofia_test_pflag(profile, PFLAG_MULTIREG) ? switch_epoch_time_now(NULL) + exp_delta : exp_delta * -1,
if ((sub_state == nua_substate_active) && (switch_stristr("dialog", (const char *) event))) {
sstr = switch_mprintf("active;expires=%ld", exp_delta);
sql = switch_mprintf("update sip_subscriptions "
"set expires=%ld "
"where call_id='%q' and event='dialog' and hostname='%q' ",
(long) switch_epoch_time_now(NULL) + (exp_delta * 2),
full_agent, accept, profile->name, mod_sofia_globals.hostname, np.network_port, np.network_ip);
switch_assert(sql != NULL);
call_id,
mod_sofia_globals.hostname);
if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s SUBSCRIBE %s@%s %s@%s\n%s\n",
profile->name, from_user, from_host, to_user, to_host, sql);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"re-subscribe with dialog detected, sql: %s\n", sql);
}
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
} else {
if (sofia_test_pflag(profile, PFLAG_MULTIREG)) {
sql = switch_mprintf("delete from sip_subscriptions where call_id='%q' "
"or (proto='%q' and sip_user='%q' and sip_host='%q' "
"and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q' "
"and contact='%q')",
call_id, proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname, contact_str);
} else {
sql = switch_mprintf("delete from sip_subscriptions where "
"proto='%q' and sip_user='%q' and sip_host='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q'",
proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname);
}
switch_mutex_lock(profile->ireg_mutex);
switch_assert(sql != NULL);
sofia_glue_actually_execute_sql(profile, sql, NULL);
switch_safe_free(sql);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
sstr = switch_mprintf("active;expires=%ld", exp_delta);
if (sub_state == nua_substate_terminated) {
sstr = switch_mprintf("terminated");
} else {
sip_accept_t *ap = sip->sip_accept;
char accept[256] = "";
full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent);
while (ap) {
switch_snprintf(accept + strlen(accept), sizeof(accept) - strlen(accept), "%s%s ", ap->ac_type, ap->ac_next ? "," : "");
ap = ap->ac_next;
}
sql = switch_mprintf("insert into sip_subscriptions "
"(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from,"
"full_via,expires,user_agent,accept,profile_name,hostname,network_port,network_ip) "
"values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%d','%q')",
proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host,
event, contact_str, call_id, full_from, full_via,
//sofia_test_pflag(profile, PFLAG_MULTIREG) ? switch_epoch_time_now(NULL) + exp_delta : exp_delta * -1,
(long) switch_epoch_time_now(NULL) + (exp_delta * 2),
full_agent, accept, profile->name, mod_sofia_globals.hostname, np.network_port, np.network_ip);
switch_assert(sql != NULL);
if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s SUBSCRIBE %s@%s %s@%s\n%s\n",
profile->name, from_user, from_host, to_user, to_host, sql);
}
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
sstr = switch_mprintf("active;expires=%ld", exp_delta);
}
switch_mutex_unlock(profile->ireg_mutex);
}
if (status < 200) {
char *sticky = NULL;
@@ -2773,9 +2796,7 @@ void sofia_presence_handle_sip_i_message(int status,
sip_to_t const *to = sip->sip_to;
const char *to_user = NULL;
const char *to_host = NULL;
sip_subject_t const *sip_subject = sip->sip_subject;
sip_payload_t *payload = sip->sip_payload;
const char *subject = "n/a";
char *msg = NULL;
if (sip->sip_content_type && sip->sip_content_type->c_subtype) {
@@ -2802,14 +2823,9 @@ void sofia_presence_handle_sip_i_message(int status,
msg = payload->pl_data;
}
if (sip_subject) {
subject = sip_subject->g_value;
}
if (nh) {
char hash_key[512];
private_object_t *tech_pvt;
switch_channel_t *channel;
switch_event_t *event;
char *to_addr;
char *from_addr;
@@ -2840,7 +2856,6 @@ void sofia_presence_handle_sip_i_message(int status,
}
if (sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT) && (tech_pvt = (private_object_t *) switch_core_hash_find(profile->chat_hash, hash_key))) {
channel = switch_core_session_get_channel(tech_pvt->session);
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url);
+11 -116
View File
@@ -800,7 +800,7 @@ void sofia_reg_auth_challenge(nua_t *nua, sofia_profile_t *profile, nua_handle_t
sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname, last_nc) "
"values('%q', %ld, '%q', '%q', 0)", uuid_str,
switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL),
(long) switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL),
profile->name, mod_sofia_globals.hostname);
switch_assert(sql != NULL);
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
@@ -852,7 +852,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
const char *reg_host = profile->reg_db_domain;
const char *sub_host = profile->sub_domain;
char contact_str[1024] = "";
int nat_hack = 0;
uint8_t multi_reg = 0, multi_reg_contact = 0, avoid_multi_reg = 0;
uint8_t stale = 0, forbidden = 0;
auth_res_t auth_res;
@@ -863,7 +862,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
char network_ip[80];
char network_port_c[6];
char url_ip[80];
char *register_gateway = NULL;
int network_port;
const char *reg_desc = "Registered";
const char *call_id = NULL;
@@ -1094,8 +1092,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
avoid_multi_reg = 1;
}
register_gateway = switch_event_get_header(*v_event, "sip-register-gateway");
/* Allow us to force the SIP user to be something specific - needed if
* we - for example - want to be able to ensure that the username a UA can
* be contacted at is the same one that they used for authentication.
@@ -1104,7 +1100,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
to_user = force_user;
}
if (profile->rport_level == 3 && sip->sip_user_agent &&
if (profile->server_rport_level == 3 && sip->sip_user_agent &&
sip->sip_user_agent->g_string && !strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7)) {
if (sip && sip->sip_via) {
const char *host = sip->sip_via->v_host;
@@ -1124,8 +1120,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
}
}
if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact")) || auto_connectile) {
if ((!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0")) || auto_connectile) {
if (auto_connectile || (v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) {
if (auto_connectile || (!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0"))) {
char *path_encoded;
size_t path_encoded_len;
char my_contact_str[1024];
@@ -1166,7 +1162,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
reg_desc = "Registered(AUTO-NAT)";
exptime = 30;
}
nat_hack = 1;
} else {
char *p;
switch_copy_string(contact_str, v_contact_str, sizeof(contact_str));
@@ -1914,7 +1909,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
} else if (gateway) {
switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->auth_username, gateway->register_password);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Matching gateway found\n");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot locate any authentication credentials to complete an authentication request for realm '%s'\n", realm);
goto cancel;
}
@@ -2007,7 +2002,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
const char *call_id = NULL;
char *sql;
char *number_alias = NULL;
switch_xml_t domain, xml = NULL, user, param, uparams, dparams, group = NULL, gparams = NULL;
switch_xml_t user = NULL, param, uparams;
char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1] = "";
char *domain_name = NULL;
switch_event_t *params = NULL;
@@ -2184,7 +2179,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
domain_name = realm;
}
if (switch_xml_locate_user("id", zstr(username) ? "nobody" : username, domain_name, ip, &xml, &domain, &user, &group, params) != SWITCH_STATUS_SUCCESS) {
if (switch_xml_locate_user_merged("id", zstr(username) ? "nobody" : username, domain_name, ip, &user, params) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n"
"You must define a domain called '%s' in your directory and add a user with the id=\"%s\" attribute\n"
"and you must configure your device to use the proper domain in it's authentication credentials.\n", username, domain_name,
@@ -2205,90 +2200,10 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
number_alias = zstr(username) ? "nobody" : username;
}
dparams = switch_xml_child(domain, "params");
uparams = switch_xml_child(user, "params");
if (group) {
gparams = switch_xml_child(group, "params");
}
if (!(dparams || uparams)) {
if (!(uparams = switch_xml_child(user, "params"))) {
ret = AUTH_OK;
goto skip_auth;
}
if (dparams) {
for (param = switch_xml_child(dparams, "param"); param; param = param->next) {
const char *var = switch_xml_attr_soft(param, "name");
const char *val = switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "sip-forbid-register") && switch_true(val)) {
ret = AUTH_FORBIDDEN;
goto end;
}
if (!strcasecmp(var, "password")) {
passwd = val;
}
if (!strcasecmp(var, "auth-acl")) {
auth_acl = val;
}
if (!strcasecmp(var, "a1-hash")) {
a1_hash = val;
}
if (!strcasecmp(var, "mwi-account")) {
mwi_account = val;
}
if (!strcasecmp(var, "allow-empty-password")) {
allow_empty_password = switch_true(val);
}
if (!strcasecmp(var, "user-agent-filter")) {
user_agent_filter = val;
}
if (!strcasecmp(var, "max-registrations-per-extension")) {
max_registrations_perext = atoi(val);
}
}
}
if (gparams) {
for (param = switch_xml_child(gparams, "param"); param; param = param->next) {
const char *var = switch_xml_attr_soft(param, "name");
const char *val = switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "sip-forbid-register") && switch_true(val)) {
ret = AUTH_FORBIDDEN;
goto end;
}
if (!strcasecmp(var, "password")) {
passwd = val;
}
if (!strcasecmp(var, "auth-acl")) {
auth_acl = val;
}
if (!strcasecmp(var, "a1-hash")) {
a1_hash = val;
}
if (!strcasecmp(var, "mwi-account")) {
mwi_account = val;
}
if (!strcasecmp(var, "allow-empty-password")) {
allow_empty_password = switch_true(val);
}
if (!strcasecmp(var, "user-agent-filter")) {
user_agent_filter = val;
}
if (!strcasecmp(var, "max-registrations-per-extension")) {
max_registrations_perext = atoi(val);
}
}
}
if (uparams) {
} else {
for (param = switch_xml_child(uparams, "param"); param; param = param->next) {
const char *var = switch_xml_attr_soft(param, "name");
const char *val = switch_xml_attr_soft(param, "value");
@@ -2509,31 +2424,11 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "mwi-account", mwi_account);
}
if ((dparams = switch_xml_child(domain, "params"))) {
xparams_type[i] = 0;
xparams[i++] = dparams;
}
if (group && (gparams = switch_xml_child(group, "params"))) {
xparams_type[i] = 0;
xparams[i++] = gparams;
}
if ((uparams = switch_xml_child(user, "params"))) {
xparams_type[i] = 0;
xparams[i++] = uparams;
}
if ((dparams = switch_xml_child(domain, "variables"))) {
xparams_type[i] = 1;
xparams[i++] = dparams;
}
if (group && (gparams = switch_xml_child(group, "variables"))) {
xparams_type[i] = 1;
xparams[i++] = gparams;
}
if ((uparams = switch_xml_child(user, "variables"))) {
xparams_type[i] = 1;
xparams[i++] = uparams;
@@ -2637,8 +2532,8 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
switch_event_destroy(&params);
if (xml) {
switch_xml_free(xml);
if (user) {
switch_xml_free(user);
}
switch_safe_free(input);