[libpri-commits] rmudgett: branch 1.4 r842 - /branches/1.4/q931.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Wed Jun 3 16:35:18 CDT 2009


Author: rmudgett
Date: Wed Jun  3 16:35:14 2009
New Revision: 842

URL: http://svn.asterisk.org/svn-view/libpri?view=rev&rev=842
Log:
Renamed callstate2str() to q931_call_state_str().

Modified:
    branches/1.4/q931.c

Modified: branches/1.4/q931.c
URL: http://svn.asterisk.org/svn-view/libpri/branches/1.4/q931.c?view=diff&rev=842&r1=841&r2=842
==============================================================================
--- branches/1.4/q931.c (original)
+++ branches/1.4/q931.c Wed Jun  3 16:35:14 2009
@@ -230,8 +230,8 @@
 #define UPDATE_OURCALLSTATE(ctrl,c,newstate) do {\
 	if (ctrl->debug & (PRI_DEBUG_Q931_STATE) && c->ourcallstate != newstate) \
 		pri_message(ctrl, DBGHEAD "call %d on channel %d enters state %d (%s)\n", DBGINFO, \
-		            c->cr, c->channelno, newstate, callstate2str(newstate)); \
-	c->ourcallstate = newstate; \
+			c->cr, c->channelno, newstate, q931_call_state_str(newstate)); \
+		c->ourcallstate = newstate; \
 	} while (0)
 #else
 /* Update call state with no trace. */
@@ -1489,7 +1489,14 @@
 	return 0;
 }
 
-static char *callstate2str(int callstate)
+/*!
+ * \brief Convert the internal Q.931 call state to a string.
+ *
+ * \param callstate Internal Q.931 call state.
+ *
+ * \return String equivalent of the given Q.931 call state.
+ */
+static const char *q931_call_state_str(int callstate)
 {
 	static struct msgtype callstates[] = {
 		{ 0, "Null" },
@@ -1519,7 +1526,7 @@
 {
 	pri_message(ctrl, "%c Call State (len=%2d) [ Ext: %d  Coding: %s (%d)  Call state: %s (%d)\n",
 		prefix, len, ie->data[0] >> 7, coding2str((ie->data[0] & 0xC0) >> 6), (ie->data[0] & 0xC0) >> 6,
-		callstate2str(ie->data[0] & 0x3f), ie->data[0] & 0x3f);
+		q931_call_state_str(ie->data[0] & 0x3f), ie->data[0] & 0x3f);
 }
 
 static void dump_call_identity(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
@@ -2444,7 +2451,10 @@
 			else
 				*ctrl->callpool = cur->next;
 			if (ctrl->debug & PRI_DEBUG_Q931_STATE)
-				pri_message(ctrl, "NEW_HANGUP DEBUG: Destroying the call, ourstate %s, peerstate %s\n",callstate2str(cur->ourcallstate),callstate2str(cur->peercallstate));
+				pri_message(ctrl,
+					"NEW_HANGUP DEBUG: Destroying the call, ourstate %s, peerstate %s\n",
+					q931_call_state_str(cur->ourcallstate),
+					q931_call_state_str(cur->peercallstate));
 			if (cur->retranstimer)
 				pri_schedule_del(ctrl, cur->retranstimer);
 			pri_call_apdu_queue_cleanup(cur);
@@ -3245,7 +3255,10 @@
 	int disconnect = 1;
 	int release_compl = 0;
 	if (ctrl->debug & PRI_DEBUG_Q931_STATE)
-		pri_message(ctrl, "NEW_HANGUP DEBUG: Calling q931_hangup, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate));
+		pri_message(ctrl,
+			"NEW_HANGUP DEBUG: Calling q931_hangup, ourstate %s, peerstate %s\n",
+			q931_call_state_str(c->ourcallstate),
+			q931_call_state_str(c->peercallstate));
 	if (!ctrl || !c)
 		return -1;
 	/* If mandatory IE was missing, insist upon that cause code */
@@ -3296,7 +3309,10 @@
 			else
 				q931_release(ctrl,c,cause);
 		} else 
-			pri_error(ctrl, "Wierd, doing nothing but this shouldn't happen, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate));
+			pri_error(ctrl,
+				"Wierd, doing nothing but this shouldn't happen, ourstate %s, peerstate %s\n",
+				q931_call_state_str(c->ourcallstate),
+				q931_call_state_str(c->peercallstate));
 		break;
 	case Q931_CALL_STATE_ACTIVE:
 		/* received CONNECT */
@@ -3320,13 +3336,17 @@
 	case Q931_CALL_STATE_RESTART:
 	case Q931_CALL_STATE_RESTART_REQUEST:
 		/* sent RESTART */
-		pri_error(ctrl, "q931_hangup shouldn't be called in this state, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate));
+		pri_error(ctrl,
+			"q931_hangup shouldn't be called in this state, ourstate %s, peerstate %s\n",
+			q931_call_state_str(c->ourcallstate),
+			q931_call_state_str(c->peercallstate));
 		break;
 	default:
-		pri_error(ctrl, "We're not yet handling hanging up when our state is %d, contact support at digium.com, ourstate %s, peerstate %s\n",
-			  c->ourcallstate,
-			  callstate2str(c->ourcallstate),
-			  callstate2str(c->peercallstate));
+		pri_error(ctrl,
+			"We're not yet handling hanging up when our state is %d, contact support at digium.com, ourstate %s, peerstate %s\n",
+			c->ourcallstate,
+			q931_call_state_str(c->ourcallstate),
+			q931_call_state_str(c->peercallstate));
 		return -1;
 	}
 	/* we did handle hangup properly at this point */
@@ -4206,7 +4226,8 @@
 			} else if (cur->ourcallstate != Q931_CALL_STATE_NULL) {
 				/* For a call that is not in Active state, schedule internal clearing of the call 'ASAP' (delay 0). */
 				pri_message(ctrl, DBGHEAD "cancel call %d on channel %d in state %d (%s)\n", DBGINFO,
-				            cur->cr, cur->channelno, cur->ourcallstate, callstate2str(cur->ourcallstate));
+					cur->cr, cur->channelno, cur->ourcallstate,
+					q931_call_state_str(cur->ourcallstate));
 				if (cur->retranstimer)
 					pri_schedule_del(ctrl, cur->retranstimer);
 				cur->retranstimer = pri_schedule_event(ctrl, 0, pri_dl_down_cancelcall, cur);




More information about the libpri-commits mailing list