Merged revisions 378854,378858-378859 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk ........ r378854 | rmudgett | 2013-01-09 17:22:00 -0600 (Wed, 09 Jan 2013) | 1 line Fix logger.c function definition. ........ r378858 | rmudgett | 2013-01-09 17:23:41 -0600 (Wed, 09 Jan 2013) | 6 lines Trivial misc bridge code changes. * softmix_bridge_thread() was redundantly initializing an 8K buffer. * Promoted a debug message to a warning in multiplexed_add_or_remove(). ........ r378859 | rmudgett | 2013-01-09 17:51:45 -0600 (Wed, 09 Jan 2013) | 6 lines * Simple optimization of bridge_playfile(). * Squeezed some redundancy out of update_bridge_vars(). * Wrapped long line in __ast_change_name_nolink(). ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378868 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
e844969fba
commit
41eba63840
|
@ -290,7 +290,8 @@ static void multiplexed_add_or_remove(struct multiplexed_thread *multiplexed_thr
|
||||||
ao2_ref(multiplexed_thread, +1);
|
ao2_ref(multiplexed_thread, +1);
|
||||||
if (ast_pthread_create(&multiplexed_thread->thread, NULL, multiplexed_thread_function, multiplexed_thread)) {
|
if (ast_pthread_create(&multiplexed_thread->thread, NULL, multiplexed_thread_function, multiplexed_thread)) {
|
||||||
ao2_ref(multiplexed_thread, -1);
|
ao2_ref(multiplexed_thread, -1);
|
||||||
ast_debug(1, "Failed to create an actual thread for multiplexed thread '%p', trying next time\n", multiplexed_thread);
|
ast_log(LOG_WARNING, "Failed to create the bridge thread for multiplexed thread '%p', trying next time\n",
|
||||||
|
multiplexed_thread);
|
||||||
}
|
}
|
||||||
} else if (!multiplexed_thread->service_count && multiplexed_thread->thread != AST_PTHREADT_NULL) {
|
} else if (!multiplexed_thread->service_count && multiplexed_thread->thread != AST_PTHREADT_NULL) {
|
||||||
thread = multiplexed_thread->thread;
|
thread = multiplexed_thread->thread;
|
||||||
|
|
|
@ -750,7 +750,7 @@ static int softmix_bridge_thread(struct ast_bridge *bridge)
|
||||||
struct softmix_bridge_data *softmix_data = bridge->bridge_pvt;
|
struct softmix_bridge_data *softmix_data = bridge->bridge_pvt;
|
||||||
struct ast_timer *timer;
|
struct ast_timer *timer;
|
||||||
struct softmix_translate_helper trans_helper;
|
struct softmix_translate_helper trans_helper;
|
||||||
int16_t buf[MAX_DATALEN] = { 0, };
|
int16_t buf[MAX_DATALEN];
|
||||||
unsigned int stat_iteration_counter = 0; /* counts down, gather stats at zero and reset. */
|
unsigned int stat_iteration_counter = 0; /* counts down, gather stats at zero and reset. */
|
||||||
int timingfd;
|
int timingfd;
|
||||||
int update_all_rates = 0; /* set this when the internal sample rate has changed */
|
int update_all_rates = 0; /* set this when the internal sample rate has changed */
|
||||||
|
|
|
@ -6502,7 +6502,11 @@ static void __ast_change_name_nolink(struct ast_channel *chan, const char *newna
|
||||||
<synopsis>Raised when the name of a channel is changed.</synopsis>
|
<synopsis>Raised when the name of a channel is changed.</synopsis>
|
||||||
</managerEventInstance>
|
</managerEventInstance>
|
||||||
***/
|
***/
|
||||||
ast_manager_event(chan, EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", ast_channel_name(chan), newname, ast_channel_uniqueid(chan));
|
ast_manager_event(chan, EVENT_FLAG_CALL, "Rename",
|
||||||
|
"Channel: %s\r\n"
|
||||||
|
"Newname: %s\r\n"
|
||||||
|
"Uniqueid: %s\r\n",
|
||||||
|
ast_channel_name(chan), newname, ast_channel_uniqueid(chan));
|
||||||
ast_channel_name_set(chan, newname);
|
ast_channel_name_set(chan, newname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7461,22 +7465,26 @@ struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
|
||||||
|
|
||||||
static void bridge_playfile(struct ast_channel *chan, struct ast_channel *peer, const char *sound, int remain)
|
static void bridge_playfile(struct ast_channel *chan, struct ast_channel *peer, const char *sound, int remain)
|
||||||
{
|
{
|
||||||
int min = 0, sec = 0, check;
|
int check;
|
||||||
|
|
||||||
check = ast_autoservice_start(peer);
|
check = ast_autoservice_start(peer);
|
||||||
if (check)
|
if (check) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (remain > 0) {
|
|
||||||
if (remain / 60 > 1) {
|
|
||||||
min = remain / 60;
|
|
||||||
sec = remain % 60;
|
|
||||||
} else {
|
|
||||||
sec = remain;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(sound,"timeleft")) { /* Queue support */
|
if (!strcmp(sound, "timeleft")) { /* Queue support */
|
||||||
|
int min = 0;
|
||||||
|
int sec = 0;
|
||||||
|
|
||||||
|
if (remain > 0) {
|
||||||
|
if (remain / 60 > 1) {
|
||||||
|
min = remain / 60;
|
||||||
|
sec = remain % 60;
|
||||||
|
} else {
|
||||||
|
sec = remain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ast_stream_and_wait(chan, "vm-youhave", "");
|
ast_stream_and_wait(chan, "vm-youhave", "");
|
||||||
if (min) {
|
if (min) {
|
||||||
ast_say_number(chan, min, AST_DIGIT_ANY, ast_channel_language(chan), NULL);
|
ast_say_number(chan, min, AST_DIGIT_ANY, ast_channel_language(chan), NULL);
|
||||||
|
@ -7761,40 +7769,41 @@ static void manager_bridge_event(int onoff, int type, struct ast_channel *c0, st
|
||||||
S_COR(ast_channel_caller(c1)->id.number.valid, ast_channel_caller(c1)->id.number.str, ""));
|
S_COR(ast_channel_caller(c1)->id.number.valid, ast_channel_caller(c1)->id.number.str, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void update_bridge_vars_set(struct ast_channel *chan, const char *name, const char *pvtid)
|
||||||
|
{
|
||||||
|
if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "BRIDGEPEER"))) {
|
||||||
|
pbx_builtin_setvar_helper(chan, "BRIDGEPEER", name);
|
||||||
|
}
|
||||||
|
if (pvtid) {
|
||||||
|
pbx_builtin_setvar_helper(chan, "BRIDGEPVTCALLID", pvtid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void update_bridge_vars(struct ast_channel *c0, struct ast_channel *c1)
|
static void update_bridge_vars(struct ast_channel *c0, struct ast_channel *c1)
|
||||||
{
|
{
|
||||||
const char *c0_name;
|
const char *c0_name;
|
||||||
const char *c1_name;
|
const char *c1_name;
|
||||||
const char *c0_pvtid = NULL;
|
const char *c0_pvtid = NULL;
|
||||||
const char *c1_pvtid = NULL;
|
const char *c1_pvtid = NULL;
|
||||||
|
#define UPDATE_BRIDGE_VARS_GET(chan, name, pvtid) \
|
||||||
|
do { \
|
||||||
|
name = ast_strdupa(ast_channel_name(chan)); \
|
||||||
|
if (ast_channel_tech(chan)->get_pvt_uniqueid) { \
|
||||||
|
pvtid = ast_strdupa(ast_channel_tech(chan)->get_pvt_uniqueid(chan)); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
ast_channel_lock(c1);
|
ast_channel_lock(c1);
|
||||||
c1_name = ast_strdupa(ast_channel_name(c1));
|
UPDATE_BRIDGE_VARS_GET(c1, c1_name, c1_pvtid);
|
||||||
if (ast_channel_tech(c1)->get_pvt_uniqueid) {
|
|
||||||
c1_pvtid = ast_strdupa(ast_channel_tech(c1)->get_pvt_uniqueid(c1));
|
|
||||||
}
|
|
||||||
ast_channel_unlock(c1);
|
ast_channel_unlock(c1);
|
||||||
|
|
||||||
ast_channel_lock(c0);
|
ast_channel_lock(c0);
|
||||||
if (!ast_strlen_zero(pbx_builtin_getvar_helper(c0, "BRIDGEPEER"))) {
|
update_bridge_vars_set(c0, c1_name, c1_pvtid);
|
||||||
pbx_builtin_setvar_helper(c0, "BRIDGEPEER", c1_name);
|
UPDATE_BRIDGE_VARS_GET(c0, c0_name, c0_pvtid);
|
||||||
}
|
|
||||||
if (c1_pvtid) {
|
|
||||||
pbx_builtin_setvar_helper(c0, "BRIDGEPVTCALLID", c1_pvtid);
|
|
||||||
}
|
|
||||||
c0_name = ast_strdupa(ast_channel_name(c0));
|
|
||||||
if (ast_channel_tech(c0)->get_pvt_uniqueid) {
|
|
||||||
c0_pvtid = ast_strdupa(ast_channel_tech(c0)->get_pvt_uniqueid(c0));
|
|
||||||
}
|
|
||||||
ast_channel_unlock(c0);
|
ast_channel_unlock(c0);
|
||||||
|
|
||||||
ast_channel_lock(c1);
|
ast_channel_lock(c1);
|
||||||
if (!ast_strlen_zero(pbx_builtin_getvar_helper(c1, "BRIDGEPEER"))) {
|
update_bridge_vars_set(c1, c0_name, c0_pvtid);
|
||||||
pbx_builtin_setvar_helper(c1, "BRIDGEPEER", c0_name);
|
|
||||||
}
|
|
||||||
if (c0_pvtid) {
|
|
||||||
pbx_builtin_setvar_helper(c1, "BRIDGEPVTCALLID", c0_pvtid);
|
|
||||||
}
|
|
||||||
ast_channel_unlock(c1);
|
ast_channel_unlock(c1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1355,7 +1355,7 @@ int ast_callid_threadassoc_add(struct ast_callid *callid)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_callid_threadassoc_remove()
|
int ast_callid_threadassoc_remove(void)
|
||||||
{
|
{
|
||||||
struct ast_callid **pointing;
|
struct ast_callid **pointing;
|
||||||
pointing = ast_threadstorage_get(&unique_callid, sizeof(struct ast_callid **));
|
pointing = ast_threadstorage_get(&unique_callid, sizeof(struct ast_callid **));
|
||||||
|
|
Loading…
Reference in New Issue