[asterisk-commits] mmichelson: branch group/CCSS r220791 - /team/group/CCSS/main/ccss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 28 14:57:07 CDT 2009


Author: mmichelson
Date: Mon Sep 28 14:57:03 2009
New Revision: 220791

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=220791
Log:
Hnadle generic CC requests while still on the failed call more gracefully.


Modified:
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=220791&r1=220790&r2=220791
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Mon Sep 28 14:57:03 2009
@@ -719,6 +719,7 @@
 		return -1;
 	}
 
+	generic_pvt->offer_timer_id = -1;
 	agent->private_data = generic_pvt;
 	return 0;
 }
@@ -1342,6 +1343,8 @@
 		return -1;
 	}
 
+	ast_log(LOG_NOTICE, "Found core_instance with core_id %d\n", core_instance->core_id);
+
 	if (strcmp(core_instance->agent->callbacks->type, "generic")) {
 		ast_log(LOG_NOTICE, "CallCompletionRequest is only for generic agent types.\n");
 		cc_unref(core_instance, "Unref core_instance since CallCompletionRequest was called with native agent");
@@ -1350,7 +1353,13 @@
 
 	generic_pvt = core_instance->agent->private_data;
 
-	ast_sched_thread_del(cc_sched_thread, generic_pvt->offer_timer_id);
+	/* Generic agents have the flexibility of requesting CC either while
+	 * still on the failed call, or after hanging up. As such, the offer timer
+	 * is not always guaranteed to be running when the caller makes his request.
+	 */
+	if (generic_pvt->offer_timer_id != -1) {
+		ast_sched_thread_del(cc_sched_thread, generic_pvt->offer_timer_id);
+	}
 	res = ast_cc_request_state_change(CC_CALLER_REQUESTED, core_instance->core_id, "CallCompletionRequest called");
 	cc_unref(core_instance, "Done with CallCompletionRequest");
 	return res;




More information about the asterisk-commits mailing list