[commit] r5115 - in freeswitch/trunk: libs/curl libs/curl/lib src src/include src/mod/applications/mod_bridgecall src/mod/applications/mod_esf
Author: anthm Date: Wed May 9 15:44:15 2007 New Revision: 5115 Modified: freeswitch/trunk/libs/curl/lib/config.h.in freeswitch/trunk/libs/curl/mkinstalldirs freeswitch/trunk/src/include/switch_types.h freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c freeswitch/trunk/src/switch_channel.c freeswitch/trunk/src/switch_core_session.c freeswitch/trunk/src/switch_core_state_machine.c freeswitch/trunk/src/switch_ivr.c freeswitch/trunk/src/switch_ivr_async.c freeswitch/trunk/src/switch_ivr_bridge.c freeswitch/trunk/src/switch_ivr_originate.c freeswitch/trunk/src/switch_rtp.c Log: these aren't the droids you're looking for.... Modified: freeswitch/trunk/libs/curl/lib/config.h.in ============================================================================== --- freeswitch/trunk/libs/curl/lib/config.h.in (original) +++ freeswitch/trunk/libs/curl/lib/config.h.in Wed May 9 15:44:15 2007 @@ -621,16 +621,16 @@ /* Define to the function return type for send. */ #undef SEND_TYPE_RETV -/* The size of a `curl_off_t', as computed by sizeof. */ +/* The size of `curl_off_t', as computed by sizeof. */ #undef SIZEOF_CURL_OFF_T -/* The size of a `long', as computed by sizeof. */ +/* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The size of a `size_t', as computed by sizeof. */ +/* The size of `size_t', as computed by sizeof. */ #undef SIZEOF_SIZE_T -/* The size of a `time_t', as computed by sizeof. */ +/* The size of `time_t', as computed by sizeof. */ #undef SIZEOF_TIME_T /* Define to 1 if you have the ANSI C header files. */ @@ -685,7 +685,7 @@ /* type to use in place of in_addr_t if not defined */ #undef in_addr_t -/* Define to `unsigned' if <sys/types.h> does not define. */ +/* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t /* type to use in place of socklen_t if not defined */ Modified: freeswitch/trunk/libs/curl/mkinstalldirs ============================================================================== --- freeswitch/trunk/libs/curl/mkinstalldirs (original) +++ freeswitch/trunk/libs/curl/mkinstalldirs Wed May 9 15:44:15 2007 @@ -1,40 +1,150 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Public domain -# $Id: mkinstalldirs,v 1.2 2000/01/10 23:36:14 bagder Exp $ +scriptversion=2004-02-15.20 + +# Original author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to <bug-automake@gnu.org>." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --version) + echo "$0 $scriptversion" + exit 0 + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. +case $dirmode in + '') + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version + fi + ;; + *) + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done + fi + ;; +esac for file do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi - pathcomp="$pathcomp/" - done + pathcomp="$pathcomp/" + done done exit $errstatus -# mkinstalldirs ends here +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: Modified: freeswitch/trunk/src/include/switch_types.h ============================================================================== --- freeswitch/trunk/src/include/switch_types.h (original) +++ freeswitch/trunk/src/include/switch_types.h Wed May 9 15:44:15 2007 @@ -95,6 +95,7 @@ #define SWITCH_PATH_SEPARATOR "/" #endif #define SWITCH_URL_SEPARATOR "://" +#define SWITCH_BYPASS_MEDIA_VARIABLE "bypass_media" #define SWITCH_ENDPOINT_DISPOSITION_VARIABLE "endpoint_disposition" #define SWITCH_HOLD_MUSIC_VARIABLE "hold_music" #define SWITCH_EXPORT_VARS_VARIABLE "export_vars" @@ -544,7 +545,7 @@ CF_TAGGED = (1 << 10) - Channel is tagged CF_WINNER = (1 << 11) - Channel is the winner CF_CONTROLLED = (1 << 12) - Channel is under control -CF_NOMEDIA = (1 << 13) - Channel has no media +CF_BYPASS_MEDIA = (1 << 13) - Channel has no media CF_SUSPEND = (1 << 14) - Suspend i/o CF_EVENT_PARSE = (1 << 15) - Suspend control events CF_REPEAT_STATE = (1 << 16) - Tell the state machine to repeat a state @@ -571,7 +572,7 @@ CF_TAGGED = (1 << 10), CF_WINNER = (1 << 11), CF_CONTROLLED = (1 << 12), - CF_NOMEDIA = (1 << 13), + CF_BYPASS_MEDIA = (1 << 13), CF_SUSPEND = (1 << 14), CF_EVENT_PARSE = (1 << 15), CF_REPEAT_STATE = (1 << 16), Modified: freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c (original) +++ freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c Wed May 9 15:44:15 2007 @@ -61,11 +61,11 @@ do_continue = switch_true(var); } - if (switch_channel_test_flag(caller_channel, CF_NOMEDIA) - || ((var = switch_channel_get_variable(caller_channel, "no_media")) && switch_true(var))) { + if (switch_channel_test_flag(caller_channel, CF_BYPASS_MEDIA) + || ((var = switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE)) && switch_true(var))) { if (!switch_channel_test_flag(caller_channel, CF_ANSWERED) && !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) { - switch_channel_set_flag(caller_channel, CF_NOMEDIA); + switch_channel_set_flag(caller_channel, CF_BYPASS_MEDIA); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is already up, delaying point-to-point mode 'till both legs are up.\n"); no_media_bridge = 1; @@ -107,7 +107,7 @@ switch_ivr_nomedia(switch_core_session_get_uuid(peer_session), SMF_FORCE); switch_ivr_signal_bridge(session, peer_session); } else { - if (switch_channel_test_flag(caller_channel, CF_NOMEDIA)) { + if (switch_channel_test_flag(caller_channel, CF_BYPASS_MEDIA)) { switch_ivr_signal_bridge(session, peer_session); } else { switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL); Modified: freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c (original) +++ freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c Wed May 9 15:44:15 2007 @@ -102,7 +102,7 @@ } - if (switch_true(switch_channel_get_variable(channel, "no_media"))) { + if (switch_true(switch_channel_get_variable(channel, SWITCH_BYPASS_MEDIA_VARIABLE))) { switch_core_session_message_t msg = { 0 }; ready = SEND_TYPE_NOMEDIA; Modified: freeswitch/trunk/src/switch_channel.c ============================================================================== --- freeswitch/trunk/src/switch_channel.c (original) +++ freeswitch/trunk/src/switch_channel.c Wed May 9 15:44:15 2007 @@ -431,7 +431,7 @@ assert(channel != NULL); - if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE))) { + if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { switch_core_session_t *session; if ((session = switch_core_session_locate(uuid))) { switch_channel_set_flag(switch_core_session_get_channel(session), flags); @@ -449,7 +449,7 @@ assert(channel != NULL); - if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE))) { + if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { switch_core_session_t *session; if ((session = switch_core_session_locate(uuid))) { switch_channel_clear_flag(switch_core_session_get_channel(session), flags); Modified: freeswitch/trunk/src/switch_core_session.c ============================================================================== --- freeswitch/trunk/src/switch_core_session.c (original) +++ freeswitch/trunk/src/switch_core_session.c Wed May 9 15:44:15 2007 @@ -296,8 +296,8 @@ switch_channel_set_variable(peer_channel, SWITCH_MAX_FORWARDS_VARIABLE, val); } - if (switch_channel_test_flag(channel, CF_NOMEDIA)) { - switch_channel_set_flag(peer_channel, CF_NOMEDIA); + if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) { + switch_channel_set_flag(peer_channel, CF_BYPASS_MEDIA); } if (profile) { @@ -606,6 +606,7 @@ switch_ivr_deactivate_unicast(session); switch_channel_clear_flag(channel, CF_BREAK); + } @@ -996,7 +997,7 @@ goto done; } - if (switch_channel_test_flag(session->channel, CF_NOMEDIA) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) { + if (switch_channel_test_flag(session->channel, CF_BYPASS_MEDIA) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application %s Cannot be used with NO_MEDIA mode!\n", extension->current_application->application_name); status = SWITCH_STATUS_FALSE; Modified: freeswitch/trunk/src/switch_core_state_machine.c ============================================================================== --- freeswitch/trunk/src/switch_core_state_machine.c (original) +++ freeswitch/trunk/src/switch_core_state_machine.c Wed May 9 15:44:15 2007 @@ -129,7 +129,7 @@ return; } - if (switch_channel_test_flag(session->channel, CF_NOMEDIA) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) { + if (switch_channel_test_flag(session->channel, CF_BYPASS_MEDIA) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application %s Cannot be used with NO_MEDIA mode!\n", extension->current_application->application_name); switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); Modified: freeswitch/trunk/src/switch_ivr.c ============================================================================== --- freeswitch/trunk/src/switch_ivr.c (original) +++ freeswitch/trunk/src/switch_ivr.c Wed May 9 15:44:15 2007 @@ -271,7 +271,8 @@ unsigned long CMD_HANGUP = switch_hashfunc_default("hangup", &hlen); unsigned long CMD_NOMEDIA = switch_hashfunc_default("nomedia", &hlen); unsigned long CMD_UNICAST = switch_hashfunc_default("unicast", &hlen); - + char *lead_frames = switch_event_get_header(event, "lead-frames"); + assert(channel != NULL); assert(event != NULL); @@ -285,6 +286,21 @@ switch_channel_set_flag(channel, CF_EVENT_PARSE); + if (lead_frames) { + switch_frame_t *read_frame; + int frame_count = atoi(lead_frames); + switch_status_t status; + + while(frame_count > 0) { + status = switch_core_session_read_frame(session, &read_frame, -1, 0); + if (!SWITCH_READ_ACCEPTABLE(status)) { + return status; + } + if (!switch_test_flag(read_frame, SFF_CNG)) { + frame_count--; + } + } + } if (cmd_hash == CMD_EXECUTE) { const switch_application_interface_t *application_interface; @@ -304,7 +320,7 @@ switch_channel_set_flag(channel, CF_BROADCAST); for (x = 0; x < loops || loops < 0; x++) { switch_core_session_exec(session, application_interface, app_arg); - if (!switch_channel_test_flag(channel, CF_BROADCAST)) { + if (!switch_channel_ready(channel) || !switch_channel_test_flag(channel, CF_BROADCAST)) { break; } } @@ -718,9 +734,9 @@ swap = 1; } - if (switch_channel_test_flag(channel, CF_NOMEDIA)) { + if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) { status = SWITCH_STATUS_SUCCESS; - switch_channel_clear_flag(channel, CF_NOMEDIA); + switch_channel_clear_flag(channel, CF_BYPASS_MEDIA); switch_core_session_receive_message(session, &msg); if ((flags & SMF_REBRIDGE) @@ -773,8 +789,8 @@ swap = 1; } - if ((flags & SMF_FORCE) || !switch_channel_test_flag(channel, CF_NOMEDIA)) { - switch_channel_set_flag(channel, CF_NOMEDIA); + if ((flags & SMF_FORCE) || !switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) { + switch_channel_set_flag(channel, CF_BYPASS_MEDIA); switch_core_session_receive_message(session, &msg); if ((flags & SMF_REBRIDGE) && (other_uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(other_uuid))) { Modified: freeswitch/trunk/src/switch_ivr_async.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_async.c (original) +++ freeswitch/trunk/src/switch_ivr_async.c Wed May 9 15:44:15 2007 @@ -779,10 +779,10 @@ channel = switch_core_session_get_channel(session); assert(channel != NULL); - if ((nomedia = switch_channel_test_flag(channel, CF_NOMEDIA))) { + if ((nomedia = switch_channel_test_flag(channel, CF_BYPASS_MEDIA))) { switch_ivr_media(uuid, SMF_REBRIDGE); } - + if ((p = strchr(mypath, ':'))) { app = mypath; *p++ = '\0'; @@ -802,10 +802,11 @@ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-name", "%s", app); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-arg", "%s", path); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); if ((flags & SMF_LOOP)) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "loops", "%d", -1); } - + switch_core_session_queue_private_event(other_session, &event); } @@ -819,6 +820,7 @@ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-name", "%s", app); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-arg", "%s", path); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); if ((flags & SMF_LOOP)) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "loops", "%d", -1); } Modified: freeswitch/trunk/src/switch_ivr_bridge.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_bridge.c (original) +++ freeswitch/trunk/src/switch_ivr_bridge.c Wed May 9 15:44:15 2007 @@ -52,7 +52,6 @@ switch_input_callback_function_t input_callback; switch_core_session_message_t *message, msg = { 0 }; void *user_data; - switch_channel_t *chan_a, *chan_b; switch_frame_t *read_frame; switch_core_session_t *session_a, *session_b; @@ -81,7 +80,7 @@ switch_channel_state_t b_state; switch_status_t status; switch_event_t *event; - + /* if you really want to make sure it's not ready, test it twice because it might be just a break */ if (!switch_channel_ready(chan_a) && !switch_channel_ready(chan_a)) { break; @@ -97,12 +96,24 @@ break; } + if (switch_channel_test_flag(chan_a, CF_SUSPEND) || switch_channel_test_flag(chan_b, CF_SUSPEND)) { + switch_yield(100000); + continue; + } + if (switch_core_session_dequeue_private_event(session_a, &event) == SWITCH_STATUS_SUCCESS) { switch_channel_set_flag(chan_b, CF_SUSPEND); + msg.string_arg = data->b_uuid; + msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; + msg.from = __FILE__; + switch_core_session_receive_message(session_a, &msg); switch_ivr_parse_event(session_a, event); + msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; + switch_core_session_receive_message(session_a, &msg); switch_channel_clear_flag(chan_b, CF_SUSPEND); switch_event_destroy(&event); } + /* if 1 channel has DTMF pass it to the other */ if (switch_channel_has_dtmf(chan_a)) { @@ -154,11 +165,6 @@ } - if (switch_channel_test_flag(chan_a, CF_SUSPEND) || switch_channel_test_flag(chan_b, CF_SUSPEND)) { - switch_yield(10000); - continue; - } - /* read audio from 1 channel and write it to the other */ status = switch_core_session_read_frame(session_a, &read_frame, -1, stream_id); @@ -180,6 +186,7 @@ msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; msg.from = __FILE__; switch_core_session_receive_message(session_a, &msg); + switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK); switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL); Modified: freeswitch/trunk/src/switch_ivr_originate.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_originate.c (original) +++ freeswitch/trunk/src/switch_ivr_originate.c Wed May 9 15:44:15 2007 @@ -607,7 +607,7 @@ } if (session && (read_codec = switch_core_session_get_read_codec(session)) && - (ringback_data || !switch_channel_test_flag(caller_channel, CF_NOMEDIA))) { + (ringback_data || !switch_channel_test_flag(caller_channel, CF_BYPASS_MEDIA))) { if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) { if (switch_core_codec_init(&write_codec, @@ -713,7 +713,7 @@ } /* read from the channel while we wait if the audio is up on it */ - if (session && (ringback_data || !switch_channel_test_flag(caller_channel, CF_NOMEDIA)) && + if (session && (ringback_data || !switch_channel_test_flag(caller_channel, CF_BYPASS_MEDIA)) && (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA))) { switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0); @@ -777,7 +777,7 @@ idx = IDX_CANCEL; } - if (session && (ringback_data || !switch_channel_test_flag(caller_channel, CF_NOMEDIA))) { + if (session && (ringback_data || !switch_channel_test_flag(caller_channel, CF_BYPASS_MEDIA))) { switch_core_session_reset(session); } Modified: freeswitch/trunk/src/switch_rtp.c ============================================================================== --- freeswitch/trunk/src/switch_rtp.c (original) +++ freeswitch/trunk/src/switch_rtp.c Wed May 9 15:44:15 2007 @@ -375,7 +375,7 @@ done: if (status != SWITCH_STATUS_SUCCESS) { - rtp_session->ready = 0; + rtp_session->ready = 1; } if (new_sock) { @@ -817,7 +817,7 @@ switch_status_t status; uint8_t check = 1; stfu_frame_t *jb_frame; - + if (!rtp_session->timer.interval) { rtp_session->last_time = switch_time_now(); } @@ -825,7 +825,7 @@ while (switch_rtp_ready(rtp_session)) { bytes = sizeof(rtp_msg_t); status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock, 0, (void *) &rtp_session->recv_msg, &bytes); - + if (!SWITCH_STATUS_IS_BREAK(status) && rtp_session->timer.interval) { switch_core_timer_step(&rtp_session->timer); }
participants (1)
-
Freeswitch SVN