icc changes part 1

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@982 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2006-03-30 23:02:50 +00:00
1 parent 14b58205b1
commit 64507e70ca
57 files changed
+1055 -1048

No files matched your search

@@ -103,7 +103,7 @@ static void tts_function(switch_core_session *session, char *data)
return;
}
if ((argc = switch_separate_string(mydata, ':', argv, sizeof(argv) / sizeof(argv[0]))) > 1) {
if ((argc = switch_separate_string(mydata, ':', argv, sizeof(argv) / sizeof(argv[0]))) > 1 && argc) {
tts_name = argv[0];
voice_name = argv[1];
text = argv[2];
+7 -4
View File
@@ -29,6 +29,10 @@
* mod_cepstral.c -- Cepstral Interface
*
*/
#ifdef __ICC
#pragma warning (disable:188)
#endif
#include <swift.h>
#include <switch.h>
@@ -56,7 +60,6 @@ static swift_result_t write_audio(swift_event *event, swift_event_t type, void *
swift_event_t rv = SWIFT_SUCCESS;
void *buf = NULL;
int len = 0;
int wrote;
cepstral = udata;
assert(cepstral != NULL);
@@ -64,7 +67,7 @@ static swift_result_t write_audio(swift_event *event, swift_event_t type, void *
/* Only proceed when we have success */
if (!SWIFT_FAILED((rv = swift_event_get_audio(event, &buf, &len)))) {
switch_mutex_lock(cepstral->audio_lock);
if ((wrote=switch_buffer_write(cepstral->audio_buffer, buf, len)) <= 0) {
if (switch_buffer_write(cepstral->audio_buffer, buf, len) <= 0) {
rv = SWIFT_UNKNOWN_ERROR;
}
switch_mutex_unlock(cepstral->audio_lock);
@@ -242,7 +245,7 @@ static switch_status cepstral_speech_read_tts(switch_speech_handle *sh,
return status;
}
const switch_speech_interface cepstral_speech_interface = {
static const switch_speech_interface cepstral_speech_interface = {
/*.interface_name*/ "cepstral",
/*.speech_open*/ cepstral_speech_open,
/*.speech_close*/ cepstral_speech_close,
@@ -253,7 +256,7 @@ const switch_speech_interface cepstral_speech_interface = {
};
const switch_loadable_module_interface cepstral_module_interface = {
static const switch_loadable_module_interface cepstral_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
+3
View File
@@ -39,6 +39,9 @@
*/
#include "g711.h"
#ifdef __ICC
#pragma warning (disable:810 869 1418)
#endif
/*
* g711.c
+3 -1
View File
@@ -187,6 +187,7 @@ static switch_status switch_g711a_destroy(switch_codec *codec)
/* Registration */
#if 0
static const switch_codec_implementation g711u_8k_60ms_implementation = {
/*.samples_per_second */ 8000,
@@ -204,6 +205,7 @@ static const switch_codec_implementation g711u_8k_60ms_implementation = {
/*.destroy */ switch_g711u_destroy
};
static const switch_codec_implementation g711u_8k_30ms_implementation = {
/*.samples_per_second */ 8000,
/*.bits_per_second */ 96000,
@@ -220,7 +222,7 @@ static const switch_codec_implementation g711u_8k_30ms_implementation = {
/*.destroy */ switch_g711u_destroy,
/*.next */ &g711u_8k_60ms_implementation
};
#endif
static const switch_codec_implementation g711u_16k_implementation = {
/*.samples_per_second */ 16000,
+2 -2
View File
@@ -121,11 +121,11 @@ static switch_status switch_gsm_decode(switch_codec *codec, switch_codec *other_
if (new_len <= *decoded_data_len) {
*decoded_data_len = new_len;
} else {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "buffer overflow!!! %d %d\n", new_len, *decoded_data_len);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "buffer overflow!!! %u %u\n", new_len, *decoded_data_len);
return SWITCH_STATUS_FALSE;
}
} else {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "yo this frame is an odd size [%d]\n", encoded_data_len);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "yo this frame is an odd size [%u]\n", encoded_data_len);
}
return SWITCH_STATUS_SUCCESS;
}
+1 -1
View File
@@ -35,7 +35,7 @@
static const char modname[] = "mod_speexcodec";
const struct switch_codec_settings default_codec_settings = {
static const struct switch_codec_settings default_codec_settings = {
/*.quality */ 5,
/*.complexity */ 5,
/*.enhancement */ 1,
@@ -38,7 +38,7 @@
static const char modname[] = "mod_dialplan_demo";
switch_caller_extension *demo_dialplan_hunt(switch_core_session *session)
static switch_caller_extension *demo_dialplan_hunt(switch_core_session *session)
{
switch_caller_profile *caller_profile;
switch_caller_extension *extension = NULL;
@@ -82,7 +82,7 @@ static void load_config(void)
switch_config_close_file(&cfg);
}
switch_caller_extension *directory_dialplan_hunt(switch_core_session *session)
static switch_caller_extension *directory_dialplan_hunt(switch_core_session *session)
{
switch_caller_profile *caller_profile;
switch_caller_extension *extension = NULL;
+1 -1
View File
@@ -42,7 +42,7 @@ static const char modname[] = "mod_pcre";
re = NULL;\
}
switch_caller_extension *dialplan_hunt(switch_core_session *session)
static switch_caller_extension *dialplan_hunt(switch_core_session *session)
{
switch_caller_profile *caller_profile;
switch_caller_extension *extension = NULL;
+1 -1
View File
@@ -140,7 +140,7 @@ static switch_status mod_ldap_next(switch_directory_handle *dh)
return SWITCH_STATUS_SUCCESS;
}
switch_status mod_ldap_next_pair(switch_directory_handle *dh, char **var, char **val)
static switch_status mod_ldap_next_pair(switch_directory_handle *dh, char **var, char **val)
{
struct ldap_context *context;
+15 -15
View File
@@ -282,8 +282,7 @@ static switch_status exosip_on_init(switch_core_session *session)
sdp_message_m_media_add(tech_pvt->local_sdp, "audio", port, NULL, "RTP/AVP");
/* Add in every codec we support on this outbound call */
if (globals.codec_string) {
num_codecs = switch_loadable_module_get_codecs_sorted(switch_core_session_get_pool(tech_pvt->session),
codecs,
num_codecs = switch_loadable_module_get_codecs_sorted(codecs,
SWITCH_MAX_CODECS,
globals.codec_order,
globals.codec_order_last);
@@ -301,7 +300,7 @@ static switch_status exosip_on_init(switch_core_session *session)
for (i = 0; i < num_codecs; i++) {
int x = 0;
snprintf(tmp, sizeof(tmp), "%i", codecs[i]->ianacode);
snprintf(tmp, sizeof(tmp), "%u", codecs[i]->ianacode);
sdp_message_m_payload_add(tech_pvt->local_sdp, 0, osip_strdup(tmp));
for (imp = codecs[i]->implementations; imp; imp = imp->next) {
/* Add to SDP config */
@@ -309,8 +308,7 @@ static switch_status exosip_on_init(switch_core_session *session)
imp->samples_per_second, x++);
/* Add to SDP message */
snprintf(tmp, sizeof(tmp), "%i %s/%i", codecs[i]->ianacode, codecs[i]->iananame,
imp->samples_per_second);
snprintf(tmp, sizeof(tmp), "%u %s/%d", codecs[i]->ianacode, codecs[i]->iananame, imp->samples_per_second);
sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "rtpmap", osip_strdup(tmp));
memset(tmp, 0, sizeof(tmp));
}
@@ -464,7 +462,7 @@ static void activate_rtp(struct private_object *tech_pvt)
bw *= 8;
}
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Activating RTP %s:%d->%s:%d codec: %d ms: %d\n",
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Activating RTP %s:%d->%s:%d codec: %u ms: %d\n",
tech_pvt->local_sdp_audio_ip,
tech_pvt->local_sdp_audio_port,
tech_pvt->remote_sdp_audio_ip,
@@ -684,7 +682,7 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra
struct private_object *tech_pvt;
switch_channel *channel = NULL;
switch_status status = SWITCH_STATUS_SUCCESS;
int bytes = 0, samples = 0, ms = 0, frames = 0;
int bytes = 0, samples = 0, frames = 0;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -712,7 +710,6 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
frames = ((int) frame->datalen / bytes);
samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame / 1000;
} else {
assert(0);
}
@@ -739,8 +736,12 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra
for (x = 0; x < loops; x++) {
jrtp4c_write_payload(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 101, ts, tech_pvt->out_digit_seq);
printf("Send %s packet for [%c] ts=%d sofar=%d dur=%d\n", loops == 1 ? "middle" : "end", tech_pvt->out_digit, ts,
tech_pvt->out_digit_sofar, duration);
printf("Send %s packet for [%c] ts=%d sofar=%u dur=%d\n",
loops == 1 ? "middle" : "end",
tech_pvt->out_digit,
ts,
tech_pvt->out_digit_sofar,
duration);
}
}
@@ -762,7 +763,7 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra
tech_pvt->out_digit_seq++;
for (x = 0; x < 3; x++) {
jrtp4c_write_payload(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 101, ts, tech_pvt->out_digit_seq);
printf("Send start packet for [%c] ts=%d sofar=%d dur=%d\n", tech_pvt->out_digit, ts,
printf("Send start packet for [%c] ts=%d sofar=%u dur=%d\n", tech_pvt->out_digit, ts,
tech_pvt->out_digit_sofar, 0);
}
@@ -1111,8 +1112,7 @@ static switch_status exosip_create_call(eXosip_event_t * event)
if (globals.codec_string) {
num_codecs = switch_loadable_module_get_codecs_sorted(switch_core_session_get_pool(tech_pvt->session),
codecs,
num_codecs = switch_loadable_module_get_codecs_sorted(codecs,
SWITCH_MAX_CODECS,
globals.codec_order,
globals.codec_order_last);
@@ -1245,7 +1245,7 @@ static switch_status exosip_create_call(eXosip_event_t * event)
}
return 0;
return SWITCH_STATUS_SUCCESS;
}
@@ -1624,7 +1624,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
config_exosip(0);
if (globals.debug) {
osip_trace_initialize(globals.debug, stdout);
osip_trace_initialize((osip_trace_level_t) globals.debug, stdout);
}
if (eXosip_init()) {
@@ -17,6 +17,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef __ICC
#pragma warning (disable:810 869 1418 981)
#endif
#include <stdlib.h>
#include <osipparser2/osip_port.h>
+8 -11
View File
@@ -215,8 +215,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
int x, srate = 8000;
if (globals.codec_string) {
if ((num_codecs = switch_loadable_module_get_codecs_sorted(switch_core_session_get_pool(tech_pvt->session),
codecs,
if ((num_codecs = switch_loadable_module_get_codecs_sorted(codecs,
SWITCH_MAX_CODECS,
globals.codec_order,
globals.codec_order_last)) <= 0) {
@@ -863,9 +862,7 @@ static switch_status load_config(void)
SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
{
int res;
int netfd;
int refresh;
//int refresh;
struct iax_event *iaxevent = NULL;
switch_event *s_event;
if (load_config() != SWITCH_STATUS_SUCCESS) {
@@ -875,14 +872,14 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
if (globals.debug) {
iax_enable_debug();
}
if (((res = iax_init(globals.port) < 0)) != 0) {
if (iax_init(globals.port) < 0) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error Binding Port!\n");
return SWITCH_STATUS_TERM;
}
iax_set_error(iax_err_cb);
iax_set_output(iax_out_cb);
netfd = iax_get_fd();
//netfd = iax_get_fd();
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "IAX Ready Port %d\n", globals.port);
@@ -912,8 +909,8 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
switch (iaxevent->etype) {
case IAX_EVENT_REGACK:
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Registration completed successfully.\n");
if (iaxevent->ies.refresh)
refresh = iaxevent->ies.refresh;
//if (iaxevent->ies.refresh)
//refresh = iaxevent->ies.refresh;
break;
case IAX_EVENT_REGREJ:
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Registration failed.\n");
@@ -927,7 +924,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
if (iax_set_codec(tech_pvt, iaxevent->session, &format, &cap, &iaxevent->ies.samprate, IAX_SET) !=
SWITCH_STATUS_SUCCESS) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WTF? %d %d\n", iaxevent->ies.format,
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WTF? %u %u\n", iaxevent->ies.format,
iaxevent->ies.capability);
}
}
@@ -961,7 +958,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
case IAX_EVENT_CONNECT:
// incoming call detected
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
"Incoming call connected %s, %s, %s %d/%d\n",
"Incoming call connected %s, %s, %s %u/%u\n",
iaxevent->ies.called_number,
iaxevent->ies.calling_number,
iaxevent->ies.calling_name, iaxevent->ies.format, iaxevent->ies.capability);
+4
View File
@@ -38,6 +38,10 @@
* PLB021214 - check for valid stream in CloseAudioStream() to prevent hang.
* add timeOutMSec to CloseAudioStream() to prevent hang.
*/
#ifdef __ICC
#pragma warning (disable:810 869 981 279 1469)
#endif
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -33,6 +33,9 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifdef __ICC
#pragma warning (disable:810 869 981 279 1469)
#endif
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
+305 -302
View File
@@ -191,7 +191,7 @@ static int str2dp(char *dp)
return PRI_UNKNOWN;
}
static const switch_endpoint_interface wanpipe_endpoint_interface;
static void set_global_dialplan(char *dialplan);
static int str2node(char *node);
@@ -395,6 +395,307 @@ static switch_status wanpipe_on_transmit(switch_core_session *session)
return SWITCH_STATUS_SUCCESS;
}
static switch_status wanpipe_answer_channel(switch_core_session *session)
{
struct private_object *tech_pvt;
switch_channel *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
if (switch_test_flag(tech_pvt, TFLAG_INBOUND) && !switch_test_flag(tech_pvt, TFLAG_NOSIG)) {
pri_answer(tech_pvt->spri->pri, tech_pvt->call, 0, 1);
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status wanpipe_read_frame(switch_core_session *session, switch_frame **frame, int timeout,
switch_io_flag flags, int stream_id)
{
struct private_object *tech_pvt;
switch_channel *channel = NULL;
uint8_t *bp;
int bytes = 0, res = 0;
char digit_str[80];
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
bp = tech_pvt->databuf;
*frame = NULL;
memset(tech_pvt->databuf, 0, sizeof(tech_pvt->databuf));
while (bytes < globals.mtu) {
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
if ((res = sangoma_socket_waitfor(tech_pvt->socket, timeout, POLLIN | POLLERR)) < 0) {
return SWITCH_STATUS_GENERR;
} else if (res == 0) {
tech_pvt->read_frame.datalen = 0;
return SWITCH_STATUS_SUCCESS;
}
if ((res = sangoma_readmsg_socket(tech_pvt->socket,
&tech_pvt->hdrframe,
sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) {
if (errno == EBUSY) {
continue;
} else {
return SWITCH_STATUS_GENERR;
}
}
bytes += res;
bp += bytes;
}
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
tech_pvt->read_frame.datalen = bytes;
tech_pvt->read_frame.samples = bytes / 2;
res = teletone_dtmf_detect (&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
res = teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str));
if(digit_str[0]) {
switch_channel_queue_dtmf(channel, digit_str);
if (globals.debug) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "DTMF DETECTED: [%s]\n", digit_str);
}
if (globals.supress_dtmf_tone) {
memset(tech_pvt->read_frame.data, 0, tech_pvt->read_frame.datalen);
}
}
if (tech_pvt->skip_read_frames > 0) {
memset(tech_pvt->read_frame.data, 0, tech_pvt->read_frame.datalen);
tech_pvt->skip_read_frames--;
}
#ifdef DOTRACE
write(tech_pvt->fd2, tech_pvt->read_frame.data, (int) tech_pvt->read_frame.datalen);
#endif
//printf("read %d\n", tech_pvt->read_frame.datalen);
*frame = &tech_pvt->read_frame;
return SWITCH_STATUS_SUCCESS;
}
static switch_status wanpipe_write_frame(switch_core_session *session, switch_frame *frame, int timeout,
switch_io_flag flags, int stream_id)
{
struct private_object *tech_pvt;
switch_channel *channel = NULL;
int result = 0;
int bytes = frame->datalen;
uint8_t *bp = frame->data;
unsigned char dtmf[1024];
int bread, bwrote = 0;
switch_status status = SWITCH_STATUS_SUCCESS;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
while (tech_pvt->dtmf_buffer && bwrote < frame->datalen && bytes > 0 && switch_buffer_inuse(tech_pvt->dtmf_buffer) > 0) {
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
if ((bread = switch_buffer_read(tech_pvt->dtmf_buffer, dtmf, globals.mtu)) < globals.mtu) {
while (bread < globals.mtu) {
dtmf[bread++] = 0;
}
}
sangoma_socket_waitfor(tech_pvt->socket, -1, POLLOUT | POLLERR | POLLHUP);
#ifdef DOTRACE
write(tech_pvt->fd, dtmf, (int) bread);
#endif
result = sangoma_sendmsg_socket(tech_pvt->socket,
&tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), dtmf, bread, 0);
if (result < 0) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
"Bad Write %d bytes returned %d (%s)!\n", bread,
result, strerror(errno));
if (errno == EBUSY) {
continue;
}
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Failed!\n");
status = SWITCH_STATUS_GENERR;
break;
} else {
bytes -= result;
bwrote += result;
bp += result;
result = 0;
}
}
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
if (tech_pvt->skip_write_frames) {
tech_pvt->skip_write_frames--;
return SWITCH_STATUS_SUCCESS;
}
while (bytes > 0) {
unsigned int towrite;
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
sangoma_socket_waitfor(tech_pvt->socket, -1, POLLOUT | POLLERR | POLLHUP);
#ifdef DOTRACE
write(tech_pvt->fd, bp, (int) globals.mtu);
#endif
towrite = bytes >= globals.mtu ? globals.mtu : bytes;
result = sangoma_sendmsg_socket(tech_pvt->socket,
&tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), bp, towrite, 0);
if (result < 0) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
"Bad Write frame len %u write %d bytes returned %d (%s)!\n", frame->datalen,
globals.mtu, result, strerror(errno));
if (errno == EBUSY) {
continue;
}
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Failed!\n");
status = SWITCH_STATUS_GENERR;
break;
} else {
bytes -= result;
bp += result;
result = 0;
}
}
//printf("write %d %d\n", frame->datalen, status);
return status;
}
static switch_status wanpipe_send_dtmf(switch_core_session *session, char *digits)
{
struct private_object *tech_pvt;
switch_channel *channel = NULL;
switch_status status = SWITCH_STATUS_SUCCESS;
int wrote = 0;
char *cur = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
if (!tech_pvt->dtmf_buffer) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocate DTMF Buffer....");
if (switch_buffer_create(switch_core_session_get_pool(session), &tech_pvt->dtmf_buffer, 3192) != SWITCH_STATUS_SUCCESS) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "FAILURE!\n");
return SWITCH_STATUS_FALSE;
} else {
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "SUCCESS!\n");
}
}
for (cur = digits; *cur; cur++) {
if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int)*cur]))) {
switch_buffer_write(tech_pvt->dtmf_buffer, tech_pvt->tone_session.buffer, wrote * 2);
}
}
tech_pvt->skip_read_frames = 200;
return status;
}
static switch_status wanpipe_receive_message(switch_core_session *session, switch_core_session_message *msg)
{
return SWITCH_STATUS_FALSE;
}
static switch_status wanpipe_kill_channel(switch_core_session *session, int sig)
{
struct private_object *tech_pvt;
switch_channel *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
switch_set_flag(tech_pvt, TFLAG_BYE);
switch_clear_flag(tech_pvt, TFLAG_MEDIA);
return SWITCH_STATUS_SUCCESS;
}
static const switch_io_routines wanpipe_io_routines = {
/*.outgoing_channel */ wanpipe_outgoing_channel,
/*.answer_channel */ wanpipe_answer_channel,
/*.read_frame */ wanpipe_read_frame,
/*.write_frame */ wanpipe_write_frame,
/*.kill_channel */ wanpipe_kill_channel,
/*.waitfor_read */ NULL,
/*.waitfor_read */ NULL,
/*.send_dtmf*/ wanpipe_send_dtmf,
/*.receive_message*/ wanpipe_receive_message
};
static const switch_state_handler_table wanpipe_state_handlers = {
/*.on_init */ wanpipe_on_init,
/*.on_ring */ wanpipe_on_ring,
/*.on_execute */ NULL,
/*.on_hangup */ wanpipe_on_hangup,
/*.on_loopback */ wanpipe_on_loopback,
/*.on_transmit */ wanpipe_on_transmit
};
static const switch_endpoint_interface wanpipe_endpoint_interface = {
/*.interface_name */ "wanpipe",
/*.io_routines */ &wanpipe_io_routines,
/*.state_handlers */ &wanpipe_state_handlers,
/*.private */ NULL,
/*.next */ NULL
};
static const switch_loadable_module_interface wanpipe_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ &wanpipe_endpoint_interface,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ NULL,
/*.application_interface */ NULL
};
static switch_status wanpipe_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
switch_core_session **new_session, switch_memory_pool *pool)
{
@@ -600,304 +901,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
return SWITCH_STATUS_GENERR;
}
static switch_status wanpipe_answer_channel(switch_core_session *session)
{
struct private_object *tech_pvt;
switch_channel *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
if (switch_test_flag(tech_pvt, TFLAG_INBOUND) && !switch_test_flag(tech_pvt, TFLAG_NOSIG)) {
pri_answer(tech_pvt->spri->pri, tech_pvt->call, 0, 1);
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status wanpipe_read_frame(switch_core_session *session, switch_frame **frame, int timeout,
switch_io_flag flags, int stream_id)
{
struct private_object *tech_pvt;
switch_channel *channel = NULL;
void *bp;
int bytes = 0, res = 0;
char digit_str[80];
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
bp = tech_pvt->databuf;
*frame = NULL;
memset(tech_pvt->databuf, 0, sizeof(tech_pvt->databuf));
while (bytes < globals.mtu) {
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
if ((res = sangoma_socket_waitfor(tech_pvt->socket, timeout, POLLIN | POLLERR)) < 0) {
return SWITCH_STATUS_GENERR;
} else if (res == 0) {
tech_pvt->read_frame.datalen = 0;
return SWITCH_STATUS_SUCCESS;
}
if ((res = sangoma_readmsg_socket(tech_pvt->socket,
&tech_pvt->hdrframe,
sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) {
if (errno == EBUSY) {
continue;
} else {
return SWITCH_STATUS_GENERR;
}
}
bytes += res;
bp += bytes;
}
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
tech_pvt->read_frame.datalen = bytes;
tech_pvt->read_frame.samples = bytes / 2;
res = teletone_dtmf_detect (&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
res = teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str));
if(digit_str[0]) {
switch_channel_queue_dtmf(channel, digit_str);
if (globals.debug) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "DTMF DETECTED: [%s]\n", digit_str);
}
if (globals.supress_dtmf_tone) {
memset(tech_pvt->read_frame.data, 0, tech_pvt->read_frame.datalen);
}
}
if (tech_pvt->skip_read_frames > 0) {
memset(tech_pvt->read_frame.data, 0, tech_pvt->read_frame.datalen);
tech_pvt->skip_read_frames--;
}
#ifdef DOTRACE
write(tech_pvt->fd2, tech_pvt->read_frame.data, (int) tech_pvt->read_frame.datalen);
#endif
//printf("read %d\n", tech_pvt->read_frame.datalen);
*frame = &tech_pvt->read_frame;
return SWITCH_STATUS_SUCCESS;
}
static switch_status wanpipe_write_frame(switch_core_session *session, switch_frame *frame, int timeout,
switch_io_flag flags, int stream_id)
{
struct private_object *tech_pvt;
switch_channel *channel = NULL;
int res = 0;
int bytes = frame->datalen;
void *bp = frame->data;
unsigned char dtmf[1024];
int inuse, bread, bwrote = 0;
switch_status status = SWITCH_STATUS_SUCCESS;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
while (tech_pvt->dtmf_buffer && bwrote < frame->datalen && bytes > 0 && (inuse = switch_buffer_inuse(tech_pvt->dtmf_buffer)) > 0) {
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
if ((bread = switch_buffer_read(tech_pvt->dtmf_buffer, dtmf, globals.mtu)) < globals.mtu) {
while (bread < globals.mtu) {
dtmf[bread++] = 0;
}
}
sangoma_socket_waitfor(tech_pvt->socket, -1, POLLOUT | POLLERR | POLLHUP);
#ifdef DOTRACE
write(tech_pvt->fd, dtmf, (int) bread);
#endif
res = sangoma_sendmsg_socket(tech_pvt->socket,
&tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), dtmf, bread, 0);
if (res < 0) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
"Bad Write %d bytes returned %d (%s)!\n", bread,
res, strerror(errno));
if (errno == EBUSY) {
continue;
}
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Failed!\n");
status = SWITCH_STATUS_GENERR;
break;
} else {
bytes -= res;
bwrote += res;
bp += res;
res = 0;
}
}
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
if (tech_pvt->skip_write_frames) {
tech_pvt->skip_write_frames--;
return SWITCH_STATUS_SUCCESS;
}
while (bytes > 0) {
unsigned int towrite;
if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) {
return SWITCH_STATUS_GENERR;
}
sangoma_socket_waitfor(tech_pvt->socket, -1, POLLOUT | POLLERR | POLLHUP);
#ifdef DOTRACE
write(tech_pvt->fd, bp, (int) globals.mtu);
#endif
towrite = bytes >= globals.mtu ? globals.mtu : bytes;
res = sangoma_sendmsg_socket(tech_pvt->socket,
&tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), bp, towrite, 0);
if (res < 0) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
"Bad Write frame len %d write %d bytes returned %d (%s)!\n", frame->datalen,
globals.mtu, res, strerror(errno));
if (errno == EBUSY) {
continue;
}
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Failed!\n");
status = SWITCH_STATUS_GENERR;
break;
} else {
bytes -= res;
bp += res;
res = 0;
}
}
//printf("write %d %d\n", frame->datalen, status);
return status;
}
static switch_status wanpipe_send_dtmf(switch_core_session *session, char *digits)
{
struct private_object *tech_pvt;
switch_channel *channel = NULL;
switch_status status = SWITCH_STATUS_SUCCESS;
int wrote = 0;
char *cur = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
if (!tech_pvt->dtmf_buffer) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocate DTMF Buffer....");
if (switch_buffer_create(switch_core_session_get_pool(session), &tech_pvt->dtmf_buffer, 3192) != SWITCH_STATUS_SUCCESS) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "FAILURE!\n");
return SWITCH_STATUS_FALSE;
} else {
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "SUCCESS!\n");
}
}
for (cur = digits; *cur; cur++) {
if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int)*cur]))) {
switch_buffer_write(tech_pvt->dtmf_buffer, tech_pvt->tone_session.buffer, wrote * 2);
}
}
tech_pvt->skip_read_frames = 200;
return status;
}
static switch_status wanpipe_receive_message(switch_core_session *session, switch_core_session_message *msg)
{
return SWITCH_STATUS_FALSE;
}
static switch_status wanpipe_kill_channel(switch_core_session *session, int sig)
{
struct private_object *tech_pvt;
switch_channel *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
switch_set_flag(tech_pvt, TFLAG_BYE);
switch_clear_flag(tech_pvt, TFLAG_MEDIA);
return SWITCH_STATUS_SUCCESS;
}
static const switch_io_routines wanpipe_io_routines = {
/*.outgoing_channel */ wanpipe_outgoing_channel,
/*.answer_channel */ wanpipe_answer_channel,
/*.read_frame */ wanpipe_read_frame,
/*.write_frame */ wanpipe_write_frame,
/*.kill_channel */ wanpipe_kill_channel,
/*.waitfor_read */ NULL,
/*.waitfor_read */ NULL,
/*.send_dtmf*/ wanpipe_send_dtmf,
/*.receive_message*/ wanpipe_receive_message
};
static const switch_state_handler_table wanpipe_state_handlers = {
/*.on_init */ wanpipe_on_init,
/*.on_ring */ wanpipe_on_ring,
/*.on_execute */ NULL,
/*.on_hangup */ wanpipe_on_hangup,
/*.on_loopback */ wanpipe_on_loopback,
/*.on_transmit */ wanpipe_on_transmit
};
static const switch_endpoint_interface wanpipe_endpoint_interface = {
/*.interface_name */ "wanpipe",
/*.io_routines */ &wanpipe_io_routines,
/*.state_handlers */ &wanpipe_state_handlers,
/*.private */ NULL,
/*.next */ NULL
};
static const switch_loadable_module_interface wanpipe_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ &wanpipe_endpoint_interface,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ NULL,
/*.application_interface */ NULL
};
static void s_pri_error(struct pri *pri, char *s)
{
@@ -926,7 +930,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
}
/* start the pri's */
if ((status = config_wanpipe(0) != SWITCH_STATUS_SUCCESS)) {
if ((status = config_wanpipe(0)) != SWITCH_STATUS_SUCCESS) {
return status;
}
@@ -1222,7 +1226,7 @@ static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_typ
static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event)
{
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Caught Event span %d %d (%s)\n", spri->span, event_type,
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Caught Event span %d %u (%s)\n", spri->span, event_type,
sangoma_pri_event_str(event_type));
return 0;
}
@@ -1276,7 +1280,6 @@ static switch_status config_wanpipe(int reload)
{
switch_config cfg;
char *var, *val;
int count = 0;
char *cf = "wanpipe.conf";
int current_span = 0;
@@ -1404,7 +1407,7 @@ static switch_status config_wanpipe(int reload)
return count;
return SWITCH_STATUS_SUCCESS;
}
+20 -23
View File
@@ -329,8 +329,8 @@ static switch_status woomerachan_kill_channel(switch_core_session *session, int
udp_socket_close(tech_pvt);
switch_channel_hangup(channel);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s WOOMERACHAN KILL %d\n", switch_channel_get_name(channel),
tech_pvt->udp_socket);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel));
return SWITCH_STATUS_SUCCESS;
@@ -355,7 +355,7 @@ static switch_status woomerachan_waitfor_read(switch_core_session *session, int
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
return switch_socket_waitfor(&tech_pvt->read_poll, ms);
return switch_socket_waitfor(&tech_pvt->read_poll, ms) ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
}
static switch_status woomerachan_waitfor_write(switch_core_session *session, int ms, int stream_id)
@@ -375,7 +375,6 @@ static switch_status woomerachan_read_frame(switch_core_session *session, switch
switch_channel *channel = NULL;
struct private_object *tech_pvt = NULL;
switch_frame *pframe;
switch_status status;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -395,12 +394,12 @@ static switch_status woomerachan_read_frame(switch_core_session *session, switch
*frame = pframe;
pframe->datalen = sizeof(tech_pvt->databuf);
if ((status =
switch_socket_recvfrom(tech_pvt->udpread, tech_pvt->udp_socket, 0, tech_pvt->databuf,
&pframe->datalen)) == SWITCH_STATUS_SUCCESS) {
if (switch_socket_recvfrom(tech_pvt->udpread, tech_pvt->udp_socket, 0, tech_pvt->databuf, &pframe->datalen) == SWITCH_STATUS_SUCCESS) {
pframe->samples = (int) pframe->datalen / 2;
return SWITCH_STATUS_SUCCESS;
}
return status;
return SWITCH_STATUS_FALSE;
}
static switch_status woomerachan_write_frame(switch_core_session *session, switch_frame *frame, int timeout,
@@ -408,7 +407,7 @@ static switch_status woomerachan_write_frame(switch_core_session *session, switc
{
switch_channel *channel = NULL;
struct private_object *tech_pvt = NULL;
switch_frame *pframe;
//switch_frame *pframe;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -420,9 +419,12 @@ static switch_status woomerachan_write_frame(switch_core_session *session, switc
return SWITCH_STATUS_GENERR;
}
pframe = &tech_pvt->frame;
return switch_socket_sendto(tech_pvt->udp_socket, tech_pvt->udpwrite, 0, frame->data, &frame->datalen);
//pframe = &tech_pvt->frame;
if (switch_socket_sendto(tech_pvt->udp_socket, tech_pvt->udpwrite, 0, frame->data, &frame->datalen) == SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_GENERR;
}
static const switch_state_handler_table woomerachan_event_handlers = {
@@ -623,10 +625,9 @@ static int woomera_dequeue_event(woomera_event_queue * event_queue, woomera_mess
static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, int timeout, woomera_profile * profile,
woomera_event_queue * event_queue)
{
char *cur, *cr, *next = NULL, *eor = NULL;
char *cur, *cr, *next = NULL;
char buf[2048] = "", *ptr;
int bytes = 0;
int failto = 0;
memset(wmsg, 0, sizeof(woomera_message));
@@ -636,14 +637,13 @@ static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, in
if (timeout < 0) {
timeout = abs(timeout);
failto = 1;
} else if (timeout == 0) {
timeout = -1;
}
ptr = buf;
bytes = 0;
while ((eor = strstr(buf, WOOMERA_RECORD_SEPERATOR)) == 0) {
while (!strstr(buf, WOOMERA_RECORD_SEPERATOR)) {
size_t len = 1;
if (!profile->thread_running) {
@@ -774,14 +774,12 @@ static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile
{
switch_sockaddr_t *sa;
switch_status status;
status = switch_sockaddr_info_get(&sa, profile->woomera_host, AF_INET, profile->woomera_port, 0, module_pool);
if (status != SWITCH_STATUS_SUCCESS) {
if (switch_sockaddr_info_get(&sa, profile->woomera_host, AF_INET, profile->woomera_port, 0, module_pool) != SWITCH_STATUS_SUCCESS) {
return -1;
}
status = switch_socket_create(new_sock, AF_INET, SOCK_STREAM, 0, module_pool);
if (status != SWITCH_STATUS_SUCCESS) {
if (switch_socket_create(new_sock, AF_INET, SOCK_STREAM, 0, module_pool) != SWITCH_STATUS_SUCCESS) {
return -1;
}
/*
@@ -791,8 +789,7 @@ static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile
return -1;
}
*/
status = switch_socket_connect((*new_sock), sa);
if (status != SWITCH_STATUS_SUCCESS) {
if (switch_socket_connect((*new_sock), sa) != SWITCH_STATUS_SUCCESS) {
return -1;
}
@@ -1220,7 +1217,7 @@ static void *woomera_thread_run(void *obj)
profile->woomera_host, profile->woomera_port);
}
}*/
continue;
//continue;
}
if (!strcasecmp(wmsg.command, "INCOMING")) {
@@ -95,7 +95,6 @@ static void event_handler(switch_event *event)
switch (event->event_id) {
case SWITCH_EVENT_LOG:
return;
break;
default:
switch_event_serialize(event, buf, sizeof(buf), NULL);
len = strlen(buf);
@@ -191,7 +190,6 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
{
switch_event *local_event;
switch_status status;
char buf[1024];
globals.running = 1;
@@ -199,7 +197,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
switch_sockaddr_t addr = {0};
size_t len = sizeof(buf);
memset(buf, 0, len);
if ((status = switch_socket_recvfrom(&addr, globals.udp_socket, 0, buf, &len)) == SWITCH_STATUS_SUCCESS) {
if (switch_socket_recvfrom(&addr, globals.udp_socket, 0, buf, &len) == SWITCH_STATUS_SUCCESS) {
if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT) == SWITCH_STATUS_SUCCESS) {
char *var, *val, *term = NULL;
switch_event_add_header(local_event, SWITCH_STACK_BOTTOM, "Multicast", "yes");
@@ -43,7 +43,6 @@ static void event_handler(switch_event *event)
switch (event->event_id) {
case SWITCH_EVENT_LOG:
return;
break;
default:
switch_event_serialize(event, buf, sizeof(buf), NULL);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nEVENT\n--------------------------------\n%s\n", buf);
@@ -144,13 +144,13 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_jid, globals.jid)
}
int on_result(struct session *sess, ikspak * pak)
static int on_result(struct session *sess, ikspak * pak)
{
return IKS_FILTER_EAT;
}
int on_stream(struct session *sess, int type, iks * node)
static int on_stream(struct session *sess, int type, iks * node)
{
sess->counter = opt_timeout;
@@ -216,7 +216,7 @@ int on_stream(struct session *sess, int type, iks * node)
return IKS_OK;
}
int on_msg(void *user_data, ikspak * pak)
static int on_msg(void *user_data, ikspak * pak)
{
char *cmd = iks_find_cdata(pak->x, "body");
char *arg = NULL;
@@ -238,13 +238,13 @@ int on_msg(void *user_data, ikspak * pak)
return 0;
}
int on_error(void *user_data, ikspak * pak)
static int on_error(void *user_data, ikspak * pak)
{
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "authorization failed\n");
return IKS_FILTER_EAT;
}
void on_log(struct session *sess, const char *data, size_t size, int is_incoming)
static void on_log(struct session *sess, const char *data, size_t size, int is_incoming)
{
if (iks_is_secure(sess->parser))
fprintf(stderr, "Sec");
@@ -255,7 +255,7 @@ void on_log(struct session *sess, const char *data, size_t size, int is_incoming
fprintf(stderr, "[%s]\n", data);
}
void j_setup_filter(struct session *sess)
static void j_setup_filter(struct session *sess)
{
if (my_filter)
iks_filter_delete(my_filter);
@@ -172,7 +172,7 @@ static void event_handler(switch_event *event)
my_service_reply,
NULL,
&globals.disc_id)) != SW_OKAY) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "publish failed: %d\n", result);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "publish failed: %u\n", result);
sw_text_record_fina(text_record);
switch_mutex_unlock(globals.zc_lock);
return;
+5 -5
View File
@@ -41,7 +41,7 @@ struct sndfile_context {
typedef struct sndfile_context sndfile_context;
switch_status sndfile_file_open(switch_file_handle *handle, char *path)
static switch_status sndfile_file_open(switch_file_handle *handle, char *path)
{
sndfile_context *context;
int mode = 0;
@@ -144,7 +144,7 @@ switch_status sndfile_file_open(switch_file_handle *handle, char *path)
return SWITCH_STATUS_SUCCESS;
}
switch_status sndfile_file_close(switch_file_handle *handle)
static switch_status sndfile_file_close(switch_file_handle *handle)
{
sndfile_context *context = handle->private_info;
@@ -153,7 +153,7 @@ switch_status sndfile_file_close(switch_file_handle *handle)
return SWITCH_STATUS_SUCCESS;
}
switch_status sndfile_file_seek(switch_file_handle *handle, unsigned int *cur_sample, int64_t samples, int whence)
static switch_status sndfile_file_seek(switch_file_handle *handle, unsigned int *cur_sample, int64_t samples, int whence)
{
sndfile_context *context = handle->private_info;
@@ -169,7 +169,7 @@ switch_status sndfile_file_seek(switch_file_handle *handle, unsigned int *cur_sa
}
switch_status sndfile_file_read(switch_file_handle *handle, void *data, size_t *len)
static switch_status sndfile_file_read(switch_file_handle *handle, void *data, size_t *len)
{
size_t inlen = *len;
sndfile_context *context = handle->private_info;
@@ -191,7 +191,7 @@ switch_status sndfile_file_read(switch_file_handle *handle, void *data, size_t *
return SWITCH_STATUS_SUCCESS;
}
switch_status sndfile_file_write(switch_file_handle *handle, void *data, size_t *len)
static switch_status sndfile_file_write(switch_file_handle *handle, void *data, size_t *len)
{
size_t inlen = *len;
sndfile_context *context = handle->private_info;
+1 -1
View File
@@ -40,7 +40,7 @@ $(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c $(MODNAME).o $(OBJS)
$(CC) $(SOLINK) -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(MODNAME).o $(OBJS) $(LDFLAGS)
clean:
rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~ perlxsi.c .perlok
rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~ .perlok
install:
mkdir -p $(PREFIX)/perl
+3 -1
View File
@@ -29,7 +29,9 @@
* mod_perl.c -- Perl
*
*/
#ifdef __ICC
#pragma warning (disable:1419)
#endif
#ifdef _MSC_VER
#include <perlibs.h>
#pragma comment(lib, PERL_LIB)
+19
View File
@@ -0,0 +1,19 @@
#ifdef __ICC
#pragma warning (disable:1419)
#endif
#include <EXTERN.h>
#include <perl.h>
EXTERN_C void xs_init (pTHX);
EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
EXTERN_C void
xs_init(pTHX)
{
char *file = __FILE__;
dXSUB_SYS;
/* DynaLoader is a special case */
newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
}
+10 -2
View File
@@ -1,4 +1,9 @@
#include <switch.h>
#ifdef __ICC
#pragma warning (disable:1418)
#endif
#ifdef _MSC_VER
#include <perlibs.h>
@@ -108,9 +113,12 @@ void fs_channel_set_state(struct switch_core_session *session, char *state)
switch_channel_set_state(channel, fs_state);
}
int fs_ivr_play_file(struct switch_core_session *session, char *file, char *timer_name_in)
int fs_ivr_play_file(struct switch_core_session *session, char *file, char *timer_name)
{
char *timer_name = switch_strlen_zero(timer_name_in) ? NULL : timer_name;
if (switch_strlen_zero(timer_name)) {
timer_name = NULL;
}
switch_status status = switch_ivr_play_file(session, NULL, file, timer_name, NULL, NULL, 0);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
}
@@ -33,6 +33,9 @@
#define HAVE_CURL
#endif
#define JS_BUFFER_SIZE 131072
#ifdef __ICC
#pragma warning (disable:310 193 1418)
#endif
#include <switch.h>
#include "jstypes.h"
@@ -1363,8 +1366,8 @@ static JSBool db_fetch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
}
for (x = 0; x < colcount; x++) {
snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"",
switch_core_db_column_name(dbo->stmt, x),
switch_core_db_column_text(dbo->stmt, x));
(char *) switch_core_db_column_name(dbo->stmt, x),
(char *) switch_core_db_column_text(dbo->stmt, x));
eval_some_js(code, dbo->cx, dbo->obj, rval);
if (*rval == JS_FALSE) {
@@ -1517,7 +1520,7 @@ static JSBool teletone_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
(read_codec->implementation->samples_per_second / 50) * read_codec->implementation->number_of_channels,
pool) == SWITCH_STATUS_SUCCESS) {
tto->timer = &tto->timer_base;
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Timer INIT Success %d\n", ms);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Timer INIT Success %u\n", ms);
} else {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Timer INIT Failed\n");
}
@@ -1653,9 +1656,7 @@ static JSBool teletone_generate(JSContext *cx, JSObject *obj, uintN argc, jsval
}
if (tto->timer) {
int x;
if ((x = switch_core_timer_next(tto->timer)) < 0) {
if (switch_core_timer_next(tto->timer)< 0) {
break;
}
@@ -1850,7 +1851,7 @@ static JSBool js_email(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
if ( argc > 4) {
file = JS_GetStringBytes(JS_ValueToString(cx, argv[4]));
}
snprintf(filename, 80, "%smail.%ld", SWITCH_GLOBAL_dirs.temp_dir, switch_time_now());
snprintf(filename, 80, "%smail.%ld%04x", SWITCH_GLOBAL_dirs.temp_dir, time(NULL), rand() & 0xffff);
if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
if (file) {
@@ -2051,7 +2052,7 @@ static int env_init(JSContext *cx, JSObject *javascript_object)
static void js_parse_and_execute(switch_core_session *session, char *input_code)
{
JSObject *javascript_global_object = NULL, *session_obj = NULL;
JSObject *javascript_global_object = NULL;
char buf[1024], *script, *arg, *argv[512];
int argc = 0, x = 0, y = 0;
unsigned int flags = 0;
@@ -2067,7 +2068,7 @@ static void js_parse_and_execute(switch_core_session *session, char *input_code)
JS_SetGlobalObject(cx, javascript_global_object);
/* Emaculent conception of session object into the script if one is available */
if (session && (session_obj = new_js_session(cx, javascript_global_object, session, &jss, "session", flags))) {
if (session && new_js_session(cx, javascript_global_object, session, &jss, "session", flags)) {
JS_SetPrivate(cx, javascript_global_object, session);
}
} else {