[asterisk-ss7] chan_ss7: patch for overlapping cic codes with 2 redundant signaling links

Robert Verspuy robert at exa-omicron.nl
Wed Mar 24 04:18:20 CDT 2010


All,

Here in the Netherlands we have a SS7 connection with the biggest local 
telco.
This local telco has 2 redundant networks, and uses different point 
codes for signaling and the audio streams.

we have 6 E1's connected on one server.
port 1 -> network A, with signaling link
port 2 -> network B, with signaling link
port 3 -> network A
port 4 -> network B
port 5 -> network A
port 6 -> network B

The signaling link on network A is connected to point code 123 (just an 
example, I'm not using the real point codes)
The signaling link on network B is connected to point code 124

Through both networks we receive calls from point code 201 and 202.
But this can be received through signaling link from network A or from 
network B.

In the chan_ss7 source (l4isup.c) there is a function called find_pvt.
This function gets the signaling link and cic code as argument, and 
returns the pvt from the ciclist.
But when I receive a call for a cic on network B, through the signaling 
link from network A, this will not work, because the incorrect pvt will 
be selected.

With the patch (see below) I've changed the source a bit, to take into 
account the originating point code.
The patch below is for version 1.2.1. and I use these changes since 
December 2008, it's fully stable, and the server processed more then 
2.000.000 calls since.
Having a quick look at the source of 1.3, it appears that these changes 
can be patched without any problems into this version too.

So besides placing this patch in this mailing list,
is there a contact person / location where I can deliver this patch?

With kind regards,
Robert Verspuy

--- l4isup.c.orig    2010-03-24 09:12:46.000000000 +0100
+++ l4isup.c    2010-03-24 09:00:43.000000000 +0100
@@ -474,6 +474,28 @@
    return NULL;
  }

+static struct ss7_chan* find_pvt_with_pc(struct link* slink, int cic, 
int pc)
+{
+  struct linkset* ls;
+  int lsi;
+
+  ls = slink->linkset;
+  if (ls->dpc == pc) {
+    if (ls->cic_list[cic])
+      return ls->cic_list[cic];
+    for (lsi = 0; lsi < n_linksets; lsi++)
+      if (is_combined_linkset(ls, &linksets[lsi]))
+        if (linksets[lsi].cic_list[cic])
+          return linksets[lsi].cic_list[cic];
+  } else {
+    for (lsi = 0; lsi < n_linksets; lsi++)
+      if (is_combined_linkset(ls, &linksets[lsi]))
+        if (linksets[lsi].dpc == pc)
+          if (linksets[lsi].cic_list[cic])
+            return linksets[lsi].cic_list[cic];
+  }
+  return NULL;
+}

  /* This function must be called with the global lock mutex held. */
  static void remove_from_idlelist(struct ss7_chan *pvt) {
@@ -2669,7 +2691,8 @@
      return;
    }
    lock_global();
-  pvt = find_pvt(slink, cic);
+//  pvt = find_pvt(slink, cic);
+  pvt = find_pvt_with_pc(slink, cic, inmsg->opc);
    ast_log(LOG_DEBUG, "Process circuit message %s, CIC=%d, state=%d, 
reset_done=%d\n", isupmsg(inmsg->typ), cic, pvt->state, pvt->reset_done);
    if(!pvt->equipped) {
      ast_log(LOG_ERROR, "Received CIC=%d for not equipped circuit 
(typ=%s), link '%s'.\n", cic, isupmsg(inmsg->typ), slink->name);
@@ -2743,7 +2766,8 @@
      return;
    }
    lock_global();
-  pvt = find_pvt(slink, cic);
+//  pvt = find_pvt(slink, cic);
+  pvt = find_pvt_with_pc(slink, cic, inmsg->opc);
    if(!(pvt->equipped || (inmsg->typ == ISUP_CGA) || (inmsg->typ == 
ISUP_CUA) || (inmsg->typ == ISUP_GRA))) {
      ast_log(LOG_ERROR, "Received CIC=%d for not equipped circuit 
(typ=%s), link '%s'.\n", cic, isupmsg(inmsg->typ), slink->name);
      unlock_global();
@@ -4616,7 +4640,8 @@
      unlock_global();
      return;
    }
-  pvt = find_pvt(linkset->links[0], cic);
+//  pvt = find_pvt(linkset->links[0], cic);
+  pvt = find_pvt_with_pc(linkset->links[0], cic, isup_msg.opc);
    ast_log(LOG_DEBUG, "Got ISUP event, typ=%s, cic=%d, dpc=%d, 
linkset=%s, pvt=0x%08lx, pvt.eq=%d \n", isupmsg(isup_msg.typ), cic, dpc, 
linkset->name, (unsigned long int) pvt, pvt ? pvt->equipped : -1);
    unlock_global();

@@ -4665,7 +4690,8 @@
      /* Q.764 (2.9.5): Discard invalid message.*/
      ast_log(LOG_NOTICE, "ISUP decoding error, message discarded. 
(typ=%d)\n", isup_msg.typ);
    } else {
-    struct ss7_chan* pvt = find_pvt(event->isup.slink, isup_msg.cic);
+//    struct ss7_chan* pvt = find_pvt(event->isup.slink, isup_msg.cic);
+    struct ss7_chan* pvt = find_pvt_with_pc(event->isup.slink, 
isup_msg.cic, isup_msg.opc);
      if (pvt) {
        if(pvt->equipped)
      process_isup_message(pvt->link, &isup_msg);


-- 
*Exa-Omicron*
Patroonsweg 10
3892 DB Zeewolde
Tel.: 088-OMICRON (66 427 66)
http://www.exa-omicron.nl



More information about the asterisk-ss7 mailing list