Merge commit 'v1.3.1' into v1.2.stable

This commit is contained in:
Ken Rice 2012-11-06 00:50:54 +00:00
commit 3ed890ece6
83 changed files with 5235 additions and 2166 deletions

View File

@ -202,6 +202,7 @@ library_include_HEADERS = \
src/include/switch_xml_config.h \
src/include/switch_cpp.h \
src/include/switch_json.h \
libs/stfu/stfu.h \
libs/libteletone/src/libteletone_detect.h \
libs/libteletone/src/libteletone_generate.h \
libs/libteletone/src/libteletone.h \

View File

@ -1,13 +1,8 @@
<configuration name="java.conf" description="Java Plug-Ins">
<!-- Path to the Java 1.6 virtual machine to use -->
<javavm path="/usr/java/jdk1.6.0/jre/lib/i386/client/libjvm.so"/>
<!-- Options to pass to Java -->
<javavm path="/opt/jdk1.6.0_04/jre/lib/amd64/server/libjvm.so"/>
<options>
<!-- Your class path (make sure freeswitch.jar is on it) -->
<option value="-Djava.class.path=$${base_dir}/scripts/freeswitch.jar"/>
<!-- Enable remote debugging -->
<option value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8000"/>
<option value="-Djava.class.path=$${base_dir}/scripts/freeswitch.jar:$${base_dir}/scripts/example.jar"/>
<option value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8000"/>
</options>
<startup class="net/cog/fs/system/Control" method="startup" arg="start up arg"/>
<shutdown class="net/cog/fs/system/Control" method="shutdown" arg="shutdown arg"/>
<startup class="org/freeswitch/example/ApplicationLauncher" method="startup"/>
</configuration>

View File

@ -155,8 +155,8 @@ fi
AX_PATH_LIBGNUTLS()
# set defaults for use on all platforms
SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src -I${switch_srcdir}/libs/stfu"
SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src -I${switch_srcdir}/libs/stfu"
SWITCH_AM_LDFLAGS="-lm"
#set SOLINK variable based on compiler and host
@ -164,7 +164,7 @@ if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
SOLINK="-Bdynamic -dy -G"
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
case "$host" in
*darwin10.*)
*darwin12.*|*darwin10.*)
SOLINK="-dynamic -force-flat-namespace"
;;
*darwin*)
@ -248,7 +248,7 @@ elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
if test "${enable_64}" = "yes"; then
case "$host" in
*darwin10.*|*darwin9.*|*darwin8.*)
*darwin12.*|*darwin10.*|*darwin9.*|*darwin8.*)
APR_ADDTO(CFLAGS, -arch x86_64)
APR_ADDTO(LDFLAGS, -arch x86_64)
APR_ADDTO(CXXFLAGS, -arch x86_64)
@ -425,6 +425,13 @@ fi
fi
AC_ARG_ENABLE(deprecated-core-db-events,
[AS_HELP_STRING([--enable-deprecated-core-db-events], [Keep deprecated core db events])],,[enable_deprecated_core_db_events="no"])
if test x"$enable_deprecated_core_db_events" = x"yes" ; then
AC_DEFINE([SWITCH_DEPRECATED_CORE_DB], [1], [Define to 1 to enable deprecated core db events])
fi
AC_ARG_ENABLE(timerfd-wrapper,
[AC_HELP_STRING([--enable-timerfd-wrapper],[timerfd is in the kernel but not in your libc])],[enable_timer_fd_wrapper="$enableval"],[enable_timer_fd_wrapper="no"])
AM_CONDITIONAL([ENABLE_TIMERFD_WRAPPER],[test "x$enable_timer_fd_wrapper" != "xno"])
@ -447,6 +454,17 @@ PLATFORM_CORE_LDFLAGS=
PLATFORM_CORE_LIBS=
# tweak platform specific flags
case "$host" in
*darwin12.*)
APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp -Wno-deprecated-declarations)
APR_ADDTO(LDFLAGS, -pipe -bind_at_load)
APR_ADDTO(CXXFLAGS, -pipe)
APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
if test "x$enable_core_odbc_support" != "xno"; then
APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
fi
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl])
;;
*darwin10.*)
APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp)

2
debian/bootstrap.sh vendored
View File

@ -176,7 +176,7 @@ Build-Depends:
wget, pkg-config,
# configure options
libssl-dev, unixodbc-dev,
libncurses5-dev, libjpeg62-dev,
libncurses5-dev, libjpeg62-dev | libjpeg8-dev,
python-dev, erlang-dev,
# documentation
doxygen,

View File

@ -384,7 +384,7 @@ Build-Depends: libx11-dev
Module: endpoints/mod_h323
Description: mod_h323
Adds mod_h323.
Build-Depends: libopenh323-dev, libpt-dev
Build-Depends: libopenh323-dev | libh323plus-dev, libpt-dev
Module: endpoints/mod_html5
Description: HTML5 endpoint module

View File

@ -511,7 +511,7 @@
<prompt phrase="There is..." filename="ivr-there_is.wav"/>
<prompt phrase="That number is on the Do Not Call list." filename="ivr-do_not_call_list.wav"/>
<prompt phrase="The call attempt has been aborted." filename="ivr-call_attempt_aborted.wav"/>
<prompt phrase="To wait for the next available representative, please stay on the line." filename="ivr_to_wait_stay_on_the_line.wav"/>
<prompt phrase="To wait for the next available representative, please stay on the line." filename="ivr-to_wait_stay_on_the_line.wav"/>
<prompt phrase="If you would like us to call you back, press..." filename="ivr-if_you_would_like_us_to_call_back.wav"/>
<prompt phrase="It appears that your phone number is..." filename="ivr-it_appears_that_your_phone_number_is.wav"/>
<prompt phrase="Would you like to receive a call at this number?" filename="ivr-would_you_like_to_receive_a_call_at_this_number.wav"/>

View File

@ -6093,7 +6093,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t
case FTDM_SIGEVENT_START:
{
ftdm_assert(!ftdm_test_flag(fchan, FTDM_CHANNEL_CALL_STARTED), "Started call twice!");
ftdm_assert(!ftdm_test_flag(fchan, FTDM_CHANNEL_CALL_STARTED), "Started call twice!\n");
if (ftdm_test_flag(fchan, FTDM_CHANNEL_OUTBOUND)) {
ftdm_log_chan_msg(fchan, FTDM_LOG_WARNING, "Inbound call taking over outbound channel\n");

View File

@ -974,7 +974,13 @@ static ftdm_status_t state_advance(ftdm_channel_t *chan)
ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP);
}
} else if (call) {
pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0);
/*
* Even if we have no media, sending progress without PI is forbidden
* by Q.931 3.1.8, so a protocol error will be issued from libpri
* and from remote equipment.
* So just pretend we have PI.
*/
pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1);
} else {
ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART);
}

View File

@ -38,8 +38,11 @@
#define PRI_SPAN(p) (((p) >> 8) & 0xff)
#define PRI_CHANNEL(p) ((p) & 0xff)
#define PRITAP_NETWORK_ANSWER 0x1
typedef enum {
PRITAP_RUNNING = (1 << 0),
PRITAP_MASTER = (1 << 1),
} pritap_flags_t;
typedef struct {
@ -49,10 +52,16 @@ typedef struct {
ftdm_number_t callednum;
ftdm_channel_t *fchan;
char callingname[80];
int proceeding:1;
int inuse:1;
uint8_t proceeding;
uint8_t inuse;
} passive_call_t;
typedef enum pritap_iface {
PRITAP_IFACE_UNKNOWN = 0,
PRITAP_IFACE_CPE = 1,
PRITAP_IFACE_NET = 2,
} pritap_iface_t;
typedef struct pritap {
int32_t flags;
struct pri *pri;
@ -63,6 +72,7 @@ typedef struct pritap {
ftdm_span_t *peerspan;
ftdm_mutex_t *pcalls_lock;
passive_call_t pcalls[FTDM_MAX_CHANNELS_PHYSICAL_SPAN];
pritap_iface_t iface;
} pritap_t;
static FIO_IO_UNLOAD_FUNCTION(ftdm_pritap_unload)
@ -266,11 +276,14 @@ static ftdm_state_map_t pritap_state_map = {
}
};
#define PRITAP_GET_INTERFACE(iface) iface == PRITAP_IFACE_CPE ? "CPE" : \
iface == PRITAP_IFACE_NET ? "NET" : "UNKNOWN"
static ftdm_status_t state_advance(ftdm_channel_t *ftdmchan)
{
ftdm_status_t status;
ftdm_sigmsg_t sig;
ftdm_channel_t *peerchan = ftdmchan->call_data;
pritap_t *pritap = ftdmchan->span->signal_data;
pritap_t *peer_pritap = pritap->peerspan->signal_data;
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "processing state %s\n", ftdm_channel_state2str(ftdmchan->state));
@ -279,28 +292,56 @@ static ftdm_status_t state_advance(ftdm_channel_t *ftdmchan)
sig.span_id = ftdmchan->span_id;
sig.channel = ftdmchan;
ftdm_channel_complete_state(ftdmchan);
ftdm_channel_complete_state(ftdmchan);
switch (ftdmchan->state) {
case FTDM_CHANNEL_STATE_DOWN:
{
ftdmchan->call_data = NULL;
ftdm_channel_close(&ftdmchan);
ftdm_channel_t *fchan = ftdmchan;
peerchan->call_data = NULL;
ftdm_channel_close(&peerchan);
/* Destroy the peer data first */
if (fchan->call_data) {
ftdm_channel_t *peerchan = fchan->call_data;
ftdm_channel_t *pchan = peerchan;
ftdm_channel_lock(peerchan);
pchan->call_data = NULL;
pchan->pflags = 0;
ftdm_channel_close(&pchan);
ftdm_channel_unlock(peerchan);
} else {
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "No call data?\n");
}
ftdmchan->call_data = NULL;
ftdmchan->pflags = 0;
ftdm_channel_close(&fchan);
}
break;
case FTDM_CHANNEL_STATE_PROGRESS:
case FTDM_CHANNEL_STATE_PROGRESS_MEDIA:
case FTDM_CHANNEL_STATE_UP:
case FTDM_CHANNEL_STATE_HANGUP:
break;
case FTDM_CHANNEL_STATE_UP:
{
if (ftdm_test_pflag(ftdmchan, PRITAP_NETWORK_ANSWER)) {
ftdm_clear_pflag(ftdmchan, PRITAP_NETWORK_ANSWER);
sig.event_id = FTDM_SIGEVENT_UP;
ftdm_span_send_signal(ftdmchan->span, &sig);
}
}
break;
case FTDM_CHANNEL_STATE_RING:
{
sig.event_id = FTDM_SIGEVENT_START;
/* The ring interface (where the setup was received) is the peer, since we RING the channel
* where PROCEED/PROGRESS is received */
ftdm_sigmsg_add_var(&sig, "pritap_ring_interface", PRITAP_GET_INTERFACE(peer_pritap->iface));
if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) {
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
}
@ -333,9 +374,9 @@ static __inline__ void pritap_check_state(ftdm_span_t *span)
uint32_t j;
ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE);
for(j = 1; j <= span->chan_count; j++) {
ftdm_mutex_lock(span->channels[j]->mutex);
ftdm_channel_lock(span->channels[j]);
ftdm_channel_advance_states(span->channels[j]);
ftdm_mutex_unlock(span->channels[j]->mutex);
ftdm_channel_unlock(span->channels[j]);
}
}
}
@ -397,23 +438,47 @@ static passive_call_t *tap_pri_get_pcall_bycrv(pritap_t *pritap, int crv)
for (i = 0; i < ftdm_array_len(pritap->pcalls); i++) {
tstcrv = pritap->pcalls[i].callref ? tap_pri_get_crv(pritap->pri, pritap->pcalls[i].callref) : 0;
if (pritap->pcalls[i].callref && tstcrv == crv) {
if (!pritap->pcalls[i].inuse) {
ftdm_log(FTDM_LOG_ERROR, "Found crv %d in slot %d of span %s with call %p but is no longer in use!\n",
crv, i, pritap->span->name, pritap->pcalls[i].callref);
continue;
if (pritap->pcalls[i].inuse) {
ftdm_mutex_unlock(pritap->pcalls_lock);
return &pritap->pcalls[i];
}
ftdm_mutex_unlock(pritap->pcalls_lock);
return &pritap->pcalls[i];
/* This just means the crv is being re-used in another call before this one was destroyed */
ftdm_log(FTDM_LOG_DEBUG, "Found crv %d in slot %d of span %s with call %p but is no longer in use\n",
crv, i, pritap->span->name, pritap->pcalls[i].callref);
}
}
ftdm_log(FTDM_LOG_DEBUG, "crv %d was not found active in span %s\n", crv, pritap->span->name);
ftdm_mutex_unlock(pritap->pcalls_lock);
return NULL;
}
/*
* This is a tricky function with some side effects, some explanation needed ...
*
* The libpri stack process HDLC frames, then finds Q921 frames and Q931 events, each time
* it finds a new Q931 event, checks if the crv of that event matches a known call in the internal
* list found in the PRI control block (for us, one control block per span), if it does not find
* the call, allocates a new one and then sends the event up to the user (us, ftmod_pritap in this case)
*
* The user is then expected to destroy the call when done with it (on hangup), but things get tricky here
* because in ftmod_pritap we do not destroy the call right away to be sure we only destroy it when no one
* else needs that pointer, therefore we decide to delay the destruction of the call pointer until later
* when a new call comes which triggers the garbage collecting code in this function
*
* Now, what happens if a new call arrives right away with the same crv than the last call? the pri stack
* does *not* allocate a new call pointer because is still a known call and we must therefore re-use the
* same call pointer
*
* This function accepts a pointer to a callref, even a NULL one. When callref is NULL we search for an
* available slot so the caller of this function can use it to store a new callref pointer. In the process
* we also scan for slots that still have a callref pointer but are no longer in use (inuse=0) and we
* destroy that callref and clear the slot (memset). The trick is, we only do this if the callref to
* be garbage collected is NOT the one provided by the parameter callref, of course! otherwise we may
* be freeing a pointer to a callref for a new call that used an old (recycled) callref!
*/
static passive_call_t *tap_pri_get_pcall(pritap_t *pritap, void *callref)
{
int i;
@ -422,7 +487,11 @@ static passive_call_t *tap_pri_get_pcall(pritap_t *pritap, void *callref)
ftdm_mutex_lock(pritap->pcalls_lock);
for (i = 0; i < ftdm_array_len(pritap->pcalls); i++) {
if (pritap->pcalls[i].callref && !pritap->pcalls[i].inuse) {
/* If this slot has a call reference
* and it is different than the *callref provided to us
* and is no longer in use,
* then it is time to garbage collect it ... */
if (pritap->pcalls[i].callref && callref != pritap->pcalls[i].callref && !pritap->pcalls[i].inuse) {
crv = tap_pri_get_crv(pritap->pri, pritap->pcalls[i].callref);
/* garbage collection */
ftdm_log(FTDM_LOG_DEBUG, "Garbage collecting callref %d/%p from span %s in slot %d\n",
@ -431,7 +500,17 @@ static passive_call_t *tap_pri_get_pcall(pritap_t *pritap, void *callref)
memset(&pritap->pcalls[i], 0, sizeof(pritap->pcalls[0]));
}
if (callref == pritap->pcalls[i].callref) {
pritap->pcalls[i].inuse = 1;
if (callref == NULL) {
pritap->pcalls[i].inuse = 1;
ftdm_log(FTDM_LOG_DEBUG, "Enabling callref slot %d in span %s\n", i, pritap->span->name);
} else if (!pritap->pcalls[i].inuse) {
crv = tap_pri_get_crv(pritap->pri, callref);
ftdm_log(FTDM_LOG_DEBUG, "Recyclying callref slot %d in span %s for callref %d/%p\n",
i, pritap->span->name, crv, callref);
memset(&pritap->pcalls[i], 0, sizeof(pritap->pcalls[0]));
pritap->pcalls[i].callref = callref;
pritap->pcalls[i].inuse = 1;
}
ftdm_mutex_unlock(pritap->pcalls_lock);
@ -464,13 +543,11 @@ static void tap_pri_put_pcall(pritap_t *pritap, void *callref)
}
tstcrv = tap_pri_get_crv(pritap->pri, pritap->pcalls[i].callref);
if (tstcrv == crv) {
ftdm_log(FTDM_LOG_DEBUG, "releasing slot %d in span %s used by callref %d/%p\n", i,
pritap->span->name, crv, pritap->pcalls[i].callref);
if (!pritap->pcalls[i].inuse) {
ftdm_log(FTDM_LOG_ERROR, "slot %d in span %s used by callref %d/%p was released already?\n",
i, pritap->span->name, crv, pritap->pcalls[i].callref);
if (pritap->pcalls[i].inuse) {
ftdm_log(FTDM_LOG_DEBUG, "releasing slot %d in span %s used by callref %d/%p\n", i,
pritap->span->name, crv, pritap->pcalls[i].callref);
pritap->pcalls[i].inuse = 0;
}
pritap->pcalls[i].inuse = 0;
}
}
@ -480,6 +557,7 @@ static void tap_pri_put_pcall(pritap_t *pritap, void *callref)
static __inline__ ftdm_channel_t *tap_pri_get_fchan(pritap_t *pritap, passive_call_t *pcall, int channel)
{
ftdm_channel_t *fchan = NULL;
int err = 0;
int chanpos = PRI_CHANNEL(channel);
if (!chanpos || chanpos > pritap->span->chan_count) {
ftdm_log(FTDM_LOG_CRIT, "Invalid pri tap channel %d requested in span %s\n", channel, pritap->span->name);
@ -487,14 +565,19 @@ static __inline__ ftdm_channel_t *tap_pri_get_fchan(pritap_t *pritap, passive_ca
}
fchan = pritap->span->channels[PRI_CHANNEL(channel)];
ftdm_channel_lock(fchan);
if (ftdm_test_flag(fchan, FTDM_CHANNEL_INUSE)) {
ftdm_log(FTDM_LOG_ERROR, "Channel %d requested in span %s is already in use!\n", channel, pritap->span->name);
return NULL;
err = 1;
goto done;
}
if (ftdm_channel_open_chan(fchan) != FTDM_SUCCESS) {
ftdm_log(FTDM_LOG_ERROR, "Could not open tap channel %d requested in span %s\n", channel, pritap->span->name);
return NULL;
err = 1;
goto done;
}
memset(&fchan->caller_data, 0, sizeof(fchan->caller_data));
@ -508,6 +591,15 @@ static __inline__ ftdm_channel_t *tap_pri_get_fchan(pritap_t *pritap, passive_ca
ftdm_set_string(fchan->caller_data.ani.digits, pcall->callingani.digits);
ftdm_set_string(fchan->caller_data.dnis.digits, pcall->callednum.digits);
done:
if (fchan) {
ftdm_channel_unlock(fchan);
}
if (err) {
return NULL;
}
return fchan;
}
@ -534,10 +626,17 @@ static void handle_pri_passive_event(pritap_t *pritap, pri_event *e)
ftdm_log(FTDM_LOG_WARNING, "There is a call with callref %d already, ignoring duplicated ring event\n", crv);
break;
}
pcall = tap_pri_get_pcall(pritap, NULL);
/* Try to get a recycled call (ie, e->ring.call is a call that the PRI stack allocated previously and then
* re-used for the next RING event because we did not destroy it fast enough) */
pcall = tap_pri_get_pcall(pritap, e->ring.call);
if (!pcall) {
ftdm_log(FTDM_LOG_ERROR, "Failed to get a free passive PRI call slot for callref %d, this is a bug!\n", crv);
break;
/* ok so the call is really not known to us, let's get a new one */
pcall = tap_pri_get_pcall(pritap, NULL);
if (!pcall) {
ftdm_log(FTDM_LOG_ERROR, "Failed to get a free passive PRI call slot for callref %d, this is a bug!\n", crv);
break;
}
}
pcall->callref = e->ring.call;
ftdm_set_string(pcall->callingnum.digits, e->ring.callingnum);
@ -562,7 +661,7 @@ static void handle_pri_passive_event(pritap_t *pritap, pri_event *e)
/* check that we already know about this call in the peer PRI (which was the one receiving the PRI_EVENT_RING event) */
if (!(pcall = tap_pri_get_pcall_bycrv(peertap, crv))) {
ftdm_log(FTDM_LOG_DEBUG,
"ignoring proceeding in channel %s:%d:%d for callref %d since we don't know about it",
"ignoring proceeding in channel %s:%d:%d for callref %d since we don't know about it\n",
pritap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv);
break;
}
@ -570,13 +669,27 @@ static void handle_pri_passive_event(pritap_t *pritap, pri_event *e)
ftdm_log(FTDM_LOG_DEBUG, "Ignoring duplicated proceeding with callref %d\n", crv);
break;
}
peerpcall = tap_pri_get_pcall(pritap, NULL);
if (!peerpcall) {
ftdm_log(FTDM_LOG_ERROR, "Failed to get a free peer PRI passive call slot for callref %d in span %s, this is a bug!\n",
crv, pritap->span->name);
pcall->proceeding = 1;
/* This call should not be known to this PRI yet ... */
if ((peerpcall = tap_pri_get_pcall_bycrv(pritap, crv))) {
ftdm_log(FTDM_LOG_ERROR,
"ignoring proceeding in channel %s:%d:%d for callref %d, dup???\n",
pritap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv);
break;
}
peerpcall->callref = e->proceeding.call;
/* Check if the call pointer is being recycled */
peerpcall = tap_pri_get_pcall(pritap, e->proceeding.call);
if (!peerpcall) {
peerpcall = tap_pri_get_pcall(pritap, NULL);
if (!peerpcall) {
ftdm_log(FTDM_LOG_ERROR, "Failed to get a free peer PRI passive call slot for callref %d in span %s, this is a bug!\n",
crv, pritap->span->name);
break;
}
peerpcall->callref = e->proceeding.call;
}
/* check that the layer 1 and trans capability are supported */
layer1 = pri_get_layer1(peertap->pri, pcall->callref);
@ -598,7 +711,6 @@ static void handle_pri_passive_event(pritap_t *pritap, pri_event *e)
pritap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv);
break;
}
pcall->fchan = fchan;
peerfchan = tap_pri_get_fchan(peertap, pcall, e->proceeding.channel);
if (!peerfchan) {
@ -606,12 +718,20 @@ static void handle_pri_passive_event(pritap_t *pritap, pri_event *e)
peertap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv);
break;
}
pcall->fchan = fchan;
peerpcall->fchan = fchan;
fchan->call_data = peerfchan;
peerfchan->call_data = fchan;
ftdm_log_chan(fchan, FTDM_LOG_NOTICE, "Starting new tapped call with callref %d\n", crv);
ftdm_channel_lock(fchan);
fchan->call_data = peerfchan;
ftdm_set_state(fchan, FTDM_CHANNEL_STATE_RING);
ftdm_channel_unlock(fchan);
ftdm_channel_lock(peerfchan);
peerfchan->call_data = fchan;
ftdm_channel_unlock(peerfchan);
ftdm_set_state_locked(fchan, FTDM_CHANNEL_STATE_RING);
break;
case PRI_EVENT_ANSWER:
@ -620,33 +740,54 @@ static void handle_pri_passive_event(pritap_t *pritap, pri_event *e)
pritap->span->name, PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), crv);
if (!(pcall = tap_pri_get_pcall_bycrv(pritap, crv))) {
ftdm_log(FTDM_LOG_DEBUG,
"ignoring answer in channel %s:%d:%d for callref %d since we don't know about it",
pritap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv);
"ignoring answer in channel %s:%d:%d for callref %d since we don't know about it\n",
pritap->span->name, PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->proceeding.channel), crv);
break;
}
if (!pcall->fchan) {
ftdm_log(FTDM_LOG_ERROR,
"Received answer in channel %s:%d:%d for callref %d but we never got a channel\n",
pritap->span->name, PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), crv);
break;
}
ftdm_channel_lock(pcall->fchan);
ftdm_log_chan(pcall->fchan, FTDM_LOG_NOTICE, "Tapped call was answered in state %s\n", ftdm_channel_state2str(pcall->fchan->state));
ftdm_set_pflag(pcall->fchan, PRITAP_NETWORK_ANSWER);
ftdm_set_state(pcall->fchan, FTDM_CHANNEL_STATE_UP);
ftdm_channel_unlock(pcall->fchan);
break;
case PRI_EVENT_HANGUP_REQ:
crv = tap_pri_get_crv(pritap->pri, e->hangup.call);
ftdm_log(FTDM_LOG_DEBUG, "Hangup on channel %s:%d:%d with callref %d\n",
pritap->span->name, PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), crv);
ftdm_log(FTDM_LOG_DEBUG, "Hangup on channel %s:%d:%d with callref %d\n",
pritap->span->name, PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), crv);
if (!(pcall = tap_pri_get_pcall_bycrv(pritap, crv))) {
ftdm_log(FTDM_LOG_DEBUG,
"ignoring hangup in channel %s:%d:%d for callref %d since we don't know about it",
pritap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv);
pritap->span->name, PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), crv);
break;
}
fchan = pcall->fchan;
ftdm_set_state_locked(fchan, FTDM_CHANNEL_STATE_TERMINATING);
if (pcall->fchan) {
fchan = pcall->fchan;
ftdm_channel_lock(fchan);
if (fchan->state < FTDM_CHANNEL_STATE_TERMINATING) {
ftdm_set_state(fchan, FTDM_CHANNEL_STATE_TERMINATING);
}
pcall->fchan = NULL; /* after this event we're not supposed to need to do anything with the channel anymore */
ftdm_channel_unlock(fchan);
}
tap_pri_put_pcall(pritap, e->hangup.call);
tap_pri_put_pcall(peertap, e->hangup.call);
break;
case PRI_EVENT_HANGUP_ACK:
crv = tap_pri_get_crv(pritap->pri, e->hangup.call);
ftdm_log(FTDM_LOG_DEBUG, "Hangup ack on channel %s:%d:%d with callref %d\n",
pritap->span->name, PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), crv);
pritap->span->name, PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), crv);
tap_pri_put_pcall(pritap, e->hangup.call);
tap_pri_put_pcall(peertap, e->hangup.call);
break;
@ -661,12 +802,14 @@ static void handle_pri_passive_event(pritap_t *pritap, pri_event *e)
static void *ftdm_pritap_run(ftdm_thread_t *me, void *obj)
{
ftdm_span_t *span = (ftdm_span_t *) obj;
ftdm_span_t *peer = NULL;
pritap_t *pritap = span->signal_data;
pritap_t *p_pritap = NULL;
pri_event *event = NULL;
struct pollfd dpoll = { 0, 0, 0 };
struct pollfd dpoll[2];
int rc = 0;
ftdm_log(FTDM_LOG_DEBUG, "Tapping PRI thread started on span %d\n", span->span_id);
ftdm_log(FTDM_LOG_DEBUG, "Tapping PRI thread started on span %s\n", span->name);
pritap->span = span;
@ -684,48 +827,80 @@ static void *ftdm_pritap_run(ftdm_thread_t *me, void *obj)
goto done;
}
dpoll.fd = pritap->dchan->sockfd;
/* The last span starting runs the show ...
* This simplifies locking and avoid races by having multiple threads for a single tapped link
* Since both threads really handle a single tapped link there is no benefit on multi-threading, just complications ... */
peer = pritap->peerspan;
p_pritap = peer->signal_data;
if (!ftdm_test_flag(pritap, PRITAP_MASTER)) {
ftdm_log(FTDM_LOG_DEBUG, "Running dummy thread on span %s\n", span->name);
while (ftdm_running() && !ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) {
poll(NULL, 0, 100);
}
} else {
memset(&dpoll, 0, sizeof(dpoll));
dpoll[0].fd = pritap->dchan->sockfd;
dpoll[1].fd = p_pritap->dchan->sockfd;
while (ftdm_running() && !ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) {
ftdm_log(FTDM_LOG_DEBUG, "Master tapping thread on span %s (fd1=%d, fd2=%d)\n", span->name,
pritap->dchan->sockfd, p_pritap->dchan->sockfd);
while (ftdm_running() && !ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) {
pritap_check_state(span);
pritap_check_state(span);
pritap_check_state(peer);
dpoll.revents = 0;
dpoll.events = POLLIN;
dpoll[0].revents = 0;
dpoll[0].events = POLLIN;
rc = poll(&dpoll, 1, 10);
dpoll[1].revents = 0;
dpoll[1].events = POLLIN;
if (rc < 0) {
if (errno == EINTR) {
ftdm_log(FTDM_LOG_DEBUG, "D-channel waiting interrupted, continuing ...\n");
rc = poll(&dpoll[0], 2, 10);
if (rc < 0) {
if (errno == EINTR) {
ftdm_log(FTDM_LOG_DEBUG, "D-channel waiting interrupted, continuing ...\n");
continue;
}
ftdm_log(FTDM_LOG_ERROR, "poll failed: %s\n", strerror(errno));
continue;
}
ftdm_log(FTDM_LOG_ERROR, "poll failed: %s\n", strerror(errno));
continue;
}
pri_schedule_run(pritap->pri);
pri_schedule_run(pritap->pri);
pri_schedule_run(p_pritap->pri);
if (rc) {
if (dpoll.revents & POLLIN) {
event = pri_read_event(pritap->pri);
if (event) {
handle_pri_passive_event(pritap, event);
pritap_check_state(span);
pritap_check_state(peer);
if (rc) {
if (dpoll[0].revents & POLLIN) {
event = pri_read_event(pritap->pri);
if (event) {
handle_pri_passive_event(pritap, event);
pritap_check_state(span);
}
}
} else {
ftdm_log(FTDM_LOG_WARNING, "nothing to read?\n");
}
}
pritap_check_state(span);
if (dpoll[1].revents & POLLIN) {
event = pri_read_event(p_pritap->pri);
if (event) {
handle_pri_passive_event(p_pritap, event);
pritap_check_state(peer);
}
}
}
}
}
done:
ftdm_log(FTDM_LOG_DEBUG, "Tapping PRI thread ended on span %d\n", span->span_id);
ftdm_log(FTDM_LOG_DEBUG, "Tapping PRI thread ended on span %s\n", span->name);
ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD);
ftdm_clear_flag(pritap, PRITAP_RUNNING);
ftdm_clear_flag(pritap, PRITAP_MASTER);
return NULL;
}
@ -811,6 +986,7 @@ static ftdm_status_t ftdm_pritap_start(ftdm_span_t *span)
{
ftdm_status_t ret;
pritap_t *pritap = span->signal_data;
pritap_t *p_pritap = pritap->peerspan->signal_data;
if (ftdm_test_flag(pritap, PRITAP_RUNNING)) {
return FTDM_FAIL;
@ -822,6 +998,10 @@ static ftdm_status_t ftdm_pritap_start(ftdm_span_t *span)
ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD);
ftdm_set_flag(pritap, PRITAP_RUNNING);
if (p_pritap && ftdm_test_flag(p_pritap, PRITAP_RUNNING)) {
/* our peer already started, we're the master */
ftdm_set_flag(pritap, PRITAP_MASTER);
}
ret = ftdm_thread_create_detached(ftdm_pritap_run, span);
if (ret != FTDM_SUCCESS) {
@ -840,6 +1020,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_pritap_configure_span)
ftdm_channel_t *dchan = NULL;
pritap_t *pritap = NULL;
ftdm_span_t *peerspan = NULL;
pritap_iface_t iface = PRITAP_IFACE_UNKNOWN;
unsigned paramindex = 0;
if (span->trunk_type >= FTDM_TRUNK_NONE) {
@ -867,6 +1048,14 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_pritap_configure_span)
debug = val;
} else if (!strcasecmp(var, "mixaudio")) {
mixaudio = ftdm_true(val);
} else if (!strcasecmp(var, "interface")) {
if (!strcasecmp(val, "cpe")) {
iface = PRITAP_IFACE_CPE;
} else if (!strcasecmp(val, "net")) {
iface = PRITAP_IFACE_NET;
} else {
ftdm_log(FTDM_LOG_WARNING, "Ignoring invalid tapping interface type %s\n", val);
}
} else if (!strcasecmp(var, "peerspan")) {
if (ftdm_span_find_by_name(val, &peerspan) != FTDM_SUCCESS) {
ftdm_log(FTDM_LOG_ERROR, "Invalid tapping peer span %s\n", val);
@ -891,6 +1080,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_pritap_configure_span)
pritap->dchan = dchan;
pritap->peerspan = peerspan;
pritap->mixaudio = mixaudio;
pritap->iface = iface;
span->start = ftdm_pritap_start;
span->stop = ftdm_pritap_stop;

View File

@ -425,7 +425,7 @@ if test "$target" != "$host"; then
LDFLAGS=$_SAVE_LDFLAGS
case "$build:$target" in
powerpc-apple-darwin8*:i?86-apple-darwin*)
powerpc-apple-darwin8*:*86-apple-darwin*)
dnl The Darwin cross compiler doesn't necessarily point itself at a
dnl root that has libraries for the proper architecture, it defaults
dnl to the system root. The libraries in the system root on current
@ -446,7 +446,7 @@ if test "$target" != "$host"; then
AC_PROG_CXX
case "$build:$target" in
powerpc-apple-darwin8*:i?86-apple-darwin*)
powerpc-apple-darwin8*:*86-apple-darwin*)
dnl Revert the changes made above. From this point on, the target
dnl compiler will never be used without applying the SDK to CFLAGS
dnl (see --with-macos-sdk below).
@ -496,7 +496,7 @@ fi
rm -f a.out
case "$build:$target" in
i?86-apple-darwin*:powerpc-apple-darwin*)
*86-apple-darwin*:powerpc-apple-darwin*)
dnl cross_compiling will have erroneously been set to "no" in this
dnl case, because the x86 build host is able to run ppc code in a
dnl translated environment, making a cross compiler appear native.
@ -975,7 +975,7 @@ case "$target" in
AC_DEFINE(HAVE_BSD_FLOCK)
CFLAGS="$CFLAGS -Wmost -fno-common"
case "${target_cpu}" in
i*86*)
*86*)
AC_DEFINE(i386)
CPU_ARCH=i386
PR_MD_ASFILES=os_Darwin_x86.s
@ -1014,7 +1014,7 @@ case "$target" in
dnl Architecture minimum 10.1
export MACOSX_DEPLOYMENT_TARGET=10.1
;;
i*86*)
*86*)
dnl Architecture minimum 10.4
export MACOSX_DEPLOYMENT_TARGET=10.4
;;

View File

@ -623,7 +623,7 @@ static ldl_status parse_jingle_code(ldl_handle_t *handle, iks *xml, char *to, ch
}
if (!(id && action)) {
if (!(id && action && from)) {
globals.logger(DL_LOG_CRIT, "missing required params\n");
return LDL_STATUS_FALSE;
}
@ -820,6 +820,9 @@ static ldl_status parse_jingle_code(ldl_handle_t *handle, iks *xml, char *to, ch
break;
}
}
} else {
globals.logger(DL_LOG_WARNING, "No preference specified");
continue;
}
if (index < 0) {

View File

@ -1 +1 @@
Tue Oct 23 13:13:35 EDT 2012
Fri Oct 26 14:14:41 CDT 2012

View File

@ -744,7 +744,7 @@ void auth_check_digest(auth_mod_t *am,
auth_challenge_digest(am, as, ach);
as->as_blacklist = am->am_blacklist;
}
SU_DEBUG_5(("auth_method_digest: response did not match\n"));
SU_DEBUG_5(("auth_method_digest: response did not match\n" VA_NONE));
return;
}
@ -761,7 +761,7 @@ void auth_check_digest(auth_mod_t *am,
if (am->am_challenge)
auth_challenge_digest(am, as, ach);
SU_DEBUG_7(("auth_method_digest: successful authentication\n"));
SU_DEBUG_7(("auth_method_digest: successful authentication\n" VA_NONE));
as->as_status = 0; /* Successful authentication! */
as->as_phrase = "";
@ -1412,11 +1412,11 @@ int auth_validate_digest_nonce(auth_mod_t *am,
/* Check nonce */
if (!ar->ar_nonce) {
SU_DEBUG_5(("auth_method_digest: no nonce\n"));
SU_DEBUG_5(("auth_method_digest: no nonce\n" VA_NONE));
return -1;
}
if (base64_d((void*)nonce, (sizeof nonce), ar->ar_nonce) != (sizeof nonce)) {
SU_DEBUG_5(("auth_method_digest: too short nonce\n"));
SU_DEBUG_5(("auth_method_digest: too short nonce\n" VA_NONE));
return -1;
}
@ -1426,7 +1426,7 @@ int auth_validate_digest_nonce(auth_mod_t *am,
auth_md5_hmac_digest(am, md5, hmac, sizeof hmac);
if (memcmp(nonce->digest, hmac, sizeof nonce->digest)) {
SU_DEBUG_5(("auth_method_digest: bad nonce\n"));
SU_DEBUG_5(("auth_method_digest: bad nonce\n" VA_NONE));
return -1;
}

View File

@ -424,12 +424,12 @@ nea_server_t *nea_server_create(nta_agent_t *agent,
throttle = min_throttle;
if (!url) {
SU_DEBUG_5(("nea_server_create(): invalid url\n"));
SU_DEBUG_5(("nea_server_create(): invalid url\n" VA_NONE));
return NULL;
}
if (min_expires > expires || expires > max_expires) {
SU_DEBUG_5(("nea_server_create(): invalid expiration range\n"));
SU_DEBUG_5(("nea_server_create(): invalid expiration range\n" VA_NONE));
return NULL;
}

View File

@ -1276,7 +1276,7 @@ void agent_timer(su_root_magic_t *rm, su_timer_t *timer, nta_agent_t *agent)
if (next == latest) {
/* Do not set timer? */
SU_DEBUG_9(("nta: timer not set\n"));
SU_DEBUG_9(("nta: timer not set\n" VA_NONE));
assert(!agent->sa_out.completed->q_head);
assert(!agent->sa_out.trying->q_head);
assert(!agent->sa_out.inv_calling->q_head);
@ -2162,7 +2162,7 @@ int nta_agent_add_tport(nta_agent_t *self,
if (url_string_p(uri))
SU_DEBUG_1(("nta: %s: invalid bind URL\n", uri->us_str));
else
SU_DEBUG_1(("nta: invalid bind URL\n"));
SU_DEBUG_1(("nta: invalid bind URL\n" VA_NONE));
su_seterrno(EINVAL);
return -1;
}
@ -2249,19 +2249,19 @@ int nta_agent_add_tport(nta_agent_t *self,
/* XXX - when to use maddr? */
if ((agent_init_via(self, tport_primaries(self->sa_tports), 0)) < 0) {
error = su_errno();
SU_DEBUG_1(("nta: cannot create Via headers\n"));
SU_DEBUG_1(("nta: cannot create Via headers\n" VA_NONE));
goto error;
}
else
SU_DEBUG_9(("nta: Via fields initialized\n"));
SU_DEBUG_9(("nta: Via fields initialized\n" VA_NONE));
if ((agent_init_contact(self)) < 0) {
error = su_errno();
SU_DEBUG_1(("nta: cannot create Contact header\n"));
SU_DEBUG_1(("nta: cannot create Contact header\n" VA_NONE));
goto error;
}
else
SU_DEBUG_9(("nta: Contact header created\n"));
SU_DEBUG_9(("nta: Contact header created\n" VA_NONE));
su_free(self->sa_home, url);
ta_end(ta);
@ -2286,7 +2286,7 @@ int agent_create_master_transport(nta_agent_t *self, tagi_t *tags)
if (!self->sa_tports)
return -1;
SU_DEBUG_9(("nta: master transport created\n"));
SU_DEBUG_9(("nta: master transport created\n" VA_NONE));
return 0;
}
@ -7713,7 +7713,7 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent,
home = msg_home(msg);
if (!sip->sip_request || sip_complete_message(msg) < 0) {
SU_DEBUG_3(("nta: outgoing_create: incomplete request\n"));
SU_DEBUG_3(("nta: outgoing_create: incomplete request\n" VA_NONE));
return NULL;
}
@ -7900,7 +7900,7 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent,
}
}
else {
SU_DEBUG_1(("outgoing_create: ACK without INVITE\n"));
SU_DEBUG_1(("outgoing_create: ACK without INVITE\n" VA_NONE));
assert(!"INVITE found for ACK");
}
}
@ -7987,11 +7987,11 @@ outgoing_prepare_send(nta_outgoing_t *orq)
outgoing_send_via(orq, tp);
}
else if (orq->orq_sips) {
SU_DEBUG_3(("nta outgoing create: no secure transport\n"));
SU_DEBUG_3(("nta outgoing create: no secure transport\n" VA_NONE));
outgoing_reply(orq, SIP_416_UNSUPPORTED_URI, 1);
}
else {
SU_DEBUG_3(("nta outgoing create: no transport protocol\n"));
SU_DEBUG_3(("nta outgoing create: no transport protocol\n" VA_NONE));
outgoing_reply(orq, 503, "No transport", 1);
}
}
@ -8013,7 +8013,7 @@ outgoing_send_via(nta_outgoing_t *orq, tport_t *tp)
if (old_tp) tport_unref(old_tp);
if (outgoing_insert_via(orq, agent_tport_via(tp)) < 0) {
SU_DEBUG_3(("nta outgoing create: cannot insert Via line\n"));
SU_DEBUG_3(("nta outgoing create: cannot insert Via line\n" VA_NONE));
outgoing_reply(orq, 503, "Cannot insert Via", 1);
return;
}
@ -9211,7 +9211,7 @@ int outgoing_recv(nta_outgoing_t *_orq,
if (orq->orq_destroyed && 200 <= status && status < 300) {
if (orq->orq_uas && su_strcasecmp(sip->sip_to->a_tag, orq->orq_tag) != 0) {
/* Orphan 200 Ok to INVITE. ACK and BYE it */
SU_DEBUG_5(("nta: Orphan 200 Ok send ACK&BYE\n"));
SU_DEBUG_5(("nta: Orphan 200 Ok send ACK&BYE\n" VA_NONE));
return nta_msg_ackbye(sa, msg);
}
return -1; /* Proxy statelessly (RFC3261 section 16.11) */
@ -9273,7 +9273,7 @@ int outgoing_recv(nta_outgoing_t *_orq,
return outgoing_duplicate(orq, msg, sip);
/* Orphan 200 Ok to INVITE. ACK and BYE it */
SU_DEBUG_5(("nta: Orphan 200 Ok send ACK&BYE"));
SU_DEBUG_5(("nta: Orphan 200 Ok send ACK&BYE" VA_NONE));
return nta_msg_ackbye(sa, msg);
}
}

View File

@ -911,7 +911,7 @@ int hc_resolve_and_send(nth_client_t * hc)
if (msg_serialize(msg, http) < 0) {
assert(hc->hc_tport);
SU_DEBUG_3(("nth client create: invalid message"));
SU_DEBUG_3(("nth client create: invalid message" VA_NONE));
return -1;
}

View File

@ -312,20 +312,20 @@ nth_site_t *nth_site_create(nth_site_t *parent,
is_path = url->url_path != NULL;
if (is_host && is_path) {
SU_DEBUG_3(("nth_site_create(): virtual host and path simultanously\n"));
SU_DEBUG_3(("nth_site_create(): virtual host and path simultanously\n" VA_NONE));
errno = EINVAL;
goto error;
}
if (!parent && !is_host) {
SU_DEBUG_3(("nth_site_create(): host is required\n"));
SU_DEBUG_3(("nth_site_create(): host is required\n" VA_NONE));
errno = EINVAL;
goto error;
}
if (parent) {
if (!parent->site_isdir) {
SU_DEBUG_3(("nth_site_create(): invalid parent resource \n"));
SU_DEBUG_3(("nth_site_create(): invalid parent resource \n" VA_NONE));
errno = EINVAL;
goto error;
}
@ -995,7 +995,7 @@ static void server_reply(server_t *srv, tport_t *tport,
if (tport_tqsend(tport, response, NULL,
TPTAG_CLOSE_AFTER(close),
TAG_END()) == -1) {
SU_DEBUG_3(("server_reply(): cannot queue response\n"));
SU_DEBUG_3(("server_reply(): cannot queue response\n" VA_NONE));
tport_shutdown(tport, 2);
}

View File

@ -967,7 +967,7 @@ static int nua_register_client_response(nua_client_request_t *cr,
if (tport && tport != nr->nr_tport) {
if (nr->nr_error_report_id) {
if (tport_release(nr->nr_tport, nr->nr_error_report_id, NULL, NULL, nr, 0) < 0)
SU_DEBUG_1(("nua_register: tport_release() failed\n"));
SU_DEBUG_1(("nua_register: tport_release() failed\n" VA_NONE));
nr->nr_error_report_id = 0;
}
tport_unref(nr->nr_tport);
@ -996,7 +996,7 @@ static int nua_register_client_response(nua_client_request_t *cr,
if (nr->nr_tport) {
if (nr->nr_error_report_id) {
if (tport_release(nr->nr_tport, nr->nr_error_report_id, NULL, NULL, nr, 0) < 0)
SU_DEBUG_1(("nua_register: tport_release() failed\n"));
SU_DEBUG_1(("nua_register: tport_release() failed\n" VA_NONE));
nr->nr_error_report_id = 0;
}
@ -1028,7 +1028,7 @@ void nua_register_connection_closed(tp_stack_t *sip_stack,
pending = nr->nr_error_report_id;
if (tport_release(tport, pending, NULL, NULL, nr, 0) < 0)
SU_DEBUG_1(("nua_register: tport_release() failed\n"));
SU_DEBUG_1(("nua_register: tport_release() failed\n" VA_NONE));
nr->nr_error_report_id = 0;
tpn = tport_name(nr->nr_tport);

View File

@ -3039,11 +3039,11 @@ nh_referral_check(nua_handle_t *nh, tagi_t const *tags)
ref->ref_event = sip_event_dup(nh->nh_home, event);
if (!nh_validate(nh->nh_nua, ref_handle)) {
SU_DEBUG_3(("nua: invalid NOTIFY_REFER handle\n"));
SU_DEBUG_3(("nua: invalid NOTIFY_REFER handle\n" VA_NONE));
return -1;
}
else if (!ref->ref_event) {
SU_DEBUG_3(("nua: NOTIFY event missing\n"));
SU_DEBUG_3(("nua: NOTIFY event missing\n" VA_NONE));
return -1;
}

View File

@ -192,7 +192,7 @@ int nua_stack_init(su_root_t *root, nua_t *nua)
dnh->nh_ds->ds_leg == NULL ||
nta_agent_set_params(nua->nua_nta, NTATAG_UA(1), TAG_END()) < 0 ||
nua_stack_init_transport(nua, nua->nua_args) < 0) {
SU_DEBUG_1(("nua: initializing SIP stack failed\n"));
SU_DEBUG_1(("nua: initializing SIP stack failed\n" VA_NONE));
return -1;
}

View File

@ -3596,7 +3596,7 @@ sres_decode_msg(sres_resolver_t *res,
m->m_offset = sizeof(m->m_packet.mp_header);
if (m->m_size < m->m_offset) {
SU_DEBUG_5(("sres_decode_msg: truncated message\n"));
SU_DEBUG_5(("sres_decode_msg: truncated message\n" VA_NONE));
return -1;
}

View File

@ -132,13 +132,13 @@ sres_resolver_create(su_root_t *root,
srs->srs_timer = t;
if (!srs->srs_timer)
SU_DEBUG_3(("sres: cannot create timer\n"));
SU_DEBUG_3(("sres: cannot create timer\n" VA_NONE));
#if nomore
else if (su_timer_set_for_ever(t, sres_sofia_timer, srs) < 0)
SU_DEBUG_3(("sres: cannot set timer\n"));
SU_DEBUG_3(("sres: cannot set timer\n" VA_NONE));
#else
else if (sres_resolver_set_timer_cb(res, sres_sofia_set_timer, srs) < 0)
SU_DEBUG_3(("sres: cannot set timer cb\n"));
SU_DEBUG_3(("sres: cannot set timer cb\n" VA_NONE));
#endif
else
return res; /* Success! */

View File

@ -73,13 +73,17 @@ SOFIA_BEGIN_DECLS
SOFIAPUBVAR su_log_t SU_LOG[];
#endif
#define VA_NONE "%s",""
#define SU_DEBUG_DEF(level) \
su_inline void su_debug_##level(char const *fmt, ...) \
__attribute__ ((__format__ (printf, 1, 2))); \
su_inline void su_debug_##level(char const *fmt, ...) \
{ va_list ap; va_start(ap, fmt); su_vllog(SU_LOG, level, fmt, ap); va_end(ap); }
{ va_list ap; va_start(ap, fmt); su_vllog(SU_LOG, level, fmt, ap); va_end(ap); }
//SU_DEBUG_DEF(0)
#define su_debug_0(_f, ...) su_llog(SU_LOG, 0, _f, __VA_ARGS__)
SU_DEBUG_DEF(0)
/** Log messages at level 0.
*
* Fatal errors and panic messages should be logged at level 0.
@ -100,7 +104,10 @@ SU_DEBUG_DEF(0)
#endif
#if SU_DEBUG_MAX >= 1
SU_DEBUG_DEF(1)
//SU_DEBUG_DEF(1)
#define su_debug_1(_f, ...) su_llog(SU_LOG, 1, _f, __VA_ARGS__)
/**Log messages at level 1.
*
* Critical errors and minimal progress at subsystem level should be logged
@ -114,7 +121,8 @@ SU_DEBUG_DEF(1)
#endif
#if SU_DEBUG_MAX >= 2
SU_DEBUG_DEF(2)
//SU_DEBUG_DEF(2)
#define su_debug_2(_f, ...) su_llog(SU_LOG, 2, _f, __VA_ARGS__)
/**Log messages at level 2.
*
* Non-critical errors should be logged at level 2.
@ -127,7 +135,8 @@ SU_DEBUG_DEF(2)
#endif
#if SU_DEBUG_MAX >= 3
SU_DEBUG_DEF(3)
//SU_DEBUG_DEF(3)
#define su_debug_3(_f, ...) su_llog(SU_LOG, 3, _f, __VA_ARGS__)
/** Log messages at level 3.
*
* Warnings and progress messages should be logged at level 3.
@ -140,7 +149,8 @@ SU_DEBUG_DEF(3)
#endif
#if SU_DEBUG_MAX >= 4
SU_DEBUG_DEF(4)
//SU_DEBUG_DEF(4)
#define su_debug_4(_f, ...) su_llog(SU_LOG, 4, _f, __VA_ARGS__)
/** Log messages at level 4. */
#define SU_DEBUG_4(x) (SU_LOG_LEVEL >= 4 ? (su_debug_4 x) : (void)0)
#else
@ -148,7 +158,8 @@ SU_DEBUG_DEF(4)
#endif
#if SU_DEBUG_MAX >= 5
SU_DEBUG_DEF(5)
//SU_DEBUG_DEF(5)
#define su_debug_5(_f, ...) su_llog(SU_LOG, 5, _f, __VA_ARGS__)
/** Log messages at level 5.
*
* Signaling protocol actions (incoming packets, etc.) should be logged
@ -162,7 +173,8 @@ SU_DEBUG_DEF(5)
#endif
#if SU_DEBUG_MAX >= 6
SU_DEBUG_DEF(6)
//SU_DEBUG_DEF(6)
#define su_debug_6(_f, ...) su_llog(SU_LOG, 6, _f, __VA_ARGS__)
/** Log messages at level 6. */
#define SU_DEBUG_6(x) (SU_LOG_LEVEL >= 6 ? (su_debug_6 x) : (void)0)
#else
@ -170,7 +182,8 @@ SU_DEBUG_DEF(6)
#endif
#if SU_DEBUG_MAX >= 7
SU_DEBUG_DEF(7)
//SU_DEBUG_DEF(7)
#define su_debug_7(_f, ...) su_llog(SU_LOG, 7, _f, __VA_ARGS__)
/** Log messages at level 7.
*
* Media protocol actions (incoming packets, etc) should be logged at level 7.
@ -183,7 +196,8 @@ SU_DEBUG_DEF(7)
#endif
#if SU_DEBUG_MAX >= 8
SU_DEBUG_DEF(8)
//SU_DEBUG_DEF(8)
#define su_debug_8(_f, ...) su_llog(SU_LOG, 8, _f, __VA_ARGS__)
/** Log messages at level 8. */
#define SU_DEBUG_8(x) (SU_LOG_LEVEL >= 8 ? (su_debug_8 x) : (void)0)
#else
@ -191,7 +205,8 @@ SU_DEBUG_DEF(8)
#endif
#if SU_DEBUG_MAX >= 9
SU_DEBUG_DEF(9)
//SU_DEBUG_DEF(9)
#define su_debug_9(_f, ...) su_llog(SU_LOG, 9, _f, __VA_ARGS__)
/** Log messages at level 9.
*
* Entering/exiting functions, very verbatim progress should be logged at

View File

@ -52,6 +52,15 @@ typedef struct su_log_s su_log_t;
SOFIA_BEGIN_DECLS
#ifdef _MSC_VER
#define __SOFIA_FUNC__ __FUNCTION__
#else
#define __SOFIA_FUNC__ (const char *)__func__
#endif
/** Prototype for logging function */
typedef void (su_logger_f)(void *stream, char const *fmt, va_list ap);
@ -77,9 +86,9 @@ enum { SU_LOG_MAX = 9 };
SOFIAPUBFUN void su_log(char const *fmt, ...)
__attribute__ ((__format__ (printf, 1, 2)));
SOFIAPUBFUN void su_llog(su_log_t *log, unsigned level, char const *fmt, ...)
__attribute__ ((__format__ (printf, 3, 4)));
SOFIAPUBFUN void su_vllog(su_log_t *log, unsigned level,
SOFIAPUBFUN void _su_llog(su_log_t *log, unsigned level, const char *file, const char *func, int line, char const *fmt, ...)
__attribute__ ((__format__ (printf, 6, 7)));
SOFIAPUBFUN void _su_vllog(su_log_t *log, unsigned level, const char *file, const char *func, int line,
char const *fmt, va_list ap);
SOFIAPUBFUN void su_log_redirect(su_log_t *log, su_logger_f *f, void *stream);
SOFIAPUBFUN void su_log_set_level(su_log_t *log, unsigned level);
@ -92,6 +101,9 @@ SOFIAPUBVAR su_log_t su_log_global[];
/** Log the latest su error message */
SOFIAPUBFUN void su_perror(char const *s);
#define su_llog(_l, _ll, _f, ...) _su_llog(_l, _ll, __FILE__, __SOFIA_FUNC__, __LINE__, _f, __VA_ARGS__)
#define su_vllog(_l, _ll, _f, ...) _su_vllog(_l, _ll, __FILE__, __SOFIA_FUNC__, __LINE__, _f, __VA_ARGS__)
/** Log the su error message. */
SOFIAPUBFUN void su_perror2(char const *s, int errcode);

View File

@ -1260,7 +1260,7 @@ int bsd_localinfo(su_localinfo_t const hints[1],
flags |= LI_NUMERIC;
if (!(li = calloc(1, sizeof(*li) + sulen + ifnamelen))) {
SU_DEBUG_1(("su_getlocalinfo: memory exhausted\n"));
SU_DEBUG_1(("su_getlocalinfo: memory exhausted\n" VA_NONE));
error = ELI_MEMORY;
break;
}
@ -1629,7 +1629,7 @@ int li_name(su_localinfo_t const *hints,
if (error) {
if ((flags & LI_NAMEREQD) == LI_NAMEREQD)
return 1;
SU_DEBUG_7(("li_name: getnameinfo() failed\n"));
SU_DEBUG_7(("li_name: getnameinfo() failed\n" VA_NONE));
if (!su_inet_ntop(su->su_family, SU_ADDR(su), name, sizeof name))
return ELI_RESOLVER;
}

View File

@ -100,17 +100,23 @@ void su_log(char const *fmt, ...)
*
* @note This function is used mainly by SU_DEBUG_n() macros.
*/
void su_llog(su_log_t *log, unsigned level, char const *fmt, ...)
void _su_llog(su_log_t *log, unsigned level, const char *file, const char *func, int line,
char const *fmt, ...)
{
va_list ap;
char buf[512];
va_start(ap, fmt);
su_vllog(log, level, fmt, ap);
snprintf(buf, sizeof(buf), "%s:%d %s() %s", file, line, func, fmt);
_su_vllog(log, level, file, func, line, buf, ap);
va_end(ap);
}
/** Log a message with level (stdarg version). */
void su_vllog(su_log_t *log, unsigned level, char const *fmt, va_list ap)
void _su_vllog(su_log_t *log, unsigned level, const char *file, const char *func, int line,
char const *fmt, va_list ap)
{
su_logger_f *logger;
void *stream;
@ -133,8 +139,9 @@ void su_vllog(su_log_t *log, unsigned level, char const *fmt, va_list ap)
stream = su_log_default->log_stream;
}
if (logger)
logger(stream, fmt, ap);
if (logger) {
logger(stream, fmt, ap);
}
}
static char const not_initialized[1];

View File

@ -105,7 +105,7 @@ void nw_changed_cb(SCDynamicStoreRef store,
su_network_changed_t *snc2;
su_msg_r rmsg = SU_MSG_R_INIT;
SU_DEBUG_7(("nw_changed_cb: entering.\n"));
SU_DEBUG_7(("nw_changed_cb: entering.\n" VA_NONE));
if (su_msg_create(rmsg,
su_root_task(snc->su_root),

View File

@ -3350,7 +3350,7 @@ tport_t *tport_tsend(tport_t *self,
if (!self) {
msg_set_errno(msg, su_errno());
SU_DEBUG_9(("tport_socket failed in tsend\n"));
SU_DEBUG_9(("tport_socket failed in tsend\n" VA_NONE));
return NULL;
}
@ -3406,7 +3406,7 @@ int tport_prepare_and_send(tport_t *self, msg_t *msg,
/* ...or we are connecting */
(self->tp_events & (SU_WAIT_CONNECT | SU_WAIT_OUT))) {
if (tport_queue(self, msg) < 0) {
SU_DEBUG_9(("tport_queue failed in tsend\n"));
SU_DEBUG_9(("tport_queue failed in tsend\n" VA_NONE));
return -1;
}
return 0;

View File

@ -201,7 +201,7 @@ static tport_t *tport_http_connect(tport_primary_t *pri, su_addrinfo_t *ai,
msg_set_next(response, thci->thci_stackmsg = tport_msg_alloc(tport, 512));
if (tport_send_msg(tport, msg, tpn, NULL) < 0) {
SU_DEBUG_9(("tport_send_msg failed in tpot_http_connect\n"));
SU_DEBUG_9(("tport_send_msg failed in tpot_http_connect\n" VA_NONE));
msg_destroy(msg);
tport_zap_secondary(tport);
return NULL;

View File

@ -59,7 +59,7 @@
static void weighting_filter(int16_t x[40],
const int16_t *e) // signal [-5..0.39.44] IN)
{
#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__)
#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__) && !(defined(__APPLE_CC__) && __APPLE_CC__ >= 5448)
/* Table 4.4 Coefficients of the weighting filter */
/* This must be padded to a multiple of 4 for MMX to work */
static const union

View File

@ -69,6 +69,7 @@ struct stfu_instance {
struct stfu_queue *old_queue;
struct stfu_frame *last_frame;
uint32_t cur_ts;
uint16_t cur_seq;
uint32_t last_wr_ts;
uint32_t last_rd_ts;
uint32_t samples_per_packet;
@ -361,6 +362,7 @@ void stfu_n_reset(stfu_instance_t *i)
stfu_n_sync(i, 1);
i->cur_ts = 0;
i->cur_seq = 0;
i->last_wr_ts = 0;
i->last_rd_ts = 0;
i->miss_count = 0;
@ -650,6 +652,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
for (x = 0; x < i->out_queue->array_len; x++) {
if (!i->out_queue->array[x].was_read) {
i->cur_ts = i->out_queue->array[x].ts;
i->cur_ts = i->out_queue->array[x].seq;
break;
}
if (i->cur_ts == 0) {
@ -661,6 +664,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
}
} else {
i->cur_ts = i->cur_ts + i->samples_per_packet;
i->cur_seq++;
}
found = stfu_n_find_frame(i, i->out_queue, i->last_wr_ts, i->cur_ts, &rframe);
@ -679,12 +683,14 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
if (found) {
i->cur_ts = rframe->ts;
i->cur_seq = rframe->seq;
}
if (i->sync_out) {
if (!found) {
if ((found = stfu_n_find_any_frame(i, i->out_queue, &rframe))) {
i->cur_ts = rframe->ts;
i->cur_seq = rframe->seq;
}
if (stfu_log != null_logger && i->debug) {
@ -783,6 +789,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
rframe->dlen = i->plc_len;
rframe->pt = i->plc_pt;
rframe->ts = i->cur_ts;
rframe->seq = i->cur_seq;
i->miss_count++;
if (stfu_log != null_logger && i->debug) {
@ -799,6 +806,38 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
return rframe;
}
int32_t stfu_n_copy_next_frame(stfu_instance_t *jb, uint32_t timestamp, uint16_t seq, uint16_t distance, stfu_frame_t *next_frame)
{
uint32_t i = 0, j = 0;
stfu_queue_t *queues[] = { jb->out_queue, jb->in_queue, jb->old_queue};
stfu_queue_t *queue = NULL;
stfu_frame_t *frame = NULL;
uint32_t target_ts = 0;
if (!next_frame) return 0;
target_ts = timestamp + (distance - 1) * jb->samples_per_packet;
for (i = 0; i < sizeof(queues)/sizeof(queues[0]); i++) {
queue = queues[i];
if (!queue) continue;
for(j = 0; j < queue->array_size; j++) {
frame = &queue->array[j];
/* FIXME: ts rollover happened? bad luck */
if (frame->ts > target_ts) {
memcpy(next_frame, frame, sizeof(stfu_frame_t));
return 1;
}
}
}
return 0;
}
#ifdef WIN32
#ifndef vsnprintf
#define vsnprintf _vsnprintf
@ -927,7 +966,6 @@ static void default_logger(const char *file, const char *func, int line, int lev
}
/* For Emacs:
* Local Variables:
* mode:c

View File

@ -191,6 +191,7 @@ stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_
stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen);
stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last);
stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i);
int32_t stfu_n_copy_next_frame(stfu_instance_t *jb, uint32_t timestamp, uint16_t seq, uint16_t distance, stfu_frame_t *next_frame);
void stfu_n_reset(stfu_instance_t *i);
stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets);
void stfu_n_call_me(stfu_instance_t *i, stfu_n_call_me_t callback, void *udata);

View File

@ -256,8 +256,6 @@ struct switch_runtime {
switch_profile_timer_t *profile_timer;
double profile_time;
double min_idle_time;
int sql_buffer_len;
int max_sql_buffer_len;
switch_dbtype_t odbc_dbtype;
char hostname[256];
char *switchname;

View File

@ -106,7 +106,11 @@
#include <signal.h>
#include <errno.h>
#ifndef WIN32
#include "stfu.h"
#else
#include "../../../libs/stfu/stfu.h"
#endif
#include "switch_platform.h"
#include "switch_types.h"
#include "switch_apr.h"

View File

@ -70,6 +70,12 @@ typedef struct switch_hold_record_s {
} switch_hold_record_t;
typedef struct switch_thread_data_s {
switch_thread_start_t func;
void *obj;
int alloc;
} switch_thread_data_t;
#define MESSAGE_STAMP_FFL(_m) _m->_file = __FILE__; _m->_func = __SWITCH_FUNC__; _m->_line = __LINE__
@ -703,6 +709,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_
SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(_In_ switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_thread_pool_launch_thread(switch_thread_data_t **tdp);
SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_core_session_t *session);
/*!
@ -818,14 +825,22 @@ SWITCH_DECLARE(void) switch_core_dump_variables(_In_ switch_stream_handle_t *str
*/
SWITCH_DECLARE(void) switch_core_session_hupall(_In_ switch_call_cause_t cause);
typedef enum {
SHT_NONE = 0,
SHT_UNANSWERED = (1 << 0),
SHT_ANSWERED = (1 << 1)
} switch_hup_type_t;
/*!
\brief Hangup all sessions which match a specific channel variable
\param var_name The variable name to look for
\param var_val The value to look for
\param cause the hangup cause to apply to the hungup channels
*/
SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(_In_ const char *var_name, _In_ const char *var_val, _In_ switch_call_cause_t cause);
SWITCH_DECLARE(uint32_t) switch_core_session_hupall_matching_var_ans(_In_ const char *var_name, _In_ const char *var_val, _In_
switch_call_cause_t cause, switch_hup_type_t type);
SWITCH_DECLARE(switch_console_callback_match_t *) switch_core_session_findall_matching_var(const char *var_name, const char *var_val);
#define switch_core_session_hupall_matching_var(_vn, _vv, _c) switch_core_session_hupall_matching_var_ans(_vn, _vv, _c, SHT_UNANSWERED | SHT_ANSWERED)
/*!
\brief Hangup all sessions that belong to an endpoint
@ -2198,8 +2213,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_chat_send(const char *dest_proto, sw
SWITCH_DECLARE(switch_status_t) switch_core_chat_deliver(const char *dest_proto, switch_event_t **message_event);
SWITCH_DECLARE(switch_status_t) switch_ivr_preprocess_session(switch_core_session_t *session, const char *cmds);
SWITCH_DECLARE(void) switch_core_sqldb_stop_thread(void);
SWITCH_DECLARE(void) switch_core_sqldb_start_thread(void);
SWITCH_DECLARE(void) switch_core_sqldb_pause(void);
SWITCH_DECLARE(void) switch_core_sqldb_resume(void);
///\}
@ -2418,17 +2434,22 @@ SWITCH_DECLARE(void) switch_core_recovery_untrack(switch_core_session_t *session
SWITCH_DECLARE(void) switch_core_recovery_track(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_recovery_flush(const char *technology, const char *profile_name);
SWITCH_DECLARE(switch_status_t) switch_switch_sql_queue_manager_push(switch_sql_queue_manager_t *qm, const char *sql, uint32_t pos, switch_bool_t dup);
SWITCH_DECLARE(switch_status_t) switch_switch_sql_queue_manager_destroy(switch_sql_queue_manager_t **qmp);
SWITCH_DECLARE(switch_status_t) switch_switch_sql_queue_manager_init(switch_sql_queue_manager_t **qmp,
uint32_t numq, const char *dsn,
const char *pre_trans_execute,
const char *post_trans_execute,
const char *inner_pre_trans_execute,
const char *inner_post_trans_execute);
SWITCH_DECLARE(int) switch_sql_queue_manager_size(switch_sql_queue_manager_t *qm, uint32_t index);
SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql_queue_manager_t *qm, const char *sql, uint32_t pos, switch_bool_t dup);
SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push(switch_sql_queue_manager_t *qm, const char *sql, uint32_t pos, switch_bool_t dup);
SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_destroy(switch_sql_queue_manager_t **qmp);
SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_init_name(const char *name,
switch_sql_queue_manager_t **qmp,
uint32_t numq, const char *dsn, uint32_t max_trans,
const char *pre_trans_execute,
const char *post_trans_execute,
const char *inner_pre_trans_execute,
const char *inner_post_trans_execute);
SWITCH_DECLARE(switch_status_t) switch_switch_sql_queue_manager_start(switch_sql_queue_manager_t *qm);
SWITCH_DECLARE(switch_status_t) switch_switch_sql_queue_manager_stop(switch_sql_queue_manager_t *qm);
#define switch_sql_queue_manager_init(_q, _n, _d, _m, _p1, _p2, _ip1, _ip2) switch_sql_queue_manager_init_name(__FILE__, _q, _n, _d, _m, _p1, _p2, _ip1, _ip2)
SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_start(switch_sql_queue_manager_t *qm);
SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_stop(switch_sql_queue_manager_t *qm);
SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback(switch_cache_db_handle_t *dbh,
const char *sql, switch_db_event_callback_func_t callback, void *pdata, char **err);

View File

@ -927,6 +927,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *sessi
SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname, const char *prefix);
SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid);
SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_force_exists(const char *uuid);

View File

@ -618,6 +618,7 @@ struct switch_codec {
switch_mutex_t *mutex;
struct switch_codec *next;
switch_core_session_t *session;
switch_frame_t *cur_frame;
};
/*! \brief A table of settings and callbacks that define a paticular implementation of a codec */

View File

@ -146,6 +146,7 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE "execute_on_tone_detect"
#define SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE "execute_on_originate"
#define SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE "execute_on_post_originate"
#define SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE "execute_on_pre_originate"
#define SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE "api_on_answer"
#define SWITCH_CHANNEL_API_ON_PRE_ANSWER_VARIABLE "api_on_pre_answer"
@ -154,6 +155,7 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE "api_on_tone_detect"
#define SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE "api_on_originate"
#define SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE "api_on_post_originate"
#define SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE "api_on_pre_originate"
#define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout"
#define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid"
@ -213,6 +215,7 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_BITS_PER_BYTE 8
#define SWITCH_DEFAULT_FILE_BUFFER_LEN 65536
#define SWITCH_DTMF_LOG_LEN 1000
#define SWITCH_MAX_TRANS 2000
typedef uint8_t switch_byte_t;
/*!
@ -463,6 +466,7 @@ typedef struct {
struct switch_directories {
char *base_dir;
char *mod_dir;
char *lib_dir;
char *conf_dir;
char *log_dir;
char *run_dir;
@ -1169,6 +1173,7 @@ typedef enum {
CF_OUTBOUND,
CF_EARLY_MEDIA,
CF_BRIDGE_ORIGINATOR,
CF_UUID_BRIDGE_ORIGINATOR,
CF_TRANSFER,
CF_ACCEPT_CNG,
CF_REDIRECT,
@ -1299,7 +1304,8 @@ typedef enum {
SAF_SUPPORT_NOMEDIA = (1 << 0),
SAF_ROUTING_EXEC = (1 << 1),
SAF_MEDIA_TAP = (1 << 2),
SAF_ZOMBIE_EXEC = (1 << 3)
SAF_ZOMBIE_EXEC = (1 << 3),
SAF_NO_LOOPBACK = (1 << 4)
} switch_application_flag_enum_t;
typedef uint32_t switch_application_flag_t;

View File

@ -423,7 +423,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function_ptr(_In_ switc
///\return the section mask
SWITCH_DECLARE(switch_xml_section_t) switch_xml_parse_section_string(_In_opt_z_ const char *str);
SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond, int *offset);
SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond, int *offset, const char *tzname);
SWITCH_DECLARE(switch_status_t) switch_xml_locate_language(switch_xml_t *root, switch_xml_t *node, switch_event_t *params, switch_xml_t *language, switch_xml_t *phrases, switch_xml_t *macros, const char *str_language);

View File

@ -8539,11 +8539,13 @@ static void conference_send_presence(conference_obj_t *conference)
}
}
static void kickall_matching_var(conference_obj_t *conference, const char *var, const char *val)
#if 0
static uint32_t kickall_matching_var(conference_obj_t *conference, const char *var, const char *val)
{
conference_member_t *member = NULL;
const char *vval = NULL;
uint32_t r = 0;
switch_mutex_lock(conference->mutex);
switch_mutex_lock(conference->member_mutex);
@ -8560,14 +8562,18 @@ static void kickall_matching_var(conference_obj_t *conference, const char *var,
if (vval && !strcmp(vval, val)) {
switch_set_flag_locked(member, MFLAG_KICKED);
switch_clear_flag_locked(member, MFLAG_RUNNING);
switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
r++;
}
}
switch_mutex_unlock(conference->member_mutex);
switch_mutex_unlock(conference->mutex);
return r;
}
#endif
static void call_setup_event_handler(switch_event_t *event)
{
@ -8631,8 +8637,11 @@ static void call_setup_event_handler(switch_event_t *event)
}
} else if (!strcasecmp(action, "end")) {
//switch_core_session_hupall_matching_var("conference_call_key", key, SWITCH_CAUSE_NORMAL_CLEARING);
kickall_matching_var(conference, "conference_call_key", key);
if (switch_core_session_hupall_matching_var("conference_call_key", key, SWITCH_CAUSE_NORMAL_CLEARING)) {
send_conference_notify(conference, "SIP/2.0 200 OK\r\n", call_id, SWITCH_TRUE);
} else {
send_conference_notify(conference, "SIP/2.0 481 Failure\r\n", call_id, SWITCH_TRUE);
}
status = SWITCH_STATUS_SUCCESS;
}

View File

@ -1176,6 +1176,15 @@ SWITCH_STANDARD_APP(answer_function)
switch_channel_answer(channel);
}
SWITCH_STANDARD_APP(wait_for_answer_function)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Waiting for answer\n");
while (!switch_channel_test_flag(channel, CF_ANSWERED) && switch_channel_ready(channel)) {
switch_ivr_sleep(session, 100, SWITCH_TRUE, NULL);
}
}
SWITCH_STANDARD_APP(presence_function)
{
char *argv[6] = { 0 };
@ -5083,6 +5092,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
zombie_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "wait_for_answer", "Wait for call to be answered", "Wait for call to be answered.", wait_for_answer_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "hangup", "Hangup the call", "Hangup the call for a channel.", hangup_function, "[<cause>]", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "set_name", "Name the channel", "Name the channel", set_name_function, "<name>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "presence", "Send Presence", "Send Presence.", presence_function, "<rpid> <status> [<id>]",

View File

@ -64,6 +64,16 @@ typedef enum {
} break_t;
#define check_tz() tzoff = switch_event_get_header(event, "tod_tz_offset"); \
tzname = switch_event_get_header(event, "timezone"); \
do { \
if (!zstr(tzoff) && switch_is_number(tzoff)) { \
offset = atoi(tzoff); \
} else { \
tzoff = NULL; \
} \
break; \
} while(tzoff)
static int parse_exten(switch_event_t *event, switch_xml_t xexten, switch_event_t **extension)
{
@ -73,6 +83,10 @@ static int parse_exten(switch_event_t *event, switch_xml_t xexten, switch_event_
char *expression_expanded = NULL, *field_expanded = NULL;
switch_regex_t *re = NULL;
const char *to = switch_event_get_header(event, "to");
const char *tzoff = NULL, *tzname = NULL;
int offset = 0;
check_tz();
if (!to) {
to = "nobody";
@ -90,8 +104,10 @@ static int parse_exten(switch_event_t *event, switch_xml_t xexten, switch_event_
int ovector[30];
switch_bool_t anti_action = SWITCH_TRUE;
break_t do_break_i = BREAK_ON_FALSE;
int time_match;
int time_match = switch_xml_std_datetime_check(xcond, NULL);
check_tz();
time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL, tzname);
switch_safe_free(field_expanded);
switch_safe_free(expression_expanded);

View File

@ -714,9 +714,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init)
t38_gateway_function, "", SAF_MEDIA_TAP);
SWITCH_ADD_APP(app_interface, "rxfax", "FAX Receive Application", "FAX Receive Application", spanfax_rx_function, SPANFAX_RX_USAGE,
SAF_SUPPORT_NOMEDIA);
SAF_SUPPORT_NOMEDIA | SAF_NO_LOOPBACK);
SWITCH_ADD_APP(app_interface, "txfax", "FAX Transmit Application", "FAX Transmit Application", spanfax_tx_function, SPANFAX_TX_USAGE,
SAF_SUPPORT_NOMEDIA);
SAF_SUPPORT_NOMEDIA | SAF_NO_LOOPBACK);
SWITCH_ADD_APP(app_interface, "spandsp_stop_dtmf", "stop inband dtmf", "Stop detecting inband dtmf.", stop_dtmf_session_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "spandsp_start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_MEDIA_TAP);

View File

@ -1604,7 +1604,18 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
*cc.buf = '\0';
goto play_file;
} else if (!strcmp(input, profile->callback_key)) {
switch_core_session_execute_exten(session, cbt->cid_number, profile->callback_dialplan, profile->callback_context);
const char *callback_dialplan;
const char *callback_context;
if (!(callback_dialplan = switch_channel_get_variable(channel, "voicemail_callback_dialplan"))) {
callback_dialplan = profile->callback_dialplan;
}
if (!(callback_context = switch_channel_get_variable(channel, "voicemail_callback_context"))) {
callback_context = profile->callback_context;
}
switch_core_session_execute_exten(session, cbt->cid_number, callback_dialplan, callback_context);
} else if (!strcmp(input, profile->forward_key)) {
char *cmd = NULL;
char *new_file_path = NULL;

View File

@ -4,6 +4,7 @@ SILK_BUILDDIR=$(switch_builddir)/libs/silk
LOCAL_CFLAGS=-I$(SILK_DIR)/src -I$(SILK_DIR)/interface
SILK_LA=$(SILK_BUILDDIR)/.libs/libSKP_SILK_SDK.la
LOCAL_LIBADD=$(SILK_LA)
LOCAL_OBJS=$(BASE)/libs/stfu/stfu.o
include $(BASE)/build/modmake.rules
$(SILK_LA): $(SILK_DIR)/.update

View File

@ -31,6 +31,7 @@
*/
#include "switch.h"
#include "stfu.h"
#include "SKP_Silk_SDK_API.h"
SWITCH_MODULE_LOAD_FUNCTION(mod_silk_load);
@ -321,23 +322,43 @@ static switch_status_t switch_silk_decode(switch_codec_t *codec,
SKP_int16 ret, len;
int16_t *target = decoded_data;
switch_core_session_t *session = codec->session;
stfu_instance_t *jb;
stfu_instance_t *jb = NULL;
SKP_int lost_flag = (*flag & SFF_PLC);
stfu_frame_t next_frame;
SKP_uint8 recbuff[STFU_DATALEN];
SKP_int16 reclen;
int32_t found_frame;
switch_bool_t did_lbrr = SWITCH_FALSE;
*decoded_data_len = 0;
if (session) {
jb = switch_core_session_get_jb(session, SWITCH_MEDIA_TYPE_AUDIO);
}
if (jb) {
/* to allow compile */
jb = NULL;
if (lost_flag) {
if (session) {
jb = switch_core_session_get_jb(session, SWITCH_MEDIA_TYPE_AUDIO);
}
if (jb && codec && codec->cur_frame) {
for (int i = 1; i <= MAX_LBRR_DELAY; i++) {
found_frame = stfu_n_copy_next_frame(jb, codec->cur_frame->timestamp, codec->cur_frame->seq, i, &next_frame);
if (found_frame) {
SKP_Silk_SDK_search_for_LBRR(next_frame.data, next_frame.dlen, i, (SKP_uint8*) &recbuff, &reclen);
if (reclen) {
encoded_data = &recbuff;
encoded_data_len = reclen;
lost_flag = SKP_FALSE;
did_lbrr = SWITCH_TRUE;
break;
}
}
}
}
}
do {
ret = SKP_Silk_SDK_Decode(context->dec_state,
&context->decoder_object,
((*flag & SFF_PLC)),
lost_flag,
encoded_data,
encoded_data_len,
target,
@ -345,6 +366,8 @@ static switch_status_t switch_silk_decode(switch_codec_t *codec,
if (ret){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SKP_Silk_Decode returned %d!\n", ret);
printSilkError(ret);
/* if FEC was activated, we can ignore bit errors*/
if (! (ret == SKP_SILK_DEC_PAYLOAD_ERROR && did_lbrr))
return SWITCH_STATUS_FALSE;
}

View File

@ -81,6 +81,7 @@ static switch_status_t exec_app(switch_core_session_t *session, const char *app,
#define check_tz() tzoff = switch_channel_get_variable(channel, "tod_tz_offset"); \
tzname = switch_channel_get_variable(channel, "timezone"); \
do { \
if (!zstr(tzoff) && switch_is_number(tzoff)) { \
offset = atoi(tzoff); \
@ -99,7 +100,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
char *expression_expanded = NULL, *field_expanded = NULL;
switch_regex_t *re = NULL, *save_re = NULL;
int offset = 0;
const char *tzoff;
const char *tzoff = NULL, *tzname = NULL;
check_tz();
@ -120,7 +121,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
int time_match;
check_tz();
time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL);
time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL, tzname);
switch_safe_free(field_expanded);
@ -173,7 +174,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
for (xregex = switch_xml_child(xcond, "regex"); xregex; xregex = xregex->next) {
check_tz();
time_match = switch_xml_std_datetime_check(xregex, tzoff ? &offset : NULL);
time_match = switch_xml_std_datetime_check(xregex, tzoff ? &offset : NULL, tzname);
if (time_match == 1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,

View File

@ -1167,6 +1167,8 @@ static int activate_audio_rtp(struct private_object *tech_pvt)
r = 0;
goto end;
}
tech_pvt->transports[LDL_TPORT_RTP].read_codec.session = tech_pvt->session;
tech_pvt->transports[LDL_TPORT_RTP].read_frame.rate = tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_second;
tech_pvt->transports[LDL_TPORT_RTP].read_frame.codec = &tech_pvt->transports[LDL_TPORT_RTP].read_codec;
@ -1186,6 +1188,7 @@ static int activate_audio_rtp(struct private_object *tech_pvt)
r = 0;
goto end;
}
tech_pvt->transports[LDL_TPORT_RTP].write_codec.session = tech_pvt->session;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Write Codec to %s@%d\n",
tech_pvt->transports[LDL_TPORT_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_RTP].write_codec.implementation->samples_per_second);
@ -1511,8 +1514,14 @@ static int do_tport_candidates(struct private_object *tech_pvt, ldl_transport_ty
}
address = advip;
if(address && !strncasecmp(address, "host:", 5)) {
address = address + 5;
if (address && !strncasecmp(address, "host:", 5)) {
char *lookup = switch_stun_host_lookup(address + 5, switch_core_session_get_pool(tech_pvt->session));
if (zstr(lookup)) {
address = address + 5;
} else {
address = lookup;
}
}
memset(cand, 0, sizeof(*cand));
@ -4177,7 +4186,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
tech_pvt->them = switch_core_session_strdup(session, ldl_session_get_callee(dlsession));
tech_pvt->us = switch_core_session_strdup(session, ldl_session_get_caller(dlsession));
if ((tmp = strdup(tech_pvt->us))) {
if (tech_pvt->us && (tmp = strdup(tech_pvt->us))) {
char *p, *q;
if ((p = strchr(tmp, '@'))) {

View File

@ -42,6 +42,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_loopback_shutdown);
SWITCH_MODULE_DEFINITION(mod_loopback, mod_loopback_load, mod_loopback_shutdown, NULL);
static switch_status_t find_non_loopback_bridge(switch_core_session_t *session, switch_core_session_t **br_session, const char **br_uuid);
static switch_endpoint_interface_t *loopback_endpoint_interface = NULL;
typedef enum {
@ -409,6 +411,8 @@ static switch_status_t channel_on_execute(switch_core_session_t *session)
{
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
switch_caller_extension_t *exten;
int bow = 0;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@ -418,6 +422,37 @@ static switch_status_t channel_on_execute(switch_core_session_t *session)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
if ((exten = switch_channel_get_caller_extension(channel))) {
switch_caller_application_t *app_p;
for (app_p = exten->applications; app_p; app_p = app_p->next) {
int32_t flags;
switch_core_session_get_app_flags(app_p->application_name, &flags);
if ((flags & SAF_NO_LOOPBACK)) {
bow = 1;
break;
}
}
}
if (bow) {
switch_core_session_t *other_session;
const char *other_uuid;
if ((find_non_loopback_bridge(tech_pvt->other_session, &other_session, &other_uuid) == SWITCH_STATUS_SUCCESS)) {
switch_caller_extension_t *extension;
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
switch_caller_extension_clone(&extension, exten, switch_core_session_get_pool(other_session));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_INFO, "BOWOUT Transfering current extension to non-loopback leg.\n");
switch_channel_transfer_to_extension(other_channel, extension);
switch_core_session_rwunlock(other_session);
}
}
return SWITCH_STATUS_SUCCESS;
}
@ -1126,8 +1161,11 @@ static switch_io_routines_t channel_io_routines = {
/*.receive_message */ channel_receive_message
};
SWITCH_STANDARD_APP(unloop_function) { /* NOOP */}
SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load)
{
switch_application_interface_t *app_interface;
memset(&globals, 0, sizeof(globals));
@ -1138,6 +1176,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load)
loopback_endpoint_interface->io_routines = &channel_io_routines;
loopback_endpoint_interface->state_handler = &channel_event_handlers;
SWITCH_ADD_APP(app_interface, "unloop", "Tell loopback to unfold", "Tell loopback to unfold", unloop_function, "", SAF_NO_LOOPBACK);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}

View File

@ -1511,6 +1511,10 @@ static switch_status_t sofia_send_dtmf(switch_core_session_t *session, const swi
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
if (sofia_test_flag(tech_pvt, TFLAG_DROP_DTMF)) {
return SWITCH_STATUS_SUCCESS;
}
dtmf_type = tech_pvt->dtmf_type;
/* We only can send INFO when we have no media */
@ -2015,16 +2019,30 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
switch_channel_get_name(channel), msg->string_arg);
sofia_glue_tech_set_local_sdp(tech_pvt, msg->string_arg, SWITCH_TRUE);
if(zstr(tech_pvt->local_sdp_str)) {
sofia_set_flag(tech_pvt, TFLAG_3PCC_INVITE);
if (msg->numeric_arg) { // ACK
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY nomedia - sending ack\n");
nua_ack(tech_pvt->nh,
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(msg->string_arg),
SOATAG_REUSE_REJECTED(1),
SOATAG_RTP_SELECT(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
TAG_END());
sofia_clear_flag(tech_pvt, TFLAG_3PCC_INVITE);
} else {
if(zstr(tech_pvt->local_sdp_str)) {
sofia_set_flag(tech_pvt, TFLAG_3PCC_INVITE);
}
sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
switch_channel_set_flag(channel, CF_REQ_MEDIA);
}
sofia_glue_do_invite(session);
}
sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
switch_channel_set_flag(channel, CF_REQ_MEDIA);
}
sofia_glue_do_invite(session);
}
break;
@ -3636,7 +3654,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
switch_xml_reload(&err);
stream->write_function(stream, "Reload XML [%s]\n", err);
if (config_sofia(1, argv[0]) == SWITCH_STATUS_SUCCESS) {
if (config_sofia(SOFIA_CONFIG_RESCAN, argv[0]) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "%s started successfully\n", argv[0]);
} else {
stream->write_function(stream, "Failure starting %s\n", argv[0]);
@ -3713,7 +3731,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
switch_xml_reload(&err);
stream->write_function(stream, "Reload XML [%s]\n", err);
if (reconfig_sofia(profile) == SWITCH_STATUS_SUCCESS) {
if (config_sofia(SOFIA_CONFIG_RESCAN, profile->name) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "+OK scan complete\n");
} else {
stream->write_function(stream, "-ERR cannot find config for profile %s\n", profile->name);
@ -4900,8 +4918,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
sql = switch_mprintf("insert into sip_dialogs (uuid,presence_id,presence_data,profile_name,hostname,rcd,call_info_state) "
"values ('%q', '%q', '%q', '%q', '%q', %ld, '')", switch_core_session_get_uuid(nsession),
switch_str_nil(presence_id), switch_str_nil(presence_data), profile->name, mod_sofia_globals.hostname, (long) now);
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
switch_safe_free(sql);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
}
#endif
@ -5708,8 +5725,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
/* start one message thread */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Starting initial message thread.\n");
sofia_msg_thread_start(0);
if (config_sofia(0, NULL) != SWITCH_STATUS_SUCCESS) {
if (sofia_init() != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_GENERR;
}
if (config_sofia(SOFIA_CONFIG_LOAD, NULL) != SWITCH_STATUS_SUCCESS) {
mod_sofia_globals.running = 0;
return SWITCH_STATUS_GENERR;
}

View File

@ -138,6 +138,12 @@ typedef struct private_object private_object_t;
#include <sofia-sip/msg.h>
#include <sofia-sip/uniqueid.h>
typedef enum {
SOFIA_CONFIG_LOAD = 0,
SOFIA_CONFIG_RESCAN,
SOFIA_CONFIG_RESPAWN
} sofia_config_t;
typedef enum {
DTMF_2833,
DTMF_INFO,
@ -241,7 +247,7 @@ typedef enum {
PFLAG_DISABLE_HOLD,
PFLAG_AUTO_NAT,
PFLAG_SIPCOMPACT,
PFLAG_SQL_IN_TRANS,
PFLAG_USE_ME,
PFLAG_PRESENCE_PRIVACY,
PFLAG_PASS_CALLEE_ID,
PFLAG_LOG_AUTH_FAIL,
@ -273,6 +279,7 @@ typedef enum {
PFLAG_MWI_USE_REG_CALLID,
PFLAG_FIRE_MESSAGE_EVENTS,
PFLAG_SEND_DISPLAY_UPDATE,
PFLAG_RUNNING_TRANS,
/* No new flags below this line */
PFLAG_MAX
} PFLAGS;
@ -345,6 +352,7 @@ typedef enum {
TFLAG_SLA_BARGING,
TFLAG_PASS_ACK,
TFLAG_CRYPTO_RECOVER,
TFLAG_DROP_DTMF,
/* No new flags below this line */
TFLAG_MAX
} TFLAGS;
@ -632,7 +640,7 @@ struct sofia_profile {
char *post_trans_execute;
char *inner_pre_trans_execute;
char *inner_post_trans_execute;
switch_queue_t *sql_queue;
switch_sql_queue_manager_t *qm;
char *acl[SOFIA_MAX_ACL];
char *acl_pass_context[SOFIA_MAX_ACL];
char *acl_fail_context[SOFIA_MAX_ACL];
@ -965,7 +973,7 @@ void sofia_presence_event_handler(switch_event_t *event);
void sofia_presence_cancel(void);
switch_status_t config_sofia(int reload, char *profile_name);
switch_status_t config_sofia(sofia_config_t reload, char *profile_name);
void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_dispatch_event_t *de,
sofia_regtype_t regtype, const char *realm, int stale);
auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization,
@ -1117,7 +1125,6 @@ switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt, in
switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force);
char *sofia_glue_get_register_host(const char *uri);
const char *sofia_glue_strip_proto(const char *uri);
switch_status_t reconfig_sofia(sofia_profile_t *profile);
void sofia_glue_del_gateway(sofia_gateway_t *gp);
void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *stream, int up);
void sofia_glue_del_every_gateway(sofia_profile_t *profile);
@ -1198,6 +1205,7 @@ void crtp_init(switch_loadable_module_interface_t *module_interface);
int sofia_recover_callback(switch_core_session_t *session);
void sofia_glue_set_name(private_object_t *tech_pvt, const char *channame);
private_object_t *sofia_glue_new_pvt(switch_core_session_t *session);
switch_status_t sofia_init(void);
/* For Emacs:
* Local Variables:

File diff suppressed because it is too large Load Diff

View File

@ -486,6 +486,10 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch
tech_pvt->session_id = tech_pvt->owner_id;
}
if (switch_true(switch_channel_get_variable_dup(tech_pvt->channel, "drop_dtmf", SWITCH_FALSE, -1))) {
sofia_set_flag(tech_pvt, TFLAG_DROP_DTMF);
}
tech_pvt->session_id++;
if ((tech_pvt->profile->ndlb & PFLAG_NDLB_SENDRECV_IN_SESSION) ||
@ -969,6 +973,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
switch_core_session_set_private(session, tech_pvt);
if (channame) {
sofia_glue_set_name(tech_pvt, channame);
}
@ -3032,6 +3037,9 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
tech_pvt->read_codec.session = tech_pvt->session;
if (switch_core_codec_init_with_bitrate(&tech_pvt->write_codec,
tech_pvt->iananame,
@ -3047,6 +3055,8 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
tech_pvt->write_codec.session = tech_pvt->session;
switch_channel_set_variable(tech_pvt->channel, "sip_use_codec_name", tech_pvt->iananame);
switch_channel_set_variable(tech_pvt->channel, "sip_use_codec_fmtp", tech_pvt->rm_fmtp);
switch_channel_set_variable_printf(tech_pvt->channel, "sip_use_codec_rate", "%d", tech_pvt->rm_rate);
@ -3214,7 +3224,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
const char *err = NULL;
const char *val = NULL;
switch_rtp_flag_t flags;
switch_status_t status;
switch_status_t status = SWITCH_STATUS_SUCCESS;
char tmp[50];
uint32_t rtp_timeout_sec = tech_pvt->profile->rtp_timeout_sec;
uint32_t rtp_hold_timeout_sec = tech_pvt->profile->rtp_hold_timeout_sec;
@ -3243,10 +3253,15 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
goto end;
}
if (switch_rtp_ready(tech_pvt->rtp_session) &&
(!sofia_test_flag(tech_pvt, TFLAG_VIDEO) || switch_rtp_ready(tech_pvt->video_rtp_session)) && !sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
status = SWITCH_STATUS_SUCCESS;
goto end;
if (!sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
if (switch_rtp_ready(tech_pvt->rtp_session)) {
if (sofia_test_flag(tech_pvt, TFLAG_VIDEO) && !switch_rtp_ready(tech_pvt->video_rtp_session)) {
goto video;
} else {
goto end;
}
}
}
if ((status = sofia_glue_tech_set_codec(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
@ -5128,7 +5143,13 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
}
if (match && bit_rate && map_bit_rate && map_bit_rate != bit_rate && strcasecmp(map->rm_encoding, "ilbc")) {
/* nevermind */
/* if a bit rate is specified and doesn't match, this is not a codec match, except for ILBC */
match = 0;
}
if (match && map->rm_rate && codec_rate && map->rm_rate != codec_rate && (!strcasecmp(map->rm_encoding, "pcma") || !strcasecmp(map->rm_encoding, "pcmu"))) {
/* if the sampling rate is specified and doesn't match, this is not a codec match for G.711 */
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "sampling rates have to match for G.711\n");
match = 0;
}
@ -5147,8 +5168,6 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
}
mimp = imp;
break;
} else {
match = 0;
}
}
@ -6269,7 +6288,8 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
};
switch_cache_db_handle_t *dbh = sofia_glue_get_db_handle(profile);
char *test2;
if (!dbh) {
return 0;
}
@ -6283,20 +6303,22 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
switch_cache_db_test_reactive(dbh, test_sql, "drop table sip_registrations", reg_sql);
if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) {
char *test2 = switch_mprintf("%s;%s", test_sql, test_sql);
test2 = switch_mprintf("%s;%s", test_sql, test_sql);
if (switch_cache_db_execute_sql(dbh, test2, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "GREAT SCOTT!!! Cannot execute batched statements!\n"
"If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS\n");
sofia_clear_pflag(profile, PFLAG_SQL_IN_TRANS);
}
if (switch_cache_db_execute_sql(dbh, test2, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "GREAT SCOTT!!! Cannot execute batched statements!\n"
"If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS\n");
switch_cache_db_release_db_handle(&dbh);
free(test2);
free(test_sql);
return 0;
}
free(test2);
free(test_sql);
test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and full_to='XXX'", mod_sofia_globals.hostname);
@ -6346,45 +6368,31 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
void sofia_glue_execute_sql(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic)
{
switch_status_t status = SWITCH_STATUS_FALSE;
char *d_sql = NULL, *sql;
char *sql;
switch_assert(sqlp && *sqlp);
sql = *sqlp;
sql = *sqlp;
if (profile->sql_queue) {
if (sql_already_dynamic) {
d_sql = sql;
} else {
d_sql = strdup(sql);
}
switch_assert(d_sql);
if ((status = switch_queue_trypush(profile->sql_queue, d_sql)) == SWITCH_STATUS_SUCCESS) {
d_sql = NULL;
}
} else if (sql_already_dynamic) {
d_sql = sql;
}
if (status != SWITCH_STATUS_SUCCESS) {
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
}
switch_safe_free(d_sql);
switch_sql_queue_manager_push(profile->qm, sql, 0, !sql_already_dynamic);
if (sql_already_dynamic) {
*sqlp = NULL;
}
}
void sofia_glue_execute_sql_now(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic)
{
sofia_glue_actually_execute_sql(profile, *sqlp, profile->ireg_mutex);
char *sql;
switch_assert(sqlp && *sqlp);
sql = *sqlp;
switch_sql_queue_manager_push_confirm(profile->qm, sql, 0, !sql_already_dynamic);
if (sql_already_dynamic) {
switch_safe_free(*sqlp);
*sqlp = NULL;
}
*sqlp = NULL;
}

View File

@ -620,9 +620,15 @@ static int sofia_presence_dialog_callback(void *pArg, int argc, char **argv, cha
if (argc >= 4) {
if (argc == 5 && !zstr(argv[4])) {
if (!switch_ivr_uuid_exists(argv[4])) {
return 0;
}
}
if (mod_sofia_globals.debug_presence > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "CHECK DIALOG state[%s] status[%s] rpid[%s] pres[%s]\n",
argv[0], argv[1], argv[2], argv[3]);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "CHECK DIALOG state[%s] status[%s] rpid[%s] pres[%s] uuid[%s]\n",
argv[0], argv[1], argv[2], argv[3], argv[4]);
}
if (!helper->hits) {
@ -668,7 +674,7 @@ static void do_normal_probe(switch_event_t *event)
}
if (probe_euser && probe_host && (profile = sofia_glue_find_profile(probe_host))) {
sql = switch_mprintf("select state,status,rpid,presence_id from sip_dialogs "
sql = switch_mprintf("select state,status,rpid,presence_id,uuid from sip_dialogs "
"where hostname='%q' and profile_name='%q' and call_info_state != 'seized' and "
"((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') order by rcd desc",
mod_sofia_globals.hostname, profile->name, probe_euser, probe_host, probe_euser, probe_host);
@ -1061,7 +1067,12 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
status = NULL;
}
if (status && switch_stristr("CS_HANGUP", status)) {
if (!zstr(uuid) && !switch_ivr_uuid_exists(uuid)) {
status = "CS_HANGUP";
}
if ((status && switch_stristr("CS_HANGUP", status)) || (!zstr(uuid) && !switch_ivr_uuid_exists(uuid))) {
status = "Available";
hup = 1;
}
@ -1279,12 +1290,12 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
if (zstr(uuid)) {
sql = switch_mprintf("select state,status,rpid,presence_id from sip_dialogs "
sql = switch_mprintf("select state,status,rpid,presence_id,uuid from sip_dialogs "
"where call_info_state != 'seized' and hostname='%q' and profile_name='%q' and "
"((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') order by rcd desc",
mod_sofia_globals.hostname, profile->name, euser, host, euser, host);
} else {
sql = switch_mprintf("select state,status,rpid,presence_id from sip_dialogs "
sql = switch_mprintf("select state,status,rpid,presence_id,uuid from sip_dialogs "
"where uuid != '%q' and call_info_state != 'seized' and hostname='%q' and profile_name='%q' and "
"((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') order by rcd desc",
uuid, mod_sofia_globals.hostname, profile->name, euser, host, euser, host);
@ -3619,9 +3630,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
}
switch_assert(sql != NULL);
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
switch_safe_free(sql);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
sstr = switch_mprintf("terminated;reason=noresource");
} else {
@ -4123,7 +4132,6 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n
char *pd_dup = NULL;
int count = 1, sub_count = 1;
char *contact_str;
int open = 1;
sofia_nat_parse_t np = { { 0 } };
if (!sip) {
@ -4190,11 +4198,10 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n
if (!strcasecmp(open_closed, "closed")) {
rpid = note_txt = "Unregistered";
}
if (sofia_test_pflag(profile, PFLAG_MULTIREG) && !open) {
count = sofia_reg_reg_count(profile, from_user, from_host);
sub_count = sofia_presence_contact_count(profile, contact_str);
if (sofia_test_pflag(profile, PFLAG_MULTIREG)) {
count = sofia_reg_reg_count(profile, from_user, from_host);
sub_count = sofia_presence_contact_count(profile, contact_str);
}
}
/* if (count > 1) let's not and say we did or all the clients who subscribe to their own presence will think they selves is offline */
@ -4522,8 +4529,7 @@ void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now)
"sub del sql: %s\n", sql);
}
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
switch_safe_free(sql);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
}
}

View File

@ -695,7 +695,7 @@ void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int
switch_safe_free(sql);
sql = switch_mprintf("delete from sip_registrations where call_id='%q' %s", call_id, sqlextra);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_FALSE);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
switch_safe_free(sqlextra);
switch_safe_free(sql);
@ -705,84 +705,86 @@ void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int
void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot)
{
char sql[1024];
char *sql;
if (now) {
switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires"
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,expires"
",user_agent,server_user,server_host,profile_name,network_ip"
",%d from sip_registrations where expires > 0 and expires <= %ld", reboot, (long) now);
} else {
switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires"
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,expires"
",user_agent,server_user,server_host,profile_name,network_ip" ",%d from sip_registrations where expires > 0", reboot);
}
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_reg_del_callback, profile);
free(sql);
if (now) {
switch_snprintfv(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires <= %ld and hostname='%q'",
sql = switch_mprintf("delete from sip_registrations where expires > 0 and expires <= %ld and hostname='%q'",
(long) now, mod_sofia_globals.hostname);
} else {
switch_snprintfv(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
sql = switch_mprintf("delete from sip_registrations where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
}
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
if (now) {
switch_snprintfv(sql, sizeof(sql), "select call_id from sip_shared_appearance_dialogs where hostname='%q' "
sql = switch_mprintf("select call_id from sip_shared_appearance_dialogs where hostname='%q' "
"and profile_name='%s' and expires <= %ld", mod_sofia_globals.hostname, profile->name, (long) now);
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_sla_dialog_del_callback, profile);
switch_snprintfv(sql, sizeof(sql), "delete from sip_shared_appearance_dialogs where expires > 0 and hostname='%q' and expires <= %ld",
free(sql);
sql = switch_mprintf("delete from sip_shared_appearance_dialogs where expires > 0 and hostname='%q' and expires <= %ld",
mod_sofia_globals.hostname, (long) now);
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
if (now) {
switch_snprintfv(sql, sizeof(sql), "delete from sip_presence where expires > 0 and expires <= %ld and hostname='%q'",
sql = switch_mprintf("delete from sip_presence where expires > 0 and expires <= %ld and hostname='%q'",
(long) now, mod_sofia_globals.hostname);
} else {
switch_snprintfv(sql, sizeof(sql), "delete from sip_presence where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
sql = switch_mprintf("delete from sip_presence where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
}
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
if (now) {
switch_snprintfv(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and expires <= %ld and hostname='%q'",
sql = switch_mprintf("delete from sip_authentication where expires > 0 and expires <= %ld and hostname='%q'",
(long) now, mod_sofia_globals.hostname);
} else {
switch_snprintfv(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
sql = switch_mprintf("delete from sip_authentication where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
}
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
sofia_presence_check_subscriptions(profile, now);
if (now) {
switch_snprintfv(sql, sizeof(sql), "delete from sip_dialogs where (expires = -1 or (expires > 0 and expires <= %ld)) and hostname='%q'",
sql = switch_mprintf("delete from sip_dialogs where (expires = -1 or (expires > 0 and expires <= %ld)) and hostname='%q'",
(long) now, mod_sofia_globals.hostname);
} else {
switch_snprintfv(sql, sizeof(sql), "delete from sip_dialogs where expires >= -1 and hostname='%q'", mod_sofia_globals.hostname);
sql = switch_mprintf("delete from sip_dialogs where expires >= -1 and hostname='%q'", mod_sofia_globals.hostname);
}
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
if (now) {
if (sofia_test_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING)) {
switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,"
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,"
"expires,user_agent,server_user,server_host,profile_name"
" from sip_registrations where hostname='%s' and "
"profile_name='%s'", mod_sofia_globals.hostname, profile->name);
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_reg_nat_callback, profile);
} else if (sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) {
switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,"
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,"
"expires,user_agent,server_user,server_host,profile_name"
" from sip_registrations where (status like '%%NAT%%' "
"or contact like '%%fs_nat=yes%%') and hostname='%s' "
@ -846,37 +848,36 @@ void sofia_reg_check_call_id(sofia_profile_t *profile, const char *call_id)
void sofia_reg_check_sync(sofia_profile_t *profile)
{
char sql[1024];
char *sql;
switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires"
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,expires"
",user_agent,server_user,server_host,profile_name,network_ip"
" from sip_registrations where expires > 0");
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_reg_del_callback, profile);
switch_snprintfv(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
sql = switch_mprintf("delete from sip_registrations where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
switch_snprintfv(sql, sizeof(sql), "delete from sip_presence where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
sql = switch_mprintf("delete from sip_presence where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
switch_snprintfv(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
sql = switch_mprintf("delete from sip_authentication where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
switch_snprintfv(sql, sizeof(sql), "delete from sip_subscriptions where expires >= -1 and hostname='%q'", mod_sofia_globals.hostname);
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
sql = switch_mprintf("delete from sip_subscriptions where expires >= -1 and hostname='%q'", mod_sofia_globals.hostname);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
switch_snprintfv(sql, sizeof(sql), "delete from sip_dialogs where expires >= -1 and hostname='%q'", mod_sofia_globals.hostname);
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
sql = switch_mprintf("delete from sip_dialogs where expires >= -1 and hostname='%q'", mod_sofia_globals.hostname);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
}
char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const char *host, char *val, switch_size_t len)
{
struct callback_t cbt = { 0 };
char sql[512] = "";
char *sql;
if (!user) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Called with null user!\n");
@ -887,10 +888,10 @@ char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const c
cbt.len = len;
if (host) {
switch_snprintfv(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
user, host, host);
} else {
switch_snprintfv(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%q'", user);
sql = switch_mprintf("select contact from sip_registrations where sip_user='%q'", user);
}
@ -908,7 +909,7 @@ char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const c
switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *profile, const char *user, const char *host)
{
struct callback_t cbt = { 0 };
char sql[512] = "";
char *sql;
if (!user) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Called with null user!\n");
@ -916,10 +917,10 @@ switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *p
}
if (host) {
switch_snprintfv(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
user, host, host);
} else {
switch_snprintfv(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%q'", user);
sql = switch_mprintf("select contact from sip_registrations where sip_user='%q'", user);
}
@ -932,7 +933,7 @@ switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *p
switch_console_callback_match_t *sofia_reg_find_reg_url_with_positive_expires_multi(sofia_profile_t *profile, const char *user, const char *host)
{
struct callback_t cbt = { 0 };
char sql[512] = "";
char *sql;
if (!user) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Called with null user!\n");
@ -940,13 +941,14 @@ switch_console_callback_match_t *sofia_reg_find_reg_url_with_positive_expires_mu
}
if (host) {
switch_snprintfv(sql, sizeof(sql), "select contact,expires from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
sql = switch_mprintf("select contact,expires from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
user, host, host);
} else {
switch_snprintfv(sql, sizeof(sql), "select contact,expires from sip_registrations where sip_user='%q'", user);
sql = switch_mprintf("select contact,expires from sip_registrations where sip_user='%q'", user);
}
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_reg_find_reg_with_positive_expires_callback, &cbt);
free(sql);
return cbt.list;
}
@ -973,8 +975,7 @@ void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_
(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);
switch_safe_free(sql);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
auth_str = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", realm, uuid_str, stale ? " stale=true," : "");
@ -2802,8 +2803,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : exptime + 10), ncl, nonce);
switch_assert(sql != NULL);
sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
switch_safe_free(sql);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
if (ret == AUTH_OK)
ret = AUTH_RENEWED;

View File

@ -366,7 +366,7 @@ static void event_handler(switch_event_t *event)
if (send && switch_test_flag(l, LFLAG_MYEVENTS)) {
char *uuid = switch_event_get_header(event, "unique-id");
if (!uuid || strcmp(uuid, switch_core_session_get_uuid(l->session))) {
if (!uuid || (l->session && strcmp(uuid, switch_core_session_get_uuid(l->session)))) {
send = 0;
}
}

View File

@ -45,6 +45,7 @@
#include <switch.h>
#include <vlc/vlc.h>
#include <vlc/libvlc_media_player.h>
#include <vlc/libvlc_events.h>
#define VLC_BUFFER_SIZE 65536
@ -83,6 +84,29 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_vlc_shutdown);
SWITCH_MODULE_LOAD_FUNCTION(mod_vlc_load);
SWITCH_MODULE_DEFINITION(mod_vlc, mod_vlc_load, mod_vlc_shutdown, NULL);
static void vlc_mediaplayer_error_callback(const libvlc_event_t * event, void * data)
{
vlc_file_context_t *context = (vlc_file_context_t *) data;
int status = libvlc_media_get_state(context->m);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got a libvlc_MediaPlayerEncounteredError callback. mediaPlayer Status: %d\n", status);
if (status == libvlc_Error) {
context->err = 1;
switch_thread_cond_signal(context->started);
}
}
static void vlc_media_state_callback(const libvlc_event_t * event, void * data)
{
vlc_file_context_t *context = (vlc_file_context_t *) data;
int new_state = event->u.media_state_changed.new_state;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got a libvlc_MediaStateChanged callback. New state: %d\n", new_state);
if (new_state == libvlc_Ended || new_state == libvlc_Error) {
switch_thread_cond_signal(context->started);
}
}
void vlc_auto_play_callback(void *data, const void *samples, unsigned count, int64_t pts) {
vlc_file_context_t *context = (vlc_file_context_t *) data;
@ -145,6 +169,7 @@ void vlc_imem_release_callback(void *data, const char *cookie, size_t size, void
static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *path)
{
vlc_file_context_t *context;
libvlc_event_manager_t *mp_event_manager, *m_event_manager;
context = switch_core_alloc(handle->memory_pool, sizeof(*context));
context->pool = handle->memory_pool;
@ -192,6 +217,12 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p
libvlc_audio_set_format(context->mp, "S16N", context->samplerate, 1);
m_event_manager = libvlc_media_event_manager(context->m);
libvlc_event_attach(m_event_manager, libvlc_MediaStateChanged, vlc_media_state_callback, (void *) context);
mp_event_manager = libvlc_media_player_event_manager(context->mp);
libvlc_event_attach(mp_event_manager, libvlc_MediaPlayerEncounteredError, vlc_mediaplayer_error_callback, (void *) context);
libvlc_audio_set_callbacks(context->mp, vlc_auto_play_callback, NULL,NULL,NULL,NULL, (void *) context);
libvlc_media_player_play(context->mp);
@ -258,21 +289,29 @@ static switch_status_t vlc_file_read(switch_file_handle_t *handle, void *data, s
status = libvlc_media_get_state(context->m);
if (status == 7) {
if (status == libvlc_Error) {
return SWITCH_STATUS_GENERR;
}
switch_mutex_lock(context->audio_mutex);
while (context->playing == 0) {
while (context->playing == 0 && status != libvlc_Ended && status != libvlc_Error) {
switch_thread_cond_wait(context->started, context->audio_mutex);
status = libvlc_media_get_state(context->m);
}
if (context->err == 1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC error\n");
return SWITCH_STATUS_FALSE;
}
switch_mutex_unlock(context->audio_mutex);
switch_mutex_lock(context->audio_mutex);
read = switch_buffer_read(context->audio_buffer, data, bytes);
switch_mutex_unlock(context->audio_mutex);
if (!read && (status == 5 || status == 6)) {
status = libvlc_media_get_state(context->m);
if (!read && (status == libvlc_Stopped || status == libvlc_Ended || status == libvlc_Error)) {
return SWITCH_STATUS_FALSE;
} else if (!read) {
read = 2;
@ -301,19 +340,29 @@ static switch_status_t vlc_file_write(switch_file_handle_t *handle, void *data,
static switch_status_t vlc_file_close(switch_file_handle_t *handle)
{
vlc_file_context_t *context = handle->private_info;
int sanity = 0;
context->playing = 0;
/* The clients need to empty the last of the audio buffer */
while ( switch_buffer_inuse(context->audio_buffer) > 0 ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC waiting to close the files: %d \n", (int) switch_buffer_inuse(context->audio_buffer));
sleep(1);
switch_yield(500000);
if (++sanity > 10) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Giving up waiting for client to empty the audio buffer\n");
break;
}
}
/* Let the clients get the last of the audio stream */
sanity = 0;
while ( 3 == libvlc_media_get_state(context->m) ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC waiting for clients: %d \n", libvlc_media_get_state(context->m));
sleep(1);
switch_yield(500000);
if (++sanity > 10) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Giving up waiting for client to get the last of the audio stream\n");
break;
}
}
if( context->mp )

View File

@ -1,5 +1,35 @@
#include "freeswitch_java.h"
jobject originate_state_handler;
SWITCH_DECLARE(void) setOriginateStateHandler(jobject stateHandler)
{
JNIEnv *env = NULL;
jint envStatus = javaVM->GetEnv((void**)&env, JNI_VERSION_1_4);
if ( envStatus != JNI_OK ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error getting JNIEnv!\n");
return;
}
if ( stateHandler != NULL && originate_state_handler != NULL ) {
const char* errorMessage = "Originate state handler is already registered";
jclass exceptionClass = env->FindClass("java/util/TooManyListenersException");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, errorMessage);
env->ThrowNew(exceptionClass, errorMessage);
} else if ( stateHandler == NULL && originate_state_handler != NULL ) {
env->DeleteGlobalRef(originate_state_handler);
originate_state_handler = NULL;
} else {
originate_state_handler = env->NewGlobalRef(stateHandler);
if ( originate_state_handler == NULL ) {
const char* errorMessage = "Unable to create global reference for state handler";
jclass exceptionClass = env->FindClass("java/lang/OutOfMemoryError");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, errorMessage);
env->ThrowNew(exceptionClass, errorMessage);
}
}
}
JavaSession::JavaSession() : CoreSession()
{
}
@ -328,3 +358,152 @@ done:
return status;
}
switch_status_t originate_handler_method(switch_core_session_t *session, const char* method) {
if ( originate_state_handler != NULL ) {
JNIEnv *env = NULL;
bool needDetach = false;
jint envStatus = javaVM->GetEnv((void**)&env, JNI_VERSION_1_4);
if ( envStatus == JNI_EDETACHED ) {
envStatus = javaVM->AttachCurrentThread((void**)&env, NULL);
if ( envStatus == JNI_OK ) needDetach = true;
}
if ( envStatus != JNI_OK ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error getting JNIEnv!\n");
return SWITCH_STATUS_FALSE;
}
jclass handlerClass = env->GetObjectClass(originate_state_handler);
if ( handlerClass == NULL ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error getting handler class!\n");
if ( needDetach ) javaVM->DetachCurrentThread();
return SWITCH_STATUS_FALSE;
}
jint result = SWITCH_STATUS_FALSE;
jmethodID handlerMethod = env->GetMethodID(handlerClass, method, "(Ljava/lang/String;)I");
if ( handlerMethod != NULL ) {
char *uuid = switch_core_session_get_uuid(session);
jstring javaUuid = env->NewStringUTF(uuid);
result = env->CallIntMethod(originate_state_handler, handlerMethod, javaUuid);
env->DeleteLocalRef(javaUuid);
}
env->DeleteLocalRef(handlerClass);
if ( needDetach ) javaVM->DetachCurrentThread();
return (switch_status_t)result;
}
return SWITCH_STATUS_FALSE;
}
switch_status_t originate_on_init(switch_core_session_t *session) {
return originate_handler_method(session, "onInit");
}
switch_status_t originate_on_routing(switch_core_session_t *session) {
return originate_handler_method(session, "onRouting");
}
switch_status_t originate_on_execute(switch_core_session_t *session) {
return originate_handler_method(session, "onExecute");
}
switch_status_t originate_on_hangup(switch_core_session_t *session) {
if ( originate_state_handler != NULL ) {
JNIEnv *env = NULL;
bool needDetach = false;
jint envStatus = javaVM->GetEnv((void**)&env, JNI_VERSION_1_4);
if ( envStatus == JNI_EDETACHED ) {
envStatus = javaVM->AttachCurrentThread((void**)&env, NULL);
if ( envStatus == JNI_OK ) needDetach = true;
}
if ( envStatus != JNI_OK ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error getting JNIEnv!\n");
return SWITCH_STATUS_FALSE;
}
jclass handlerClass = env->GetObjectClass(originate_state_handler);
if ( handlerClass == NULL ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error getting handler class!\n");
if ( needDetach ) javaVM->DetachCurrentThread();
return SWITCH_STATUS_FALSE;
}
jint result = SWITCH_STATUS_FALSE;
jmethodID handlerMethod = env->GetMethodID(handlerClass, "onHangup", "(Ljava/lang/String;Ljava/lang/String;)I");
if ( handlerMethod != NULL ) {
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *uuid = switch_core_session_get_uuid(session);
const char *cause = switch_channel_cause2str(switch_channel_get_cause(channel));
jstring javaUuid = env->NewStringUTF(uuid);
jstring javaCause = env->NewStringUTF(cause);
result = env->CallIntMethod(originate_state_handler, handlerMethod, javaUuid, javaCause);
env->DeleteLocalRef(javaUuid);
env->DeleteLocalRef(javaCause);
}
env->DeleteLocalRef(handlerClass);
if ( needDetach ) javaVM->DetachCurrentThread();
return (switch_status_t)result;
}
return SWITCH_STATUS_FALSE;
}
switch_status_t originate_on_exchange_media(switch_core_session_t *session) {
return originate_handler_method(session, "onExchangeMedia");
}
switch_status_t originate_on_soft_execute(switch_core_session_t *session) {
return originate_handler_method(session, "onSoftExecute");
}
switch_status_t originate_on_consume_media(switch_core_session_t *session) {
return originate_handler_method(session, "onConsumeMedia");
}
switch_status_t originate_on_hibernate(switch_core_session_t *session) {
return originate_handler_method(session, "onHibernate");
}
switch_status_t originate_on_reset(switch_core_session_t *session) {
return originate_handler_method(session, "onReset");
}
switch_status_t originate_on_park(switch_core_session_t *session) {
return originate_handler_method(session, "onPark");
}
switch_status_t originate_on_reporting(switch_core_session_t *session) {
return originate_handler_method(session, "onReporting");
}
switch_status_t originate_on_destroy(switch_core_session_t *session) {
return originate_handler_method(session, "onDestroy");
}
switch_state_handler_table_t originate_state_handlers = {
/*.on_init */ &originate_on_init,
/*.on_routing */ &originate_on_routing,
/*.on_execute */ &originate_on_execute,
/*.on_hangup */ &originate_on_hangup,
/*.on_exchange_media */ &originate_on_exchange_media,
/*.on_soft_execute */ &originate_on_soft_execute,
/*.on_consume_media */ &originate_on_consume_media,
/*.on_hibernate */ &originate_on_hibernate,
/*.on_reset */ &originate_on_reset,
/*.on_park */ &originate_on_park,
/*.on_reporting */ &originate_on_reporting,
/*.on_destroy */ &originate_on_destroy
};
int JavaSession::originate(JavaSession* aleg, char* destination, int timeout) {
switch_state_handler_table_t *stateHandlers = NULL;
if ( originate_state_handler != NULL ) stateHandlers = &originate_state_handlers;
return CoreSession::originate(aleg, destination, timeout, stateHandlers);
}

View File

@ -6,6 +6,16 @@
extern JavaVM *javaVM;
#ifdef __cplusplus
extern "C" {
#endif
SWITCH_DECLARE(void) setOriginateStateHandler(jobject stateHandler);
#ifdef __cplusplus
}
#endif
class JavaSession:public CoreSession {
public:
JavaSession();
@ -19,6 +29,7 @@ class JavaSession:public CoreSession {
void setHangupHook(jobject hangupHook);
virtual void check_hangup_hook();
virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
int originate(JavaSession* aleg, char* destination, int timeout);
};
#endif

View File

@ -2,6 +2,7 @@
%include ../../../../swig_common.i
/** insert the following includes into generated code so it compiles */
%{
#include "switch.h"
#include "switch_cpp.h"
#include "freeswitch_java.h"
%}
@ -53,7 +54,11 @@
%typemap(javain) char *terminator "$javainput"
%typemap(freearg) char *terminator ""
#define SWITCH_DECLARE(type) type
%javamethodmodifiers CoreSession::originate(CoreSession *, char *, int, switch_state_handler_table_t *) "protected";
%javaexception ("java.util.TooManyListenersException") setOriginateStateHandler(jobject);
%typemap(jtype) jobject stateHandler "org.freeswitch.StateHandler"
%typemap(jstype) jobject stateHandler "org.freeswitch.StateHandler"
%include "enums.swg"
%include switch_swigable_cpp.h

View File

@ -38,7 +38,7 @@ static switch_memory_pool_t *memoryPool = NULL;
static switch_dso_handle_t *javaVMHandle = NULL;
JavaVM *javaVM = NULL;
jclass launcherClass = NULL;
SWITCH_MODULE_LOAD_FUNCTION(mod_java_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_java_shutdown);
@ -62,19 +62,16 @@ static vm_control_t vmControl;
static void launch_java(switch_core_session_t *session, const char *data, JNIEnv *env)
{
jclass Launcher = NULL;
jmethodID launch = NULL;
jstring uuid = NULL;
jstring args = NULL;
Launcher = (*env)->FindClass(env, "org/freeswitch/Launcher");
if (Launcher == NULL)
if (launcherClass == NULL)
{
(*env)->ExceptionDescribe(env);
goto done;
}
launch = (*env)->GetStaticMethodID(env, Launcher, "launch", "(Ljava/lang/String;Ljava/lang/String;)V");
launch = (*env)->GetStaticMethodID(env, launcherClass, "launch", "(Ljava/lang/String;Ljava/lang/String;)V");
if (launch == NULL)
{
(*env)->ExceptionDescribe(env);
@ -95,7 +92,7 @@ static void launch_java(switch_core_session_t *session, const char *data, JNIEnv
goto done;
}
(*env)->CallStaticVoidMethod(env, Launcher, launch, uuid, args);
(*env)->CallStaticVoidMethod(env, launcherClass, launch, uuid, args);
if ((*env)->ExceptionOccurred(env))
(*env)->ExceptionDescribe(env);
@ -104,8 +101,6 @@ done:
(*env)->DeleteLocalRef(env, args);
if (uuid != NULL)
(*env)->DeleteLocalRef(env, uuid);
if (Launcher != NULL)
(*env)->DeleteLocalRef(env, Launcher);
}
static switch_status_t exec_user_method(user_method_t * userMethod) {
@ -145,12 +140,14 @@ static switch_status_t exec_user_method(user_method_t * userMethod) {
goto done;
}
arg = (*env)->NewStringUTF(env, userMethod->arg);
if (userMethod->arg != NULL) {
arg = (*env)->NewStringUTF(env, userMethod->arg);
if (arg == NULL) {
(*env)->ExceptionDescribe(env);
status = SWITCH_STATUS_FALSE;
goto done;
if (arg == NULL) {
(*env)->ExceptionDescribe(env);
status = SWITCH_STATUS_FALSE;
goto done;
}
}
(*env)->CallStaticVoidMethod(env, class, method, arg);
@ -311,8 +308,31 @@ static switch_status_t create_java_vm(JavaVMOption *options, int optionCount, vm
res = pJNI_CreateJavaVM(&javaVM, (void*) &env, &initArgs);
if (res == JNI_OK)
{
// call FindClass here already so that the Java VM executes the static
// initializer (@see org.freeswitch.Launcher) which loads the jni library
// so we can use jni functions right away (for example in the startup method)
launcherClass = (*env)->FindClass(env, "org/freeswitch/Launcher");
if ( launcherClass == NULL )
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to find 'org.freeswitch.Launcher' class!\n");
(*env)->ExceptionDescribe(env);
status = SWITCH_STATUS_FALSE;
}
// store a global reference for use in the launch_java() function
launcherClass = (*env)->NewGlobalRef(env, launcherClass);
if ( launcherClass == NULL )
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
(*env)->ExceptionDescribe(env);
status = SWITCH_STATUS_FALSE;
}
else
{
status = SWITCH_STATUS_SUCCESS;
}
(*javaVM)->DetachCurrentThread(javaVM);
status = SWITCH_STATUS_SUCCESS;
}
else
{

View File

@ -0,0 +1,15 @@
package org.freeswitch.example;
import org.freeswitch.swig.freeswitch;
public class ApplicationLauncher {
public static final void startup(String arg) {
try {
freeswitch.setOriginateStateHandler(OriginateStateHandler.getInstance());
} catch (Exception e) {
freeswitch.console_log("err", "Error registering originate state handler");
}
}
}

View File

@ -0,0 +1,22 @@
package org.freeswitch.example;
import org.freeswitch.StateHandler.OnHangupHandler;
public class OriginateStateHandler implements OnHangupHandler {
private static OriginateStateHandler instance = null;
public static final OriginateStateHandler getInstance() {
if ( instance == null ) instance = new OriginateStateHandler();
return instance;
}
private OriginateStateHandler() {
// hide constructor
}
public int onHangup(String uuid, String cause) {
return 1; // SWITCH_STATUS_FALSE
}
}

View File

@ -0,0 +1,54 @@
package org.freeswitch;
public interface StateHandler {
public interface OnInitHandler extends StateHandler {
public int onInit(String uuid);
}
public static interface OnRoutingHandler extends StateHandler {
public int onRouting(String uuid);
}
public static interface OnExecuteHandler extends StateHandler {
public int onExecute(String uuid);
}
public static interface OnHangupHandler extends StateHandler {
public int onHangup(String uuid, String cause);
}
public static interface OnExchangeMediaHandler extends StateHandler {
public int onExchangeMedia(String uuid);
}
public static interface OnSoftExecuteHandler extends StateHandler {
public int onSoftExecute(String uuid);
}
public static interface OnConsumeMediaHandler extends StateHandler {
public int onConsumeMedia(String uuid);
}
public static interface OnHibernateHandler extends StateHandler {
public int onHibernate(String uuid);
}
public static interface OnResetHandler extends StateHandler {
public int onReset(String uuid);
}
public static interface OnParkHandler extends StateHandler {
public int onPark(String uuid);
}
public static interface OnReportingHandler extends StateHandler {
public int onReporting(String uuid);
}
public static interface OnDestroyHandler extends StateHandler {
public int onDestroy(String uuid);
}
}

View File

@ -1190,6 +1190,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VA
}
SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE_get() {
char * jresult ;
char *result = 0 ;
result = (char *)("execute_on_pre_originate");
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get() {
char * jresult ;
char *result = 0 ;
@ -1260,6 +1270,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIAB
}
SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE_get() {
char * jresult ;
char *result = 0 ;
result = (char *)("api_on_pre_originate");
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get() {
char * jresult ;
char *result = 0 ;
@ -1840,6 +1860,16 @@ SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_DTMF_LOG_LEN_get() {
}
SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_TRANS_get() {
int jresult ;
int result;
result = (int)(2000);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_digit_set(void * jarg1, char jarg2) {
switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
char arg2 ;
@ -2310,6 +2340,36 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_mod_dir_get(void * jarg1
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_lib_dir_set(void * jarg1, char * jarg2) {
switch_directories *arg1 = (switch_directories *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_directories *)jarg1;
arg2 = (char *)jarg2;
{
if (arg1->lib_dir) delete [] arg1->lib_dir;
if (arg2) {
arg1->lib_dir = (char *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->lib_dir, (const char *)arg2);
} else {
arg1->lib_dir = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_lib_dir_get(void * jarg1) {
char * jresult ;
switch_directories *arg1 = (switch_directories *) 0 ;
char *result = 0 ;
arg1 = (switch_directories *)jarg1;
result = (char *) ((arg1)->lib_dir);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_conf_dir_set(void * jarg1, char * jarg2) {
switch_directories *arg1 = (switch_directories *) 0 ;
char *arg2 = (char *) 0 ;
@ -6040,6 +6100,96 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_hold_record_t(void * jarg1) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_thread_data_t_func_set(void * jarg1, void * jarg2) {
switch_thread_data_t *arg1 = (switch_thread_data_t *) 0 ;
switch_thread_start_t arg2 ;
switch_thread_start_t *argp2 ;
arg1 = (switch_thread_data_t *)jarg1;
argp2 = (switch_thread_start_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_thread_start_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->func = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_thread_data_t_func_get(void * jarg1) {
void * jresult ;
switch_thread_data_t *arg1 = (switch_thread_data_t *) 0 ;
switch_thread_start_t result;
arg1 = (switch_thread_data_t *)jarg1;
result = ((arg1)->func);
jresult = new switch_thread_start_t((const switch_thread_start_t &)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_thread_data_t_obj_set(void * jarg1, void * jarg2) {
switch_thread_data_t *arg1 = (switch_thread_data_t *) 0 ;
void *arg2 = (void *) 0 ;
arg1 = (switch_thread_data_t *)jarg1;
arg2 = (void *)jarg2;
if (arg1) (arg1)->obj = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_thread_data_t_obj_get(void * jarg1) {
void * jresult ;
switch_thread_data_t *arg1 = (switch_thread_data_t *) 0 ;
void *result = 0 ;
arg1 = (switch_thread_data_t *)jarg1;
result = (void *) ((arg1)->obj);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_thread_data_t_alloc_set(void * jarg1, int jarg2) {
switch_thread_data_t *arg1 = (switch_thread_data_t *) 0 ;
int arg2 ;
arg1 = (switch_thread_data_t *)jarg1;
arg2 = (int)jarg2;
if (arg1) (arg1)->alloc = arg2;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_thread_data_t_alloc_get(void * jarg1) {
int jresult ;
switch_thread_data_t *arg1 = (switch_thread_data_t *) 0 ;
int result;
arg1 = (switch_thread_data_t *)jarg1;
result = (int) ((arg1)->alloc);
jresult = result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_thread_data_t() {
void * jresult ;
switch_thread_data_t *result = 0 ;
result = (switch_thread_data_t *)new switch_thread_data_t();
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_thread_data_t(void * jarg1) {
switch_thread_data_t *arg1 = (switch_thread_data_t *) 0 ;
arg1 = (switch_thread_data_t *)jarg1;
delete arg1;
}
SWIGEXPORT int SWIGSTDCALL CSharp_MESSAGE_STRING_ARG_MAX_get() {
int jresult ;
int result;
@ -7785,6 +7935,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_thread_launch(void * jarg1
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_thread_pool_launch_thread(void * jarg1) {
int jresult ;
switch_thread_data_t **arg1 = (switch_thread_data_t **) 0 ;
switch_status_t result;
arg1 = (switch_thread_data_t **)jarg1;
result = (switch_status_t)switch_thread_pool_launch_thread(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_thread_pool_launch(void * jarg1) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
@ -10962,13 +11124,13 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_preprocess_session(void * jarg1, ch
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_sqldb_stop_thread() {
switch_core_sqldb_stop_thread();
SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_sqldb_pause() {
switch_core_sqldb_pause();
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_sqldb_start_thread() {
switch_core_sqldb_start_thread();
SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_sqldb_resume() {
switch_core_sqldb_resume();
}
@ -11884,7 +12046,21 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_recovery_flush(char * jarg1, char
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_switch_sql_queue_manager_push(void * jarg1, char * jarg2, unsigned long jarg3, int jarg4) {
SWIGEXPORT int SWIGSTDCALL CSharp_switch_sql_queue_manager_size(void * jarg1, unsigned long jarg2) {
int jresult ;
switch_sql_queue_manager_t *arg1 = (switch_sql_queue_manager_t *) 0 ;
uint32_t arg2 ;
int result;
arg1 = (switch_sql_queue_manager_t *)jarg1;
arg2 = (uint32_t)jarg2;
result = (int)switch_sql_queue_manager_size(arg1,arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_sql_queue_manager_push_confirm(void * jarg1, char * jarg2, unsigned long jarg3, int jarg4) {
int jresult ;
switch_sql_queue_manager_t *arg1 = (switch_sql_queue_manager_t *) 0 ;
char *arg2 = (char *) 0 ;
@ -11896,67 +12072,89 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_switch_sql_queue_manager_push(void * ja
arg2 = (char *)jarg2;
arg3 = (uint32_t)jarg3;
arg4 = (switch_bool_t)jarg4;
result = (switch_status_t)switch_switch_sql_queue_manager_push(arg1,(char const *)arg2,arg3,arg4);
result = (switch_status_t)switch_sql_queue_manager_push_confirm(arg1,(char const *)arg2,arg3,arg4);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_switch_sql_queue_manager_destroy(void * jarg1) {
SWIGEXPORT int SWIGSTDCALL CSharp_switch_sql_queue_manager_push(void * jarg1, char * jarg2, unsigned long jarg3, int jarg4) {
int jresult ;
switch_sql_queue_manager_t *arg1 = (switch_sql_queue_manager_t *) 0 ;
char *arg2 = (char *) 0 ;
uint32_t arg3 ;
switch_bool_t arg4 ;
switch_status_t result;
arg1 = (switch_sql_queue_manager_t *)jarg1;
arg2 = (char *)jarg2;
arg3 = (uint32_t)jarg3;
arg4 = (switch_bool_t)jarg4;
result = (switch_status_t)switch_sql_queue_manager_push(arg1,(char const *)arg2,arg3,arg4);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_sql_queue_manager_destroy(void * jarg1) {
int jresult ;
switch_sql_queue_manager_t **arg1 = (switch_sql_queue_manager_t **) 0 ;
switch_status_t result;
arg1 = (switch_sql_queue_manager_t **)jarg1;
result = (switch_status_t)switch_switch_sql_queue_manager_destroy(arg1);
result = (switch_status_t)switch_sql_queue_manager_destroy(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_switch_sql_queue_manager_init(void * jarg1, unsigned long jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7) {
SWIGEXPORT int SWIGSTDCALL CSharp_switch_sql_queue_manager_init_name(char * jarg1, void * jarg2, unsigned long jarg3, char * jarg4, unsigned long jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9) {
int jresult ;
switch_sql_queue_manager_t **arg1 = (switch_sql_queue_manager_t **) 0 ;
uint32_t arg2 ;
char *arg3 = (char *) 0 ;
char *arg1 = (char *) 0 ;
switch_sql_queue_manager_t **arg2 = (switch_sql_queue_manager_t **) 0 ;
uint32_t arg3 ;
char *arg4 = (char *) 0 ;
char *arg5 = (char *) 0 ;
uint32_t arg5 ;
char *arg6 = (char *) 0 ;
char *arg7 = (char *) 0 ;
char *arg8 = (char *) 0 ;
char *arg9 = (char *) 0 ;
switch_status_t result;
arg1 = (switch_sql_queue_manager_t **)jarg1;
arg2 = (uint32_t)jarg2;
arg3 = (char *)jarg3;
arg1 = (char *)jarg1;
arg2 = (switch_sql_queue_manager_t **)jarg2;
arg3 = (uint32_t)jarg3;
arg4 = (char *)jarg4;
arg5 = (char *)jarg5;
arg5 = (uint32_t)jarg5;
arg6 = (char *)jarg6;
arg7 = (char *)jarg7;
result = (switch_status_t)switch_switch_sql_queue_manager_init(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7);
arg8 = (char *)jarg8;
arg9 = (char *)jarg9;
result = (switch_status_t)switch_sql_queue_manager_init_name((char const *)arg1,arg2,arg3,(char const *)arg4,arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_switch_sql_queue_manager_start(void * jarg1) {
SWIGEXPORT int SWIGSTDCALL CSharp_switch_sql_queue_manager_start(void * jarg1) {
int jresult ;
switch_sql_queue_manager_t *arg1 = (switch_sql_queue_manager_t *) 0 ;
switch_status_t result;
arg1 = (switch_sql_queue_manager_t *)jarg1;
result = (switch_status_t)switch_switch_sql_queue_manager_start(arg1);
result = (switch_status_t)switch_sql_queue_manager_start(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_switch_sql_queue_manager_stop(void * jarg1) {
SWIGEXPORT int SWIGSTDCALL CSharp_switch_sql_queue_manager_stop(void * jarg1) {
int jresult ;
switch_sql_queue_manager_t *arg1 = (switch_sql_queue_manager_t *) 0 ;
switch_status_t result;
arg1 = (switch_sql_queue_manager_t *)jarg1;
result = (switch_status_t)switch_switch_sql_queue_manager_stop(arg1);
result = (switch_status_t)switch_sql_queue_manager_stop(arg1);
jresult = result;
return jresult;
}
@ -23190,6 +23388,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_session_get(void * jarg1) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_cur_frame_set(void * jarg1, void * jarg2) {
switch_codec *arg1 = (switch_codec *) 0 ;
switch_frame_t *arg2 = (switch_frame_t *) 0 ;
arg1 = (switch_codec *)jarg1;
arg2 = (switch_frame_t *)jarg2;
if (arg1) (arg1)->cur_frame = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_cur_frame_get(void * jarg1) {
void * jresult ;
switch_codec *arg1 = (switch_codec *) 0 ;
switch_frame_t *result = 0 ;
arg1 = (switch_codec *)jarg1;
result = (switch_frame_t *) ((arg1)->cur_frame);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec() {
void * jresult ;
switch_codec *result = 0 ;
@ -31260,6 +31480,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) {
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_force_exists(char * jarg1) {
int jresult ;
char *arg1 = (char *) 0 ;
switch_bool_t result;
arg1 = (char *)jarg1;
result = (switch_bool_t)switch_ivr_uuid_force_exists((char const *)arg1);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_last_ping(void * jarg1) {
int jresult ;
switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ;
@ -34201,15 +34433,17 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_parse_section_string(char
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_std_datetime_check(void * jarg1, void * jarg2) {
SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_std_datetime_check(void * jarg1, void * jarg2, char * jarg3) {
int jresult ;
switch_xml_t arg1 = (switch_xml_t) 0 ;
int *arg2 = (int *) 0 ;
char *arg3 = (char *) 0 ;
int result;
arg1 = (switch_xml_t)jarg1;
arg2 = (int *)jarg2;
result = (int)switch_xml_std_datetime_check(arg1,arg2);
arg3 = (char *)jarg3;
result = (int)switch_xml_std_datetime_check(arg1,arg2,(char const *)arg3);
jresult = result;
return jresult;
}

File diff suppressed because it is too large Load Diff

View File

@ -1469,6 +1469,11 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_thread_pool_launch_thread(SWIGTYPE_p_p_switch_thread_data_s tdp) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_thread_pool_launch_thread(SWIGTYPE_p_p_switch_thread_data_s.getCPtr(tdp));
return ret;
}
public static switch_status_t switch_core_session_thread_pool_launch(SWIGTYPE_p_switch_core_session session) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_thread_pool_launch(SWIGTYPE_p_switch_core_session.getCPtr(session));
return ret;
@ -2637,12 +2642,12 @@ public class freeswitch {
return ret;
}
public static void switch_core_sqldb_stop_thread() {
freeswitchPINVOKE.switch_core_sqldb_stop_thread();
public static void switch_core_sqldb_pause() {
freeswitchPINVOKE.switch_core_sqldb_pause();
}
public static void switch_core_sqldb_start_thread() {
freeswitchPINVOKE.switch_core_sqldb_start_thread();
public static void switch_core_sqldb_resume() {
freeswitchPINVOKE.switch_core_sqldb_resume();
}
public static string switch_cache_db_type_name(switch_cache_db_handle_type_t type) {
@ -2837,28 +2842,38 @@ public class freeswitch {
freeswitchPINVOKE.switch_core_recovery_flush(technology, profile_name);
}
public static switch_status_t switch_switch_sql_queue_manager_push(SWIGTYPE_p_switch_sql_queue_manager qm, string sql, uint pos, switch_bool_t dup) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_switch_sql_queue_manager_push(SWIGTYPE_p_switch_sql_queue_manager.getCPtr(qm), sql, pos, (int)dup);
public static int switch_sql_queue_manager_size(SWIGTYPE_p_switch_sql_queue_manager qm, uint index) {
int ret = freeswitchPINVOKE.switch_sql_queue_manager_size(SWIGTYPE_p_switch_sql_queue_manager.getCPtr(qm), index);
return ret;
}
public static switch_status_t switch_switch_sql_queue_manager_destroy(SWIGTYPE_p_p_switch_sql_queue_manager qmp) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_switch_sql_queue_manager_destroy(SWIGTYPE_p_p_switch_sql_queue_manager.getCPtr(qmp));
public static switch_status_t switch_sql_queue_manager_push_confirm(SWIGTYPE_p_switch_sql_queue_manager qm, string sql, uint pos, switch_bool_t dup) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_sql_queue_manager_push_confirm(SWIGTYPE_p_switch_sql_queue_manager.getCPtr(qm), sql, pos, (int)dup);
return ret;
}
public static switch_status_t switch_switch_sql_queue_manager_init(SWIGTYPE_p_p_switch_sql_queue_manager qmp, uint numq, string dsn, string pre_trans_execute, string post_trans_execute, string inner_pre_trans_execute, string inner_post_trans_execute) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_switch_sql_queue_manager_init(SWIGTYPE_p_p_switch_sql_queue_manager.getCPtr(qmp), numq, dsn, pre_trans_execute, post_trans_execute, inner_pre_trans_execute, inner_post_trans_execute);
public static switch_status_t switch_sql_queue_manager_push(SWIGTYPE_p_switch_sql_queue_manager qm, string sql, uint pos, switch_bool_t dup) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_sql_queue_manager_push(SWIGTYPE_p_switch_sql_queue_manager.getCPtr(qm), sql, pos, (int)dup);
return ret;
}
public static switch_status_t switch_switch_sql_queue_manager_start(SWIGTYPE_p_switch_sql_queue_manager qm) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_switch_sql_queue_manager_start(SWIGTYPE_p_switch_sql_queue_manager.getCPtr(qm));
public static switch_status_t switch_sql_queue_manager_destroy(SWIGTYPE_p_p_switch_sql_queue_manager qmp) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_sql_queue_manager_destroy(SWIGTYPE_p_p_switch_sql_queue_manager.getCPtr(qmp));
return ret;
}
public static switch_status_t switch_switch_sql_queue_manager_stop(SWIGTYPE_p_switch_sql_queue_manager qm) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_switch_sql_queue_manager_stop(SWIGTYPE_p_switch_sql_queue_manager.getCPtr(qm));
public static switch_status_t switch_sql_queue_manager_init_name(string name, SWIGTYPE_p_p_switch_sql_queue_manager qmp, uint numq, string dsn, uint max_trans, string pre_trans_execute, string post_trans_execute, string inner_pre_trans_execute, string inner_post_trans_execute) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_sql_queue_manager_init_name(name, SWIGTYPE_p_p_switch_sql_queue_manager.getCPtr(qmp), numq, dsn, max_trans, pre_trans_execute, post_trans_execute, inner_pre_trans_execute, inner_post_trans_execute);
return ret;
}
public static switch_status_t switch_sql_queue_manager_start(SWIGTYPE_p_switch_sql_queue_manager qm) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_sql_queue_manager_start(SWIGTYPE_p_switch_sql_queue_manager.getCPtr(qm));
return ret;
}
public static switch_status_t switch_sql_queue_manager_stop(SWIGTYPE_p_switch_sql_queue_manager qm) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_sql_queue_manager_stop(SWIGTYPE_p_switch_sql_queue_manager.getCPtr(qm));
return ret;
}
@ -5230,6 +5245,11 @@ public class freeswitch {
return ret;
}
public static switch_bool_t switch_ivr_uuid_force_exists(string uuid) {
switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_ivr_uuid_force_exists(uuid);
return ret;
}
public static switch_status_t switch_ivr_dmachine_last_ping(SWIGTYPE_p_switch_ivr_dmachine dmachine) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_last_ping(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine));
return ret;
@ -5986,8 +6006,8 @@ public class freeswitch {
return ret;
}
public static int switch_xml_std_datetime_check(switch_xml xcond, SWIGTYPE_p_int offset) {
int ret = freeswitchPINVOKE.switch_xml_std_datetime_check(switch_xml.getCPtr(xcond), SWIGTYPE_p_int.getCPtr(offset));
public static int switch_xml_std_datetime_check(switch_xml xcond, SWIGTYPE_p_int offset, string tzname) {
int ret = freeswitchPINVOKE.switch_xml_std_datetime_check(switch_xml.getCPtr(xcond), SWIGTYPE_p_int.getCPtr(offset), tzname);
return ret;
}
@ -6291,6 +6311,7 @@ public class freeswitch {
public static readonly string SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE_get();
public static readonly string SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE_get();
public static readonly string SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE_get();
public static readonly string SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE_get();
public static readonly string SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get();
public static readonly string SWITCH_CHANNEL_API_ON_PRE_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_PRE_ANSWER_VARIABLE_get();
public static readonly string SWITCH_CHANNEL_API_ON_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_MEDIA_VARIABLE_get();
@ -6298,6 +6319,7 @@ public class freeswitch {
public static readonly string SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE_get();
public static readonly string SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE_get();
public static readonly string SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE_get();
public static readonly string SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE_get();
public static readonly string SWITCH_CALL_TIMEOUT_VARIABLE = freeswitchPINVOKE.SWITCH_CALL_TIMEOUT_VARIABLE_get();
public static readonly string SWITCH_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_HOLDING_UUID_VARIABLE_get();
public static readonly string SWITCH_SOFT_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_SOFT_HOLDING_UUID_VARIABLE_get();
@ -6356,6 +6378,7 @@ public class freeswitch {
public static readonly int SWITCH_BITS_PER_BYTE = freeswitchPINVOKE.SWITCH_BITS_PER_BYTE_get();
public static readonly int SWITCH_DEFAULT_FILE_BUFFER_LEN = freeswitchPINVOKE.SWITCH_DEFAULT_FILE_BUFFER_LEN_get();
public static readonly int SWITCH_DTMF_LOG_LEN = freeswitchPINVOKE.SWITCH_DTMF_LOG_LEN_get();
public static readonly int SWITCH_MAX_TRANS = freeswitchPINVOKE.SWITCH_MAX_TRANS_get();
public static readonly int SWITCH_MAX_STACKS = freeswitchPINVOKE.SWITCH_MAX_STACKS_get();
public static readonly int SWITCH_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_THREAD_STACKSIZE_get();
public static readonly int SWITCH_SYSTEM_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_SYSTEM_THREAD_STACKSIZE_get();
@ -6874,6 +6897,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE_get")]
public static extern string SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE_get();
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE_get")]
public static extern string SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE_get();
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get")]
public static extern string SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get();
@ -6895,6 +6921,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE_get")]
public static extern string SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE_get();
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE_get")]
public static extern string SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE_get();
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get")]
public static extern string SWITCH_CALL_TIMEOUT_VARIABLE_get();
@ -7069,6 +7098,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DTMF_LOG_LEN_get")]
public static extern int SWITCH_DTMF_LOG_LEN_get();
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_TRANS_get")]
public static extern int SWITCH_MAX_TRANS_get();
[DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_digit_set")]
public static extern void switch_dtmf_t_digit_set(HandleRef jarg1, char jarg2);
@ -7195,6 +7227,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_directories_mod_dir_get")]
public static extern string switch_directories_mod_dir_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_directories_lib_dir_set")]
public static extern void switch_directories_lib_dir_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_directories_lib_dir_get")]
public static extern string switch_directories_lib_dir_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_directories_conf_dir_set")]
public static extern void switch_directories_conf_dir_set(HandleRef jarg1, string jarg2);
@ -8140,6 +8178,30 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_hold_record_t")]
public static extern void delete_switch_hold_record_t(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_thread_data_t_func_set")]
public static extern void switch_thread_data_t_func_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_thread_data_t_func_get")]
public static extern IntPtr switch_thread_data_t_func_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_thread_data_t_obj_set")]
public static extern void switch_thread_data_t_obj_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_thread_data_t_obj_get")]
public static extern IntPtr switch_thread_data_t_obj_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_thread_data_t_alloc_set")]
public static extern void switch_thread_data_t_alloc_set(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_thread_data_t_alloc_get")]
public static extern int switch_thread_data_t_alloc_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_thread_data_t")]
public static extern IntPtr new_switch_thread_data_t();
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_thread_data_t")]
public static extern void delete_switch_thread_data_t(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_MESSAGE_STRING_ARG_MAX_get")]
public static extern int MESSAGE_STRING_ARG_MAX_get();
@ -8548,6 +8610,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_thread_launch")]
public static extern int switch_core_session_thread_launch(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_thread_pool_launch_thread")]
public static extern int switch_thread_pool_launch_thread(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_thread_pool_launch")]
public static extern int switch_core_session_thread_pool_launch(HandleRef jarg1);
@ -9259,11 +9324,11 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_preprocess_session")]
public static extern int switch_ivr_preprocess_session(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_sqldb_stop_thread")]
public static extern void switch_core_sqldb_stop_thread();
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_sqldb_pause")]
public static extern void switch_core_sqldb_pause();
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_sqldb_start_thread")]
public static extern void switch_core_sqldb_start_thread();
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_sqldb_resume")]
public static extern void switch_core_sqldb_resume();
[DllImport("mod_managed", EntryPoint="CSharp_CACHE_DB_LEN_get")]
public static extern int CACHE_DB_LEN_get();
@ -9487,20 +9552,26 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_recovery_flush")]
public static extern void switch_core_recovery_flush(string jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_switch_sql_queue_manager_push")]
public static extern int switch_switch_sql_queue_manager_push(HandleRef jarg1, string jarg2, uint jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_sql_queue_manager_size")]
public static extern int switch_sql_queue_manager_size(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_switch_sql_queue_manager_destroy")]
public static extern int switch_switch_sql_queue_manager_destroy(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_sql_queue_manager_push_confirm")]
public static extern int switch_sql_queue_manager_push_confirm(HandleRef jarg1, string jarg2, uint jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_switch_sql_queue_manager_init")]
public static extern int switch_switch_sql_queue_manager_init(HandleRef jarg1, uint jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7);
[DllImport("mod_managed", EntryPoint="CSharp_switch_sql_queue_manager_push")]
public static extern int switch_sql_queue_manager_push(HandleRef jarg1, string jarg2, uint jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_switch_sql_queue_manager_start")]
public static extern int switch_switch_sql_queue_manager_start(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_sql_queue_manager_destroy")]
public static extern int switch_sql_queue_manager_destroy(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_switch_sql_queue_manager_stop")]
public static extern int switch_switch_sql_queue_manager_stop(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_sql_queue_manager_init_name")]
public static extern int switch_sql_queue_manager_init_name(string jarg1, HandleRef jarg2, uint jarg3, string jarg4, uint jarg5, string jarg6, string jarg7, string jarg8, string jarg9);
[DllImport("mod_managed", EntryPoint="CSharp_switch_sql_queue_manager_start")]
public static extern int switch_sql_queue_manager_start(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_sql_queue_manager_stop")]
public static extern int switch_sql_queue_manager_stop(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_execute_sql_event_callback")]
public static extern int switch_cache_db_execute_sql_event_callback(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, ref string jarg5);
@ -12289,6 +12360,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_codec_session_get")]
public static extern IntPtr switch_codec_session_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_codec_cur_frame_set")]
public static extern void switch_codec_cur_frame_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_codec_cur_frame_get")]
public static extern IntPtr switch_codec_cur_frame_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec")]
public static extern IntPtr new_switch_codec();
@ -14077,6 +14154,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_exists")]
public static extern int switch_ivr_uuid_exists(string jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_force_exists")]
public static extern int switch_ivr_uuid_force_exists(string jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_last_ping")]
public static extern int switch_ivr_dmachine_last_ping(HandleRef jarg1);
@ -14738,7 +14818,7 @@ class freeswitchPINVOKE {
public static extern uint switch_xml_parse_section_string(string jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_std_datetime_check")]
public static extern int switch_xml_std_datetime_check(HandleRef jarg1, HandleRef jarg2);
public static extern int switch_xml_std_datetime_check(HandleRef jarg1, HandleRef jarg2, string jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_language")]
public static extern int switch_xml_locate_language(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, string jarg7);
@ -19939,6 +20019,36 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_p_switch_thread_data_s {
private HandleRef swigCPtr;
internal SWIGTYPE_p_p_switch_thread_data_s(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected SWIGTYPE_p_p_switch_thread_data_s() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_thread_data_s obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_p_switch_xml {
private HandleRef swigCPtr;
@ -21229,6 +21339,36 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_switch_thread_start_t {
private HandleRef swigCPtr;
internal SWIGTYPE_p_switch_thread_start_t(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected SWIGTYPE_p_switch_thread_start_t() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr(SWIGTYPE_p_switch_thread_start_t obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_switch_time_exp_t {
private HandleRef swigCPtr;
@ -21666,7 +21806,8 @@ namespace FreeSWITCH.Native {
SAF_SUPPORT_NOMEDIA = (1 << 0),
SAF_ROUTING_EXEC = (1 << 1),
SAF_MEDIA_TAP = (1 << 2),
SAF_ZOMBIE_EXEC = (1 << 3)
SAF_ZOMBIE_EXEC = (1 << 3),
SAF_NO_LOOPBACK = (1 << 4)
}
}
@ -24074,6 +24215,7 @@ public enum switch_channel_flag_t {
CF_OUTBOUND,
CF_EARLY_MEDIA,
CF_BRIDGE_ORIGINATOR,
CF_UUID_BRIDGE_ORIGINATOR,
CF_TRANSFER,
CF_ACCEPT_CNG,
CF_REDIRECT,
@ -24842,6 +24984,17 @@ public class switch_codec : IDisposable {
}
}
public switch_frame cur_frame {
set {
freeswitchPINVOKE.switch_codec_cur_frame_set(swigCPtr, switch_frame.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_codec_cur_frame_get(swigCPtr);
switch_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_frame(cPtr, false);
return ret;
}
}
public switch_codec() : this(freeswitchPINVOKE.new_switch_codec(), true) {
}
@ -26519,6 +26672,16 @@ public class switch_directories : IDisposable {
}
}
public string lib_dir {
set {
freeswitchPINVOKE.switch_directories_lib_dir_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_directories_lib_dir_get(swigCPtr);
return ret;
}
}
public string conf_dir {
set {
freeswitchPINVOKE.switch_directories_conf_dir_set(swigCPtr, value);
@ -33981,6 +34144,88 @@ public enum switch_text_channel_t {
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class switch_thread_data_t : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal switch_thread_data_t(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(switch_thread_data_t obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~switch_thread_data_t() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
freeswitchPINVOKE.delete_switch_thread_data_t(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public SWIGTYPE_p_switch_thread_start_t func {
set {
freeswitchPINVOKE.switch_thread_data_t_func_set(swigCPtr, SWIGTYPE_p_switch_thread_start_t.getCPtr(value));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_switch_thread_start_t ret = new SWIGTYPE_p_switch_thread_start_t(freeswitchPINVOKE.switch_thread_data_t_func_get(swigCPtr), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public SWIGTYPE_p_void obj {
set {
freeswitchPINVOKE.switch_thread_data_t_obj_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_thread_data_t_obj_get(swigCPtr);
SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
return ret;
}
}
public int alloc {
set {
freeswitchPINVOKE.switch_thread_data_t_alloc_set(swigCPtr, value);
}
get {
int ret = freeswitchPINVOKE.switch_thread_data_t_alloc_get(swigCPtr);
return ret;
}
}
public switch_thread_data_t() : this(freeswitchPINVOKE.new_switch_thread_data_t(), true) {
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
public enum switch_thread_priority_t {
SWITCH_PRI_LOW = 1,
SWITCH_PRI_NORMAL = 10,

File diff suppressed because it is too large Load Diff

View File

@ -838,7 +838,9 @@ switch_status_t mod_xml_radius_check_conditions(switch_channel_t *channel, switc
switch_xml_t condition, param;
char *channel_var = NULL;
char *regex = NULL;
char *anti = NULL;
int all_matched = 1;
int result = 0;
if ( (condition = switch_xml_child(conditions, "condition")) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to locate a condition under the conditions section\n");
@ -856,14 +858,19 @@ switch_status_t mod_xml_radius_check_conditions(switch_channel_t *channel, switc
for (; param && all_matched; param = param->next) {
channel_var = (char *) switch_xml_attr(param, "var");
regex = (char *) switch_xml_attr(param, "regex");
anti = (char *) switch_xml_attr(param, "anti");
if ( channel_var == NULL || regex == NULL ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Improperly constructed mod_radius condition: %s %s\n", channel_var, regex);
}
if ( switch_regex_match( switch_channel_get_variable(channel, channel_var), regex) != SWITCH_STATUS_SUCCESS) {
result = ( switch_regex_match( switch_channel_get_variable(channel, channel_var), regex) != SWITCH_STATUS_SUCCESS);
if (( anti == NULL && result ) || ( anti != NULL && !result ) ){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Didn't match: %s == %s \n", switch_channel_get_variable(channel, channel_var), regex);
all_matched = 0;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Result of %s match: %s == %s \n",
anti, switch_channel_get_variable(channel, channel_var), regex);
}
}

View File

@ -1050,7 +1050,13 @@ SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue)
SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **data)
{
return apr_queue_pop(queue, data);
apr_status_t s;
do {
s = apr_queue_pop(queue, data);
} while (s == APR_EINTR);
return s;
}
SWITCH_DECLARE(switch_status_t) switch_queue_pop_timeout(switch_queue_t *queue, void **data, switch_interval_time_t timeout)
@ -1072,7 +1078,14 @@ SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *d
SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data)
{
return apr_queue_trypop(queue, data);
apr_status_t s;
do {
s = apr_queue_trypop(queue, data);
} while (s == APR_EINTR);
return s;
}
SWITCH_DECLARE(switch_status_t) switch_queue_interrupt_all(switch_queue_t *queue)

View File

@ -575,6 +575,14 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
#endif
}
if (!SWITCH_GLOBAL_dirs.lib_dir && (SWITCH_GLOBAL_dirs.lib_dir = (char *) malloc(BUFSIZE))) {
#ifdef SWITCH_LIB_DIR
switch_snprintf(SWITCH_GLOBAL_dirs.lib_dir, BUFSIZE, "%s", SWITCH_LIB_DIR);
#else
switch_snprintf(SWITCH_GLOBAL_dirs.lib_dir, BUFSIZE, "%s%slib", base_dir, SWITCH_PATH_SEPARATOR);
#endif
}
if (!SWITCH_GLOBAL_dirs.conf_dir && (SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(BUFSIZE))) {
#ifdef SWITCH_CONF_DIR
switch_snprintf(SWITCH_GLOBAL_dirs.conf_dir, BUFSIZE, "%s", SWITCH_CONF_DIR);
@ -671,6 +679,7 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
switch_assert(SWITCH_GLOBAL_dirs.base_dir);
switch_assert(SWITCH_GLOBAL_dirs.mod_dir);
switch_assert(SWITCH_GLOBAL_dirs.lib_dir);
switch_assert(SWITCH_GLOBAL_dirs.conf_dir);
switch_assert(SWITCH_GLOBAL_dirs.log_dir);
switch_assert(SWITCH_GLOBAL_dirs.run_dir);
@ -1470,11 +1479,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
runtime.db_handle_timeout = 5000000;
runtime.runlevel++;
runtime.sql_buffer_len = 1024 * 32;
runtime.max_sql_buffer_len = 1024 * 1024 * 10;
runtime.dummy_cng_frame.data = runtime.dummy_data;
runtime.dummy_cng_frame.datalen = sizeof(runtime.dummy_data);
runtime.dummy_cng_frame.buflen = sizeof(runtime.dummy_data);
runtime.dbname = "core";
switch_set_flag((&runtime.dummy_cng_frame), SFF_CNG);
switch_set_flag((&runtime), SCF_AUTO_SCHEMAS);
switch_set_flag((&runtime), SCF_CLEAR_SQL);
@ -1754,37 +1762,6 @@ static void switch_load_core_config(const char *file)
} else if (!strcasecmp(var, "multiple-registrations")) {
runtime.multiple_registrations = switch_true(val);
} else if (!strcasecmp(var, "sql-buffer-len")) {
int tmp = atoi(val);
if (end_of(val) == 'k') {
tmp *= 1024;
} else if (end_of(val) == 'm') {
tmp *= (1024 * 1024);
}
if (tmp >= 32000 && tmp < 10500000) {
runtime.sql_buffer_len = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sql-buffer-len: Value is not within rage 32k to 10m\n");
}
} else if (!strcasecmp(var, "max-sql-buffer-len")) {
int tmp = atoi(val);
if (end_of(val) == 'k') {
tmp *= 1024;
} else if (end_of(val) == 'm') {
tmp *= (1024 * 1024);
}
if (tmp < runtime.sql_buffer_len) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Value is not larger than sql-buffer-len\n");
} else if (tmp >= 32000 && tmp < 10500000) {
runtime.sql_buffer_len = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "max-sql-buffer-len: Value is not within rage 32k to 10m\n");
}
} else if (!strcasecmp(var, "auto-create-schemas")) {
if (switch_true(val)) {
switch_set_flag((&runtime), SCF_AUTO_SCHEMAS);
@ -2256,9 +2233,9 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
break;
case SCSC_SQL:
if (oldintval) {
switch_core_sqldb_start_thread();
switch_core_sqldb_resume();
} else {
switch_core_sqldb_stop_thread();
switch_core_sqldb_pause();
}
break;
case SCSC_PAUSE_ALL:

View File

@ -375,7 +375,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
} else {
switch_codec_t *codec = use_codec->implementation?use_codec:read_frame->codec;
switch_thread_rwlock_rdlock(session->bug_rwlock);
codec->session = session;
codec->cur_frame = read_frame;
session->read_codec->cur_frame = read_frame;
status = switch_core_codec_decode(codec,
session->read_codec,
read_frame->data,
@ -383,7 +384,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
session->read_impl.actual_samples_per_second,
session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate,
&read_frame->flags);
codec->session = NULL;
codec->cur_frame = NULL;
session->read_codec->cur_frame = NULL;
switch_thread_rwlock_unlock(session->bug_rwlock);
}
@ -626,14 +628,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_assert(session->read_codec != NULL);
switch_assert(enc_frame != NULL);
switch_assert(enc_frame->data != NULL);
session->read_codec->session = session;
session->read_codec->cur_frame = enc_frame;
enc_frame->codec->cur_frame = enc_frame;
status = switch_core_codec_encode(session->read_codec,
enc_frame->codec,
enc_frame->data,
enc_frame->datalen,
session->read_impl.actual_samples_per_second,
session->enc_read_frame.data, &session->enc_read_frame.datalen, &session->enc_read_frame.rate, &flag);
session->read_codec->session = NULL;
session->read_codec->cur_frame = NULL;
enc_frame->codec->cur_frame = NULL;
switch (status) {
case SWITCH_STATUS_RESAMPLE:
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fixme 1\n");
@ -907,15 +911,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
if (frame->codec) {
session->raw_write_frame.datalen = session->raw_write_frame.buflen;
frame->codec->session = session;
frame->codec->cur_frame = frame;
session->write_codec->cur_frame = frame;
status = switch_core_codec_decode(frame->codec,
session->write_codec,
frame->data,
frame->datalen,
session->write_impl.actual_samples_per_second,
session->raw_write_frame.data, &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &frame->flags);
frame->codec->session = NULL;
frame->codec->cur_frame = NULL;
session->write_codec->cur_frame = NULL;
if (do_resample && status == SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_RESAMPLE;
}
@ -1094,17 +1099,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
enc_frame = write_frame;
session->enc_write_frame.datalen = session->enc_write_frame.buflen;
session->write_codec->session = session;
session->write_codec->cur_frame = frame;
frame->codec->cur_frame = frame;
status = switch_core_codec_encode(session->write_codec,
frame->codec,
enc_frame->data,
enc_frame->datalen,
session->write_impl.actual_samples_per_second,
session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag);
session->write_codec->session = NULL;
session->write_codec->cur_frame = NULL;
frame->codec->cur_frame = NULL;
switch (status) {
case SWITCH_STATUS_RESAMPLE:
resample++;
@ -1198,15 +1203,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
} else {
rate = session->write_impl.actual_samples_per_second;
}
session->write_codec->session = session;
session->write_codec->cur_frame = frame;
frame->codec->cur_frame = frame;
status = switch_core_codec_encode(session->write_codec,
frame->codec,
enc_frame->data,
enc_frame->datalen,
rate,
session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag);
session->write_codec->session = NULL;
session->write_codec->cur_frame = NULL;
frame->codec->cur_frame = NULL;
switch (status) {
case SWITCH_STATUS_RESAMPLE:
resample++;

View File

@ -251,7 +251,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
}
} else {
if (read_impl.decoded_bytes_per_packet > other_read_impl.decoded_bytes_per_packet) {
frame_size = other_read_impl.decoded_bytes_per_packet;
frame_size = read_impl.decoded_bytes_per_packet;
}
}
}

View File

@ -204,18 +204,20 @@ struct str_node {
struct str_node *next;
};
SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_name, const char *var_val, switch_call_cause_t cause)
SWITCH_DECLARE(uint32_t) switch_core_session_hupall_matching_var_ans(const char *var_name, const char *var_val, switch_call_cause_t cause,
switch_hup_type_t type)
{
switch_hash_index_t *hi;
void *val;
switch_core_session_t *session;
switch_memory_pool_t *pool;
struct str_node *head = NULL, *np;
uint32_t r = 0;
switch_core_new_memory_pool(&pool);
if (!var_val)
return;
return r;
switch_mutex_lock(runtime.session_hash_mutex);
for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
@ -223,10 +225,13 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
if (val) {
session = (switch_core_session_t *) val;
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
np = switch_core_alloc(pool, sizeof(*np));
np->str = switch_core_strdup(pool, session->uuid_str);
np->next = head;
head = np;
int ans = switch_channel_test_flag(switch_core_session_get_channel(session), CF_ANSWERED);
if ((ans && (type & SHT_ANSWERED)) || (!ans && (type & SHT_UNANSWERED))) {
np = switch_core_alloc(pool, sizeof(*np));
np->str = switch_core_strdup(pool, session->uuid_str);
np->next = head;
head = np;
}
switch_core_session_rwunlock(session);
}
}
@ -239,6 +244,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
if (switch_channel_up_nosig(session->channel) &&
(this_val = switch_channel_get_variable(session->channel, var_name)) && (!strcmp(this_val, var_val))) {
switch_channel_hangup(session->channel, cause);
r++;
}
switch_core_session_rwunlock(session);
}
@ -246,6 +252,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
switch_core_destroy_memory_pool(&pool);
return r;
}
@ -1530,25 +1537,25 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread_pool_worker(switch_th
}
if (check_status == SWITCH_STATUS_SUCCESS) {
switch_core_session_t *session = (switch_core_session_t *) pop;
switch_size_t id;
switch_thread_data_t *td = (switch_thread_data_t *) pop;
if (!session) break;
if (!td) break;
id = session->id;
switch_mutex_lock(session_manager.mutex);
session_manager.busy++;
switch_mutex_unlock(session_manager.mutex);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Worker Thread %ld Processing session %"SWITCH_SIZE_T_FMT" %s\n",
(long) thread, id, switch_core_session_get_name(session));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Worker Thread %ld Processing\n", (long) thread);
switch_core_session_thread(thread, (void *) session);
td->func(thread, td->obj);
if (td->alloc) {
free(td);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Worker Thread %ld Done Processing\n", (long) thread);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Worker Thread %ld Done Processing session %"SWITCH_SIZE_T_FMT"\n",
(long) thread, id);
switch_mutex_lock(session_manager.mutex);
session_manager.busy--;
switch_mutex_unlock(session_manager.mutex);
@ -1656,11 +1663,27 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread_pool_manager(switch_t
return NULL;
}
SWITCH_DECLARE(switch_status_t) switch_thread_pool_launch_thread(switch_thread_data_t **tdp)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_thread_data_t *td;
switch_assert(tdp);
td = *tdp;
*tdp = NULL;
switch_queue_push(session_manager.thread_queue, td);
check_queue();
return status;
}
SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_core_session_t *session)
{
switch_status_t status = SWITCH_STATUS_INUSE;
switch_thread_data_t *td;
switch_mutex_lock(session->mutex);
if (switch_test_flag(session, SSF_THREAD_RUNNING)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Cannot double-launch thread!\n");
@ -1670,7 +1693,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_co
status = SWITCH_STATUS_SUCCESS;
switch_set_flag(session, SSF_THREAD_RUNNING);
switch_set_flag(session, SSF_THREAD_STARTED);
switch_queue_push(session_manager.thread_queue, session);
td = switch_core_session_alloc(session, sizeof(*td));
td->obj = session;
td->func = switch_core_session_thread;
switch_queue_push(session_manager.thread_queue, td);
check_queue();
}
switch_mutex_unlock(session->mutex);

File diff suppressed because it is too large Load Diff

View File

@ -457,6 +457,13 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
switch_channel_event_set_data(session->channel, event);
switch_event_fire(&event);
}
if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_ORIGINATE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(session->channel, event);
switch_event_fire(&event);
}
}
}
break;
case CS_ROUTING: /* Look for a dialplan and find something to do */

View File

@ -3209,6 +3209,19 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid)
return exists;
}
SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_force_exists(const char *uuid)
{
switch_bool_t exists = SWITCH_FALSE;
switch_core_session_t *psession = NULL;
if ((psession = switch_core_session_force_locate(uuid))) {
switch_core_session_rwunlock(psession);
exists = 1;
}
return exists;
}
SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *session, const char *cmd, switch_file_handle_t *fhp)
{
if (zstr(cmd)) {

View File

@ -745,7 +745,7 @@ static switch_status_t uuid_bridge_on_reset(switch_core_session_t *session)
cleanup_proxy_mode_b(session);
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
if (switch_channel_test_flag(channel, CF_UUID_BRIDGE_ORIGINATOR)) {
switch_channel_set_state(channel, CS_SOFT_EXECUTE);
}
@ -767,7 +767,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CUSTOM SOFT_EXECUTE\n", switch_channel_get_name(channel));
switch_channel_clear_state_handler(channel, &uuid_bridge_state_handlers);
if (!switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
if (!switch_channel_test_flag(channel, CF_UUID_BRIDGE_ORIGINATOR)) {
return SWITCH_STATUS_SUCCESS;
}
@ -801,7 +801,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
if (running_state == CS_SOFT_EXECUTE) {
if (switch_channel_test_flag(other_channel, CF_BRIDGE_ORIGINATOR)) {
if (switch_channel_test_flag(other_channel, CF_UUID_BRIDGE_ORIGINATOR)) {
goto done;
} else {
break;
@ -878,7 +878,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
other_session = NULL;
}
switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR);
switch_channel_clear_flag(channel, CF_UUID_BRIDGE_ORIGINATOR);
return SWITCH_STATUS_FALSE;
}
@ -1663,10 +1663,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
//switch_channel_set_variable(originatee_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE, NULL);
switch_channel_clear_state_handler(originator_channel, NULL);
switch_channel_clear_state_handler(originatee_channel, NULL);
switch_channel_clear_flag_recursive(originator_channel, CF_BRIDGE_ORIGINATOR);
switch_channel_clear_flag_recursive(originatee_channel, CF_BRIDGE_ORIGINATOR);
switch_channel_set_state_flag(originator_channel, CF_BRIDGE_ORIGINATOR);
switch_channel_clear_state_flag(originator_channel, CF_BRIDGE_ORIGINATOR);
switch_channel_clear_state_flag(originatee_channel, CF_BRIDGE_ORIGINATOR);
switch_channel_clear_flag(originator_channel, CF_UUID_BRIDGE_ORIGINATOR);
switch_channel_clear_flag(originatee_channel, CF_UUID_BRIDGE_ORIGINATOR);
switch_channel_set_state_flag(originator_channel, CF_UUID_BRIDGE_ORIGINATOR);
switch_channel_add_state_handler(originator_channel, &uuid_bridge_state_handlers);
switch_channel_add_state_handler(originatee_channel, &uuid_bridge_state_handlers);

View File

@ -1888,6 +1888,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
oglobals.session = session;
switch_channel_execute_on(caller_channel, SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE);
switch_channel_api_on(caller_channel, SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE);
switch_core_session_get_read_impl(session, &read_impl);
if ((to_var = switch_channel_get_variable(caller_channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
@ -2420,7 +2423,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
for (i = 0; i < and_argc; i++) {
const char *current_variable;
switch_event_t *local_var_event = NULL, *originate_var_event = NULL, *event = NULL;
switch_event_t *local_var_event = NULL, *originate_var_event = NULL;
end = NULL;
@ -2686,11 +2689,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
}
switch_event_create(&event, SWITCH_EVENT_CHANNEL_ORIGINATE);
switch_assert(event);
switch_channel_event_set_data(originate_status[i].peer_channel, event);
switch_event_fire(&event);
if (originate_status[i].peer_channel) {
const char *vvar;
@ -3732,6 +3730,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_safe_free(fail_on_single_reject_var);
if (caller_channel) {
switch_channel_execute_on(caller_channel, SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE);
switch_channel_api_on(caller_channel, SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE);
switch_channel_clear_flag(caller_channel, CF_ORIGINATOR);
switch_channel_clear_flag(caller_channel, CF_XFER_ZOMBIE);
}

View File

@ -1219,7 +1219,11 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
#ifdef WIN32
dso = switch_dso_open("FreeSwitch.dll", load_global, &derr);
#elif defined (MACOSX) || defined(DARWIN)
dso = switch_dso_open(SWITCH_PREFIX_DIR "/lib/libfreeswitch.dylib", load_global, &derr);
{
char *lib_path = switch_mprintf("%s/libfreeswitch.dylib", SWITCH_GLOBAL_dirs.lib_dir);
dso = switch_dso_open(lib_path, load_global, &derr);
switch_safe_free(lib_path);
}
#else
dso = switch_dso_open(NULL, load_global, &derr);
#endif

View File

@ -444,7 +444,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_
#ifdef SWITCH_HAVE_ODBC
SQLHSTMT stmt = NULL;
int result;
char *err_str = NULL;
char *err_str = NULL, *err2 = NULL;
SQLLEN m = 0;
handle->affected_rows = 0;
@ -454,16 +454,32 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_
}
if (SQLAllocHandle(SQL_HANDLE_STMT, handle->con, &stmt) != SQL_SUCCESS) {
err2 = "SQLAllocHandle failed.";
goto error;
}
if (SQLPrepare(stmt, (unsigned char *) sql, SQL_NTS) != SQL_SUCCESS) {
err2 = "SQLPrepare failed.";
goto error;
}
result = SQLExecute(stmt);
if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO && result != SQL_NO_DATA) {
switch (result) {
case SQL_SUCCESS:
case SQL_SUCCESS_WITH_INFO:
case SQL_NO_DATA:
break;
case SQL_ERROR:
err2 = "SQLExecute returned SQL_ERROR.";
goto error;
break;
case SQL_NEED_DATA:
err2 = "SQLExecute returned SQL_NEED_DATA.";
goto error;
break;
default:
err2 = "SQLExecute returned unknown result code.";
goto error;
}
@ -486,7 +502,11 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_
}
if (zstr(err_str)) {
err_str = strdup((char *)"SQL ERROR!");
if (err2) {
err_str = strdup(err2);
} else {
err_str = strdup((char *)"SQL ERROR!");
}
}
if (err_str) {

View File

@ -3054,6 +3054,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
*bytes = jb_frame->dlen + rtp_header_len;
rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
rtp_session->recv_msg.header.pt = jb_frame->pt;
rtp_session->recv_msg.header.seq = htons(jb_frame->seq);
status = SWITCH_STATUS_SUCCESS;
}
}

View File

@ -2883,7 +2883,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_cut(switch_xml_t xml)
return xml;
}
SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond, int *offset)
SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond, int *offset, const char *tzname)
{
const char *xdt = switch_xml_attr(xcond, "date-time");
@ -2920,7 +2920,9 @@ SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond, int *offse
if (offset) {
eoffset = *offset;
switch_time_exp_tz(&tm, ts, *offset);
switch_time_exp_tz(&tm, ts, *offset * 3600);
} else if (!zstr(tzname)) {
switch_time_exp_tz_name(tzname, &tm, ts);
} else {
tm = tm2;
}