[asterisk-ss7] chan_ss7: patch for selecting CICs from dialplan

Robert Verspuy robert at exa-omicron.nl
Thu May 27 16:12:29 CDT 2010


Unfortunately, there is a small bug in the patch for selecting CIC's 
from the dialplan.

In stead of:

+      strncpy(cics, cic_sep + 1, sep-cic_sep-1);
+      cics[sep-cic_sep] = '\0';

This should be:

+      strncpy(cics, cic_sep + 1, sep-cic_sep-1);
+      cics[sep-cic_sep*-1*] = '\0';

And the following lines:

+      	strncpy(last_cic, cics_sep + 1, strlen(cics) - (cics_sep-cics) - 2);
+
+	first_cic[cics_sep-cics] = '\0';
+	last_cic[strlen(cics) - (cics_sep-cics) - 2] = '\0';

Should be

+      	strncpy(last_cic, cics_sep + 1, strlen(cics) - (cics_sep-cics)*  - 1*);
+
+	first_cic[cics_sep-cics] = '\0';
+	last_cic[strlen(cics) - (cics_sep-cics)*  - 1*] = '\0';


When trying this new patch on our ss7 link, I tried to dial a 
SS7/link1:129/0031xxx number.

The first 2 lines place the \0 one byte too far.
This probably did not give any problems for the ones who tested the patch,
but in my case, the 'undeterimined byte was somehow in the memory a "-".
This would the content of the cics = "129-".

And this causes the code to try and seperate this into a first_cic and 
last_cic.
With incorrect information the strncpy to the last_cic resulted in a 
crash with core dump.

The extra byte is not a problem, when using a for example: 
SS7/link1:129-159/00316xxx
Because the second fix I mentioned above, normally cuts of the last 
character.
By using fix 1 (to make dialing with a single cic working), fix 2 is 
also needed, or else, you will have cut off one character too much.

The original patch was based on chan_ss7 version 1.2.1.
And it's oncluded in the main branche from netfors in version 1.4.

So version chan_ss7 1.4 will also have have this bug.
I will inform netfors.

As a workaround it's also possible to use SS7/link1:129-129/316xxxx.
This should not give you any core dumps (I think, didn't test it)

With kind regards,
Robert Verspuy

On 04/15/2010 02:05 PM, Matthias van der Vlies wrote:
> Dear all,
>
> Here in the Netherlands we have a SS7 connection with the biggest local
> telco. We have 4 E1s with the following CIC usage:
>
> Linkset one:
>
> 1-31    Incoming
> 33-58    Outgoing
> 58-63    Emergency Traffic
>
> Linkset two:
>
> 1-31    Incoming
> 33-58    Outgoing
> 58-63    Emergency Traffic
>
> Using the standard Dial command we cannot select on which CICs to send 
> out traffic, since chan_ss7 will by default use all CICs:
>
> Dial(SS7/Linkset1/number)
>
> To overcome this problem we have written a patch that allows you to 
> select the CICs when dialing, like follows:
>
> Dial(SS7/Linkset1:33-58/number)
>
> This way we can specify on which CICs to send. With the patch it's 
> also possible to specify a single CIC like:
>
> Dial(SS7/Linkset1:33/number)
>
> The patch attached was written for chan_ss7 1.2.1
>
> Best Regards,
>
> Matthias van der Vlies


-- 
*Exa-Omicron*
Patroonsweg 10
3892 DB Zeewolde
Tel.: 088-OMICRON (66 427 66)
http://www.exa-omicron.nl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-ss7/attachments/20100527/576e0ec6/attachment.htm 


More information about the asterisk-ss7 mailing list