[asterisk-commits] mjordan: branch mjordan/Timeout_Stuff r346761 - in /team/mjordan/Timeout_Stuf...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 1 16:23:00 CST 2011


Author: mjordan
Date: Thu Dec  1 16:22:56 2011
New Revision: 346761

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=346761
Log:
Move to a branch

Added:
    team/mjordan/Timeout_Stuff/trunk/
      - copied from r346709, trunk/
Modified:
    team/mjordan/Timeout_Stuff/trunk/apps/app_dial.c
    team/mjordan/Timeout_Stuff/trunk/channels/chan_sip.c
    team/mjordan/Timeout_Stuff/trunk/include/asterisk/cdr.h
    team/mjordan/Timeout_Stuff/trunk/main/cdr.c

Modified: team/mjordan/Timeout_Stuff/trunk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/Timeout_Stuff/trunk/apps/app_dial.c?view=diff&rev=346761&r1=346709&r2=346761
==============================================================================
--- team/mjordan/Timeout_Stuff/trunk/apps/app_dial.c (original)
+++ team/mjordan/Timeout_Stuff/trunk/apps/app_dial.c Thu Dec  1 16:22:56 2011
@@ -715,6 +715,7 @@
 	int busy;
 	int congestion;
 	int nochan;
+	int timedout;
 };
 
 static void handle_cause(int cause, struct cause_args *num)
@@ -740,7 +741,12 @@
 			ast_cdr_failed(cdr);
 		num->nochan++;
 		break;
-
+	case AST_CAUSE_NO_USER_RESPONSE:
+		if (cdr) {
+			ast_cdr_timedout(cdr);
+		}
+		num->timedout++;
+		break;
 	case AST_CAUSE_NO_ANSWER:
 		if (cdr) {
 			ast_cdr_noanswer(cdr);
@@ -1010,7 +1016,7 @@
 	struct ast_party_id *forced_clid, struct ast_party_id *stored_clid)
 {
 	struct cause_args num = *num_in;
-	int prestart = num.busy + num.congestion + num.nochan;
+	int prestart = num.busy + num.congestion + num.nochan + num.timedout;
 	int orig = *to;
 	struct ast_channel *peer = NULL;
 	/* single is set if only one destination is enabled */
@@ -1078,12 +1084,15 @@
 		if (pos == 1) { /* only the input channel is available */
 			if (numlines == (num.busy + num.congestion + num.nochan)) {
 				ast_verb(2, "Everyone is busy/congested at this time (%d:%d/%d/%d)\n", numlines, num.busy, num.congestion, num.nochan);
-				if (num.busy)
+				if (num.busy) {
 					strcpy(pa->status, "BUSY");
-				else if (num.congestion)
+				} else if (num.congestion) {
 					strcpy(pa->status, "CONGESTION");
-				else if (num.nochan)
+				} else if (num.timedout) {
+					strcpy(pa->status, "TIMEDOUT");
+				} else if (num.nochan) {
 					strcpy(pa->status, "CHANUNAVAIL");
+				}
 			} else {
 				ast_verb(3, "No one is available to answer at this time (%d:%d/%d/%d)\n", numlines, num.busy, num.congestion, num.nochan);
 			}

Modified: team/mjordan/Timeout_Stuff/trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/Timeout_Stuff/trunk/channels/chan_sip.c?view=diff&rev=346761&r1=346709&r2=346761
==============================================================================
--- team/mjordan/Timeout_Stuff/trunk/channels/chan_sip.c (original)
+++ team/mjordan/Timeout_Stuff/trunk/channels/chan_sip.c Thu Dec  1 16:22:56 2011
@@ -3677,6 +3677,7 @@
 			pkt->owner->owner->hangupcause = AST_CAUSE_NO_USER_RESPONSE;
 		}
 		if (pkt->owner->owner) {
+			ast_log(LOG_WARNING, "CAUSE CODE: %s\n", hangup_cause2sip(pkt->owner->owner->hangupcause));
 			ast_log(LOG_WARNING, "Hanging up call %s - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).\n", pkt->owner->callid);
 
 			if (pkt->is_resp &&
@@ -3697,7 +3698,9 @@
 				/* there is nothing left to do, mark the dialog as gone */
 				sip_alreadygone(pkt->owner);
 			}
-			ast_queue_hangup_with_cause(pkt->owner->owner, AST_CAUSE_PROTOCOL_ERROR);
+			ast_log(LOG_WARNING, "What the hell: %p %p %p\n", pkt, pkt->owner, pkt->owner->owner);
+			ast_queue_hangup_with_cause(pkt->owner->owner, pkt->owner->owner->hangupcause);
+			ast_log(LOG_WARNING, "Well, that's odd\n");
 			ast_channel_unlock(pkt->owner->owner);
 		} else {
 			/* If no channel owner, destroy now */

Modified: team/mjordan/Timeout_Stuff/trunk/include/asterisk/cdr.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/Timeout_Stuff/trunk/include/asterisk/cdr.h?view=diff&rev=346761&r1=346709&r2=346761
==============================================================================
--- team/mjordan/Timeout_Stuff/trunk/include/asterisk/cdr.h (original)
+++ team/mjordan/Timeout_Stuff/trunk/include/asterisk/cdr.h Thu Dec  1 16:22:56 2011
@@ -59,6 +59,7 @@
 	AST_CDR_BUSY     = (1 << 2),
 	AST_CDR_ANSWERED = (1 << 3),
 	AST_CDR_CONGESTION = (1 << 4),
+	AST_CDR_TIMEDOUT = (1 << 5),
 };
 
 /*!
@@ -269,6 +270,15 @@
 extern void ast_cdr_noanswer(struct ast_cdr *cdr);
 
 /*!
+ * \brief A call timed out
+ * \param cdr the cdr you wish to associate with the call
+ * Marks the channel disposition as "TIMED OUT"
+ * \note Will skip CDR's in chain with ANS_LOCK bit set.  (see
+ * forkCDR() application.)
+ */
+extern void ast_cdr_timedout(struct ast_cdr *cdr);
+
+/*!
  * \brief A call was set to congestion
  * \param cdr the cdr you wish to associate with the call
  * Markst he channel disposition as "CONGESTION"

Modified: team/mjordan/Timeout_Stuff/trunk/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/Timeout_Stuff/trunk/main/cdr.c?view=diff&rev=346761&r1=346709&r2=346761
==============================================================================
--- team/mjordan/Timeout_Stuff/trunk/main/cdr.c (original)
+++ team/mjordan/Timeout_Stuff/trunk/main/cdr.c Thu Dec  1 16:22:56 2011
@@ -773,6 +773,18 @@
 	}
 }
 
+void ast_cdr_timedout(struct ast_cdr *cdr)
+{
+	for (; cdr; cdr = cdr->next) {
+		check_post(cdr);
+		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+			check_post(cdr);
+			cdr->disposition = AST_CDR_TIMEDOUT;
+		}
+		cdr = cdr->next;
+	}
+}
+
 void ast_cdr_noanswer(struct ast_cdr *cdr)
 {
 	while (cdr) {
@@ -824,6 +836,9 @@
 			break;
 		case AST_CAUSE_NO_ANSWER:
 			ast_cdr_noanswer(cdr);
+			break;
+		case AST_CAUSE_NO_USER_RESPONSE:
+			ast_cdr_timedout(cdr);
 			break;
 		case AST_CAUSE_NORMAL_CIRCUIT_CONGESTION:
 			ast_cdr_congestion(cdr);
@@ -999,6 +1014,8 @@
 		return "ANSWERED";
 	case AST_CDR_CONGESTION:
 		return "CONGESTION";
+	case AST_CDR_TIMEDOUT:
+		return "TIMED OUT";
 	}
 	return "UNKNOWN";
 }




More information about the asterisk-commits mailing list