mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-25 12:10:18 +00:00
cross t's and dot i's
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7075 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
e790b22af1
commit
1bbeb4f706
@ -68,7 +68,7 @@
|
|||||||
<!-- File to play when you're alone (music on hold)-->
|
<!-- File to play when you're alone (music on hold)-->
|
||||||
<param name="moh-sound" value="$${moh_uri}"/>
|
<param name="moh-sound" value="$${moh_uri}"/>
|
||||||
<!-- File to play when you join the conference -->
|
<!-- File to play when you join the conference -->
|
||||||
<!--<param name="enter-sound" value="welcome.wav"/>-->
|
<param name="enter-sound" value="tone_stream://%(1000,0,500)"/>
|
||||||
<!-- File to play when you leave the conference -->
|
<!-- File to play when you leave the conference -->
|
||||||
<!--<param name="exit-sound" value="exit.wav"/>-->
|
<!--<param name="exit-sound" value="exit.wav"/>-->
|
||||||
<!-- File to play when you ae ejected from the conference -->
|
<!-- File to play when you ae ejected from the conference -->
|
||||||
|
@ -98,6 +98,7 @@
|
|||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<extension name="extension-intercom">
|
<extension name="extension-intercom">
|
||||||
|
<condition field="${sip_to_params}" expression="intercom\=true" continue="on-true"/>
|
||||||
<condition field="destination_number" expression="^8(10[01][0-9])$">
|
<condition field="destination_number" expression="^8(10[01][0-9])$">
|
||||||
<action application="set" data="dialed_ext=$1"/>
|
<action application="set" data="dialed_ext=$1"/>
|
||||||
<action application="export" data="sip_h_Call-Info=<sip:$${domain}>;answer-after=0"/>
|
<action application="export" data="sip_h_Call-Info=<sip:$${domain}>;answer-after=0"/>
|
||||||
@ -166,7 +167,7 @@
|
|||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<extension name="rtp_multicast_page">
|
<extension name="rtp_multicast_page">
|
||||||
<condition field="destination_number" expression="^pagegroup$">
|
<condition field="destination_number" expression="^pagegroup$|^7243">
|
||||||
<action application="esf_page_group"/>
|
<action application="esf_page_group"/>
|
||||||
</condition>
|
</condition>
|
||||||
</extension>
|
</extension>
|
||||||
@ -215,6 +216,13 @@
|
|||||||
</condition>
|
</condition>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
|
<extension name="milliwatt">
|
||||||
|
<condition field="destination_number" expression="^9997$">
|
||||||
|
<action application="answer"/>
|
||||||
|
<action application="playback" data="tone_stream://%(10000,0,1004);loops=-1"/>
|
||||||
|
</condition>
|
||||||
|
</extension>
|
||||||
|
|
||||||
<extension name="tone_stream">
|
<extension name="tone_stream">
|
||||||
<condition field="destination_number" expression="^9998$">
|
<condition field="destination_number" expression="^9998$">
|
||||||
<action application="answer"/>
|
<action application="answer"/>
|
||||||
|
4
libs/libedit/configure
vendored
4
libs/libedit/configure
vendored
@ -420,7 +420,7 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
|||||||
|
|
||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='libedit'
|
PACKAGE_NAME='libedit'
|
||||||
PACKAGE_TARNAME='libedit-20071219'
|
PACKAGE_TARNAME='libedit-20071230'
|
||||||
PACKAGE_VERSION='2.10'
|
PACKAGE_VERSION='2.10'
|
||||||
PACKAGE_STRING='libedit 2.10'
|
PACKAGE_STRING='libedit 2.10'
|
||||||
PACKAGE_BUGREPORT=''
|
PACKAGE_BUGREPORT=''
|
||||||
@ -1816,7 +1816,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='libedit-20071219'
|
PACKAGE='libedit-20071230'
|
||||||
VERSION='2.10'
|
VERSION='2.10'
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ print "Call: $data->{'caller-channel-name'} $data->{'unique-id'}\n";
|
|||||||
$o = $fs->call_command("answer");
|
$o = $fs->call_command("answer");
|
||||||
#to turn on events when in async mode
|
#to turn on events when in async mode
|
||||||
$o = $fs->raw_command("myevents");
|
$o = $fs->raw_command("myevents");
|
||||||
$o = $fs->call_command("playback", "/ram/swimp.raw");
|
$o = $fs->call_command("echo");
|
||||||
|
|
||||||
|
|
||||||
#comment exit in async mode
|
#comment exit in async mode
|
||||||
@ -38,6 +38,7 @@ while(my $r = $fs->readhash(undef)) {
|
|||||||
}
|
}
|
||||||
if ($r->{event}->{'event-name'} !~ /execute/i) {
|
if ($r->{event}->{'event-name'} !~ /execute/i) {
|
||||||
printf "wtf $data->{'unique-id'}\n";
|
printf "wtf $data->{'unique-id'}\n";
|
||||||
|
print ".";
|
||||||
$o = $fs->call_command("break");
|
$o = $fs->call_command("break");
|
||||||
$o = $fs->call_command("hangup");
|
$o = $fs->call_command("hangup");
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_c
|
|||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session, const char *uuid, switch_eavesdrop_flag_t flags);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session, const char *uuid, switch_eavesdrop_flag_t flags);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_t *session, char *file, uint32_t limit, const char *flags);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_t *session, const char *file, uint32_t limit, const char *flags);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_session_t *session, const char *file);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_session_t *session, const char *file);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -195,6 +195,8 @@ struct switch_timer {
|
|||||||
switch_memory_pool_t *memory_pool;
|
switch_memory_pool_t *memory_pool;
|
||||||
/*! private data for loadable modules to store information */
|
/*! private data for loadable modules to store information */
|
||||||
void *private_info;
|
void *private_info;
|
||||||
|
/*! remaining time from last call to _check()*/
|
||||||
|
switch_size_t diff;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -2028,7 +2028,7 @@ SWITCH_STANDARD_API(uuid_dump_function)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch_assert(buf);
|
switch_assert(buf);
|
||||||
stream->write_function(stream, buf);
|
stream->raw_write_function(stream, (unsigned char *)buf, strlen(buf));
|
||||||
switch_event_destroy(&event);
|
switch_event_destroy(&event);
|
||||||
free(buf);
|
free(buf);
|
||||||
} else {
|
} else {
|
||||||
|
@ -558,7 +558,7 @@ static switch_status_t conference_add_member(conference_obj_t * conference, conf
|
|||||||
conference_stop_file(conference, FILE_STOP_ASYNC);
|
conference_stop_file(conference, FILE_STOP_ASYNC);
|
||||||
}
|
}
|
||||||
if(conference->enter_sound) {
|
if(conference->enter_sound) {
|
||||||
conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
|
conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -808,7 +808,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread,
|
|||||||
/* Lead in time */
|
/* Lead in time */
|
||||||
if (conference->fnode->leadin) {
|
if (conference->fnode->leadin) {
|
||||||
conference->fnode->leadin--;
|
conference->fnode->leadin--;
|
||||||
} else {
|
} else if (!conference->fnode->done) {
|
||||||
file_sample_len = samples;
|
file_sample_len = samples;
|
||||||
if (conference->fnode->type == NODE_TYPE_SPEECH) {
|
if (conference->fnode->type == NODE_TYPE_SPEECH) {
|
||||||
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
|
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
|
||||||
@ -837,7 +837,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread,
|
|||||||
/* Lead in time */
|
/* Lead in time */
|
||||||
if (conference->async_fnode->leadin) {
|
if (conference->async_fnode->leadin) {
|
||||||
conference->async_fnode->leadin--;
|
conference->async_fnode->leadin--;
|
||||||
} else {
|
} else if (!conference->async_fnode->done) {
|
||||||
file_sample_len = samples;
|
file_sample_len = samples;
|
||||||
switch_core_file_read(&conference->async_fnode->fh, async_file_frame, &file_sample_len);
|
switch_core_file_read(&conference->async_fnode->fh, async_file_frame, &file_sample_len);
|
||||||
if (file_sample_len <= 0) {
|
if (file_sample_len <= 0) {
|
||||||
|
@ -84,6 +84,7 @@ static struct {
|
|||||||
switch_hash_t *fifo_hash;
|
switch_hash_t *fifo_hash;
|
||||||
switch_mutex_t *mutex;
|
switch_mutex_t *mutex;
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
|
int running;
|
||||||
} globals;
|
} globals;
|
||||||
|
|
||||||
|
|
||||||
@ -105,6 +106,10 @@ static fifo_node_t *create_node(const char *name)
|
|||||||
{
|
{
|
||||||
fifo_node_t *node;
|
fifo_node_t *node;
|
||||||
|
|
||||||
|
if (!globals.running) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
node = switch_core_alloc(globals.pool, sizeof(*node));
|
node = switch_core_alloc(globals.pool, sizeof(*node));
|
||||||
node->name = switch_core_strdup(globals.pool, name);
|
node->name = switch_core_strdup(globals.pool, name);
|
||||||
|
|
||||||
@ -122,6 +127,10 @@ static void send_presence(fifo_node_t *node)
|
|||||||
{
|
{
|
||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
|
|
||||||
|
if (!globals.running) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "%s", "park");
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "%s", "park");
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", node->name);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", node->name);
|
||||||
@ -139,7 +148,6 @@ static void send_presence(fifo_node_t *node)
|
|||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-state", "%s", node->waiting_count > 0 ? "CS_RING" : "CS_HANGUP");
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-state", "%s", node->waiting_count > 0 ? "CS_RING" : "CS_HANGUP");
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "unique-id", "%s", node->name);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "unique-id", "%s", node->name);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "answer-state", "%s", node->waiting_count > 0 ? "early" : "terminated");
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "answer-state", "%s", node->waiting_count > 0 ? "early" : "terminated");
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "astate", "%s", node->waiting_count > 0 ? "early" : "terminated");
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-direction", "%s", "inbound");
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-direction", "%s", "inbound");
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
}
|
||||||
@ -152,6 +160,10 @@ static void pres_event_handler(switch_event_t *event)
|
|||||||
char *dup_to = NULL, *node_name;
|
char *dup_to = NULL, *node_name;
|
||||||
fifo_node_t *node;
|
fifo_node_t *node;
|
||||||
|
|
||||||
|
if (!globals.running) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!to || strncasecmp(to, "park+", 5)) {
|
if (!to || strncasecmp(to, "park+", 5)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -192,7 +204,9 @@ SWITCH_STANDARD_APP(fifo_function)
|
|||||||
switch_time_t ts = switch_timestamp_now();
|
switch_time_t ts = switch_timestamp_now();
|
||||||
switch_size_t retsize;
|
switch_size_t retsize;
|
||||||
|
|
||||||
|
if (!globals.running) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (switch_strlen_zero(data)) {
|
if (switch_strlen_zero(data)) {
|
||||||
@ -577,6 +591,11 @@ SWITCH_STANDARD_API(fifo_api_function)
|
|||||||
const void *var;
|
const void *var;
|
||||||
int x = 0, verbose = 0;
|
int x = 0, verbose = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if (!globals.running) {
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!switch_strlen_zero(cmd)) {
|
if (!switch_strlen_zero(cmd)) {
|
||||||
data = strdup(cmd);
|
data = strdup(cmd);
|
||||||
switch_assert(data);
|
switch_assert(data);
|
||||||
@ -672,6 +691,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load)
|
|||||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||||
SWITCH_ADD_APP(app_interface, "fifo", "Park with FIFO", FIFO_DESC, fifo_function, FIFO_USAGE, SAF_NONE);
|
SWITCH_ADD_APP(app_interface, "fifo", "Park with FIFO", FIFO_DESC, fifo_function, FIFO_USAGE, SAF_NONE);
|
||||||
SWITCH_ADD_API(commands_api_interface, "fifo", "Return data about a fifo", fifo_api_function, FIFO_API_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "fifo", "Return data about a fifo", fifo_api_function, FIFO_API_SYNTAX);
|
||||||
|
globals.running = 1;
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -684,7 +704,10 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
|
|||||||
switch_hash_index_t *hi;
|
switch_hash_index_t *hi;
|
||||||
void *val, *pop;
|
void *val, *pop;
|
||||||
fifo_node_t *node;
|
fifo_node_t *node;
|
||||||
|
switch_memory_pool_t *pool = globals.pool;
|
||||||
switch_mutex_lock(globals.mutex);
|
switch_mutex_lock(globals.mutex);
|
||||||
|
|
||||||
|
globals.running = 0;
|
||||||
/* Cleanup*/
|
/* Cleanup*/
|
||||||
for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
|
for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
|
||||||
switch_hash_this(hi, NULL, NULL, &val);
|
switch_hash_this(hi, NULL, NULL, &val);
|
||||||
@ -695,9 +718,11 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
|
|||||||
switch_core_hash_destroy(&node->caller_hash);
|
switch_core_hash_destroy(&node->caller_hash);
|
||||||
switch_core_hash_destroy(&node->consumer_hash);
|
switch_core_hash_destroy(&node->consumer_hash);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(globals.mutex);
|
|
||||||
switch_core_hash_destroy(&globals.fifo_hash);
|
switch_core_hash_destroy(&globals.fifo_hash);
|
||||||
switch_core_destroy_memory_pool(&globals.pool);
|
memset(&globals, 0, sizeof(globals));
|
||||||
|
switch_mutex_unlock(globals.mutex);
|
||||||
|
|
||||||
|
switch_core_destroy_memory_pool(&pool);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,30 +252,11 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
|||||||
cause = switch_channel_get_cause(channel);
|
cause = switch_channel_get_cause(channel);
|
||||||
|
|
||||||
if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
|
if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
|
||||||
const char *buuid;
|
|
||||||
switch_core_session_t *bsession;
|
|
||||||
switch_channel_t *bchannel;
|
|
||||||
const char *lost_ext;
|
|
||||||
|
|
||||||
|
|
||||||
if (tech_pvt->max_missed_packets) {
|
if (tech_pvt->max_missed_packets) {
|
||||||
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
|
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
|
||||||
}
|
}
|
||||||
switch_channel_presence(tech_pvt->channel, "unknown", "unhold");
|
switch_channel_presence(tech_pvt->channel, "unknown", "unhold");
|
||||||
if ((buuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
|
|
||||||
if ((bsession = switch_core_session_locate(buuid))) {
|
|
||||||
bchannel = switch_core_session_get_channel(bsession);
|
|
||||||
if (switch_channel_test_flag(bchannel, CF_BROADCAST)) {
|
|
||||||
if ((lost_ext = switch_channel_get_variable(bchannel, "left_hanging_extension"))) {
|
|
||||||
switch_ivr_session_transfer(bsession, lost_ext, NULL, NULL);
|
|
||||||
}
|
|
||||||
switch_channel_clear_flag(bchannel, CF_BROADCAST);
|
|
||||||
switch_channel_set_flag(bchannel, CF_BREAK);
|
|
||||||
}
|
|
||||||
switch_core_session_rwunlock(bsession);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1382,25 +1382,38 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
|||||||
if (sendonly) {
|
if (sendonly) {
|
||||||
if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
|
if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
|
||||||
const char *stream;
|
const char *stream;
|
||||||
|
|
||||||
switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
||||||
switch_channel_presence(tech_pvt->channel, "unknown", "hold");
|
switch_channel_presence(tech_pvt->channel, "unknown", "hold");
|
||||||
|
|
||||||
if (tech_pvt->max_missed_packets) {
|
if (tech_pvt->max_missed_packets) {
|
||||||
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets * 10);
|
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
|
if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
|
||||||
stream = tech_pvt->profile->hold_music;
|
stream = tech_pvt->profile->hold_music;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream) {
|
if (stream) {
|
||||||
switch_ivr_broadcast(switch_core_session_get_uuid(tech_pvt->session), stream, SMF_ECHO_BLEG | SMF_LOOP);
|
switch_ivr_displace_session(tech_pvt->session, stream, 0, "rl");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
|
if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
|
||||||
switch_channel_clear_flag_partner(tech_pvt->channel, CF_BROADCAST);
|
const char *stream;
|
||||||
|
|
||||||
if (tech_pvt->max_missed_packets) {
|
if (tech_pvt->max_missed_packets) {
|
||||||
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
|
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
|
||||||
}
|
}
|
||||||
switch_channel_set_flag_partner(tech_pvt->channel, CF_BREAK);
|
|
||||||
|
if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
|
||||||
|
stream = tech_pvt->profile->hold_music;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream) {
|
||||||
|
switch_ivr_stop_displace_session(tech_pvt->session, stream);
|
||||||
|
}
|
||||||
|
|
||||||
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
||||||
switch_channel_presence(tech_pvt->channel, "unknown", "unhold");
|
switch_channel_presence(tech_pvt->channel, "unknown", "unhold");
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
|||||||
{
|
{
|
||||||
switch_io_event_hook_read_frame_t *ptr;
|
switch_io_event_hook_read_frame_t *ptr;
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
int need_codec, perfect, do_bugs = 0, do_resample = 0;
|
int need_codec, perfect, do_bugs = 0, do_resample = 0, is_cng = 0;
|
||||||
unsigned int flag = 0;
|
unsigned int flag = 0;
|
||||||
top:
|
top:
|
||||||
|
|
||||||
@ -131,10 +131,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
|||||||
switch_assert(session != NULL);
|
switch_assert(session != NULL);
|
||||||
switch_assert(*frame != NULL);
|
switch_assert(*frame != NULL);
|
||||||
|
|
||||||
|
|
||||||
if (switch_test_flag(*frame, SFF_CNG)) {
|
if (switch_test_flag(*frame, SFF_CNG)) {
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
goto done;
|
if (!session->bugs) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
is_cng = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_assert((*frame)->codec != NULL);
|
switch_assert((*frame)->codec != NULL);
|
||||||
@ -163,16 +166,25 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
|||||||
if (status == SWITCH_STATUS_SUCCESS && need_codec) {
|
if (status == SWITCH_STATUS_SUCCESS && need_codec) {
|
||||||
switch_frame_t *enc_frame, *read_frame = *frame;
|
switch_frame_t *enc_frame, *read_frame = *frame;
|
||||||
|
|
||||||
if (read_frame->codec) {
|
if (read_frame->codec || is_cng) {
|
||||||
session->raw_read_frame.datalen = session->raw_read_frame.buflen;
|
session->raw_read_frame.datalen = session->raw_read_frame.buflen;
|
||||||
status = switch_core_codec_decode(read_frame->codec,
|
|
||||||
session->read_codec,
|
|
||||||
read_frame->data,
|
|
||||||
read_frame->datalen,
|
|
||||||
session->read_codec->implementation->actual_samples_per_second,
|
|
||||||
session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, &flag);
|
|
||||||
|
|
||||||
if (do_resample && status == SWITCH_STATUS_SUCCESS) {
|
if (is_cng) {
|
||||||
|
memset(session->raw_read_frame.data, 255, read_frame->codec->implementation->bytes_per_frame);
|
||||||
|
session->raw_read_frame.datalen = read_frame->codec->implementation->bytes_per_frame;
|
||||||
|
session->raw_read_frame.samples = session->raw_read_frame.datalen / sizeof(int16_t);
|
||||||
|
read_frame = &session->raw_read_frame;
|
||||||
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
} else {
|
||||||
|
status = switch_core_codec_decode(read_frame->codec,
|
||||||
|
session->read_codec,
|
||||||
|
read_frame->data,
|
||||||
|
read_frame->datalen,
|
||||||
|
session->read_codec->implementation->actual_samples_per_second,
|
||||||
|
session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, &flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (do_resample && ((status == SWITCH_STATUS_SUCCESS) || is_cng)) {
|
||||||
status = SWITCH_STATUS_RESAMPLE;
|
status = SWITCH_STATUS_RESAMPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,6 +506,9 @@ SWITCH_DECLARE(switch_status_t) switch_event_del_header(switch_event_t *event, c
|
|||||||
} else {
|
} else {
|
||||||
event->headers = hp->next;
|
event->headers = hp->next;
|
||||||
}
|
}
|
||||||
|
if (hp == event->last_header || !hp->next) {
|
||||||
|
event->last_header = lp;
|
||||||
|
}
|
||||||
FREE(hp->name);
|
FREE(hp->name);
|
||||||
FREE(hp->value);
|
FREE(hp->value);
|
||||||
memset(hp, 0, sizeof(*hp));
|
memset(hp, 0, sizeof(*hp));
|
||||||
|
@ -98,9 +98,10 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session)
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
switch_file_handle_t fh;
|
switch_file_handle_t fh;
|
||||||
int mux;
|
int mux;
|
||||||
|
int loop;
|
||||||
} displace_helper_t;
|
} displace_helper_t;
|
||||||
|
|
||||||
static switch_bool_t displace_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
|
static switch_bool_t write_displace_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
|
||||||
{
|
{
|
||||||
displace_helper_t *dh = (displace_helper_t *) user_data;
|
displace_helper_t *dh = (displace_helper_t *) user_data;
|
||||||
uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||||
@ -154,7 +155,12 @@ static switch_bool_t displace_callback(switch_media_bug_t *bug, void *user_data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (st != SWITCH_STATUS_SUCCESS || len == 0) {
|
if (st != SWITCH_STATUS_SUCCESS || len == 0) {
|
||||||
return SWITCH_FALSE;
|
if (dh->loop) {
|
||||||
|
uint32_t pos = 0;
|
||||||
|
switch_core_file_seek(&dh->fh, &pos, 0, SEEK_SET);
|
||||||
|
} else {
|
||||||
|
return SWITCH_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_core_media_bug_set_write_replace_frame(bug, rframe);
|
switch_core_media_bug_set_write_replace_frame(bug, rframe);
|
||||||
@ -168,6 +174,80 @@ static switch_bool_t displace_callback(switch_media_bug_t *bug, void *user_data,
|
|||||||
return SWITCH_TRUE;
|
return SWITCH_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static switch_bool_t read_displace_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
|
||||||
|
{
|
||||||
|
displace_helper_t *dh = (displace_helper_t *) user_data;
|
||||||
|
uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||||
|
switch_frame_t frame = { 0 };
|
||||||
|
|
||||||
|
frame.data = data;
|
||||||
|
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case SWITCH_ABC_TYPE_INIT:
|
||||||
|
break;
|
||||||
|
case SWITCH_ABC_TYPE_CLOSE:
|
||||||
|
if (dh) {
|
||||||
|
switch_core_file_close(&dh->fh);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SWITCH_ABC_TYPE_WRITE_REPLACE:
|
||||||
|
{
|
||||||
|
switch_frame_t *rframe = switch_core_media_bug_get_write_replace_frame(bug);
|
||||||
|
if (dh && !dh->mux) {
|
||||||
|
memset(rframe->data, 255, rframe->datalen);
|
||||||
|
}
|
||||||
|
switch_core_media_bug_set_write_replace_frame(bug, rframe);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SWITCH_ABC_TYPE_READ_REPLACE:
|
||||||
|
if (dh) {
|
||||||
|
switch_frame_t *rframe = NULL;
|
||||||
|
switch_size_t len;
|
||||||
|
switch_status_t st;
|
||||||
|
rframe = switch_core_media_bug_get_read_replace_frame(bug);
|
||||||
|
len = rframe->samples;
|
||||||
|
|
||||||
|
if (dh->mux) {
|
||||||
|
int16_t buf[1024];
|
||||||
|
int16_t *fp = rframe->data;
|
||||||
|
uint32_t x;
|
||||||
|
|
||||||
|
st = switch_core_file_read(&dh->fh, buf, &len);
|
||||||
|
|
||||||
|
for(x = 0; x < (uint32_t) len; x++) {
|
||||||
|
int32_t mixed = fp[x] + buf[x];
|
||||||
|
switch_normalize_to_16bit(mixed);
|
||||||
|
fp[x] = (int16_t) mixed;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
st = switch_core_file_read(&dh->fh, rframe->data, &len);
|
||||||
|
rframe->samples = (uint32_t) len;
|
||||||
|
rframe->datalen = rframe->samples * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (st != SWITCH_STATUS_SUCCESS || len == 0) {
|
||||||
|
if (dh->loop) {
|
||||||
|
uint32_t pos = 0;
|
||||||
|
switch_core_file_seek(&dh->fh, &pos, 0, SEEK_SET);
|
||||||
|
} else {
|
||||||
|
return SWITCH_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_core_media_bug_set_read_replace_frame(bug, rframe);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SWITCH_ABC_TYPE_WRITE:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SWITCH_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_session_t *session, const char *file)
|
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_session_t *session, const char *file)
|
||||||
{
|
{
|
||||||
switch_media_bug_t *bug;
|
switch_media_bug_t *bug;
|
||||||
@ -184,7 +264,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_ses
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_t *session, char *file, uint32_t limit, const char *flags)
|
SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_t *session, const char *file, uint32_t limit, const char *flags)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
switch_codec_t *read_codec;
|
switch_codec_t *read_codec;
|
||||||
@ -207,14 +287,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
read_codec = switch_core_session_get_read_codec(session);
|
read_codec = switch_core_session_get_read_codec(session);
|
||||||
switch_assert(read_codec != NULL);
|
switch_assert(read_codec != NULL);
|
||||||
|
|
||||||
dh->fh.channels = read_codec->implementation->number_of_channels;
|
dh->fh.channels = read_codec->implementation->number_of_channels;
|
||||||
dh->fh.samplerate = read_codec->implementation->actual_samples_per_second;
|
dh->fh.samplerate = read_codec->implementation->actual_samples_per_second;
|
||||||
|
|
||||||
|
|
||||||
if (switch_core_file_open(&dh->fh,
|
if (switch_core_file_open(&dh->fh,
|
||||||
file,
|
file,
|
||||||
read_codec->implementation->number_of_channels,
|
read_codec->implementation->number_of_channels,
|
||||||
@ -236,7 +314,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_
|
|||||||
dh->mux++;
|
dh->mux++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status = switch_core_media_bug_add(session, displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
|
if (flags && strchr(flags, 'l')) {
|
||||||
|
dh->loop++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags && strchr(flags, 'r')) {
|
||||||
|
status = switch_core_media_bug_add(session, read_displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE, &bug);
|
||||||
|
} else {
|
||||||
|
status = switch_core_media_bug_add(session, write_displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE, &bug);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_core_file_close(&dh->fh);
|
switch_core_file_close(&dh->fh);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -1600,105 +1688,108 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const cha
|
|||||||
switch_core_session_t *other_session = NULL;
|
switch_core_session_t *other_session = NULL;
|
||||||
const char *other_uuid = NULL;
|
const char *other_uuid = NULL;
|
||||||
char *app = "playback";
|
char *app = "playback";
|
||||||
|
char *cause = NULL;
|
||||||
|
char *mypath;
|
||||||
|
char *p;
|
||||||
|
|
||||||
switch_assert(path);
|
switch_assert(path);
|
||||||
|
|
||||||
if ((session = switch_core_session_locate(uuid))) {
|
if (!(session = switch_core_session_locate(uuid))) {
|
||||||
char *cause = NULL;
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "uuid [%s] does not match an existing session.\n", switch_str_nil(uuid));
|
||||||
char *mypath;
|
return SWITCH_STATUS_FALSE;
|
||||||
char *p;
|
|
||||||
|
|
||||||
master = session;
|
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(session);
|
|
||||||
switch_assert(channel != NULL);
|
|
||||||
|
|
||||||
if ((switch_channel_test_flag(channel, CF_EVENT_PARSE))) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Channel [%s] already broadcasting...broadcast aborted\n",
|
|
||||||
switch_channel_get_name(channel));
|
|
||||||
switch_core_session_rwunlock(session);
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
mypath = strdup(path);
|
|
||||||
|
|
||||||
|
|
||||||
if ((nomedia = switch_channel_test_flag(channel, CF_BYPASS_MEDIA))) {
|
|
||||||
switch_ivr_media(uuid, SMF_REBRIDGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((p = strchr(mypath, ':')) && *(p+1) == ':') {
|
|
||||||
app = mypath;
|
|
||||||
*p++ = '\0';
|
|
||||||
*p++ = '\0';
|
|
||||||
path = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((cause = strchr(app, '!'))) {
|
|
||||||
*cause++ = '\0';
|
|
||||||
if (!cause) {
|
|
||||||
cause = "normal_clearing";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((flags & SMF_ECHO_BLEG) && (other_uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE))
|
|
||||||
&& (other_session = switch_core_session_locate(other_uuid))) {
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
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);
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true");
|
|
||||||
if ((flags & SMF_LOOP)) {
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "loops", "%d", -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_core_session_queue_private_event(other_session, &event);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_core_session_rwunlock(other_session);
|
|
||||||
master = other_session;
|
|
||||||
other_session = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((flags & SMF_ECHO_ALEG)) {
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
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);
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true");
|
|
||||||
if ((flags & SMF_LOOP)) {
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "loops", "%d", -1);
|
|
||||||
}
|
|
||||||
switch_core_session_queue_private_event(session, &event);
|
|
||||||
}
|
|
||||||
master = session;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nomedia) {
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "nomedia");
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "nomedia-uuid", "%s", uuid);
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true");
|
|
||||||
switch_core_session_queue_private_event(master, &event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cause) {
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "execute");
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-name", "hangup");
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-arg", "%s", cause);
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true");
|
|
||||||
switch_core_session_queue_private_event(session, &event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_core_session_rwunlock(session);
|
|
||||||
switch_safe_free(mypath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
master = session;
|
||||||
|
|
||||||
|
channel = switch_core_session_get_channel(session);
|
||||||
|
switch_assert(channel != NULL);
|
||||||
|
|
||||||
|
if ((switch_channel_test_flag(channel, CF_EVENT_PARSE))) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Channel [%s] already broadcasting...broadcast aborted\n",
|
||||||
|
switch_channel_get_name(channel));
|
||||||
|
switch_core_session_rwunlock(session);
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
mypath = strdup(path);
|
||||||
|
|
||||||
|
|
||||||
|
if ((nomedia = switch_channel_test_flag(channel, CF_BYPASS_MEDIA))) {
|
||||||
|
switch_ivr_media(uuid, SMF_REBRIDGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((p = strchr(mypath, ':')) && *(p+1) == ':') {
|
||||||
|
app = mypath;
|
||||||
|
*p++ = '\0';
|
||||||
|
*p++ = '\0';
|
||||||
|
path = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((cause = strchr(app, '!'))) {
|
||||||
|
*cause++ = '\0';
|
||||||
|
if (!cause) {
|
||||||
|
cause = "normal_clearing";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((flags & SMF_ECHO_BLEG) && (other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
|
||||||
|
&& (other_session = switch_core_session_locate(other_uuid))) {
|
||||||
|
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
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);
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true");
|
||||||
|
if ((flags & SMF_LOOP)) {
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "loops", "%d", -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_core_session_queue_private_event(other_session, &event);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_core_session_rwunlock(other_session);
|
||||||
|
master = other_session;
|
||||||
|
other_session = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((flags & SMF_ECHO_ALEG)) {
|
||||||
|
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
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);
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true");
|
||||||
|
if ((flags & SMF_LOOP)) {
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "loops", "%d", -1);
|
||||||
|
}
|
||||||
|
switch_core_session_queue_private_event(session, &event);
|
||||||
|
}
|
||||||
|
master = session;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nomedia) {
|
||||||
|
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "nomedia");
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "nomedia-uuid", "%s", uuid);
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true");
|
||||||
|
switch_core_session_queue_private_event(master, &event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cause) {
|
||||||
|
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "execute");
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-name", "hangup");
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-arg", "%s", cause);
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event-lock", "%s", "true");
|
||||||
|
switch_core_session_queue_private_event(session, &event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_core_session_rwunlock(session);
|
||||||
|
switch_safe_free(mypath);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
|
@ -1102,11 +1102,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
|||||||
|
|
||||||
do_continue:
|
do_continue:
|
||||||
|
|
||||||
if (rtp_session->ms_per_packet) {
|
switch_yield(1000);
|
||||||
switch_yield((rtp_session->ms_per_packet / 1000) * 750);
|
|
||||||
} else {
|
|
||||||
switch_yield(1000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*payload_type = (switch_payload_t) rtp_session->recv_msg.header.pt;
|
*payload_type = (switch_payload_t) rtp_session->recv_msg.header.pt;
|
||||||
|
@ -187,7 +187,7 @@ static switch_status_t timer_check(switch_timer_t *timer)
|
|||||||
{
|
{
|
||||||
timer_private_t *private_info = timer->private_info;
|
timer_private_t *private_info = timer->private_info;
|
||||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
switch_size_t diff;
|
|
||||||
|
|
||||||
if (globals.RUNNING != 1 || !private_info->ready) {
|
if (globals.RUNNING != 1 || !private_info->ready) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
@ -196,12 +196,12 @@ static switch_status_t timer_check(switch_timer_t *timer)
|
|||||||
check_roll();
|
check_roll();
|
||||||
|
|
||||||
if (TIMER_MATRIX[timer->interval].tick < private_info->reference) {
|
if (TIMER_MATRIX[timer->interval].tick < private_info->reference) {
|
||||||
diff = private_info->reference - TIMER_MATRIX[timer->interval].tick;
|
timer->diff = private_info->reference - TIMER_MATRIX[timer->interval].tick;
|
||||||
} else {
|
} else {
|
||||||
diff = 0;
|
timer->diff = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diff) {
|
if (timer->diff) {
|
||||||
status = SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
} else {
|
} else {
|
||||||
timer_step(timer);
|
timer_step(timer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user