[asterisk-commits] mmichelson: branch group/CCSS_Monitor_Restructure r244496 - /team/group/CCSS_...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Feb 2 19:40:23 CST 2010
Author: mmichelson
Date: Tue Feb 2 19:40:19 2010
New Revision: 244496
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244496
Log:
Improve code having to do with SIP call-completion.
This is mostly just some cleanup. Returning more accurate
values, handling failure cases properly, etc. There is
also a grievous logic error fixed in the monitor's suspend
callback.
I'm currently having an issue where my PUBLISH dialogs are not
being destroyed, apparently because they are not being unlinked
from the container of dialogs. The problem I'm having is that
I am unclear on what the proper chan_sip way of doing this is.
What's also odd is that I don't see this for my SUBSCRIBE requests,
which are handled much the same way. Alas, this is a problem
for tomorrow.
Modified:
team/group/CCSS_Monitor_Restructure/channels/chan_sip.c
Modified: team/group/CCSS_Monitor_Restructure/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/channels/chan_sip.c?view=diff&rev=244496&r1=244495&r2=244496
==============================================================================
--- team/group/CCSS_Monitor_Restructure/channels/chan_sip.c (original)
+++ team/group/CCSS_Monitor_Restructure/channels/chan_sip.c Tue Feb 2 19:40:19 2010
@@ -1901,7 +1901,7 @@
return NULL;
}
- if (!(epa_entry = ao2_alloc(sizeof(*epa_entry), static_data->destructor))) {
+ if (!(epa_entry = ao2_t_alloc(sizeof(*epa_entry), static_data->destructor, "Allocate new EPA entry"))) {
return NULL;
}
@@ -3637,7 +3637,7 @@
if (monitor_instance->suspension_entry) {
monitor_instance->suspension_entry->body[0] = '\0';
transmit_publish(monitor_instance->suspension_entry, SIP_PUBLISH_REMOVE ,monitor_instance->notify_uri);
- ao2_ref(monitor_instance->suspension_entry, -1);
+ ao2_t_ref(monitor_instance->suspension_entry, -1, "Decrementing suspension entry refcount in sip_monitor_instance_destructor");
}
ast_string_field_free_memory(monitor_instance);
}
@@ -3766,13 +3766,15 @@
ao2_ref(monitor_instance, -1);
return -1;
}
+ ast_log(LOG_NOTICE, "Created EPA entry......\n");
cc_entry->core_id = monitor->core_id;
- cc_entry->current_state = CC_CLOSED;
monitor_instance->suspension_entry->instance_data = cc_entry;
publish_type = SIP_PUBLISH_INITIAL;
} else {
publish_type = SIP_PUBLISH_MODIFY;
}
+
+ cc_entry->current_state = CC_CLOSED;
if (ast_strlen_zero(monitor_instance->notify_uri)) {
/* If we have no set notify_uri, then what this means is that we have
@@ -3790,9 +3792,7 @@
return 0;
}
construct_pidf_body(CC_CLOSED, monitor_instance->suspension_entry->body, sizeof(monitor_instance->suspension_entry->body));
- transmit_publish(monitor_instance->suspension_entry, publish_type, monitor_instance->notify_uri);
-
- return 0;
+ return transmit_publish(monitor_instance->suspension_entry, publish_type, monitor_instance->notify_uri);
}
static int sip_cc_monitor_status_response(struct ast_cc_monitor *monitor, enum ast_device_state devstate)
@@ -3824,9 +3824,7 @@
return 0;
}
construct_pidf_body(CC_OPEN, monitor_instance->suspension_entry->body, sizeof(monitor_instance->suspension_entry->body));
- transmit_publish(monitor_instance->suspension_entry, SIP_PUBLISH_MODIFY, monitor_instance->notify_uri);
-
- return 0;
+ return transmit_publish(monitor_instance->suspension_entry, SIP_PUBLISH_MODIFY, monitor_instance->notify_uri);
}
static int sip_cc_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id)
@@ -12549,7 +12547,10 @@
sip_pvt_lock(pvt);
- create_addr(pvt, epa_entry->destination, NULL, TRUE);
+ if (create_addr(pvt, epa_entry->destination, NULL, TRUE)) {
+ dialog_unlink_all(pvt, TRUE, TRUE);
+ dialog_unref(pvt, "create_addr failed in transmit_publish. Unref dialog");
+ }
ast_sip_ouraddrfor(&pvt->sa.sin_addr, &pvt->ourip, pvt);
ast_set_flag(&pvt->flags[0], SIP_OUTGOING);
expires = (publish_type == SIP_PUBLISH_REMOVE) ? 0 : DEFAULT_PUBLISH_EXPIRES;
@@ -21536,14 +21537,19 @@
}
ast_string_field_set(monitor_instance, notify_uri, uri);
- if (monitor_instance->suspension_entry && (cc_entry = monitor_instance->suspension_entry->instance_data) == CC_CLOSED) {
- /* If we've created a suspension entry and the current state is closed, then that means
- * we got a notice from the CC core earlier to suspend monitoring, but because this particular
- * call leg had not yet notified us that it was ready for recall, it meant that we
- * could not yet send a PUBLISH. Now, however, we can.
- */
- construct_pidf_body(CC_CLOSED, monitor_instance->suspension_entry->body, sizeof(monitor_instance->suspension_entry->body));
- transmit_publish(monitor_instance->suspension_entry, SIP_PUBLISH_INITIAL, monitor_instance->notify_uri);
+ if (monitor_instance->suspension_entry) {
+ cc_entry = monitor_instance->suspension_entry->instance_data;
+ if (cc_entry->current_state == CC_CLOSED) {
+ /* If we've created a suspension entry and the current state is closed, then that means
+ * we got a notice from the CC core earlier to suspend monitoring, but because this particular
+ * call leg had not yet notified us that it was ready for recall, it meant that we
+ * could not yet send a PUBLISH. Now, however, we can.
+ */
+ construct_pidf_body(CC_CLOSED, monitor_instance->suspension_entry->body, sizeof(monitor_instance->suspension_entry->body));
+ transmit_publish(monitor_instance->suspension_entry, SIP_PUBLISH_INITIAL, monitor_instance->notify_uri);
+ } else {
+ ast_cc_monitor_callee_available(monitor_instance->core_id);
+ }
} else {
ast_cc_monitor_callee_available(monitor_instance->core_id);
}
More information about the asterisk-commits
mailing list