more stuff

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6908 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-12-20 02:55:36 +00:00
parent 427fbdb369
commit ef3fde4ddf
16 changed files with 5575 additions and 6031 deletions
+4 -4
View File
@@ -53,10 +53,10 @@ typedef enum {
SWITCH_SHN_ON_HANGUP,
SWITCH_SHN_ON_LOOPBACK,
SWITCH_SHN_ON_TRANSMIT,
SWITCH_SHN_ON_PARK,
SWITCH_SHN_ON_HOLD,
SWITCH_SHN_ON_HIBERNATE,
SWITCH_SHN_ON_RESET
SWITCH_SHN_ON_RESET,
SWITCH_SHN_ON_PARK
} switch_state_handler_name_t;
struct switch_state_handler_table {
@@ -72,14 +72,14 @@ struct switch_state_handler_table {
switch_state_handler_t on_loopback;
/*! executed when the state changes to transmit */
switch_state_handler_t on_transmit;
/*! executed when the state changes to park */
switch_state_handler_t on_park;
/*! executed when the state changes to hold */
switch_state_handler_t on_hold;
/*! executed when the state changes to hibernate */
switch_state_handler_t on_hibernate;
/*! executed when the state changes to reset */
switch_state_handler_t on_reset;
/*! executed when the state changes to park */
switch_state_handler_t on_park;
void *padding[10];
};
+28
View File
@@ -202,6 +202,34 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
const char *buuid;
switch_core_session_t *bsession;
switch_channel_t *bchannel;
const char *lost_ext;
if (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");
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 ((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);
}
cause = switch_channel_get_cause(channel);
sip_cause = hangup_cause_to_sip(cause);
+1 -1
View File
@@ -1875,7 +1875,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
switch_core_session_t *b_session;
if ((b_session = switch_core_session_locate(br))) {
switch_channel_set_variable(channel, "TRANSFER_FALLBACK", from->a_user);
switch_channel_set_variable(channel, "transfer_fallback_extension", from->a_user);
switch_ivr_session_transfer(b_session, exten, NULL, NULL);
switch_core_session_rwunlock(b_session);
}
+4 -2
View File
@@ -670,9 +670,11 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
dft_state = "confirmed";
}
if (!strcasecmp(state, "cs_execute") && !strcasecmp(direction, "inbound") && !strcasecmp(event_status, "hold")) {
if (!strcasecmp(state, "cs_execute") && !strstr(event_status, "hold")) {
goto end;
} else if (!strcasecmp(state, "cs_hangup")) {
}
if (!strcasecmp(state, "cs_hangup")) {
astate = "terminated";
} else if (switch_strlen_zero(astate)) {
astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
+21 -14
View File
@@ -219,6 +219,8 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
end:
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
//switch_channel_clear_flag(chan_b, CF_BROADCAST);
//switch_channel_set_flag(chan_b, CF_BREAK);
switch_core_session_reset(session_a);
switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
@@ -650,6 +652,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
}
switch_channel_clear_flag(caller_channel, CF_ORIGINATOR);
//make sure this doesnt break anything
switch_channel_set_state(peer_channel, CS_RESET);
while (switch_channel_get_state(peer_channel) == CS_LOOPBACK) {
switch_yield(1000);
}
@@ -702,7 +706,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
* inturrupt anything they are already doing.
* originatee_session will fall asleep and originator_session will bridge to it
*/
switch_channel_clear_state_handler(originator_channel, NULL);
switch_channel_clear_state_handler(originatee_channel, NULL);
switch_channel_set_flag(originator_channel, CF_ORIGINATOR);
@@ -767,7 +771,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid)
{
switch_core_session_t *rsession, *bsession;
switch_core_session_t *rsession, *bsession = NULL;
switch_channel_t *channel, *rchannel, *bchannel;
const char *buuid;
@@ -779,25 +783,28 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session
channel = switch_core_session_get_channel(session);
rchannel = switch_core_session_get_channel(rsession);
switch_channel_answer(channel);
switch_channel_pre_answer(channel);
buuid = switch_channel_get_variable(rchannel, SWITCH_SIGNAL_BOND_VARIABLE);
if ((buuid = switch_channel_get_variable(rchannel, SWITCH_SIGNAL_BOND_VARIABLE))) {
bsession = switch_core_session_locate(buuid);
}
if (!switch_channel_test_flag(rchannel, CF_ANSWERED)) {
switch_channel_answer(rchannel);
}
//switch_ivr_park_session(rsession);
switch_channel_set_state_flag(rchannel, CF_TRANSFER);
switch_channel_set_state(rchannel, CS_RESET);
if (buuid) {
if ((bsession = switch_core_session_locate(buuid))) {
bchannel = switch_core_session_get_channel(bsession);
switch_channel_hangup(bchannel, SWITCH_CAUSE_PICKED_OFF);
switch_core_session_rwunlock(bsession);
}
if (bsession) {
bchannel = switch_core_session_get_channel(bsession);
switch_channel_hangup(bchannel, SWITCH_CAUSE_PICKED_OFF);
switch_core_session_rwunlock(bsession);
}
if (!switch_channel_test_flag(rchannel, CF_ANSWERED)) {
switch_channel_answer(rchannel);
}
switch_core_session_rwunlock(rsession);