[Freeswitch-svn] [commit] r8089 - in freeswitch/trunk/src/mod: applications/mod_fifo endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Fri Apr 11 15:41:24 EDT 2008
Author: anthm
Date: Fri Apr 11 15:41:24 2008
New Revision: 8089
Modified:
freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
Log:
tweak parking bug
Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c Fri Apr 11 15:41:24 2008
@@ -329,9 +329,7 @@
node = create_node(node_name, 0);
}
- switch_mutex_lock(node->mutex);
send_presence(node);
- switch_mutex_unlock(node->mutex);
switch_mutex_unlock(globals.mutex);
@@ -498,8 +496,9 @@
switch_mutex_lock(node->mutex);
node->caller_count++;
- send_presence(node);
+
switch_core_hash_insert(node->caller_hash, uuid, session);
+
if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) {
p = atoi(pri);
@@ -545,6 +544,8 @@
cd.next = switch_timestamp(NULL) + cd.freq;
}
+ send_presence(node);
+
while(switch_channel_ready(channel)) {
switch_input_args_t args = { 0 };
char buf[25] = "";
@@ -566,7 +567,9 @@
if ((serviced_uuid = switch_channel_get_variable(channel, "fifo_serviced_uuid"))) {
break;
}
-
+
+ switch_core_session_flush_private_events(session);
+
if (moh) {
switch_ivr_play_file(session, NULL, moh, &args);
} else {
@@ -592,6 +595,7 @@
}
}
+ switch_core_session_flush_private_events(session);
if (switch_channel_ready(channel)) {
if (announce) {
@@ -621,9 +625,10 @@
switch_mutex_lock(node->mutex);
node_remove_uuid(node, uuid);
node->caller_count--;
- send_presence(node);
switch_core_hash_delete(node->caller_hash, uuid);
switch_mutex_unlock(node->mutex);
+ send_presence(node);
+
}
if (cd.do_orbit && cd.orbit_exten) {
@@ -847,6 +852,7 @@
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_flag(other_channel, CF_BREAK);
while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && switch_channel_test_flag(other_channel, CF_TAGGED)) {
@@ -883,9 +889,9 @@
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_target", switch_core_session_get_uuid(session));
- switch_mutex_lock(node->mutex);
+
send_presence(node);
- switch_mutex_unlock(node->mutex);
+
if (record_template) {
expanded = switch_channel_expand_variables(other_channel, record_template);
@@ -912,10 +918,12 @@
switch_mutex_lock(node->mutex);
node->caller_count--;
- send_presence(node);
switch_core_hash_delete(node->caller_hash, uuid);
switch_mutex_unlock(node->mutex);
+ send_presence(node);
switch_core_session_rwunlock(other_session);
+
+
if (!do_wait) {
done = 1;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Fri Apr 11 15:41:24 2008
@@ -46,6 +46,7 @@
sofia_profile_t *profile;
switch_event_t *event;
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)
@@ -472,6 +473,7 @@
if (!switch_strlen_zero((char *)helper.stream.data)) {
char *this = (char *)helper.stream.data;
char *next = NULL;
+ char *last = NULL;
do {
if ((next = strchr(this, ';'))) {
@@ -481,8 +483,9 @@
}
}
- if (!switch_strlen_zero(this)) {
+ if (!switch_strlen_zero(this) && (!last || strcmp(last, this))) {
sofia_glue_execute_sql(profile, &this, SWITCH_FALSE);
+ last = this;
}
this = next;
} while (this);
@@ -934,8 +937,10 @@
ct = "application/dialog-info+xml";
}
- if (!switch_strlen_zero(astate) && !switch_strlen_zero(uuid) && helper && helper->stream.data) {
- helper->stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where uuid='%s';\n", astate, uuid);
+ 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';", astate, uuid);
+
+ switch_copy_string(helper->last_uuid, uuid, sizeof(helper->last_uuid));
}
More information about the Freeswitch-svn
mailing list