Dear all,
We are using the libss7 library along with asterisk for some experimentation.
In that we had a need to set the generic number and the location number fields
in the ISUP-IAM packets. So I've gone ahead and done those modifications to the
libss7-2.0.0 code base.
Attached the patch along with this posr. It is working fine. I'm not sure, whom
should I send this patch, so please guide.
regards,
Lakshmanan G
diff -Naur libss7-2.0.0/isup.c libss7-2.0.0_old/isup.c
--- libss7-2.0.0/isup.c 2014-06-10 01:18:47.000000000 +0530
+++ libss7-2.0.0_old/isup.c 2015-04-27 19:20:00.000000000 +0530
@@ -67,7 +67,7 @@
static int iam_params[] = {ISUP_PARM_NATURE_OF_CONNECTION_IND, ISUP_PARM_FORWARD_CALL_IND, ISUP_PARM_CALLING_PARTY_CAT,
ISUP_PARM_TRANSMISSION_MEDIUM_REQS, ISUP_PARM_CALLED_PARTY_NUM, ISUP_PARM_CALLING_PARTY_NUM, ISUP_PARM_REDIRECTING_NUMBER,
ISUP_PARM_REDIRECTION_INFO, ISUP_PARM_REDIRECT_COUNTER, ISUP_PARM_ORIGINAL_CALLED_NUM, ISUP_PARM_OPT_FORWARD_CALL_INDICATOR,
- ISUP_PARM_CUG_INTERLOCK_CODE, -1};
+ ISUP_PARM_CUG_INTERLOCK_CODE, ISUP_PARM_GENERIC_ADDR, ISUP_PARM_LOCATION_NUMBER, -1};
static int ansi_iam_params[] = {ISUP_PARM_NATURE_OF_CONNECTION_IND, ISUP_PARM_FORWARD_CALL_IND, ISUP_PARM_CALLING_PARTY_CAT,
ISUP_PARM_USER_SERVICE_INFO, ISUP_PARM_CALLED_PARTY_NUM, ISUP_PARM_CALLING_PARTY_NUM, ISUP_PARM_CHARGE_NUMBER,
@@ -2017,6 +2017,62 @@
return datalen + 2;
}
+static FUNC_DUMP(location_number_dump)
+{
+ int oddeven = (parm[0] >> 7) & 0x1;
+ char numbuf[64] = "";
+
+ ss7_message(ss7, "\t\t\tNature of address: %x\n", parm[0] & 0x7f);
+ ss7_message(ss7, "\t\t\tINN: %x\n", (parm[1] >> 7) & 0x1);
+ ss7_message(ss7, "\t\t\tNumbering plan: %x\n", (parm[1] >> 4) & 0x7);
+ ss7_message(ss7, "\t\t\tPresentation: %x\n", (parm[1] >> 2) & 0x3);
+ ss7_message(ss7, "\t\t\tScreening: %x\n", parm[1] & 0x3);
+
+ isup_get_number(numbuf, &parm[2], len - 2, oddeven);
+
+ ss7_message(ss7, "\t\t\tAddress signals: %s\n", numbuf);
+
+ return len;
+}
+
+static FUNC_RECV(location_number_receive)
+{
+ int oddeven = (parm[0] >> 7) & 0x1;
+
+ isup_get_number(c->location_num, &parm[2], len - 2, oddeven);
+
+ c->location_num_nai = parm[0] & 0x7f; /* Nature of Address Indicator */
+ c->location_num_presentation_ind = (parm[1] >> 2) & 0x3;
+ c->location_num_screening_ind = parm[1] & 0x3;
+
+ return len;
+}
+
+static FUNC_SEND(location_number_transmit)
+{
+ int oddeven, datalen;
+
+ if (!c->location_num[0] && c->location_num_presentation_ind != SS7_PRESENTATION_ADDR_NOT_AVAILABLE) {
+ return 0;
+ }
+
+ if (c->location_num[0] && c->location_num_presentation_ind != SS7_PRESENTATION_ADDR_NOT_AVAILABLE) {
+ isup_put_number(&parm[2], c->location_num, &datalen, &oddeven);
+ } else {
+ datalen = 0;
+ oddeven = 0;
+ c->calling_nai = 0;
+ }
+
+ parm[0] = (oddeven << 7) | c->location_num_nai; /* Nature of Address Indicator */
+ /* Assume E.164 ISDN numbering plan, calling number complete */
+ parm[1] = ((c->location_num_presentation_ind == SS7_PRESENTATION_ADDR_NOT_AVAILABLE) ? 0 : (1 << 4)) |
+ ((c->location_num_presentation_ind & 0x3) << 2) |
+ (c->location_num_screening_ind & 0x3);
+
+ return datalen + 2;
+}
+
static FUNC_DUMP(echo_control_info_dump)
{
unsigned char ba = parm[0] & 0x3;
@@ -2716,7 +2772,7 @@
{ISUP_PARM_MCID_RESPONSE_IND, "MCID response indicators"},
{ISUP_PARM_HOP_COUNTER, "Hop Counter", hop_counter_dump, hop_counter_receive, hop_counter_transmit},
{ISUP_PARM_TRANSMISSION_MEDIUM_REQ_PRIME, "Transmission medium requirement prime"},
- {ISUP_PARM_LOCATION_NUMBER, "Location Number"},
+ {ISUP_PARM_LOCATION_NUMBER, "Location Number", location_number_dump, location_number_receive, location_number_transmit},
{ISUP_PARM_REDIRECTION_NUM_RESTRICTION, "Redirection number restriction"},
{ISUP_PARM_CALL_TRANSFER_REFERENCE, "Call transfer reference"},
{ISUP_PARM_LOOP_PREVENTION_IND, "Loop prevention indicators"},
@@ -2886,6 +2942,20 @@
}
}
+void isup_set_location_num(struct isup_call *c, const char *location_num, unsigned char location_num_nai, unsigned char location_num_presentation_ind, unsigned char location_num_screening_ind)
+{
+ if ((location_num && location_num[0]) || location_num_presentation_ind == SS7_PRESENTATION_ADDR_NOT_AVAILABLE) {
+ if (location_num) {
+ strncpy(c->location_num, location_num, sizeof(c->location_num));
+ } else {
+ c->location_num[0] = '\0';
+ }
+ c->location_num_nai = location_num_nai;
+ c->location_num_presentation_ind = location_num_presentation_ind;
+ c->location_num_screening_ind = location_num_screening_ind;
+ }
+}
+
void isup_set_connected(struct isup_call *c, const char *connected, unsigned char connected_nai, unsigned char connected_presentation_ind, unsigned char connected_screening_ind) {
if ((connected && connected[0]) || connected_presentation_ind == SS7_PRESENTATION_ADDR_NOT_AVAILABLE) {
if (connected) {
diff -Naur libss7-2.0.0/isup.h libss7-2.0.0_old/isup.h
--- libss7-2.0.0/isup.h 2014-06-10 01:18:47.000000000 +0530
+++ libss7-2.0.0_old/isup.h 2015-04-27 19:20:18.000000000 +0530
@@ -296,6 +296,10 @@
unsigned char orig_called_nai;
unsigned char orig_called_pres_ind;
unsigned char orig_called_screening_ind;
+ char location_num[ISUP_MAX_NUM];
+ unsigned char location_num_nai;
+ unsigned char location_num_presentation_ind;
+ unsigned char location_num_screening_ind;
char redirecting_num[ISUP_MAX_NUM];
unsigned char redirecting_num_nai;
unsigned char redirecting_num_presentation_ind;
diff -Naur libss7-2.0.0/libss7.h libss7-2.0.0_old/libss7.h
--- libss7-2.0.0/libss7.h 2014-06-10 01:18:47.000000000 +0530
+++ libss7-2.0.0_old/libss7.h 2015-04-27 19:20:01.000000000 +0530
@@ -603,6 +603,8 @@
void isup_set_calling(struct isup_call *c, const char *calling, unsigned char calling_nai, unsigned char presentation_ind, unsigned char screening_ind);
+void isup_set_location_num(struct isup_call *c, const char *location_num, unsigned char location_num_nai, unsigned char location_num_presentation_ind, unsigned char location_num_screening_ind);
+
void isup_set_connected(struct isup_call *c, const char *connected, unsigned char connected_nai, unsigned char connected_presentation_ind, unsigned char connected_screening_ind);
void isup_set_redirecting_number(struct isup_call *c, const char *redirecting_number, unsigned char redirecting_num_nai, unsigned char redirecting_num_presentation_ind, unsigned char redirecting_num_screening_ind);
--
_____________________________________________________________________
-- 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