fix some analog issues brought about by too much concentration on digital

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@465 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale 2008-04-30 15:17:55 +00:00
parent b518f8573d
commit 14519d193c
3 changed files with 7 additions and 13 deletions

View File

@ -1 +1 @@
Fri Jan 25 19:07:34 EST 2008 Wed Apr 30 10:51:26 EDT 2008

View File

@ -159,16 +159,15 @@ static void stop_hold(const char *uuid)
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
switch_channel_stop_broadcast(channel); switch_channel_stop_broadcast(channel);
switch_channel_wait_for_flag(channel, CF_BROADCAST, SWITCH_FALSE, 2000); switch_channel_wait_for_flag(channel, CF_BROADCAST, SWITCH_FALSE, 2000);
switch_core_session_rwunlock(session); switch_core_session_rwunlock(session);
} }
} }
static void start_hold(const char *uuid, const char *music) static void start_hold(const char *uuid, const char *stream)
{ {
switch_core_session_t *session; switch_core_session_t *session;
switch_channel_t *channel; switch_channel_t *channel;
const char *stream = NULL;
if (!uuid) { if (!uuid) {
return; return;
@ -177,11 +176,8 @@ static void start_hold(const char *uuid, const char *music)
if ((session = switch_core_session_locate(uuid))) { if ((session = switch_core_session_locate(uuid))) {
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
if (!(stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE))) { if (switch_strlen_zero(stream) && !(stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
stream = music; stream = globals.hold_music;
if (switch_strlen_zero(stream)) {
stream = globals.hold_music;
}
} }
if (!switch_strlen_zero(stream)) { if (!switch_strlen_zero(stream)) {

View File

@ -416,7 +416,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
break; break;
case ZAP_CHANNEL_STATE_DIALTONE: case ZAP_CHANNEL_STATE_DIALTONE:
{ {
zap_channel_done(zchan); memset(&zchan->caller_data, 0, sizeof(zchan->caller_data));
*dtmf = '\0'; *dtmf = '\0';
dtmf_offset = 0; dtmf_offset = 0;
zap_buffer_zero(dt_buffer); zap_buffer_zero(dt_buffer);
@ -447,7 +447,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
break; break;
case ZAP_CHANNEL_STATE_GET_CALLERID: case ZAP_CHANNEL_STATE_GET_CALLERID:
{ {
zap_channel_done(zchan); memset(&zchan->caller_data, 0, sizeof(zchan->caller_data));
zap_channel_command(zchan, ZAP_COMMAND_ENABLE_CALLERID_DETECT, NULL); zap_channel_command(zchan, ZAP_COMMAND_ENABLE_CALLERID_DETECT, NULL);
continue; continue;
} }
@ -464,7 +464,6 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
{ {
zchan->caller_data.hangup_cause = ZAP_CAUSE_NORMAL_CIRCUIT_CONGESTION; zchan->caller_data.hangup_cause = ZAP_CAUSE_NORMAL_CIRCUIT_CONGESTION;
if (zap_test_flag(zchan, ZAP_CHANNEL_OFFHOOK) && !zap_test_flag(zchan, ZAP_CHANNEL_OUTBOUND)) { if (zap_test_flag(zchan, ZAP_CHANNEL_OFFHOOK) && !zap_test_flag(zchan, ZAP_CHANNEL_OUTBOUND)) {
zap_channel_done(zchan);
zap_buffer_zero(dt_buffer); zap_buffer_zero(dt_buffer);
teletone_run(&ts, zchan->span->tone_map[ZAP_TONEMAP_BUSY]); teletone_run(&ts, zchan->span->tone_map[ZAP_TONEMAP_BUSY]);
indicate = 1; indicate = 1;
@ -476,7 +475,6 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
case ZAP_CHANNEL_STATE_ATTN: case ZAP_CHANNEL_STATE_ATTN:
{ {
if (zap_test_flag(zchan, ZAP_CHANNEL_OFFHOOK) && !zap_test_flag(zchan, ZAP_CHANNEL_OUTBOUND)) { if (zap_test_flag(zchan, ZAP_CHANNEL_OFFHOOK) && !zap_test_flag(zchan, ZAP_CHANNEL_OUTBOUND)) {
zap_channel_done(zchan);
zap_buffer_zero(dt_buffer); zap_buffer_zero(dt_buffer);
teletone_run(&ts, zchan->span->tone_map[ZAP_TONEMAP_ATTN]); teletone_run(&ts, zchan->span->tone_map[ZAP_TONEMAP_ATTN]);
indicate = 1; indicate = 1;