[svn-commits] rmudgett: branch rmudgett/link_q931 r2036 - /team/rmudgett/link_q931/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Oct 15 18:46:43 CDT 2010


Author: rmudgett
Date: Fri Oct 15 18:46:39 2010
New Revision: 2036

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2036
Log:
Fixup the dummy call records for TE PTMP mode.

The TE PTMP group link will use the specific TEI dummy call record.  It
makes no sense for TE PTMP interfaces to broadcast messages on the dummy
call (or to broadcast any messages for that matter).

Modified:
    team/rmudgett/link_q931/pri.c
    team/rmudgett/link_q931/pri_q931.h
    team/rmudgett/link_q931/q931.c

Modified: team/rmudgett/link_q931/pri.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/link_q931/pri.c?view=diff&rev=2036&r1=2035&r2=2036
==============================================================================
--- team/rmudgett/link_q931/pri.c (original)
+++ team/rmudgett/link_q931/pri.c Fri Oct 15 18:46:39 2010
@@ -293,6 +293,7 @@
 		call = p->dummy_call;
 		if (call) {
 			pri_schedule_del(call->pri, call->retranstimer);
+			call->retranstimer = 0;
 			pri_call_apdu_queue_cleanup(call);
 		}
 		free(p->msg_line);
@@ -303,6 +304,7 @@
 
 struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, pri_io_cb rd, pri_io_cb wr, void *userdata, int tei, int bri)
 {
+	int create_dummy_call;
 	struct d_ctrl_dummy *dummy_ctrl;
 	struct pri *p;
 
@@ -311,19 +313,32 @@
 	case PRI_SWITCH_GR303_TMC:
 	case PRI_SWITCH_GR303_TMC_SWITCHING:
 	case PRI_SWITCH_GR303_EOC_PATH:
+		create_dummy_call = 0;
+		break;
+	default:
+		if (bri && node == PRI_CPE && tei == Q921_TEI_GROUP) {
+			/*
+			 * BRI TE PTMP will not use its own group dummy call record.  It
+			 * will use the specific TEI dummy call instead.
+			 */
+			create_dummy_call = 0;
+		} else {
+			create_dummy_call = 1;
+		}
+		break;
+	}
+	if (create_dummy_call) {
+		dummy_ctrl = calloc(1, sizeof(*dummy_ctrl));
+		if (!dummy_ctrl) {
+			return NULL;
+		}
+		p = &dummy_ctrl->ctrl;
+	} else {
 		p = calloc(1, sizeof(*p));
 		if (!p) {
 			return NULL;
 		}
 		dummy_ctrl = NULL;
-		break;
-	default:
-		dummy_ctrl = calloc(1, sizeof(*dummy_ctrl));
-		if (!dummy_ctrl) {
-			return NULL;
-		}
-		p = &dummy_ctrl->ctrl;
-		break;
 	}
 	if (!master) {
 		/* This is the master record. */
@@ -409,6 +424,13 @@
 			free(p);
 			return NULL;
 		}
+		/*
+		 * Make the group link use the just created specific TEI link
+		 * dummy call instead.  It makes no sense for TE PTMP interfaces
+		 * to broadcast messages on the dummy call or to broadcast any
+		 * messages for that matter.
+		 */
+		p->dummy_call = p->subchannel->dummy_call;
 	} else
 		q921_start(p);
 	

Modified: team/rmudgett/link_q931/pri_q931.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/link_q931/pri_q931.h?view=diff&rev=2036&r1=2035&r2=2036
==============================================================================
--- team/rmudgett/link_q931/pri_q931.h (original)
+++ team/rmudgett/link_q931/pri_q931.h Fri Oct 15 18:46:39 2010
@@ -491,7 +491,6 @@
 
 extern int q931_call_setcrv(struct pri *pri, q931_call *call, int crv, int callmode);
 
-struct q931_call *q931_find_call(struct pri *link, int cr);
 struct q931_call *q931_new_call(struct pri *ctrl);
 
 extern int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req);

Modified: team/rmudgett/link_q931/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/link_q931/q931.c?view=diff&rev=2036&r1=2035&r2=2036
==============================================================================
--- team/rmudgett/link_q931/q931.c (original)
+++ team/rmudgett/link_q931/q931.c Fri Oct 15 18:46:39 2010
@@ -3827,7 +3827,10 @@
 	/* The call is now attached to whoever called us */
 	ctrl = PRI_MASTER(link);
 	call->pri = ctrl;
-	if (BRI_TE_PTMP(ctrl)) {
+	if (cr == Q931_DUMMY_CALL_REFERENCE) {
+		/* Dummy calls are always for the given link. */
+		call->link = link;
+	} else if (BRI_TE_PTMP(ctrl)) {
 		/* Always uses the specific TEI link. */
 		call->link = ctrl->subchannel;
 	} else {
@@ -3881,6 +3884,7 @@
 }
 
 /*!
+ * \internal
  * \brief Find a call in the active call pool.
  *
  * \param link Q.921 link associated with the call.
@@ -3889,7 +3893,7 @@
  * \retval call if found.
  * \retval NULL if not found.
  */
-struct q931_call *q931_find_call(struct pri *link, int cr)
+static struct q931_call *q931_find_call(struct pri *link, int cr)
 {
 	struct q931_call *cur;
 	struct pri *ctrl;
@@ -3947,6 +3951,10 @@
 	cur = q931_find_call(link, cr);
 	if (cur) {
 		return cur;
+	}
+	if (cr == Q931_DUMMY_CALL_REFERENCE) {
+		/* Do not create new dummy call records. */
+		return NULL;
 	}
 
 	/* No call record exists, make a new one */




More information about the svn-commits mailing list