[asterisk-ss7] chan_ss7 v. 1.4.1 released

Gregory Massel greg at csurf.co.za
Mon May 31 06:54:27 CDT 2010


Hello

I would like to propose the following changes for the next release of 
chan_ss7 for compatibility with South Africa SS7:

1. Handling of subscriber local numbers in isup.c:

--- isup.c.old  2010-05-31 13:26:44.000000000 +0200
+++ isup.c      2010-05-31 13:27:08.000000000 +0200
@@ -486,9 +486,8 @@ int decode_isup_phonenum(int with_presen
     case 0x70:                  // Hong Kong CSL
     case 0x03:                  // National (significant) number.
       break;
-    case 0x01:                  // Subscriber local number. Getting this 
has
-                                // got to be wrong, but we've seen it 'in 
the
-                                // wild' where they looked like 
international.
+    case 0x01:                  // Subscriber local number.
+      break;

     case 0x02:                  // Unknown; again experience suggests
                                 // this should be international.

Reason: there are valid cases where the NAI should be subscriber local. E.g. 
We transit this NAI when we are routing to a short-coded number on the other 
network and we receive this NAI when we terminate a call to a number that 
has been ported to our network (through the number portability process) and 
with a port code pre-pended to the number.

2. Various changes to l4isup.c to handle subscriber numbers and special 
digits:

--- l4isup.c.old        2009-12-06 11:34:42.000000000 +0200
+++ l4isup.c    2010-05-27 11:43:45.000000000 +0200
@@ -1689,7 +1689,7 @@ static void check_obci(struct ss7_chan*
 }

 static int isup_phonenum_check(char **number, int *nlen,
-                               int *is_international) {
+                               int *is_international, int 
*is_subscribernumber) {
   if(*number == NULL) {
     ast_log(LOG_DEBUG, "NULL phonenumber, encoding failed.\n");
     return -1;
@@ -1703,14 +1703,22 @@ static int isup_phonenum_check(char **nu
   /* Handle both '00' and '+' as international prefix. */
   if(strncmp(*number, "00", 2) == 0) {
     *is_international = 1;
+    *is_subscribernumber = 0;
     *number += 2;
     *nlen -= 2;
   } else if(strncmp(*number, "+", 1) == 0) {
     *is_international = 1;
+    *is_subscribernumber = 0;
     *number += 1;
     *nlen -= 1;
-  } else {
+  } else if(strncmp(*number, "0", 1) == 0) {   /* Handle '0' as national 
prefix. */
+    *is_international = 0;
+    *is_subscribernumber = 0;
+    *number += 1;
+    *nlen -= 1;
+  } else {     /* Must be a subscriber number */
     *is_international = 0;
+    *is_subscribernumber = 1;
   }

   return 0;                     /* Success */
@@ -1730,10 +1738,14 @@ static int isup_phonenum_digits(char *nu
     } else {
       if ((number[i] >= '0') && (number[i] <= '9'))
        d = number[i] - '0';
+      else if ((number[i] == 'a') || (number[i] == 'A'))
+       d = 0x0a;
       else if ((number[i] == 'b') || (number[i] == 'B'))
        d = 0x0b;
       else if ((number[i] == 'c') || (number[i] == 'C'))
        d = 0x0c;
+      else if ((number[i] == 'd') || (number[i] == 'D'))
+       d = 0x0d;
       else if ((number[i] == 'e') || (number[i] == 'E'))
        d = 0x0e;
       else {
@@ -1758,9 +1770,10 @@ int isup_called_party_num_encode(struct
   int nlen;
   int is_odd;
   int is_international;
+  int is_subscribernumber;
   int result_len;

-  if(isup_phonenum_check(&number, &nlen, &is_international) == -1) {
+  if(isup_phonenum_check(&number, &nlen, &is_international, 
&is_subscribernumber) == -1) {
     return -1;
   }

@@ -1779,7 +1792,7 @@ int isup_called_party_num_encode(struct
   if (pvt->link->linkset->noa != -1)
     param[0] |= (pvt->link->linkset->noa & 0x7f);
   else
-    param[0] |= (is_international ? 4 : 3);
+    param[0] |= (is_subscribernumber ? 1 : (is_international ? 4 : 3));
   param[1] = 0x10; /* Internal routing allowed, ISDN number plan */

   if(isup_phonenum_digits(number, 1, nlen, param) == -1) {
@@ -1795,9 +1808,10 @@ int isup_called_party_num_encode_no_st(s
   int nlen;
   int is_odd;
   int is_international;
+  int is_subscribernumber;
   int result_len;

-  if(isup_phonenum_check(&number, &nlen, &is_international) == -1) {
+  if(isup_phonenum_check(&number, &nlen, &is_international, 
&is_subscribernumber) == -1) {
     return -1;
   }

@@ -1816,7 +1830,7 @@ int isup_called_party_num_encode_no_st(s
   if (pvt->link->linkset->noa != -1)
     param[0] |= (pvt->link->linkset->noa & 0x7f);
   else
-    param[0] |= (is_international ? 4 : 3);
+    param[0] |= (is_subscribernumber ? 1 : (is_international ? 4 : 3));
   param[1] = 0x10; /* Internal routing allowed, ISDN number plan */

   if(isup_phonenum_digits(number, 0, nlen, param) == -1) {
@@ -1832,9 +1846,10 @@ int isup_calling_party_num_encode(char *
   int nlen;
   int is_odd;
   int is_international;
+  int is_subscribernumber;
   int result_len;

-  if(isup_phonenum_check(&number, &nlen, &is_international) == -1) {
+  if(isup_phonenum_check(&number, &nlen, &is_international, 
&is_subscribernumber) == -1) {
     return -1;
   }

@@ -1847,7 +1862,7 @@ int isup_calling_party_num_encode(char *
     return -1;
   }

-  param[0] = (is_odd << 7) | (is_international ? 4 : 3);
+  param[0] = (is_odd << 7) | (is_subscribernumber ? 1 : (is_international ? 
4 : 3));
   param[1] = 0x10 | si; /* Number complete; ISDN number plan; + screening 
indicator */
   if(pres_restr) {
     param[1] |= (0x1 << 2);


Reasons:
1. We have to identify subscriber numbers and set the NAI accordingly when 
routing to these. Examples of subscriber numbers for us are:
(a) any short-coded number starting with the digit '1'
(b) and number ported out and pre-pended with the recipient operator's port 
code, e.g. D0010115551234. (In this case, the 'D001' is the port code.)
2. It is necessary to process all hex character digits, not just some of 
them. We had to add 'D' because all the port codes used for geographic 
number portability here start with 'D'.


I think it would also be hugely beneficial to be able to set the 
international, national and subscriber number prefixes in the config file. I 
have not contributed a patch to such effect as I have not studied the 
chan_ss7 source code sufficiently well to make such a complex change. I 
would invisage a configuration setting such as:

[region]
international_prefix => 00,+
national_prefix => 0
subscribernumber_prefix_out => 1,D

preferrably where an empty prefix also applies, e.g, to default to national:

[region]
international_prefix => 00,+
national_prefix =>
subscribernumber_prefix_out => 1,D

Kind Regards
Gregory Massel

----- Original Message ----- 
From: "Anders Baekgaard" <ab at netfors.com>
To: <asterisk-ss7 at lists.digium.com>
Sent: Monday, May 31, 2010 1:05 PM
Subject: [asterisk-ss7] chan_ss7 v. 1.4.1 released


> Netfors has released chan_ss7 v. 1.4.1.
>
> This release has minor new features, but most notably it allows dial out 
> on
> specific CIC ranges. More information is available at
> http://www.netfors.com/chan_ss7_free
>
> Please provide bug  reports and comments to chan_ss7 at netfors.com .
>
> Best regards,
> -- 
> Anders Baekgaard
> Netfors
> Mobile: +4520771844
> Gtalk: ab at netfors.com
> Skype: a.baekgaard
> MSN: ab at netfors.com
>
>
> -- 
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-ss7 mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-ss7
> 




More information about the asterisk-ss7 mailing list