[svn-commits] rmudgett: branch rmudgett/misdn_facility r164797 - /team/rmudgett/misdn_facil...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 16 13:39:03 CST 2008


Author: rmudgett
Date: Tue Dec 16 13:39:02 2008
New Revision: 164797

URL: http://svn.digium.com/view/asterisk?view=rev&rev=164797
Log:
Merged from
https://origsvn.digium.com/svn/asterisk/be/branches/C.2...

..........
r164795 | rmudgett | 2008-12-16 13:18:14 -0600 (Tue, 16 Dec 2008) | 4 lines

*  Fixed problem where User-B information for call-completion
was not saved for a possible call-completion attempt.
*  Some minor code restructuring to reduce indention levels.

Modified:
    team/rmudgett/misdn_facility/channels/chan_misdn.c

Modified: team/rmudgett/misdn_facility/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/rmudgett/misdn_facility/channels/chan_misdn.c?view=diff&rev=164797&r1=164796&r2=164797
==============================================================================
--- team/rmudgett/misdn_facility/channels/chan_misdn.c (original)
+++ team/rmudgett/misdn_facility/channels/chan_misdn.c Tue Dec 16 13:39:02 2008
@@ -5689,7 +5689,9 @@
 
 static int stop_bc_tones(struct chan_list *cl)
 {
-	if (!cl) return -1;
+	if (!cl) {
+		return -1;
+	}
 
 	cl->notxtone = 1;
 	cl->norxtone = 1;
@@ -6239,12 +6241,14 @@
 
 static void hangup_chan(struct chan_list *ch)
 {
-	int port = ch ? (ch->bc ? ch->bc->port : 0) : 0;
+	int port;
+
 	if (!ch) {
 		cb_log(1, 0, "Cannot hangup chan, no ch\n");
 		return;
 	}
 
+	port = ch->bc ? ch->bc->port : 0;
 	cb_log(5, port, "hangup_chan called\n");
 
 	if (ch->need_hangup) {
@@ -6274,80 +6278,74 @@
 }
 
 /** Isdn asks us to release channel, pendant to misdn_hangup **/
-static void release_chan(struct misdn_bchannel *bc) {
-	struct ast_channel *ast = NULL;
+static void release_chan(struct misdn_bchannel *bc)
+{
+	struct chan_list *ch;
+	struct ast_channel *ast;
 
 	ast_mutex_lock(&release_lock);
-	{
-		struct chan_list *ch=find_chan_by_bc(cl_te, bc);
-		if (!ch)  {
-			chan_misdn_log(1, bc->port, "release_chan: Ch not found!\n");
-			ast_mutex_unlock(&release_lock);
-			return;
-		}
-
-		if (ch->ast) {
-			ast = ch->ast;
-		} 
-
-		chan_misdn_log(5, bc->port, "release_chan: bc with l3id: %x\n", bc->l3_id);
-
-		/*releasing jitterbuffer*/
-		if (ch->jb ) {
-			misdn_jb_destroy(ch->jb);
-			ch->jb = NULL;
-		} else {
-			if (!bc->nojitter)
-				chan_misdn_log(5, bc->port, "Jitterbuffer already destroyed.\n");
-		}
-
-		if (ch->overlap_dial) {
-			if (ch->overlap_dial_task != -1) {
-				misdn_tasks_remove(ch->overlap_dial_task);
-				ch->overlap_dial_task = -1;
-			}
-			ast_mutex_destroy(&ch->overlap_tv_lock);
-		}
-
-		if (ch->originator == ORG_AST) {
-			misdn_out_calls[bc->port]--;
-		} else {
-			misdn_in_calls[bc->port]--;
-		}
-
-		if (ch) {
-			close(ch->pipe[0]);
-			close(ch->pipe[1]);
-
-			if (ast && MISDN_ASTERISK_TECH_PVT(ast)) {
-				chan_misdn_log(1, bc->port,
-					"* RELEASING CHANNEL pid:%d context:%s dialed:%s caller:\"%s\" <%s> state: %s\n",
-					bc ? bc->pid : -1,
-					ast->context,
-					ast->exten,
-					ast->cid.cid_name ? ast->cid.cid_name : "",
-					ast->cid.cid_num ? ast->cid.cid_num : "",
-					misdn_get_ch_state(ch));
-				chan_misdn_log(3, bc->port, " --> * State Down\n");
-				MISDN_ASTERISK_TECH_PVT(ast) = NULL;
-
-				if (ast->_state != AST_STATE_RESERVED) {
-					chan_misdn_log(3, bc->port, " --> Setting AST State to down\n");
-					ast_setstate(ast, AST_STATE_DOWN);
-				}
-			}
-
-			ch->state = MISDN_CLEANING;
-			cl_dequeue_chan(&cl_te, ch);
-
-			ast_free(ch);
-		} else {
-			/* chan is already cleaned, so exiting  */
-		}
-	}
+
+	ch = find_chan_by_bc(cl_te, bc);
+	if (!ch) {
+		chan_misdn_log(1, bc->port, "release_chan: Ch not found!\n");
+		ast_mutex_unlock(&release_lock);
+		return;
+	}
+
+	chan_misdn_log(5, bc->port, "release_chan: bc with l3id: %x\n", bc->l3_id);
+
+	/* releasing jitterbuffer */
+	if (ch->jb) {
+		misdn_jb_destroy(ch->jb);
+		ch->jb = NULL;
+	} else if (!bc->nojitter) {
+		chan_misdn_log(5, bc->port, "Jitterbuffer already destroyed.\n");
+	}
+
+	if (ch->overlap_dial) {
+		if (ch->overlap_dial_task != -1) {
+			misdn_tasks_remove(ch->overlap_dial_task);
+			ch->overlap_dial_task = -1;
+		}
+		ast_mutex_destroy(&ch->overlap_tv_lock);
+	}
+
+	if (ch->originator == ORG_AST) {
+		--misdn_out_calls[bc->port];
+	} else {
+		--misdn_in_calls[bc->port];
+	}
+
+	close(ch->pipe[0]);
+	close(ch->pipe[1]);
+
+	ast = ch->ast;
+	if (ast && MISDN_ASTERISK_TECH_PVT(ast)) {
+		chan_misdn_log(1, bc->port,
+			"* RELEASING CHANNEL pid:%d context:%s dialed:%s caller:\"%s\" <%s> state: %s\n",
+			bc ? bc->pid : -1,
+			ast->context,
+			ast->exten,
+			ast->cid.cid_name ? ast->cid.cid_name : "",
+			ast->cid.cid_num ? ast->cid.cid_num : "",
+			misdn_get_ch_state(ch));
+		chan_misdn_log(3, bc->port, " --> * State Down\n");
+		MISDN_ASTERISK_TECH_PVT(ast) = NULL;
+
+		if (ast->_state != AST_STATE_RESERVED) {
+			chan_misdn_log(3, bc->port, " --> Setting AST State to down\n");
+			ast_setstate(ast, AST_STATE_DOWN);
+		}
+	}
+
+	ch->state = MISDN_CLEANING;
+	cl_dequeue_chan(&cl_te, ch);
+
+	ast_free(ch);
+
 	ast_mutex_unlock(&release_lock);
-/*** release end **/
-}
+}	/* end release_chan() */
+
 
 static void misdn_transfer_bc(struct chan_list *tmp_ch, struct chan_list *holded_chan)
 {
@@ -6890,6 +6888,12 @@
 					ch->record_id = cc_record->record_id;
 					cc_record->port = bc->port;
 					cc_record->linkage_id = bc->fac_in.u.CallInfoRetain.CallLinkageID;
+
+					/* Record call information for possible call-completion attempt. */
+					cc_record->redial.caller = bc->caller;
+					cc_record->redial.dialed = bc->dialed;
+					cc_record->redial.capability = bc->capability;
+					cc_record->redial.hdlc = bc->hdlc;
 				}
 				ast_mutex_unlock(&misdn_cc_record_lock);
 				if (ch->record_id != -1) {
@@ -7082,6 +7086,7 @@
 					ast_log(LOG_NOTICE, "No Ast or No private Pointer in Event (%d:%s)\n", event, manager_isdn_get_info(event));
 				return -1;
 			}
+			break;
 		}
 	}
 	
@@ -7745,11 +7750,11 @@
 		bc->need_release = 0;
 		bc->need_release_complete = 0;
 
-		stop_bc_tones(ch);
-		hangup_chan(ch);
-
-		if (ch)
+		if (ch) {
+			stop_bc_tones(ch);
+			hangup_chan(ch);
 			ch->state = MISDN_CLEANING;
+		}
 
 		release_chan(bc);
 		break;




More information about the svn-commits mailing list