Merge branch 'v1.2.stable' of ssh://git.freeswitch.org:222/freeswitch into v1.2.stable

This commit is contained in:
Jeff Lenk 2013-06-19 10:52:10 -05:00
commit e9bcde6ec7
17 changed files with 1971 additions and 127 deletions

View File

@ -19,6 +19,7 @@ DAEMON=/usr/bin/freeswitch
DAEMON_ARGS="-u freeswitch -g freeswitch -nc"
USER=freeswitch
GROUP=freeswitch
CONFDIR=/etc/$NAME
RUNDIR=/var/run/$NAME
PIDFILE=$RUNDIR/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
@ -30,6 +31,12 @@ WORKDIR=/var/lib/$NAME
. /lib/lsb/init-functions
do_start() {
if ! [ -f $CONFDIR/freeswitch.xml ]; then
echo "$NAME is not configured so not starting.">&2
echo "Please review /usr/share/doc/$NAME/README.Debian">&2
return 3
fi
# Directory in /var/run may disappear on reboot (e.g. when tmpfs used for /var/run).
mkdir -p $RUNDIR
chown -R $USER:$GROUP $RUNDIR

View File

@ -3596,8 +3596,6 @@ SWITCH_STANDARD_APP(pickup_function)
caller_profile->callee_id_name = name;
caller_profile->callee_id_number = num;
switch_channel_flip_cid(channel);
if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
const char *uuid = switch_channel_get_partner_uuid(channel);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV");

View File

@ -4178,7 +4178,7 @@ static switch_status_t load_config(int reload, int del_all)
node = create_node(name, imp, globals.sql_mutex);
}
if ((val = switch_xml_attr(fifo, "outbound_name")) && !zstr(val)) {
if ((val = switch_xml_attr(fifo, "outbound_name"))) {
node->outbound_name = switch_core_strdup(node->pool, val);
}

View File

@ -32,6 +32,7 @@
*/
#ifndef WIN32
#undef HAVE_STDLIB_H
#include "switch_private.h"
#endif
#if defined(HAVE_OPENPTY) || defined(HAVE_DEV_PTMX) || defined(HAVE_POSIX_OPENPT) || WIN32

View File

@ -429,10 +429,7 @@ 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 (switch_test_flag(tech_pvt, TFLAG_BOWOUT) || switch_test_flag(tech_pvt, TFLAG_BLEG)) {
bow = 0;
} else if ((bowout = switch_channel_get_variable(tech_pvt->channel, "loopback_bowout_on_execute")) && switch_true(bowout)) {
if ((bowout = switch_channel_get_variable(tech_pvt->channel, "loopback_bowout_on_execute")) && switch_true(bowout)) {
/* loopback_bowout_on_execute variable is set */
bow = 1;
} else if ((exten = switch_channel_get_caller_extension(channel))) {
@ -455,14 +452,15 @@ static switch_status_t channel_on_execute(switch_core_session_t *session)
switch_core_session_t *other_session = NULL;
switch_caller_profile_t *cp, *clone;
const char *other_uuid = NULL;
switch_set_flag(tech_pvt, TFLAG_BOWOUT);
if ((find_non_loopback_bridge(tech_pvt->other_session, &other_session, &other_uuid) == SWITCH_STATUS_SUCCESS)) {
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
/* Wait for real channel to be exchanging media */
switch_channel_wait_for_state(other_channel, channel, CS_EXCHANGE_MEDIA);
if (switch_channel_test_flag(other_channel, CF_BRIDGED)) {
/* Wait for real channel to be exchanging media */
switch_channel_wait_for_state(other_channel, channel, CS_EXCHANGE_MEDIA);
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_INFO, "BOWOUT Replacing loopback channel with real channel: %s\n",
switch_channel_get_name(other_channel));
@ -929,6 +927,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
switch_channel_t *channel;
loopback_private_t *tech_pvt;
int done = 1, pass = 0;
switch_core_session_t *other_session;
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
@ -1011,14 +1010,32 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
pass = 1;
}
break;
case SWITCH_MESSAGE_INDICATE_DEFLECT:
{
pass = 0;
if (!zstr(msg->string_arg) && switch_core_session_get_partner(tech_pvt->other_session, &other_session) == SWITCH_STATUS_SUCCESS) {
char *ext = switch_core_session_strdup(other_session, msg->string_arg);
char *context = NULL, *dp = NULL;
if ((context = strchr(ext, ' '))) {
*context++ = '\0';
if ((dp = strchr(context, ' '))) {
*dp++ = '\0';
}
}
switch_ivr_session_transfer(other_session, ext, context, dp);
switch_core_session_rwunlock(other_session);
}
}
break;
default:
break;
}
if (!done && tech_pvt->other_session && (pass || switch_test_flag(tech_pvt, TFLAG_RUNNING_APP))) {
switch_status_t r = SWITCH_STATUS_FALSE;
switch_core_session_t *other_session;
if (switch_core_session_get_partner(tech_pvt->other_session, &other_session) == SWITCH_STATUS_SUCCESS) {
r = switch_core_session_receive_message(other_session, msg);

View File

@ -801,7 +801,9 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
skinny_line_set_state(listener, line_instance, call_id, SKINNY_ON_HOOK);
send_select_soft_keys(listener, line_instance, call_id, SKINNY_KEY_SET_ON_HOOK, 0xffff);
send_define_current_time_date(listener);
send_set_speaker_mode(listener, SKINNY_SPEAKER_OFF);
if((call_state == SKINNY_PROCEED) || (call_state == SKINNY_RING_OUT) || (call_state == SKINNY_CONNECTED)) { /* calling parties */
send_set_speaker_mode(listener, SKINNY_SPEAKER_OFF);
}
send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, call_id);
}
return 0;
@ -817,7 +819,8 @@ switch_status_t channel_on_hangup(switch_core_session_t *session)
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP [%s]\n",
switch_channel_get_name(channel), switch_channel_cause2str(cause));
helper.tech_pvt= tech_pvt;
helper.cause= cause;
@ -1378,7 +1381,7 @@ static void close_socket(switch_socket_t **sock, skinny_profile_t *profile)
switch_mutex_unlock(profile->sock_mutex);
}
static switch_status_t kill_listener(listener_t *listener, void *pvt)
switch_status_t kill_listener(listener_t *listener, void *pvt)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Killing listener %s:%d.\n",
listener->device_name, listener->device_instance);

View File

@ -243,6 +243,7 @@ switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile,
/* LISTENER FUNCTIONS */
/*****************************************************************************/
uint8_t listener_is_ready(listener_t *listener);
switch_status_t kill_listener(listener_t *listener, void *pvt);
switch_status_t keepalive_listener(listener_t *listener, void *pvt);
/*****************************************************************************/

View File

@ -268,6 +268,40 @@ static switch_status_t skinny_api_cmd_status_profile_device(const char *profile_
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_kill(const char *profile_name, const char *device_name, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
kill_listener(listener, NULL);
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_kill_all(const char *profile_name, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
profile_walk_listeners(profile, kill_listener, NULL);
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_ringer_message(const char *profile_name, const char *device_name, const char *ring_type, const char *ring_mode, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
@ -488,9 +522,15 @@ SWITCH_STANDARD_API(skinny_function)
} else if (argc == 3 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile")) {
/* skinny status profile <profile_name> */
status = skinny_api_cmd_status_profile(argv[2], stream);
} else if (argc == 3 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "kill_all")) {
/* skinny profile <profile_name> kill_all */
status = skinny_api_cmd_profile_kill_all(argv[1],stream);
} else if (argc == 5 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile") && !strcasecmp(argv[3], "device")) {
/* skinny status profile <profile_name> device <device_name> */
status = skinny_api_cmd_status_profile_device(argv[2], argv[4], stream);
} else if (argc == 5 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "device") && !strcasecmp(argv[4], "kill")) {
/* skinny profile <profile_name> device <device_name> kill */
status = skinny_api_cmd_profile_device_kill(argv[1],argv[3],stream);
} else if (argc >= 6 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "device") && !strcasecmp(argv[4], "send")) {
/* skinny profile <profile_name> device <device_name> send ... */
switch(skinny_str2message_type(argv[5])) {
@ -559,6 +599,10 @@ switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_
switch_console_set_complete("add skinny status profile ::skinny::list_profiles");
switch_console_set_complete("add skinny status profile ::skinny::list_profiles device ::skinny::list_devices");
switch_console_set_complete("add skinny profile ::skinny::list_profiles kill_all");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices kill");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send ResetMessage ::skinny::list_reset_types");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetRingerMessage ::skinny::list_ring_types ::skinny::list_ring_modes");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetLampMessage ::skinny::list_stimuli ::skinny::list_stimulus_instances ::skinny::list_stimulus_modes");

View File

@ -1900,6 +1900,40 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
}
}
break;
case SWITCH_MESSAGE_INDICATE_NOMEDIA:
{
const char *uuid;
switch_core_session_t *other_session;
switch_channel_t *other_channel;
const char *ip = NULL, *port = NULL;
switch_channel_set_flag(channel, CF_PROXY_MODE);
if (tech_pvt->rm_encoding) {
tech_pvt->rm_encoding = NULL;
}
sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
if ((uuid = switch_channel_get_partner_uuid(channel))
&& (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);
ip = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
port = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
switch_core_session_rwunlock(other_session);
if (ip && port) {
sofia_glue_set_local_sdp(tech_pvt, ip, (switch_port_t)atoi(port), NULL, 1);
}
}
if (!tech_pvt->local_sdp_str) {
sofia_glue_tech_absorb_sdp(tech_pvt);
}
sofia_glue_do_invite(session);
}
break;
default:
break;
}
@ -1989,38 +2023,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
}
}
break;
case SWITCH_MESSAGE_INDICATE_NOMEDIA:
{
const char *uuid;
switch_core_session_t *other_session;
switch_channel_t *other_channel;
const char *ip = NULL, *port = NULL;
switch_channel_set_flag(channel, CF_PROXY_MODE);
if (tech_pvt->rm_encoding) {
tech_pvt->rm_encoding = NULL;
}
sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
if ((uuid = switch_channel_get_partner_uuid(channel))
&& (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);
ip = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
port = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
switch_core_session_rwunlock(other_session);
if (ip && port) {
sofia_glue_set_local_sdp(tech_pvt, ip, (switch_port_t)atoi(port), NULL, 1);
}
}
if (!tech_pvt->local_sdp_str) {
sofia_glue_tech_absorb_sdp(tech_pvt);
}
sofia_glue_do_invite(session);
}
break;
case SWITCH_MESSAGE_INDICATE_AUDIO_DATA:
{

View File

@ -1958,10 +1958,10 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt)
void sofia_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup)
{
switch_mutex_lock(tech_pvt->sofia_mutex);
switch_mutex_lock(tech_pvt->flag_mutex);
tech_pvt->local_sdp_str = dup ? switch_core_session_strdup(tech_pvt->session, sdp_str) : (char *) sdp_str;
switch_channel_set_variable(tech_pvt->channel, "sip_local_sdp_str", tech_pvt->local_sdp_str);
switch_mutex_unlock(tech_pvt->sofia_mutex);
switch_mutex_unlock(tech_pvt->flag_mutex);
}
char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type)

View File

@ -1838,6 +1838,7 @@ static void *SWITCH_THREAD_FUNC rayo_dial_thread(switch_thread_t *thread, void *
iks *response = NULL;
const char *dcp_jid = iks_find_attrib(iq, "from");
const char *dial_to = iks_find_attrib(dial, "to");
char *dial_to_dup = NULL;
const char *dial_from = iks_find_attrib(dial, "from");
const char *dial_timeout_ms = iks_find_attrib(dial, "timeout");
struct dial_gateway *gateway = NULL;
@ -1855,6 +1856,24 @@ static void *SWITCH_THREAD_FUNC rayo_dial_thread(switch_thread_t *thread, void *
stream.write_function(&stream, "{origination_uuid=%s,rayo_dcp_jid=%s,rayo_call_jid=%s",
rayo_call_get_uuid(call), dcp_jid, RAYO_JID(call));
/* parse optional params from dialstring and append to */
if (*dial_to == '{') {
switch_event_t *params = NULL;
dial_to_dup = strdup(dial_to);
switch_event_create_brackets(dial_to_dup, '{', '}', ',', &params, (char **)&dial_to, SWITCH_FALSE);
if (params) {
switch_event_header_t *param;
for(param = params->headers; param; param = param->next) {
if (strchr(param->value, ',')) {
stream.write_function(&stream, ",%s=\\'%s\\'", param->name, param->value);
} else {
stream.write_function(&stream, ",%s=%s", param->name, param->value);
}
}
switch_event_destroy(&params);
}
}
/* set originate channel variables */
if (!zstr(dial_from)) {
/* caller ID */
@ -1976,6 +1995,7 @@ done:
iks_delete(dial);
switch_safe_free(stream.data);
switch_safe_free(dial_to_dup);
return NULL;
}
@ -1993,8 +2013,13 @@ static iks *on_rayo_dial(struct rayo_actor *client, struct rayo_actor *server, i
switch_threadattr_t *thd_attr = NULL;
iks *dial = iks_find(node, "dial");
iks *response = NULL;
const char *dial_to = iks_find_attrib(dial, "to");
if (!zstr(iks_find_attrib(dial, "to"))) {
if (zstr(dial_to)) {
response = iks_new_error_detailed(node, STANZA_ERROR_BAD_REQUEST, "missing dial to attribute");
} else if (strchr(dial_to, ' ')) {
response = iks_new_error_detailed(node, STANZA_ERROR_BAD_REQUEST, "malformed dial string");
} else {
iks *node_dup = iks_copy(node);
iks_insert_attrib(node_dup, "from", RAYO_JID(rclient)); /* save DCP jid in case it isn't specified */
@ -2003,8 +2028,6 @@ static iks *on_rayo_dial(struct rayo_actor *client, struct rayo_actor *server, i
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_thread_create(&thread, thd_attr, rayo_dial_thread, node_dup, RAYO_POOL(rclient));
} else {
response = iks_new_error_detailed(node, STANZA_ERROR_BAD_REQUEST, "missing dial to attribute");
}
return response;

File diff suppressed because it is too large Load Diff

View File

@ -1776,6 +1776,36 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void {
private HandleRef swigCPtr;
internal SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.35
*
* 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_f_p_switch_core_session_enum_switch_media_type_t__p_stfu_instance_t {
private HandleRef swigCPtr;
@ -4146,6 +4176,36 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_p_switch_device_record_s {
private HandleRef swigCPtr;
internal SWIGTYPE_p_p_switch_device_record_s(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected SWIGTYPE_p_p_switch_device_record_s() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_device_record_s obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.35
*
* 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_event {
private HandleRef swigCPtr;
@ -9258,6 +9318,11 @@ public class freeswitch {
return ret;
}
public static string switch_util_quote_shell_arg_pool(string arg0, SWIGTYPE_p_apr_pool_t pool) {
string ret = freeswitchPINVOKE.switch_util_quote_shell_arg_pool(arg0, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
return ret;
}
public static string switch_url_encode(string url, string buf, uint len) {
string ret = freeswitchPINVOKE.switch_url_encode(url, buf, len);
return ret;
@ -10075,6 +10140,48 @@ public class freeswitch {
freeswitchPINVOKE.switch_channel_handle_cause(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)cause);
}
public static void switch_channel_global_init(SWIGTYPE_p_apr_pool_t pool) {
freeswitchPINVOKE.switch_channel_global_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool));
}
public static void switch_channel_global_uninit() {
freeswitchPINVOKE.switch_channel_global_uninit();
}
public static string switch_channel_set_device_id(SWIGTYPE_p_switch_channel channel, string device_id) {
string ret = freeswitchPINVOKE.switch_channel_set_device_id(SWIGTYPE_p_switch_channel.getCPtr(channel), device_id);
return ret;
}
public static void switch_channel_clear_device_record(SWIGTYPE_p_switch_channel channel) {
freeswitchPINVOKE.switch_channel_clear_device_record(SWIGTYPE_p_switch_channel.getCPtr(channel));
}
public static switch_device_record_t switch_channel_get_device_record(SWIGTYPE_p_switch_channel channel) {
IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_device_record(SWIGTYPE_p_switch_channel.getCPtr(channel));
switch_device_record_t ret = (cPtr == IntPtr.Zero) ? null : new switch_device_record_t(cPtr, false);
return ret;
}
public static void switch_channel_release_device_record(SWIGTYPE_p_p_switch_device_record_s dcdrp) {
freeswitchPINVOKE.switch_channel_release_device_record(SWIGTYPE_p_p_switch_device_record_s.getCPtr(dcdrp));
}
public static switch_status_t switch_channel_bind_device_state_handler(SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void function, SWIGTYPE_p_void user_data) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_bind_device_state_handler(SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void.getCPtr(function), SWIGTYPE_p_void.getCPtr(user_data));
return ret;
}
public static switch_status_t switch_channel_unbind_device_state_handler(SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void function) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_unbind_device_state_handler(SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void.getCPtr(function));
return ret;
}
public static string switch_channel_device_state2str(switch_device_state_t device_state) {
string ret = freeswitchPINVOKE.switch_channel_device_state2str((int)device_state);
return ret;
}
public static switch_status_t switch_buffer_create(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t max_len) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(max_len));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
@ -14014,6 +14121,30 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_app_log")]
public static extern void delete_switch_app_log(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_switch_hold_record_t_on_set")]
public static extern void switch_hold_record_t_on_set(HandleRef jarg1, HandleRef jarg2);
@ -14044,29 +14175,191 @@ 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_device_node_t_uuid_set")]
public static extern void switch_device_node_t_uuid_set(HandleRef jarg1, string 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_device_node_t_uuid_get")]
public static extern string switch_device_node_t_uuid_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_device_node_t_xml_cdr_set")]
public static extern void switch_device_node_t_xml_cdr_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_device_node_t_xml_cdr_get")]
public static extern IntPtr switch_device_node_t_xml_cdr_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_device_node_t_event_set")]
public static extern void switch_device_node_t_event_set(HandleRef jarg1, HandleRef 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_switch_device_node_t_event_get")]
public static extern IntPtr switch_device_node_t_event_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_switch_device_node_t_callstate_set")]
public static extern void switch_device_node_t_callstate_set(HandleRef jarg1, int jarg2);
[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_switch_device_node_t_callstate_get")]
public static extern int switch_device_node_t_callstate_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_node_t_hold_record_set")]
public static extern void switch_device_node_t_hold_record_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_node_t_hold_record_get")]
public static extern IntPtr switch_device_node_t_hold_record_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_node_t_hup_profile_set")]
public static extern void switch_device_node_t_hup_profile_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_node_t_hup_profile_get")]
public static extern IntPtr switch_device_node_t_hup_profile_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_node_t_parent_set")]
public static extern void switch_device_node_t_parent_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_node_t_parent_get")]
public static extern IntPtr switch_device_node_t_parent_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_node_t_next_set")]
public static extern void switch_device_node_t_next_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_node_t_next_get")]
public static extern IntPtr switch_device_node_t_next_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_device_node_t")]
public static extern IntPtr new_switch_device_node_t();
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_device_node_t")]
public static extern void delete_switch_device_node_t(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_total_set")]
public static extern void switch_device_stats_t_total_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_total_get")]
public static extern uint switch_device_stats_t_total_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_offhook_set")]
public static extern void switch_device_stats_t_offhook_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_offhook_get")]
public static extern uint switch_device_stats_t_offhook_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_active_set")]
public static extern void switch_device_stats_t_active_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_active_get")]
public static extern uint switch_device_stats_t_active_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_held_set")]
public static extern void switch_device_stats_t_held_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_held_get")]
public static extern uint switch_device_stats_t_held_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_hup_set")]
public static extern void switch_device_stats_t_hup_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_hup_get")]
public static extern uint switch_device_stats_t_hup_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_ringing_set")]
public static extern void switch_device_stats_t_ringing_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_ringing_get")]
public static extern uint switch_device_stats_t_ringing_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_early_set")]
public static extern void switch_device_stats_t_early_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_stats_t_early_get")]
public static extern uint switch_device_stats_t_early_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_device_stats_t")]
public static extern IntPtr new_switch_device_stats_t();
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_device_stats_t")]
public static extern void delete_switch_device_stats_t(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_device_id_set")]
public static extern void switch_device_record_t_device_id_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_device_id_get")]
public static extern string switch_device_record_t_device_id_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_uuid_set")]
public static extern void switch_device_record_t_uuid_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_uuid_get")]
public static extern string switch_device_record_t_uuid_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_refs_set")]
public static extern void switch_device_record_t_refs_set(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_refs_get")]
public static extern int switch_device_record_t_refs_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_stats_set")]
public static extern void switch_device_record_t_stats_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_stats_get")]
public static extern IntPtr switch_device_record_t_stats_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_state_set")]
public static extern void switch_device_record_t_state_set(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_state_get")]
public static extern int switch_device_record_t_state_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_last_state_set")]
public static extern void switch_device_record_t_last_state_set(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_last_state_get")]
public static extern int switch_device_record_t_last_state_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_active_start_set")]
public static extern void switch_device_record_t_active_start_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_active_start_get")]
public static extern IntPtr switch_device_record_t_active_start_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_active_stop_set")]
public static extern void switch_device_record_t_active_stop_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_active_stop_get")]
public static extern IntPtr switch_device_record_t_active_stop_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_last_call_time_set")]
public static extern void switch_device_record_t_last_call_time_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_last_call_time_get")]
public static extern IntPtr switch_device_record_t_last_call_time_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_uuid_list_set")]
public static extern void switch_device_record_t_uuid_list_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_uuid_list_get")]
public static extern IntPtr switch_device_record_t_uuid_list_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_uuid_tail_set")]
public static extern void switch_device_record_t_uuid_tail_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_uuid_tail_get")]
public static extern IntPtr switch_device_record_t_uuid_tail_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_mutex_set")]
public static extern void switch_device_record_t_mutex_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_mutex_get")]
public static extern IntPtr switch_device_record_t_mutex_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_pool_set")]
public static extern void switch_device_record_t_pool_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_device_record_t_pool_get")]
public static extern IntPtr switch_device_record_t_pool_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_device_record_t")]
public static extern IntPtr new_switch_device_record_t();
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_device_record_t")]
public static extern void delete_switch_device_record_t(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_MESSAGE_STRING_ARG_MAX_get")]
public static extern int MESSAGE_STRING_ARG_MAX_get();
@ -16018,6 +16311,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_util_quote_shell_arg")]
public static extern string switch_util_quote_shell_arg(string jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_util_quote_shell_arg_pool")]
public static extern string switch_util_quote_shell_arg_pool(string jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_url_encode")]
public static extern string switch_url_encode(string jarg1, string jarg2, uint jarg3);
@ -19219,6 +19515,33 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_handle_cause")]
public static extern void switch_channel_handle_cause(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_global_init")]
public static extern void switch_channel_global_init(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_global_uninit")]
public static extern void switch_channel_global_uninit();
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_device_id")]
public static extern string switch_channel_set_device_id(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_device_record")]
public static extern void switch_channel_clear_device_record(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_device_record")]
public static extern IntPtr switch_channel_get_device_record(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_release_device_record")]
public static extern void switch_channel_release_device_record(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_bind_device_state_handler")]
public static extern int switch_channel_bind_device_state_handler(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_unbind_device_state_handler")]
public static extern int switch_channel_unbind_device_state_handler(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_device_state2str")]
public static extern string switch_channel_device_state2str(int jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create")]
public static extern int switch_buffer_create(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
@ -24554,7 +24877,8 @@ public enum switch_channel_callstate_t {
CCS_EARLY,
CCS_ACTIVE,
CCS_HELD,
CCS_HANGUP
CCS_HANGUP,
CCS_UNHOLD
}
}
@ -24666,6 +24990,8 @@ public enum switch_channel_flag_t {
CF_ZRTP_PASSTHRU,
CF_ZRTP_HASH,
CF_CHANNEL_SWAP,
CF_DEVICE_LEG,
CF_FINAL_DEVICE_LEG,
CF_PICKUP,
CF_CONFIRM_BLIND_TRANSFER,
CF_NO_PRESENCE,
@ -26834,6 +27160,464 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class switch_device_node_t : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal switch_device_node_t(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(switch_device_node_t obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~switch_device_node_t() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
swigCMemOwn = false;
freeswitchPINVOKE.delete_switch_device_node_t(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
GC.SuppressFinalize(this);
}
}
public string uuid {
set {
freeswitchPINVOKE.switch_device_node_t_uuid_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_device_node_t_uuid_get(swigCPtr);
return ret;
}
}
public switch_xml xml_cdr {
set {
freeswitchPINVOKE.switch_device_node_t_xml_cdr_set(swigCPtr, switch_xml.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_node_t_xml_cdr_get(swigCPtr);
switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
return ret;
}
}
public switch_event event {
set {
freeswitchPINVOKE.switch_device_node_t_event_set(swigCPtr, switch_event.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_node_t_event_get(swigCPtr);
switch_event ret = (cPtr == IntPtr.Zero) ? null : new switch_event(cPtr, false);
return ret;
}
}
public switch_channel_callstate_t callstate {
set {
freeswitchPINVOKE.switch_device_node_t_callstate_set(swigCPtr, (int)value);
}
get {
switch_channel_callstate_t ret = (switch_channel_callstate_t)freeswitchPINVOKE.switch_device_node_t_callstate_get(swigCPtr);
return ret;
}
}
public switch_hold_record_t hold_record {
set {
freeswitchPINVOKE.switch_device_node_t_hold_record_set(swigCPtr, switch_hold_record_t.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_node_t_hold_record_get(swigCPtr);
switch_hold_record_t ret = (cPtr == IntPtr.Zero) ? null : new switch_hold_record_t(cPtr, false);
return ret;
}
}
public switch_caller_profile hup_profile {
set {
freeswitchPINVOKE.switch_device_node_t_hup_profile_set(swigCPtr, switch_caller_profile.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_node_t_hup_profile_get(swigCPtr);
switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
return ret;
}
}
public switch_device_record_t parent {
set {
freeswitchPINVOKE.switch_device_node_t_parent_set(swigCPtr, switch_device_record_t.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_node_t_parent_get(swigCPtr);
switch_device_record_t ret = (cPtr == IntPtr.Zero) ? null : new switch_device_record_t(cPtr, false);
return ret;
}
}
public switch_device_node_t next {
set {
freeswitchPINVOKE.switch_device_node_t_next_set(swigCPtr, switch_device_node_t.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_node_t_next_get(swigCPtr);
switch_device_node_t ret = (cPtr == IntPtr.Zero) ? null : new switch_device_node_t(cPtr, false);
return ret;
}
}
public switch_device_node_t() : this(freeswitchPINVOKE.new_switch_device_node_t(), true) {
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.35
*
* 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 switch_device_record_t : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal switch_device_record_t(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(switch_device_record_t obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~switch_device_record_t() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
swigCMemOwn = false;
freeswitchPINVOKE.delete_switch_device_record_t(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
GC.SuppressFinalize(this);
}
}
public string device_id {
set {
freeswitchPINVOKE.switch_device_record_t_device_id_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_device_record_t_device_id_get(swigCPtr);
return ret;
}
}
public string uuid {
set {
freeswitchPINVOKE.switch_device_record_t_uuid_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_device_record_t_uuid_get(swigCPtr);
return ret;
}
}
public int refs {
set {
freeswitchPINVOKE.switch_device_record_t_refs_set(swigCPtr, value);
}
get {
int ret = freeswitchPINVOKE.switch_device_record_t_refs_get(swigCPtr);
return ret;
}
}
public switch_device_stats_t stats {
set {
freeswitchPINVOKE.switch_device_record_t_stats_set(swigCPtr, switch_device_stats_t.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_record_t_stats_get(swigCPtr);
switch_device_stats_t ret = (cPtr == IntPtr.Zero) ? null : new switch_device_stats_t(cPtr, false);
return ret;
}
}
public switch_device_state_t state {
set {
freeswitchPINVOKE.switch_device_record_t_state_set(swigCPtr, (int)value);
}
get {
switch_device_state_t ret = (switch_device_state_t)freeswitchPINVOKE.switch_device_record_t_state_get(swigCPtr);
return ret;
}
}
public switch_device_state_t last_state {
set {
freeswitchPINVOKE.switch_device_record_t_last_state_set(swigCPtr, (int)value);
}
get {
switch_device_state_t ret = (switch_device_state_t)freeswitchPINVOKE.switch_device_record_t_last_state_get(swigCPtr);
return ret;
}
}
public SWIGTYPE_p_switch_time_t active_start {
set {
freeswitchPINVOKE.switch_device_record_t_active_start_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_device_record_t_active_start_get(swigCPtr), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public SWIGTYPE_p_switch_time_t active_stop {
set {
freeswitchPINVOKE.switch_device_record_t_active_stop_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_device_record_t_active_stop_get(swigCPtr), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public SWIGTYPE_p_switch_time_t last_call_time {
set {
freeswitchPINVOKE.switch_device_record_t_last_call_time_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_device_record_t_last_call_time_get(swigCPtr), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public switch_device_node_t uuid_list {
set {
freeswitchPINVOKE.switch_device_record_t_uuid_list_set(swigCPtr, switch_device_node_t.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_record_t_uuid_list_get(swigCPtr);
switch_device_node_t ret = (cPtr == IntPtr.Zero) ? null : new switch_device_node_t(cPtr, false);
return ret;
}
}
public switch_device_node_t uuid_tail {
set {
freeswitchPINVOKE.switch_device_record_t_uuid_tail_set(swigCPtr, switch_device_node_t.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_record_t_uuid_tail_get(swigCPtr);
switch_device_node_t ret = (cPtr == IntPtr.Zero) ? null : new switch_device_node_t(cPtr, false);
return ret;
}
}
public SWIGTYPE_p_switch_mutex_t mutex {
set {
freeswitchPINVOKE.switch_device_record_t_mutex_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_record_t_mutex_get(swigCPtr);
SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
return ret;
}
}
public SWIGTYPE_p_apr_pool_t pool {
set {
freeswitchPINVOKE.switch_device_record_t_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_device_record_t_pool_get(swigCPtr);
SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
return ret;
}
}
public switch_device_record_t() : this(freeswitchPINVOKE.new_switch_device_record_t(), true) {
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.35
*
* 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_device_state_t {
SDS_DOWN,
SDS_RINGING,
SDS_ACTIVE,
SDS_ACTIVE_MULTI,
SDS_HELD,
SDS_HANGUP
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.35
*
* 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 switch_device_stats_t : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal switch_device_stats_t(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(switch_device_stats_t obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~switch_device_stats_t() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
swigCMemOwn = false;
freeswitchPINVOKE.delete_switch_device_stats_t(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
GC.SuppressFinalize(this);
}
}
public uint total {
set {
freeswitchPINVOKE.switch_device_stats_t_total_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_device_stats_t_total_get(swigCPtr);
return ret;
}
}
public uint offhook {
set {
freeswitchPINVOKE.switch_device_stats_t_offhook_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_device_stats_t_offhook_get(swigCPtr);
return ret;
}
}
public uint active {
set {
freeswitchPINVOKE.switch_device_stats_t_active_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_device_stats_t_active_get(swigCPtr);
return ret;
}
}
public uint held {
set {
freeswitchPINVOKE.switch_device_stats_t_held_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_device_stats_t_held_get(swigCPtr);
return ret;
}
}
public uint hup {
set {
freeswitchPINVOKE.switch_device_stats_t_hup_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_device_stats_t_hup_get(swigCPtr);
return ret;
}
}
public uint ringing {
set {
freeswitchPINVOKE.switch_device_stats_t_ringing_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_device_stats_t_ringing_get(swigCPtr);
return ret;
}
}
public uint early {
set {
freeswitchPINVOKE.switch_device_stats_t_early_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_device_stats_t_early_get(swigCPtr);
return ret;
}
}
public switch_device_stats_t() : this(freeswitchPINVOKE.new_switch_device_stats_t(), true) {
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.35
*
* 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 switch_dialplan_interface : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
@ -28106,6 +28890,8 @@ public enum switch_event_types_t {
SWITCH_EVENT_CONFERENCE_DATA,
SWITCH_EVENT_CALL_SETUP_REQ,
SWITCH_EVENT_CALL_SETUP_RESULT,
SWITCH_EVENT_CALL_DETAIL,
SWITCH_EVENT_DEVICE_STATE,
SWITCH_EVENT_ALL
}

View File

@ -336,7 +336,6 @@ static void daemonize(int *fds)
if (fds) {
setsid();
}
return;
/* redirect std* to null */
fd = open("/dev/null", O_RDONLY);
if (fd != 0) {
@ -355,6 +354,7 @@ static void daemonize(int *fds)
dup2(fd, 2);
close(fd);
}
return;
}
#endif

View File

@ -4751,7 +4751,7 @@ static void switch_channel_check_device_state(switch_channel_t *channel, switch_
}
}
if (drec->state == SDS_DOWN && drec->last_state == SDS_DOWN) {
if ((drec->state == SDS_DOWN && drec->last_state == SDS_DOWN) || (drec->state == SDS_HANGUP && drec->last_state == SDS_HANGUP)) {
switch_mutex_unlock(drec->mutex);
switch_mutex_unlock(globals.device_mutex);
return;

View File

@ -1092,6 +1092,11 @@ struct record_helper {
int native;
uint32_t packet_len;
int min_sec;
int final_timeout_ms;
int initial_timeout_ms;
int silence_threshold;
int silence_timeout_ms;
switch_time_t silence_time;
int rready;
int wready;
switch_time_t last_read_time;
@ -1100,6 +1105,34 @@ struct record_helper {
switch_codec_implementation_t read_impl;
};
static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_threshold, switch_codec_implementation_t *codec_impl)
{
int16_t *fdata = (int16_t *) frame->data;
uint32_t samples = frame->datalen / sizeof(*fdata);
switch_bool_t is_silence = SWITCH_TRUE;
uint32_t channel_num = 0;
int divisor = 0;
if (!(divisor = codec_impl->samples_per_second / 8000)) {
divisor = 1;
}
/* is silence only if every channel is silent */
for (channel_num = 0; channel_num < codec_impl->number_of_channels && is_silence; channel_num++) {
uint32_t count = 0, j = channel_num;
double energy = 0;
for (count = 0; count < samples; count++) {
energy += abs(fdata[j]);
j += codec_impl->number_of_channels;
}
is_silence &= (uint32_t) (energy / (samples / divisor)) < silence_threshold;
}
return is_silence;
}
static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
{
switch_core_session_t *session = switch_core_media_bug_get_session(bug);
@ -1118,6 +1151,8 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
rh->silence_time = switch_micro_time_now();
rh->silence_timeout_ms = rh->initial_timeout_ms;
switch_core_session_get_read_impl(session, &rh->read_impl);
@ -1274,6 +1309,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE);
if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) {
len = (switch_size_t) frame.datalen / 2;
if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS && rh->hangup_on_error) {
@ -1282,6 +1318,32 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
return SWITCH_FALSE;
}
/* check for silence timeout */
if (rh->silence_threshold) {
switch_codec_implementation_t read_impl = { 0 };
switch_core_session_get_read_impl(session, &read_impl);
if (is_silence_frame(&frame, rh->silence_threshold, &read_impl)) {
if (!rh->silence_time) {
/* start of silence */
rh->silence_time = switch_micro_time_now();
} else {
/* continuing silence */
int duration_ms = (switch_micro_time_now() - rh->silence_time) / 1000;
if (rh->silence_timeout_ms > 0 && duration_ms >= rh->silence_timeout_ms) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Recording file %s timeout: %i >= %i\n", rh->file, duration_ms, rh->silence_timeout_ms);
switch_core_media_bug_set_flag(bug, SMBF_PRUNE);
}
}
} else { /* not silence */
if (rh->silence_time) {
/* end of silence */
rh->silence_time = 0;
/* switch from initial timeout to final timeout */
rh->silence_timeout_ms = rh->final_timeout_ms;
}
}
}
}
}
break;
@ -2150,6 +2212,29 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
}
}
if ((p = switch_channel_get_variable(channel, "RECORD_INITIAL_TIMEOUT_MS"))) {
int tmp = atoi(p);
if (tmp >= 0) {
rh->initial_timeout_ms = tmp;
rh->silence_threshold = 200;
}
}
if ((p = switch_channel_get_variable(channel, "RECORD_FINAL_TIMEOUT_MS"))) {
int tmp = atoi(p);
if (tmp >= 0) {
rh->final_timeout_ms = tmp;
rh->silence_threshold = 200;
}
}
if ((p = switch_channel_get_variable(channel, "RECORD_SILENCE_THRESHOLD"))) {
int tmp = atoi(p);
if (tmp >= 0) {
rh->silence_threshold = tmp;
}
}
rh->hangup_on_error = hangup_on_error;
if ((status = switch_core_media_bug_add(session, "session_record", file,

View File

@ -53,17 +53,37 @@ static void *SWITCH_THREAD_FUNC video_bridge_thread(switch_thread_t *thread, voi
switch_channel_t *b_channel = switch_core_session_get_channel(vh->session_b);
switch_status_t status;
switch_frame_t *read_frame;
switch_core_session_message_t msg = { 0 };
vh->up = 1;
while (switch_channel_ready(channel) && switch_channel_ready(b_channel) && vh->up == 1) {
status = switch_core_session_read_video_frame(vh->session_a, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
switch_core_session_read_lock(vh->session_a);
switch_core_session_read_lock(vh->session_b);
msg.from = __FILE__;
msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ;
switch_core_session_receive_message(vh->session_a, &msg);
switch_core_session_receive_message(vh->session_b, &msg);
while (switch_channel_up_nosig(channel) && switch_channel_up_nosig(b_channel) && vh->up == 1) {
if (switch_channel_media_up(channel)) {
status = switch_core_session_read_video_frame(vh->session_a, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
switch_cond_next();
continue;
}
}
if (!switch_test_flag(read_frame, SFF_CNG)) {
if (switch_test_flag(read_frame, SFF_CNG)) {
continue;
}
if (switch_channel_media_up(b_channel)) {
if (switch_core_session_write_video_frame(vh->session_b, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
break;
switch_cond_next();
continue;
}
}
@ -72,10 +92,14 @@ static void *SWITCH_THREAD_FUNC video_bridge_thread(switch_thread_t *thread, voi
switch_core_session_kill_channel(vh->session_b, SWITCH_SIG_BREAK);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(vh->session_a), SWITCH_LOG_DEBUG, "%s video thread ended.\n", switch_channel_get_name(channel));
switch_core_session_rwunlock(vh->session_a);
switch_core_session_rwunlock(vh->session_b);
vh->up = 0;
return NULL;
}
static switch_thread_t *launch_video(struct vid_helper *vh)
{
switch_thread_t *thread;
@ -253,7 +277,13 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
}
if (bypass_media_after_bridge) {
if (switch_stristr("loopback", switch_channel_get_name(chan_a)) || switch_stristr("loopback", switch_channel_get_name(chan_b))) {
const char *source_a = switch_channel_get_variable(chan_a, "source");
const char *source_b = switch_channel_get_variable(chan_b, "source");
if (!source_a) source_a = "";
if (!source_b) source_b = "";
if (switch_stristr("loopback", source_a) || switch_stristr("loopback", source_b)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_WARNING, "Cannot bypass media while bridged to a loopback address.\n");
bypass_media_after_bridge = 0;
}