[libpri-commits] rmudgett: tag 1.4.11.4 r1946 - in /tags/1.4.11.4: pri.c q921.c rosetest.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Mon Aug 30 17:25:35 CDT 2010


Author: rmudgett
Date: Mon Aug 30 17:25:33 2010
New Revision: 1946

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1946
Log:
Merged revisions 1878,1883-1884,1894 via svnmerge from 
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1878 | mattf | 2010-08-23 17:13:44 -0500 (Mon, 23 Aug 2010) | 1 line
  
  Add silly fake MDL error Z for kicking L2 to reactivate if a DISC or DM is received in proper states on PTP links.
........
  r1883 | rmudgett | 2010-08-25 11:38:29 -0500 (Wed, 25 Aug 2010) | 2 lines
  
  Don't silently fail to post our fake MDL-ERROR(Z).
........
  r1884 | rmudgett | 2010-08-25 12:17:09 -0500 (Wed, 25 Aug 2010) | 2 lines
  
  Added gripe check to rosetest for invalid operation and error codes.
........
  r1894 | rmudgett | 2010-08-26 18:26:16 -0500 (Thu, 26 Aug 2010) | 1 line
  
  Make pri_dump_event() only print the event name.
........

Modified:
    tags/1.4.11.4/pri.c
    tags/1.4.11.4/q921.c
    tags/1.4.11.4/rosetest.c

Modified: tags/1.4.11.4/pri.c
URL: http://svnview.digium.com/svn/libpri/tags/1.4.11.4/pri.c?view=diff&rev=1946&r1=1945&r2=1946
==============================================================================
--- tags/1.4.11.4/pri.c (original)
+++ tags/1.4.11.4/pri.c Mon Aug 30 17:25:33 2010
@@ -434,32 +434,32 @@
 		char *name;
 	} events[] = {
 /* *INDENT-OFF* */
-		{ PRI_EVENT_DCHAN_UP,       "D-Channel Up" },
-		{ PRI_EVENT_DCHAN_DOWN,     "D-channel Down" },
-		{ PRI_EVENT_RESTART,        "Restart channel" },
-		{ PRI_EVENT_CONFIG_ERR,     "Configuration Error" },
-		{ PRI_EVENT_RING,           "Ring" },
-		{ PRI_EVENT_HANGUP,         "Hangup" },
-		{ PRI_EVENT_RINGING,        "Ringing" },
-		{ PRI_EVENT_ANSWER,         "Answer" },
-		{ PRI_EVENT_HANGUP_ACK,     "Hangup ACK" },
-		{ PRI_EVENT_RESTART_ACK,    "Restart ACK" },
-		{ PRI_EVENT_FACILITY,       "Facility" },
-		{ PRI_EVENT_INFO_RECEIVED,  "Info Received" },
-		{ PRI_EVENT_PROCEEDING,     "Proceeding" },
-		{ PRI_EVENT_SETUP_ACK,      "Setup ACK" },
-		{ PRI_EVENT_HANGUP_REQ,     "Hangup Req" },
-		{ PRI_EVENT_NOTIFY,         "Notify" },
-		{ PRI_EVENT_PROGRESS,       "Progress" },
-		{ PRI_EVENT_KEYPAD_DIGIT,   "Keypad Digit" },
-		{ PRI_EVENT_SERVICE,        "Service" },
-		{ PRI_EVENT_SERVICE_ACK,    "Service ACK" },
-		{ PRI_EVENT_HOLD,           "Hold" },
-		{ PRI_EVENT_HOLD_ACK,       "Hold Ack" },
-		{ PRI_EVENT_HOLD_REJ,       "Hold Rej" },
-		{ PRI_EVENT_RETRIEVE,       "Retrieve" },
-		{ PRI_EVENT_RETRIEVE_ACK,   "Retrieve ACK" },
-		{ PRI_EVENT_RETRIEVE_REJ,   "Retrieve Rej" },
+		{ PRI_EVENT_DCHAN_UP,       "PRI_EVENT_DCHAN_UP" },
+		{ PRI_EVENT_DCHAN_DOWN,     "PRI_EVENT_DCHAN_DOWN" },
+		{ PRI_EVENT_RESTART,        "PRI_EVENT_RESTART" },
+		{ PRI_EVENT_CONFIG_ERR,     "PRI_EVENT_CONFIG_ERR" },
+		{ PRI_EVENT_RING,           "PRI_EVENT_RING" },
+		{ PRI_EVENT_HANGUP,         "PRI_EVENT_HANGUP" },
+		{ PRI_EVENT_RINGING,        "PRI_EVENT_RINGING" },
+		{ PRI_EVENT_ANSWER,         "PRI_EVENT_ANSWER" },
+		{ PRI_EVENT_HANGUP_ACK,     "PRI_EVENT_HANGUP_ACK" },
+		{ PRI_EVENT_RESTART_ACK,    "PRI_EVENT_RESTART_ACK" },
+		{ PRI_EVENT_FACILITY,       "PRI_EVENT_FACILITY" },
+		{ PRI_EVENT_INFO_RECEIVED,  "PRI_EVENT_INFO_RECEIVED" },
+		{ PRI_EVENT_PROCEEDING,     "PRI_EVENT_PROCEEDING" },
+		{ PRI_EVENT_SETUP_ACK,      "PRI_EVENT_SETUP_ACK" },
+		{ PRI_EVENT_HANGUP_REQ,     "PRI_EVENT_HANGUP_REQ" },
+		{ PRI_EVENT_NOTIFY,         "PRI_EVENT_NOTIFY" },
+		{ PRI_EVENT_PROGRESS,       "PRI_EVENT_PROGRESS" },
+		{ PRI_EVENT_KEYPAD_DIGIT,   "PRI_EVENT_KEYPAD_DIGIT" },
+		{ PRI_EVENT_SERVICE,        "PRI_EVENT_SERVICE" },
+		{ PRI_EVENT_SERVICE_ACK,    "PRI_EVENT_SERVICE_ACK" },
+		{ PRI_EVENT_HOLD,           "PRI_EVENT_HOLD" },
+		{ PRI_EVENT_HOLD_ACK,       "PRI_EVENT_HOLD_ACK" },
+		{ PRI_EVENT_HOLD_REJ,       "PRI_EVENT_HOLD_REJ" },
+		{ PRI_EVENT_RETRIEVE,       "PRI_EVENT_RETRIEVE" },
+		{ PRI_EVENT_RETRIEVE_ACK,   "PRI_EVENT_RETRIEVE_ACK" },
+		{ PRI_EVENT_RETRIEVE_REJ,   "PRI_EVENT_RETRIEVE_REJ" },
 /* *INDENT-ON* */
 	};
 
@@ -1019,26 +1019,6 @@
 	if (!pri || !e)
 		return;
 	pri_message(pri, "Event type: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
-	switch(e->gen.e) {
-	case PRI_EVENT_DCHAN_UP:
-	case PRI_EVENT_DCHAN_DOWN:
-		break;
-	case PRI_EVENT_CONFIG_ERR:
-		pri_message(pri, "Error: %s", e->err.err);
-		break;
-	case PRI_EVENT_RESTART:
-		pri_message(pri, "Restart on channel %d\n", e->restart.channel);
-	case PRI_EVENT_RING:
-		pri_message(pri, "Calling number: %s (%s, %s)\n", e->ring.callingnum, pri_plan2str(e->ring.callingplan), pri_pres2str(e->ring.callingpres));
-		pri_message(pri, "Called number: %s (%s)\n", e->ring.callednum, pri_plan2str(e->ring.calledplan));
-		pri_message(pri, "Channel: %d (%s) Reference number: %d\n", e->ring.channel, e->ring.flexible ? "Flexible" : "Not Flexible", e->ring.cref);
-		break;
-	case PRI_EVENT_HANGUP:
-		pri_message(pri, "Hangup, reference number: %d, reason: %s\n", e->hangup.cref, pri_cause2str(e->hangup.cause));
-		break;
-	default:
-		pri_message(pri, "Don't know how to dump events of type %d\n", e->gen.e);
-	}
 }
 
 static void pri_sr_init(struct pri_sr *req)

Modified: tags/1.4.11.4/q921.c
URL: http://svnview.digium.com/svn/libpri/tags/1.4.11.4/q921.c?view=diff&rev=1946&r1=1945&r2=1946
==============================================================================
--- tags/1.4.11.4/q921.c (original)
+++ tags/1.4.11.4/q921.c Mon Aug 30 17:25:33 2010
@@ -61,6 +61,7 @@
 static void q921_establish_data_link(struct pri *ctrl);
 static void q921_mdl_error(struct pri *ctrl, char error);
 static void q921_mdl_remove(struct pri *ctrl);
+static void q921_restart_ptp_link_if_needed(struct pri *ctrl);
 
 /*!
  * \internal
@@ -1168,6 +1169,7 @@
 		if (ctrl->q921_state == Q921_MULTI_FRAME_ESTABLISHED)
 			stop_t203(ctrl);
 		q921_setstate(ctrl, Q921_TEI_ASSIGNED);
+		q921_restart_ptp_link_if_needed(ctrl);
 		break;
 	default:
 		pri_error(ctrl, "Don't know what to do with DISC in state %d(%s)\n",
@@ -1284,6 +1286,10 @@
 	/* This is where we act a bit like L3 instead of L2, since we've got an L3 that depends on us
 	 * keeping L2 automatically alive and happy for point to point links */
 	switch (error) {
+	case 'Z':
+		/* This is a special MDL error that actually isn't a spec error, but just so we
+		 * have an asynchronous context from the state machine to kick a PTP link back
+		 * up after being requested to drop politely (using DISC or DM) */
 	case 'G':
 		/* We pick it back up and put it back together for this case */
 		q921_discard_iqueue(ctrl);
@@ -1302,6 +1308,13 @@
 	}
 
 	return handled;
+}
+
+static void q921_restart_ptp_link_if_needed(struct pri *ctrl)
+{
+	if (PTP_MODE(ctrl)) {
+		q921_mdl_error(ctrl, 'Z');
+	}
 }
 
 static void q921_mdl_handle_error(struct pri *ctrl, char error, int errored_state)
@@ -1816,6 +1829,7 @@
 		q931_dl_indication(ctrl, PRI_EVENT_DCHAN_DOWN);
 		stop_t200(ctrl);
 		q921_setstate(ctrl, Q921_TEI_ASSIGNED);
+		q921_restart_ptp_link_if_needed(ctrl);
 		break;
 	case Q921_AWAITING_RELEASE:
 		if (!h->u.p_f)

Modified: tags/1.4.11.4/rosetest.c
URL: http://svnview.digium.com/svn/libpri/tags/1.4.11.4/rosetest.c?view=diff&rev=1946&r1=1945&r2=1946
==============================================================================
--- tags/1.4.11.4/rosetest.c (original)
+++ tags/1.4.11.4/rosetest.c Mon Aug 30 17:25:33 2010
@@ -2356,6 +2356,7 @@
 {
 	unsigned index;
 	unsigned offset;
+	const char *str;
 	static struct pri dummy_ctrl;
 
 	pri_set_message(rose_pri_message);
@@ -2469,7 +2470,12 @@
 	pri_message(&dummy_ctrl, "\n\n"
 		"List of operation codes:\n");
 	for (index = 0; index < ROSE_Num_Operation_Codes; ++index) {
-		pri_message(&dummy_ctrl, "%d: %s\n", index, rose_operation2str(index));
+		str = rose_operation2str(index);
+		if (!strncmp(str, "Invalid code:", 13)) {
+			pri_error(&dummy_ctrl, "%d: %s\n", index, str);
+		} else {
+			pri_message(&dummy_ctrl, "%d: %s\n", index, str);
+		}
 	}
 	pri_message(&dummy_ctrl, "\n\n"
 		"************************************************************\n");
@@ -2479,7 +2485,12 @@
 	pri_message(&dummy_ctrl, "\n\n"
 		"List of error codes:\n");
 	for (index = 0; index < ROSE_ERROR_Num_Codes; ++index) {
-		pri_message(&dummy_ctrl, "%d: %s\n", index, rose_error2str(index));
+		str = rose_error2str(index);
+		if (!strncmp(str, "Invalid code:", 13)) {
+			pri_error(&dummy_ctrl, "%d: %s\n", index, str);
+		} else {
+			pri_message(&dummy_ctrl, "%d: %s\n", index, str);
+		}
 	}
 	pri_message(&dummy_ctrl, "\n\n"
 		"************************************************************\n");




More information about the libpri-commits mailing list