[asterisk-commits] rmudgett: branch rmudgett/misdn_facility r173497 - /team/rmudgett/misdn_facil...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Feb 4 14:06:24 CST 2009
Author: rmudgett
Date: Wed Feb 4 14:06:24 2009
New Revision: 173497
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=173497
Log:
Merged from
https://origsvn.digium.com/svn/asterisk/be/branches/C.2...
..........
r173495 | rmudgett | 2009-02-04 13:56:39 -0600 (Wed, 04 Feb 2009) | 3 lines
* Fixed CCBS/CCNR not allowing call-completion setup if the current
call attempt is a call-completion attempt.
Modified:
team/rmudgett/misdn_facility/channels/chan_misdn.c
Modified: team/rmudgett/misdn_facility/channels/chan_misdn.c
URL: http://svn.digium.com/svn-view/asterisk/team/rmudgett/misdn_facility/channels/chan_misdn.c?view=diff&rev=173497&r1=173496&r2=173497
==============================================================================
--- team/rmudgett/misdn_facility/channels/chan_misdn.c (original)
+++ team/rmudgett/misdn_facility/channels/chan_misdn.c Wed Feb 4 14:06:24 2009
@@ -6479,6 +6479,7 @@
return -1;
}
+ /* Setup calling parameters to retry the call. */
newbc->dialed = cc_record->redial.dialed;
newbc->caller = cc_record->redial.caller;
memset(&newbc->redirecting, 0, sizeof(newbc->redirecting));
@@ -9040,9 +9041,26 @@
case EVENT_ALERTING:
case EVENT_DISCONNECT:
/* CCBS/CCNR is available */
- if (ch && ch->peer && ch->record_id == -1) {
+ if (ch && ch->peer) {
ast_mutex_lock(&misdn_cc_record_lock);
- cc_record = misdn_cc_new();
+ if (ch->record_id == -1) {
+ cc_record = misdn_cc_new();
+ } else {
+ /*
+ * We are doing a call-completion attempt or the switch
+ * is sending us extra call-completion availability
+ * indications.
+ */
+ cc_record = misdn_cc_find_by_id(ch->record_id);
+ if (cc_record) {
+ /* Restart the record age timer. */
+ cc_record->time_created = time(NULL);
+ cc_record = NULL;
+ } else {
+ ch->record_id = -1;
+ cc_record = misdn_cc_new();
+ }
+ }
if (cc_record) {
ch->record_id = cc_record->record_id;
cc_record->ptp = 0;
@@ -9057,11 +9075,14 @@
cc_record->redial.hdlc = bc->hdlc;
}
ast_mutex_unlock(&misdn_cc_record_lock);
+
+ /* Set MISDN_CC_RECORD_ID in original channel */
if (ch->record_id != -1) {
- /* Set MISDN_CC_RECORD_ID in original channel */
snprintf(buf, sizeof(buf), "%d", cc_record->record_id);
- pbx_builtin_setvar_helper(ch->peer, MISDN_CC_RECORD_ID, buf);
+ } else {
+ buf[0] = 0;
}
+ pbx_builtin_setvar_helper(ch->peer, MISDN_CC_RECORD_ID, buf);
}
break;
default:
@@ -9181,9 +9202,26 @@
case EVENT_ALERTING:
case EVENT_DISCONNECT:
/* CCBS-T/CCNR-T is available */
- if (ch && ch->peer && ch->record_id == -1) {
+ if (ch && ch->peer) {
ast_mutex_lock(&misdn_cc_record_lock);
- cc_record = misdn_cc_new();
+ if (ch->record_id == -1) {
+ cc_record = misdn_cc_new();
+ } else {
+ /*
+ * We are doing a call-completion attempt or the switch
+ * is sending us extra call-completion availability
+ * indications.
+ */
+ cc_record = misdn_cc_find_by_id(ch->record_id);
+ if (cc_record) {
+ /* Restart the record age timer. */
+ cc_record->time_created = time(NULL);
+ cc_record = NULL;
+ } else {
+ ch->record_id = -1;
+ cc_record = misdn_cc_new();
+ }
+ }
if (cc_record) {
ch->record_id = cc_record->record_id;
cc_record->ptp = 1;
@@ -9197,11 +9235,14 @@
cc_record->redial.hdlc = bc->hdlc;
}
ast_mutex_unlock(&misdn_cc_record_lock);
+
+ /* Set MISDN_CC_RECORD_ID in original channel */
if (ch->record_id != -1) {
- /* Set MISDN_CC_RECORD_ID in original channel */
snprintf(buf, sizeof(buf), "%d", cc_record->record_id);
- pbx_builtin_setvar_helper(ch->peer, MISDN_CC_RECORD_ID, buf);
+ } else {
+ buf[0] = 0;
}
+ pbx_builtin_setvar_helper(ch->peer, MISDN_CC_RECORD_ID, buf);
}
break;
default:
@@ -9889,8 +9930,15 @@
misdn_cc_delete(cc_record);
}
ast_mutex_unlock(&misdn_cc_record_lock);
+ ch->record_id = -1;
if (ch->peer) {
pbx_builtin_setvar_helper(ch->peer, MISDN_CC_RECORD_ID, "");
+
+ /*
+ * The peer pointer is no longer needed and keeping it around
+ * could be dangerous.
+ */
+ ch->peer = NULL;
}
}
#endif /* defined(AST_MISDN_ENHANCEMENTS) */
More information about the asterisk-commits
mailing list