[libpri-commits] rmudgett: branch rmudgett/issue17104 r1687 - /team/rmudgett/issue17104/

SVN commits to the libpri project libpri-commits at lists.digium.com
Tue May 11 15:41:03 CDT 2010


Author: rmudgett
Date: Tue May 11 15:41:00 2010
New Revision: 1687

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1687
Log:
Do legacy hangup behaviour if the new API call is not used.

Use pri_hangup_fix_enable() to follow Q.931 Section 5.3.2 call hangup
better.

Modified:
    team/rmudgett/issue17104/libpri.h
    team/rmudgett/issue17104/pri.c
    team/rmudgett/issue17104/pri_internal.h
    team/rmudgett/issue17104/q931.c

Modified: team/rmudgett/issue17104/libpri.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/issue17104/libpri.h?view=diff&rev=1687&r1=1686&r2=1687
==============================================================================
--- team/rmudgett/issue17104/libpri.h (original)
+++ team/rmudgett/issue17104/libpri.h Tue May 11 15:41:00 2010
@@ -1383,6 +1383,17 @@
 #define PRI_HANGUP
 int pri_hangup(struct pri *pri, q931_call *call, int cause);
 
+/*!
+ * \brief Set the call hangup fix enable flag.
+ *
+ * \param ctrl D channel controller.
+ * \param enable TRUE to follow Q.931 Section 5.3.2 call hangup better.
+ * FALSE for legacy behaviour. (Default FALSE if not called.)
+ *
+ * \return Nothing
+ */
+void pri_hangup_fix_enable(struct pri *ctrl, int enable);
+
 #define PRI_DESTROYCALL
 void pri_destroycall(struct pri *pri, q931_call *call);
 

Modified: team/rmudgett/issue17104/pri.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/issue17104/pri.c?view=diff&rev=1687&r1=1686&r2=1687
==============================================================================
--- team/rmudgett/issue17104/pri.c (original)
+++ team/rmudgett/issue17104/pri.c Tue May 11 15:41:00 2010
@@ -1093,6 +1093,14 @@
 	return 0;
 }
 
+void pri_hangup_fix_enable(struct pri *ctrl, int enable)
+{
+	if (ctrl) {
+		ctrl = PRI_MASTER(ctrl);
+		ctrl->hangup_fix_enabled = enable ? 1 : 0;
+	}
+}
+
 int pri_hangup(struct pri *pri, q931_call *call, int cause)
 {
 	if (!pri || !call)

Modified: team/rmudgett/issue17104/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/issue17104/pri_internal.h?view=diff&rev=1687&r1=1686&r2=1687
==============================================================================
--- team/rmudgett/issue17104/pri_internal.h (original)
+++ team/rmudgett/issue17104/pri_internal.h Tue May 11 15:41:00 2010
@@ -104,6 +104,7 @@
 	unsigned int service_message_support:1;/* TRUE if upper layer supports SERVICE messages */
 	unsigned int hold_support:1;/* TRUE if upper layer supports call hold. */
 	unsigned int deflection_support:1;/* TRUE if upper layer supports call deflection/rerouting. */
+	unsigned int hangup_fix_enabled:1;/* TRUE if should follow Q.931 Section 5.3.2 instead of blindly sending RELEASE_COMPLETE for certain causes */
 	unsigned int cc_support:1;/* TRUE if upper layer supports call completion. */
 	unsigned int transfer_support:1;/* TRUE if the upper layer supports ECT */
 	unsigned int aoc_support:1;/* TRUE if can send AOC events to the upper layer. */

Modified: team/rmudgett/issue17104/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/issue17104/q931.c?view=diff&rev=1687&r1=1686&r2=1687
==============================================================================
--- team/rmudgett/issue17104/q931.c (original)
+++ team/rmudgett/issue17104/q931.c Tue May 11 15:41:00 2010
@@ -5720,6 +5720,13 @@
 	case PRI_CAUSE_REQUESTED_CHAN_UNAVAIL:
 	case PRI_CAUSE_IDENTIFIED_CHANNEL_NOTEXIST:
 	case PRI_CAUSE_UNALLOCATED:
+		if (!PRI_MASTER(ctrl)->hangup_fix_enabled) {
+			/* Legacy: We'll send RELEASE_COMPLETE with these causes */
+			disconnect = 0;
+			release_compl = 1;
+			break;
+		}
+		/* Fall through */
 	case PRI_CAUSE_INCOMPATIBLE_DESTINATION:
 		/* See Q.931 Section 5.3.2 a) */
 		switch (c->ourcallstate) {




More information about the libpri-commits mailing list