[svn-commits] rmudgett: branch rmudgett/issue17865 r1968 - /team/rmudgett/issue17865/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Sep 8 19:18:16 CDT 2010
Author: rmudgett
Date: Wed Sep 8 19:18:11 2010
New Revision: 1968
URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1968
Log:
Fixup calls on TEI link when TEI is removed.
Fix pri_dl_down_timeout() and pri_dl_down_cancelcall() so event can be
passed to upper layer.
Modified:
team/rmudgett/issue17865/pri_q931.h
team/rmudgett/issue17865/q921.c
team/rmudgett/issue17865/q931.c
Modified: team/rmudgett/issue17865/pri_q931.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/issue17865/pri_q931.h?view=diff&rev=1968&r1=1967&r2=1968
==============================================================================
--- team/rmudgett/issue17865/pri_q931.h (original)
+++ team/rmudgett/issue17865/pri_q931.h Wed Sep 8 19:18:11 2010
@@ -502,7 +502,8 @@
void q931_destroycall(struct pri *pri, q931_call *c);
-extern void q931_dl_indication(struct pri *pri, int event);
+void q931_dl_tei_removal(struct pri *link);
+void q931_dl_indication(struct pri *link, int event);
int q931_send_hold(struct pri *ctrl, struct q931_call *call);
int q931_send_hold_ack(struct pri *ctrl, struct q931_call *call);
Modified: team/rmudgett/issue17865/q921.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/issue17865/q921.c?view=diff&rev=1968&r1=1967&r2=1968
==============================================================================
--- team/rmudgett/issue17865/q921.c (original)
+++ team/rmudgett/issue17865/q921.c Wed Sep 8 19:18:11 2010
@@ -1433,6 +1433,8 @@
return;
}
+ q931_dl_tei_removal(ctrl);
+
/*
* Negate the TEI value so debug messages will display a
* negated TEI when it is actually unassigned.
Modified: team/rmudgett/issue17865/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/issue17865/q931.c?view=diff&rev=1968&r1=1967&r2=1968
==============================================================================
--- team/rmudgett/issue17865/q931.c (original)
+++ team/rmudgett/issue17865/q931.c Wed Sep 8 19:18:11 2010
@@ -5865,6 +5865,7 @@
static void pri_create_fake_clearing(struct q931_call *c, struct pri *master)
{
+ /* Point to the master so the timeout event can come out. */
c->pri = master;
pri_schedule_del(master, c->retranstimer);
@@ -8334,6 +8335,10 @@
struct q931_call *c = data;
struct pri *ctrl = c->pri;
+ /* Point to the master so the timeout event can come out. */
+ ctrl = PRI_MASTER(ctrl);
+ c->pri = ctrl;
+
if (ctrl->debug & PRI_DEBUG_Q931_STATE)
pri_message(ctrl, "T309 timed out waiting for data link re-establishment\n");
@@ -8349,6 +8354,10 @@
struct q931_call *c = data;
struct pri *ctrl = c->pri;
+ /* Point to the master so the timeout event can come out. */
+ ctrl = PRI_MASTER(ctrl);
+ c->pri = ctrl;
+
if (ctrl->debug & PRI_DEBUG_Q931_STATE)
pri_message(ctrl, "Cancel call after data link failure\n");
@@ -8356,6 +8365,93 @@
c->cause = PRI_CAUSE_DESTINATION_OUT_OF_ORDER;
if (pri_internal_clear(c) == Q931_RES_HAVEEVENT)
ctrl->schedev = 1;
+}
+
+/*!
+ * \brief Layer 2 is removing the link's TEI.
+ *
+ * \param link Q.921 link losing it's TEI.
+ *
+ * \note
+ * For NT PTMP, this deviation from the specifications is needed
+ * because we have no way to re-associate any T309 calls on the
+ * removed TEI.
+ *
+ * \return Nothing
+ */
+void q931_dl_tei_removal(struct pri *link)
+{
+ struct q931_call *cur;
+ struct q931_call *call;
+ struct pri *ctrl;
+ int idx;
+
+ /* Find the master - He has the call pool */
+ ctrl = PRI_MASTER(link);
+
+ if (ctrl->debug & PRI_DEBUG_Q931_STATE) {
+ pri_message(ctrl, "DL TEI removal\n");
+ }
+
+ if (!BRI_NT_PTMP(ctrl)) {
+ /* Only NT PTMP has anything to worry about when the TEI is removed. */
+ return;
+ }
+
+ for (cur = *ctrl->callpool; cur; cur = cur->next) {
+ if (!(cur->cr & ~Q931_CALL_REFERENCE_FLAG)) {
+ /* Don't do anything on the global call reference call record. */
+ continue;
+ }
+ if (cur->outboundbroadcast) {
+ /* Does this master call have a subcall on the link that went down? */
+ call = NULL;
+ for (idx = 0; idx < ARRAY_LEN(cur->subcalls); ++idx) {
+ if (cur->subcalls[idx] && cur->subcalls[idx]->pri == link) {
+ /* This subcall is on the link that went down. */
+ call = cur->subcalls[idx];
+ break;
+ }
+ }
+ if (!call) {
+ /* No subcall is on the link that went down. */
+ continue;
+ }
+ } else if (cur->pri != link) {
+ /* This call is not on the link that went down. */
+ continue;
+ } else {
+ call = cur;
+ }
+
+
+ /*
+ * NOTE: We are gambling that no T309 timer's have had a chance
+ * to expire. They should not expire since we are either called
+ * immediately after the q931_dl_indication() or after a timeout
+ * of 0.
+ */
+ if (ctrl->debug & PRI_DEBUG_Q931_STATE) {
+ pri_message(ctrl, "Cancel call %d on channel %d in state %d (%s)\n",
+ call->cr, call->channelno, call->ourcallstate,
+ q931_call_state_str(call->ourcallstate));
+ }
+ call->pri = ctrl;/* Point to a safer place until the call is destroyed. */
+ if (call->retranstimer) {
+ pri_schedule_del(ctrl, call->retranstimer);
+ call->retranstimer = 0;
+ }
+ switch (call->ourcallstate) {
+ case Q931_CALL_STATE_ACTIVE:
+ /* NOTE: Only a winning subcall can get to the active state. */
+ pri_schedule_del(ctrl, cur->retranstimer);
+ cur->retranstimer = pri_schedule_event(ctrl, 0, pri_dl_down_cancelcall, cur);
+ break;
+ default:
+ call->retranstimer = pri_schedule_event(ctrl, 0, pri_dl_down_cancelcall, call);
+ break;
+ }
+ }
}
/* Receive an indication from Layer 2 */
More information about the svn-commits
mailing list