[libpri-commits] rmudgett: branch 1.4 r1061 - in /branches/1.4: pri_internal.h pri_q931.h q931.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Wed Sep 2 15:19:44 CDT 2009


Author: rmudgett
Date: Wed Sep  2 15:19:40 2009
New Revision: 1061

URL: http://svn.asterisk.org/svn-view/libpri?view=rev&rev=1061
Log:
Converted Q931_CALL_STATE_xxx defines to an enum.

Modified:
    branches/1.4/pri_internal.h
    branches/1.4/pri_q931.h
    branches/1.4/q931.c

Modified: branches/1.4/pri_internal.h
URL: http://svn.asterisk.org/svn-view/libpri/branches/1.4/pri_internal.h?view=diff&rev=1061&r1=1060&r2=1061
==============================================================================
--- branches/1.4/pri_internal.h (original)
+++ branches/1.4/pri_internal.h Wed Sep  2 15:19:40 2009
@@ -32,6 +32,8 @@
 
 #include <stddef.h>
 #include <sys/time.h>
+#include "pri_q921.h"
+#include "pri_q931.h"
 
 #define ARRAY_LEN(arr)	(sizeof(arr) / sizeof((arr)[0]))
 
@@ -43,10 +45,6 @@
 	void (*callback)(void *data);
 	void *data;
 };
-
-struct q921_frame;
-enum q931_state;
-enum q931_mode;
 
 /*! Maximum number of scheduled events active at the same time. */
 #define MAX_SCHED 128
@@ -387,9 +385,9 @@
 	int causeloc;			/* Cause Location */
 	int cause;				/* Cause of clearing */
 	
-	int peercallstate;		/* Call state of peer as reported */
-	int ourcallstate;		/* Our call state */
-	int sugcallstate;		/* Status call state */
+	enum Q931_CALL_STATE peercallstate;	/* Call state of peer as reported */
+	enum Q931_CALL_STATE ourcallstate;	/* Our call state */
+	enum Q931_CALL_STATE sugcallstate;	/* Status call state */
 
 	int ani2;               /* ANI II */
 

Modified: branches/1.4/pri_q931.h
URL: http://svn.asterisk.org/svn-view/libpri/branches/1.4/pri_q931.h?view=diff&rev=1061&r1=1060&r2=1061
==============================================================================
--- branches/1.4/pri_q931.h (original)
+++ branches/1.4/pri_q931.h Wed Sep  2 15:19:40 2009
@@ -138,7 +138,7 @@
 #define Q931_NON_LOCKING_SHIFT		0x98
 #define Q931_BEARER_CAPABILITY		0x04
 #define Q931_CAUSE					0x08
-#define Q931_CALL_STATE				0x14
+#define Q931_IE_CALL_STATE			0x14
 #define Q931_CHANNEL_IDENT			0x18
 #define Q931_PROGRESS_INDICATOR		0x1e
 #define Q931_NETWORK_SPEC_FAC		0x20
@@ -194,220 +194,222 @@
 #define Q931_IE_ESCAPE_FOR_EXT			0x7F
 
 
-/* Q.931 call states */
-/*!
- * \details
- *   null state (U0):
- *     No call exists.
- * \details
- *   null state (N0):
- *     No call exists.
- */
-#define Q931_CALL_STATE_NULL						0
-/*!
- * \details
- *   call initiated (U1):
- *     This state exists for an outgoing call, when the user requests
- *     call establishment from the network.
- * \details
- *   call initiated (N1):
- *     This state exists for an outgoing call when the network has received
- *     a call establishment request but has not yet responded.
- */
-#define Q931_CALL_STATE_CALL_INITIATED				1
-/*!
- * \details
- *   overlap sending (U2):
- *     This state exists for an outgoing call when the user has
- *     received acknowledgement of the call establishment request which
- *     permits the user to send additional call information to the network
- *     in overlap mode.
- * \details
- *   overlap sending (N2):
- *     This state exists for an outgoing call when the network has acknowledged
- *     the call establishment request and is prepared to receive additional
- *     call information (if any) in overlap mode.
- */
-#define Q931_CALL_STATE_OVERLAP_SENDING				2
-/*!
- * \details
- *   outgoing call proceeding (U3):
- *     This state exists for an outgoing call when the user has
- *     received acknowledgement that the network has received all
- *     call information necessary to effect call establishment.
- * \details
- *   outgoing call proceeding (N3):
- *     This state exists for an outgoing call when the network has sent
- *     acknowledgement that the network has received all call information
- *     necessary to effect call establishment.
- */
-#define Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING	3
-/*!
- * \details
- *   call delivered (U4):
- *     This state exists for an outgoing call when the calling user has
- *     received an indication that remote user alerting has been initiated.
- * \details
- *   call delivered (N4):
- *     This state exists for an outgoing call when the network has indicated
- *     that remote user alerting has been initiated.
- */
-#define Q931_CALL_STATE_CALL_DELIVERED				4
-/*!
- * \details
- *   call present (U6):
- *     This state exists for an incoming call when the user has received a
- *     call establishment request but has not yet responded.
- * \details
- *   call present (N6):
- *     This state exists for an incoming call when the network has sent a
- *     call establishment request but has not yet received a satisfactory
- *     response.
- */
-#define Q931_CALL_STATE_CALL_PRESENT				6
-/*!
- * \details
- *   call received (U7):
- *     This state exists for an incoming call when the user has indicated
- *     alerting but has not yet answered.
- * \details
- *   call received (N7):
- *     This state exists for an incoming call when the network has received
- *     an indication that the user is alerting but has not yet received an
- *     answer.
- */
-#define Q931_CALL_STATE_CALL_RECEIVED				7
-/*!
- * \details
- *   connect request (U8):
- *     This state exists for an incoming call when the user has answered
- *     the call and is waiting to be awarded the call.
- * \details
- *   connect request (N8):
- *     This state exists for an incoming call when the network has received
- *     an answer but the network has not yet awarded the call.
- */
-#define Q931_CALL_STATE_CONNECT_REQUEST				8
-/*!
- * \details
- *   incoming call proceeding (U9):
- *     This state exists for an incoming call when the user has sent
- *     acknowledgement that the user has received all call information
- *     necessary to effect call establishment.
- * \details
- *   incoming call proceeding (N9):
- *     This state exists for an incoming call when the network has received
- *     acknowledgement that the user has received all call information
- *     necessary to effect call establishment.
- */
-#define Q931_CALL_STATE_INCOMING_CALL_PROCEEDING	9
-/*!
- * \details
- *   active (U10):
- *     This state exists for an incoming call when the user has received
- *     an acknowledgement from the network that the user has been awarded
- *     the call. This state exists for an outgoing call when the user has
- *     received an indication that the remote user has answered the call.
- * \details
- *   active (N10):
- *     This state exists for an incoming call when the network has awarded
- *     the call to the called user. This state exists for an outgoing call
- *     when the network has indicated that the remote user has answered
- *     the call.
- */
-#define Q931_CALL_STATE_ACTIVE						10
-/*!
- * \details
- *   disconnect request (U11):
- *     This state exists when the user has requested the network to clear
- *     the end-to-end connection (if any) and is waiting for a response.
- * \details
- *   disconnect request (N11):
- *     This state exists when the network has received a request from the
- *     user to clear the end-to-end connection (if any).
- */
-#define Q931_CALL_STATE_DISCONNECT_REQUEST			11
-/*!
- * \details
- *   disconnect indication (U12):
- *     This state exists when the user has received an invitation to
- *     disconnect because the network has disconnected the end-to-end
- *     connection (if any).
- * \details
- *   disconnect indication (N12):
- *     This state exists when the network has disconnected the end-to-end
- *     connection (if any) and has sent an invitation to disconnect the
- *     user-network connection.
- */
-#define Q931_CALL_STATE_DISCONNECT_INDICATION		12
-/*!
- * \details
- *   suspend request (U15):
- *     This state exists when the user has requested the network to suspend
- *     the call and is waiting for a response.
- * \details
- *   suspend request (N15):
- *     This state exists when the network has received a request to suspend
- *     the call but has not yet responded.
- */
-#define Q931_CALL_STATE_SUSPEND_REQUEST				15
-/*!
- * \details
- *   resume request (U17):
- *     This state exists when the user has requested the network to resume
- *     a previously suspended call and is waiting for a response.
- * \details
- *   resume request (N17):
- *     This state exists when the network has received a request to resume
- *     a previously suspended call but has not yet responded.
- */
-#define Q931_CALL_STATE_RESUME_REQUEST				17
-/*!
- * \details
- *   release request (U19):
- *     This state exists when the user has requested the network to release
- *     and is waiting for a response.
- * \details
- *   release request (N19):
- *     This state exists when the network has requested the user to release
- *     and is waiting for a response.
- */
-#define Q931_CALL_STATE_RELEASE_REQUEST				19
-/*!
- * \details
- *   call abort (N22):
- *     This state exists for an incoming call for the point-to-multipoint
- *     configuration when the call is being cleared before any user has been
- *     awarded the call.
- */
-#define Q931_CALL_STATE_CALL_ABORT					22
-/*!
- * \details
- *   overlap receiving (U25):
- *     This state exists for an incoming call when the user has acknowledged
- *     the call establishment request from the network and is prepared to
- *     receive additional call information (if any) in overlap mode.
- * \details
- *   overlap receiving (N25):
- *     This state exists for an incoming call when the network has received
- *     acknowledgement of the call establishment request which permits the
- *     network to send additional call information (if any) in the overlap
- *     mode.
- */
-#define Q931_CALL_STATE_OVERLAP_RECEIVING			25
-/*!
- * \details
- *   call independent service (U31): (From Q.932)
- *     This state exists when a call independent supplementary service
- *     signalling connection is established.
- * \details
- *   call independent service (N31): (From Q.932)
- *     This state exists when a call independent supplementary service
- *     signalling connection is established.
- */
-#define Q931_CALL_STATE_CALL_INDEPENDENT_SERVICE	31
-#define Q931_CALL_STATE_RESTART_REQUEST				61
-#define Q931_CALL_STATE_RESTART						62
+/*! Q.931 call states */
+enum Q931_CALL_STATE {
+	/*!
+	 * \details
+	 *   null state (U0):
+	 *     No call exists.
+	 * \details
+	 *   null state (N0):
+	 *     No call exists.
+	 */
+	Q931_CALL_STATE_NULL = 0,
+	/*!
+	 * \details
+	 *   call initiated (U1):
+	 *     This state exists for an outgoing call, when the user requests
+	 *     call establishment from the network.
+	 * \details
+	 *   call initiated (N1):
+	 *     This state exists for an outgoing call when the network has received
+	 *     a call establishment request but has not yet responded.
+	 */
+	Q931_CALL_STATE_CALL_INITIATED = 1,
+	/*!
+	 * \details
+	 *   overlap sending (U2):
+	 *     This state exists for an outgoing call when the user has
+	 *     received acknowledgement of the call establishment request which
+	 *     permits the user to send additional call information to the network
+	 *     in overlap mode.
+	 * \details
+	 *   overlap sending (N2):
+	 *     This state exists for an outgoing call when the network has acknowledged
+	 *     the call establishment request and is prepared to receive additional
+	 *     call information (if any) in overlap mode.
+	 */
+	Q931_CALL_STATE_OVERLAP_SENDING = 2,
+	/*!
+	 * \details
+	 *   outgoing call proceeding (U3):
+	 *     This state exists for an outgoing call when the user has
+	 *     received acknowledgement that the network has received all
+	 *     call information necessary to effect call establishment.
+	 * \details
+	 *   outgoing call proceeding (N3):
+	 *     This state exists for an outgoing call when the network has sent
+	 *     acknowledgement that the network has received all call information
+	 *     necessary to effect call establishment.
+	 */
+	Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING = 3,
+	/*!
+	 * \details
+	 *   call delivered (U4):
+	 *     This state exists for an outgoing call when the calling user has
+	 *     received an indication that remote user alerting has been initiated.
+	 * \details
+	 *   call delivered (N4):
+	 *     This state exists for an outgoing call when the network has indicated
+	 *     that remote user alerting has been initiated.
+	 */
+	Q931_CALL_STATE_CALL_DELIVERED = 4,
+	/*!
+	 * \details
+	 *   call present (U6):
+	 *     This state exists for an incoming call when the user has received a
+	 *     call establishment request but has not yet responded.
+	 * \details
+	 *   call present (N6):
+	 *     This state exists for an incoming call when the network has sent a
+	 *     call establishment request but has not yet received a satisfactory
+	 *     response.
+	 */
+	Q931_CALL_STATE_CALL_PRESENT = 6,
+	/*!
+	 * \details
+	 *   call received (U7):
+	 *     This state exists for an incoming call when the user has indicated
+	 *     alerting but has not yet answered.
+	 * \details
+	 *   call received (N7):
+	 *     This state exists for an incoming call when the network has received
+	 *     an indication that the user is alerting but has not yet received an
+	 *     answer.
+	 */
+	Q931_CALL_STATE_CALL_RECEIVED = 7,
+	/*!
+	 * \details
+	 *   connect request (U8):
+	 *     This state exists for an incoming call when the user has answered
+	 *     the call and is waiting to be awarded the call.
+	 * \details
+	 *   connect request (N8):
+	 *     This state exists for an incoming call when the network has received
+	 *     an answer but the network has not yet awarded the call.
+	 */
+	Q931_CALL_STATE_CONNECT_REQUEST = 8,
+	/*!
+	 * \details
+	 *   incoming call proceeding (U9):
+	 *     This state exists for an incoming call when the user has sent
+	 *     acknowledgement that the user has received all call information
+	 *     necessary to effect call establishment.
+	 * \details
+	 *   incoming call proceeding (N9):
+	 *     This state exists for an incoming call when the network has received
+	 *     acknowledgement that the user has received all call information
+	 *     necessary to effect call establishment.
+	 */
+	Q931_CALL_STATE_INCOMING_CALL_PROCEEDING = 9,
+	/*!
+	 * \details
+	 *   active (U10):
+	 *     This state exists for an incoming call when the user has received
+	 *     an acknowledgement from the network that the user has been awarded
+	 *     the call. This state exists for an outgoing call when the user has
+	 *     received an indication that the remote user has answered the call.
+	 * \details
+	 *   active (N10):
+	 *     This state exists for an incoming call when the network has awarded
+	 *     the call to the called user. This state exists for an outgoing call
+	 *     when the network has indicated that the remote user has answered
+	 *     the call.
+	 */
+	Q931_CALL_STATE_ACTIVE = 10,
+	/*!
+	 * \details
+	 *   disconnect request (U11):
+	 *     This state exists when the user has requested the network to clear
+	 *     the end-to-end connection (if any) and is waiting for a response.
+	 * \details
+	 *   disconnect request (N11):
+	 *     This state exists when the network has received a request from the
+	 *     user to clear the end-to-end connection (if any).
+	 */
+	Q931_CALL_STATE_DISCONNECT_REQUEST = 11,
+	/*!
+	 * \details
+	 *   disconnect indication (U12):
+	 *     This state exists when the user has received an invitation to
+	 *     disconnect because the network has disconnected the end-to-end
+	 *     connection (if any).
+	 * \details
+	 *   disconnect indication (N12):
+	 *     This state exists when the network has disconnected the end-to-end
+	 *     connection (if any) and has sent an invitation to disconnect the
+	 *     user-network connection.
+	 */
+	Q931_CALL_STATE_DISCONNECT_INDICATION = 12,
+	/*!
+	 * \details
+	 *   suspend request (U15):
+	 *     This state exists when the user has requested the network to suspend
+	 *     the call and is waiting for a response.
+	 * \details
+	 *   suspend request (N15):
+	 *     This state exists when the network has received a request to suspend
+	 *     the call but has not yet responded.
+	 */
+	Q931_CALL_STATE_SUSPEND_REQUEST = 15,
+	/*!
+	 * \details
+	 *   resume request (U17):
+	 *     This state exists when the user has requested the network to resume
+	 *     a previously suspended call and is waiting for a response.
+	 * \details
+	 *   resume request (N17):
+	 *     This state exists when the network has received a request to resume
+	 *     a previously suspended call but has not yet responded.
+	 */
+	Q931_CALL_STATE_RESUME_REQUEST = 17,
+	/*!
+	 * \details
+	 *   release request (U19):
+	 *     This state exists when the user has requested the network to release
+	 *     and is waiting for a response.
+	 * \details
+	 *   release request (N19):
+	 *     This state exists when the network has requested the user to release
+	 *     and is waiting for a response.
+	 */
+	Q931_CALL_STATE_RELEASE_REQUEST = 19,
+	/*!
+	 * \details
+	 *   call abort (N22):
+	 *     This state exists for an incoming call for the point-to-multipoint
+	 *     configuration when the call is being cleared before any user has been
+	 *     awarded the call.
+	 */
+	Q931_CALL_STATE_CALL_ABORT = 22,
+	/*!
+	 * \details
+	 *   overlap receiving (U25):
+	 *     This state exists for an incoming call when the user has acknowledged
+	 *     the call establishment request from the network and is prepared to
+	 *     receive additional call information (if any) in overlap mode.
+	 * \details
+	 *   overlap receiving (N25):
+	 *     This state exists for an incoming call when the network has received
+	 *     acknowledgement of the call establishment request which permits the
+	 *     network to send additional call information (if any) in the overlap
+	 *     mode.
+	 */
+	Q931_CALL_STATE_OVERLAP_RECEIVING = 25,
+	/*!
+	 * \details
+	 *   call independent service (U31): (From Q.932)
+	 *     This state exists when a call independent supplementary service
+	 *     signalling connection is established.
+	 * \details
+	 *   call independent service (N31): (From Q.932)
+	 *     This state exists when a call independent supplementary service
+	 *     signalling connection is established.
+	 */
+	Q931_CALL_STATE_CALL_INDEPENDENT_SERVICE = 31,
+	Q931_CALL_STATE_RESTART_REQUEST = 61,
+	Q931_CALL_STATE_RESTART = 62,
+};
 
 
 /* EuroISDN  */

Modified: branches/1.4/q931.c
URL: http://svn.asterisk.org/svn-view/libpri/branches/1.4/q931.c?view=diff&rev=1061&r1=1060&r2=1061
==============================================================================
--- branches/1.4/q931.c (original)
+++ branches/1.4/q931.c Wed Sep  2 15:19:40 2009
@@ -68,7 +68,7 @@
 	{ Q931_RESTART_ACKNOWLEDGE, "RESTART ACKNOWLEDGE", { Q931_RESTART_INDICATOR } },
 
 	/* Miscellaneous */
-	{ Q931_STATUS, "STATUS", { Q931_CAUSE, Q931_CALL_STATE } },
+	{ Q931_STATUS, "STATUS", { Q931_CAUSE, Q931_IE_CALL_STATE } },
 	{ Q931_STATUS_ENQUIRY, "STATUS ENQUIRY" },
 	{ Q931_USER_INFORMATION, "USER_INFORMATION" },
 	{ Q931_SEGMENT, "SEGMENT" },
@@ -2789,7 +2789,7 @@
 	{ 0, Q931_LOCKING_SHIFT, "Locking Shift", dump_shift },
 	{ 0, Q931_BEARER_CAPABILITY, "Bearer Capability", dump_bearer_capability, receive_bearer_capability, transmit_bearer_capability },
 	{ 0, Q931_CAUSE, "Cause", dump_cause, receive_cause, transmit_cause },
-	{ 1, Q931_CALL_STATE, "Call State", dump_call_state, receive_call_state, transmit_call_state },
+	{ 1, Q931_IE_CALL_STATE, "Call State", dump_call_state, receive_call_state, transmit_call_state },
 	{ 0, Q931_CHANNEL_IDENT, "Channel Identification", dump_channel_id, receive_channel_id, transmit_channel_id },
 	{ 0, Q931_PROGRESS_INDICATOR, "Progress Indicator", dump_progress_indicator, receive_progress_indicator, transmit_progress_indicator },
 	{ 0, Q931_NETWORK_SPEC_FAC, "Network-Specific Facilities", dump_network_spec_fac, receive_network_spec_fac, transmit_network_spec_fac },
@@ -3418,7 +3418,7 @@
 	return send_message(ctrl, c, (MAINTENANCE_PROTOCOL_DISCRIMINATOR_1 << 8) | NATIONAL_SERVICE, maintenance_service_ies);
 }
 
-static int status_ies[] = { Q931_CAUSE, Q931_CALL_STATE, -1 };
+static int status_ies[] = { Q931_CAUSE, Q931_IE_CALL_STATE, -1 };
 
 static int q931_status(struct pri *ctrl, q931_call *c, int cause)
 {




More information about the libpri-commits mailing list