tweak parking bug
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8089 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
f66f3902b6
commit
f78d5a19df
|
@ -329,9 +329,7 @@ static void pres_event_handler(switch_event_t *event)
|
||||||
node = create_node(node_name, 0);
|
node = create_node(node_name, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_mutex_lock(node->mutex);
|
|
||||||
send_presence(node);
|
send_presence(node);
|
||||||
switch_mutex_unlock(node->mutex);
|
|
||||||
|
|
||||||
switch_mutex_unlock(globals.mutex);
|
switch_mutex_unlock(globals.mutex);
|
||||||
|
|
||||||
|
@ -498,9 +496,10 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
|
|
||||||
switch_mutex_lock(node->mutex);
|
switch_mutex_lock(node->mutex);
|
||||||
node->caller_count++;
|
node->caller_count++;
|
||||||
send_presence(node);
|
|
||||||
switch_core_hash_insert(node->caller_hash, uuid, session);
|
switch_core_hash_insert(node->caller_hash, uuid, session);
|
||||||
|
|
||||||
|
|
||||||
if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) {
|
if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) {
|
||||||
p = atoi(pri);
|
p = atoi(pri);
|
||||||
}
|
}
|
||||||
|
@ -545,6 +544,8 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
cd.next = switch_timestamp(NULL) + cd.freq;
|
cd.next = switch_timestamp(NULL) + cd.freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
send_presence(node);
|
||||||
|
|
||||||
while(switch_channel_ready(channel)) {
|
while(switch_channel_ready(channel)) {
|
||||||
switch_input_args_t args = { 0 };
|
switch_input_args_t args = { 0 };
|
||||||
char buf[25] = "";
|
char buf[25] = "";
|
||||||
|
@ -567,6 +568,8 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_core_session_flush_private_events(session);
|
||||||
|
|
||||||
if (moh) {
|
if (moh) {
|
||||||
switch_ivr_play_file(session, NULL, moh, &args);
|
switch_ivr_play_file(session, NULL, moh, &args);
|
||||||
} else {
|
} else {
|
||||||
|
@ -592,6 +595,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_core_session_flush_private_events(session);
|
||||||
|
|
||||||
if (switch_channel_ready(channel)) {
|
if (switch_channel_ready(channel)) {
|
||||||
if (announce) {
|
if (announce) {
|
||||||
|
@ -621,9 +625,10 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
switch_mutex_lock(node->mutex);
|
switch_mutex_lock(node->mutex);
|
||||||
node_remove_uuid(node, uuid);
|
node_remove_uuid(node, uuid);
|
||||||
node->caller_count--;
|
node->caller_count--;
|
||||||
send_presence(node);
|
|
||||||
switch_core_hash_delete(node->caller_hash, uuid);
|
switch_core_hash_delete(node->caller_hash, uuid);
|
||||||
switch_mutex_unlock(node->mutex);
|
switch_mutex_unlock(node->mutex);
|
||||||
|
send_presence(node);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cd.do_orbit && cd.orbit_exten) {
|
if (cd.do_orbit && cd.orbit_exten) {
|
||||||
|
@ -847,6 +852,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
|
|
||||||
switch_channel_set_variable(other_channel, "fifo_serviced_by", my_id);
|
switch_channel_set_variable(other_channel, "fifo_serviced_by", my_id);
|
||||||
switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session));
|
switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session));
|
||||||
|
|
||||||
switch_channel_set_flag(other_channel, CF_BREAK);
|
switch_channel_set_flag(other_channel, CF_BREAK);
|
||||||
|
|
||||||
while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && switch_channel_test_flag(other_channel, CF_TAGGED)) {
|
while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && switch_channel_test_flag(other_channel, CF_TAGGED)) {
|
||||||
|
@ -883,9 +889,9 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
switch_channel_set_variable(other_channel, "fifo_status", "TALKING");
|
switch_channel_set_variable(other_channel, "fifo_status", "TALKING");
|
||||||
switch_channel_set_variable(other_channel, "fifo_timestamp", date);
|
switch_channel_set_variable(other_channel, "fifo_timestamp", date);
|
||||||
switch_channel_set_variable(other_channel, "fifo_target", switch_core_session_get_uuid(session));
|
switch_channel_set_variable(other_channel, "fifo_target", switch_core_session_get_uuid(session));
|
||||||
switch_mutex_lock(node->mutex);
|
|
||||||
send_presence(node);
|
send_presence(node);
|
||||||
switch_mutex_unlock(node->mutex);
|
|
||||||
|
|
||||||
if (record_template) {
|
if (record_template) {
|
||||||
expanded = switch_channel_expand_variables(other_channel, record_template);
|
expanded = switch_channel_expand_variables(other_channel, record_template);
|
||||||
|
@ -912,10 +918,12 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
|
|
||||||
switch_mutex_lock(node->mutex);
|
switch_mutex_lock(node->mutex);
|
||||||
node->caller_count--;
|
node->caller_count--;
|
||||||
send_presence(node);
|
|
||||||
switch_core_hash_delete(node->caller_hash, uuid);
|
switch_core_hash_delete(node->caller_hash, uuid);
|
||||||
switch_mutex_unlock(node->mutex);
|
switch_mutex_unlock(node->mutex);
|
||||||
|
send_presence(node);
|
||||||
switch_core_session_rwunlock(other_session);
|
switch_core_session_rwunlock(other_session);
|
||||||
|
|
||||||
|
|
||||||
if (!do_wait) {
|
if (!do_wait) {
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ struct presence_helper {
|
||||||
sofia_profile_t *profile;
|
sofia_profile_t *profile;
|
||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
switch_stream_handle_t stream;
|
switch_stream_handle_t stream;
|
||||||
|
char last_uuid[512];
|
||||||
};
|
};
|
||||||
|
|
||||||
switch_status_t sofia_presence_chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint)
|
switch_status_t sofia_presence_chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint)
|
||||||
|
@ -472,6 +473,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
|
||||||
if (!switch_strlen_zero((char *)helper.stream.data)) {
|
if (!switch_strlen_zero((char *)helper.stream.data)) {
|
||||||
char *this = (char *)helper.stream.data;
|
char *this = (char *)helper.stream.data;
|
||||||
char *next = NULL;
|
char *next = NULL;
|
||||||
|
char *last = NULL;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if ((next = strchr(this, ';'))) {
|
if ((next = strchr(this, ';'))) {
|
||||||
|
@ -481,8 +483,9 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!switch_strlen_zero(this)) {
|
if (!switch_strlen_zero(this) && (!last || strcmp(last, this))) {
|
||||||
sofia_glue_execute_sql(profile, &this, SWITCH_FALSE);
|
sofia_glue_execute_sql(profile, &this, SWITCH_FALSE);
|
||||||
|
last = this;
|
||||||
}
|
}
|
||||||
this = next;
|
this = next;
|
||||||
} while (this);
|
} while (this);
|
||||||
|
@ -934,8 +937,10 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||||
ct = "application/dialog-info+xml";
|
ct = "application/dialog-info+xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!switch_strlen_zero(astate) && !switch_strlen_zero(uuid) && helper && helper->stream.data) {
|
if (!switch_strlen_zero(astate) && !switch_strlen_zero(uuid) && helper && helper->stream.data && strcmp(helper->last_uuid, uuid)) {
|
||||||
helper->stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where uuid='%s';\n", astate, uuid);
|
helper->stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where uuid='%s';", astate, uuid);
|
||||||
|
|
||||||
|
switch_copy_string(helper->last_uuid, uuid, sizeof(helper->last_uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue