redo some stuff
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@604 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
735165130a
commit
b2022b8d72
|
@ -1155,23 +1155,18 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxo_signal)
|
|||
case ZAP_SIGEVENT_PROGRESS_MEDIA:
|
||||
{
|
||||
if ((session = zap_channel_get_session(sigmsg->channel, 0))) {
|
||||
switch_core_session_signal_lock(session);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_mark_pre_answered(channel);
|
||||
switch_core_session_signal_unlock(session);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ZAP_SIGEVENT_STOP:
|
||||
{
|
||||
while((session = zap_channel_get_session(sigmsg->channel, 0))) {
|
||||
switch_core_session_signal_lock(session);
|
||||
zap_channel_clear_token(sigmsg->channel, 0);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_hangup(channel, sigmsg->channel->caller_data.hangup_cause);
|
||||
zap_channel_clear_token(sigmsg->channel, switch_core_session_get_uuid(session));
|
||||
switch_core_session_signal_unlock(session);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
}
|
||||
|
@ -1218,10 +1213,8 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
|
|||
case ZAP_SIGEVENT_UP:
|
||||
{
|
||||
if ((session = zap_channel_get_session(sigmsg->channel, 0))) {
|
||||
switch_core_session_signal_lock(session);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_mark_answered(channel);
|
||||
switch_core_session_signal_unlock(session);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
}
|
||||
|
@ -1256,7 +1249,6 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
|
|||
|
||||
|
||||
if ((session_a = switch_core_session_locate(sigmsg->channel->tokens[0]))) {
|
||||
switch_core_session_signal_lock(session_a);
|
||||
channel_a = switch_core_session_get_channel(session_a);
|
||||
br_a_uuid = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE);
|
||||
|
||||
|
@ -1266,7 +1258,6 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
|
|||
}
|
||||
|
||||
if ((session_b = switch_core_session_locate(sigmsg->channel->tokens[1]))) {
|
||||
switch_core_session_signal_lock(session_b);
|
||||
channel_b = switch_core_session_get_channel(session_b);
|
||||
br_b_uuid = switch_channel_get_variable(channel_b, SWITCH_SIGNAL_BOND_VARIABLE);
|
||||
|
||||
|
@ -1281,26 +1272,21 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
|
|||
switch_ivr_uuid_bridge(br_a_uuid, br_b_uuid);
|
||||
} else if (br_a_uuid && digits) {
|
||||
session_t = switch_core_session_locate(br_a_uuid);
|
||||
switch_core_session_signal_lock(session_t);
|
||||
} else if (br_b_uuid && digits) {
|
||||
session_t = switch_core_session_locate(br_b_uuid);
|
||||
switch_core_session_signal_lock(session_t);
|
||||
}
|
||||
}
|
||||
|
||||
if (session_t) {
|
||||
switch_ivr_session_transfer(session_t, sigmsg->channel->caller_data.collected, NULL, NULL);
|
||||
switch_core_session_signal_unlock(session_t);
|
||||
switch_core_session_rwunlock(session_t);
|
||||
}
|
||||
|
||||
if (session_a) {
|
||||
switch_core_session_signal_unlock(session_a);
|
||||
switch_core_session_rwunlock(session_a);
|
||||
}
|
||||
|
||||
if (session_b) {
|
||||
switch_core_session_signal_unlock(session_b);
|
||||
switch_core_session_rwunlock(session_b);
|
||||
}
|
||||
|
||||
|
@ -1308,11 +1294,9 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
|
|||
}
|
||||
|
||||
while((session = zap_channel_get_session(sigmsg->channel, 0))) {
|
||||
switch_core_session_signal_lock(session);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_hangup(channel, cause);
|
||||
zap_channel_clear_token(sigmsg->channel, switch_core_session_get_uuid(session));
|
||||
switch_core_session_signal_unlock(session);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
zap_channel_clear_token(sigmsg->channel, NULL);
|
||||
|
@ -1347,11 +1331,9 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
|
|||
if (zap_test_flag(sigmsg->channel, ZAP_CHANNEL_3WAY)) {
|
||||
zap_clear_flag(sigmsg->channel, ZAP_CHANNEL_3WAY);
|
||||
if ((session = zap_channel_get_session(sigmsg->channel, 1))) {
|
||||
switch_core_session_signal_lock(session);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||
zap_channel_clear_token(sigmsg->channel, switch_core_session_get_uuid(session));
|
||||
switch_core_session_signal_unlock(session);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
cycle_foreground(sigmsg->channel, 1, NULL);
|
||||
|
@ -1449,11 +1431,9 @@ static ZIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal)
|
|||
case ZAP_SIGEVENT_RESTART:
|
||||
{
|
||||
while((session = zap_channel_get_session(sigmsg->channel, 0))) {
|
||||
//switch_core_session_signal_lock(session);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_hangup(channel, sigmsg->channel->caller_data.hangup_cause);
|
||||
zap_channel_clear_token(sigmsg->channel, switch_core_session_get_uuid(session));
|
||||
//switch_core_session_signal_unlock(session);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
}
|
||||
|
@ -1462,23 +1442,19 @@ static ZIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal)
|
|||
{
|
||||
if ((session = zap_channel_get_session(sigmsg->channel, 0))) {
|
||||
zap_tone_type_t tt = ZAP_TONE_DTMF;
|
||||
//switch_core_session_signal_lock(session);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_mark_answered(channel);
|
||||
if (zap_channel_command(sigmsg->channel, ZAP_COMMAND_ENABLE_DTMF_DETECT, &tt) != ZAP_SUCCESS) {
|
||||
zap_log(ZAP_LOG_ERROR, "TONE ERROR\n");
|
||||
}
|
||||
//switch_core_session_signal_unlock(session);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
}
|
||||
case ZAP_SIGEVENT_PROGRESS_MEDIA:
|
||||
{
|
||||
if ((session = zap_channel_get_session(sigmsg->channel, 0))) {
|
||||
//switch_core_session_signal_lock(session);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_mark_pre_answered(channel);
|
||||
//switch_core_session_signal_unlock(session);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
}
|
||||
|
@ -1486,10 +1462,8 @@ static ZIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal)
|
|||
case ZAP_SIGEVENT_PROGRESS:
|
||||
{
|
||||
if ((session = zap_channel_get_session(sigmsg->channel, 0))) {
|
||||
//switch_core_session_signal_lock(session);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_mark_ring_ready(channel);
|
||||
//switch_core_session_signal_unlock(session);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue