[libss7-commits] mattf: branch mattf/bug13495 r220 - /team/mattf/bug13495/
SVN commits to the libss7 project
libss7-commits at lists.digium.com
Mon Dec 1 12:15:08 CST 2008
Author: mattf
Date: Mon Dec 1 12:15:08 2008
New Revision: 220
URL: http://svn.digium.com/view/libss7?view=rev&rev=220
Log:
Commit updated version of #13495 patches (with various fixes) so that we can work off of this branch
Modified:
team/mattf/bug13495/Makefile
team/mattf/bug13495/isup.c
team/mattf/bug13495/isup.h
team/mattf/bug13495/libss7.h
team/mattf/bug13495/mtp2.c
team/mattf/bug13495/mtp2.h
team/mattf/bug13495/mtp3.c
team/mattf/bug13495/mtp3.h
team/mattf/bug13495/ss7.c
team/mattf/bug13495/ss7_internal.h
team/mattf/bug13495/ss7linktest.c
Modified: team/mattf/bug13495/Makefile
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/Makefile?view=diff&rev=220&r1=219&r2=220
==============================================================================
--- team/mattf/bug13495/Makefile (original)
+++ team/mattf/bug13495/Makefile Mon Dec 1 12:15:08 2008
@@ -69,7 +69,7 @@
gcc -g -o ss7test ss7test.c libss7.a -lpthread
ss7linktest: ss7linktest.c $(STATIC_LIBRARY)
- gcc -g -o ss7linktest ss7linktest.c libss7.a -lpthread
+# gcc -g -o ss7linktest ss7linktest.c libss7.a -lpthread
parser_debug: parser_debug.c $(STATIC_LIBRARY)
gcc -g -Wall -o parser_debug parser_debug.c libss7.a
Modified: team/mattf/bug13495/isup.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/isup.c?view=diff&rev=220&r1=219&r2=220
==============================================================================
--- team/mattf/bug13495/isup.c (original)
+++ team/mattf/bug13495/isup.c Mon Dec 1 12:15:08 2008
@@ -31,6 +31,7 @@
#include <string.h>
#include <stdlib.h>
+#include <time.h>
#include "libss7.h"
#include "isup.h"
#include "ss7_internal.h"
@@ -58,13 +59,22 @@
FUNC_SEND(*transmit);
};
+struct isup_timer_param {
+ struct ss7 *ss7;
+ struct isup_call *c;
+ int timer;
+};
+
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, -1};
+ 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};
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,
ISUP_PARM_ORIG_LINE_INFO, ISUP_PARM_GENERIC_ADDR, ISUP_PARM_GENERIC_DIGITS, ISUP_PARM_GENERIC_NAME, ISUP_PARM_JIP,
- ISUP_PARM_LOCAL_SERVICE_PROVIDER_IDENTIFICATION, -1};
+ ISUP_PARM_LOCAL_SERVICE_PROVIDER_IDENTIFICATION, ISUP_PARM_REDIRECTION_INFO, ISUP_PARM_REDIRECTING_NUMBER, ISUP_PARM_REDIRECT_COUNTER,
+ ISUP_PARM_ORIGINAL_CALLED_NUM, ISUP_PARM_OPT_FORWARD_CALL_INDICATOR, ISUP_PARM_CUG_INTERLOCK_CODE, -1};
static int acm_params[] = {ISUP_PARM_BACKWARD_CALL_IND, -1};
@@ -73,9 +83,9 @@
static int far_params[] = {ISUP_PARM_FACILITY_IND, ISUP_PARM_CALL_REF, -1};
-static int anm_params[] = { -1};
-
-static int con_params[] = { ISUP_PARM_BACKWARD_CALL_IND, -1};
+static int anm_params[] = { ISUP_CONNECTED_NUMBER, -1};
+
+static int con_params[] = { ISUP_PARM_BACKWARD_CALL_IND, ISUP_CONNECTED_NUMBER, -1};
static int rel_params[] = { ISUP_PARM_CAUSE, -1};
@@ -88,6 +98,14 @@
static int cicgroup_params[] = { ISUP_PARM_CIRCUIT_GROUP_SUPERVISION_IND, ISUP_PARM_RANGE_AND_STATUS, -1};
static int cqr_params[] = { ISUP_PARM_RANGE_AND_STATUS, ISUP_PARM_CIRCUIT_STATE_IND, -1};
+
+static int susres_params[] = { ISUP_PARM_SUSRES_IND, ISUP_PARM_CALL_REF, -1};
+
+static int inr_params[] = { ISUP_PARM_INR_IND, -1};
+
+static int inf_params[] = { ISUP_PARM_INF_IND, ISUP_PARM_CALLING_PARTY_NUM, ISUP_PARM_CALLING_PARTY_CAT, -1};
+
+static int sam_params[] = { ISUP_PARM_SUBSEQUENT_NUMBER, -1};
static int empty_params[] = { -1};
@@ -126,10 +144,20 @@
{ISUP_CQR, 0, 2, 0, cqr_params},
{ISUP_FAA, 1, 0, 1, faa_params},
{ISUP_FAR, 1, 0, 1, far_params},
- {ISUP_CFN, 0, 1, 0, rel_params}
+ {ISUP_CFN, 0, 1, 0, rel_params},
+ {ISUP_SUS, 1, 0, 1, susres_params},
+ {ISUP_RES, 1, 0, 1, susres_params},
+ {ISUP_INR, 1, 0, 0, inr_params},
+ {ISUP_INF, 1, 0, 2, inf_params},
+ {ISUP_SAM, 0, 1, 0, sam_params}
};
static int isup_send_message(struct ss7 *ss7, struct isup_call *c, int messagetype, int parms[]);
+
+static int isup_start_timer(struct ss7 *ss7, struct isup_call *c, int timer);
+static void isup_stop_all_timers(struct ss7 *ss7, struct isup_call *c);
+static int isup_timer2str(int timer, char *res);
+static void isup_stop_timer(struct ss7 *ss7, struct isup_call *c, int timer);
static char * message2str(unsigned char message)
{
@@ -188,6 +216,16 @@
return "CVR";
case ISUP_CFN:
return "CFN";
+ case ISUP_SUS:
+ return "SUS";
+ case ISUP_RES:
+ return "RES";
+ case ISUP_INR:
+ return "INR";
+ case ISUP_INF:
+ return "INF";
+ case ISUP_SAM:
+ return "SAM";
default:
return "Unknown";
}
@@ -681,6 +719,50 @@
return 1;
}
+static FUNC_DUMP(opt_forward_call_ind_dump)
+{
+ char *desc;
+
+ switch (parm[0] & 0x03) {
+ case ISUP_CUG_NON:
+ desc = "non-CUG call";
+ break;
+ case ISUP_CUG_OUTGOING_ALLOWED:
+ desc = "closed user group call, outgoing access allowed";
+ break;
+ case ISUP_CUG_OUTGOING_NOT_ALLOWED:
+ desc = "closed user group call, outgoing access not allowed";
+ break;
+ default:
+ desc = "spare";
+ }
+
+ ss7_message(ss7, "\t\t\tClosed user group call indicator: %s\n", desc);
+ ss7_message(ss7, "\t\t\tSimple segmentation indicator: %s\n", (parm[0] & (1 << 2)) ?
+ "additional information will be sent in segmentation message" :
+ "no additional message will be sent");
+ ss7_message(ss7, "\t\t\tConnected line identify request indicator %s\n", (parm[0] & (1 << 7)) ?
+ "requested": "not requested");
+
+ return 1;
+}
+
+static FUNC_SEND(opt_forward_call_ind_transmit)
+{
+ if (c->col_req || c->cug_indicator) {
+ parm[0] = (c->cug_indicator & 0x03) | (c->col_req << 7);
+ return 1;
+ } else
+ return 0;
+}
+
+static FUNC_RECV(opt_forward_call_ind_receive)
+{
+ c->cug_indicator = parm[0] & 0x03;
+ c->col_req = parm[0] >> 7;
+ return 1;
+}
+
static FUNC_RECV(cause_receive)
{
c->causeloc = parm[0] & 0xf;
@@ -846,15 +928,9 @@
statuslen = (numcics / 8) + !!(numcics % 8);
- if (messagetype == ISUP_GRA) {
- for (i = 0; i < statuslen; i++) {
- parm[1 + i] = 0;
- }
- } else {
- for (i = 0; i < numcics; i++) {
- if (c->status[i])
- parm[1 + (i/8)] |= (1 << (i % 8));
- }
+ for (i = 0; i < numcics; i++) {
+ if (c->status[i])
+ parm[1 + (i/8)] |= (1 << (i % 8));
}
return statuslen + 1;
@@ -896,16 +972,74 @@
{
int oddeven, datalen;
- if (!c->calling_party_num[0])
+ if (!c->calling_party_num[0] && c->presentation_ind != SS7_PRESENTATION_ADDR_NOT_AVAILABLE)
return 0;
- isup_put_number(&parm[2], c->calling_party_num, &datalen, &oddeven);
+ if (c->calling_party_num[0] && c->presentation_ind != SS7_PRESENTATION_ADDR_NOT_AVAILABLE)
+ isup_put_number(&parm[2], c->calling_party_num, &datalen, &oddeven);
+ else {
+ datalen = 0;
+ oddeven = 0;
+ c->calling_nai = 0;
+ }
parm[0] = (oddeven << 7) | c->calling_nai; /* Nature of Address Indicator */
- parm[1] = (1 << 4) | /* Assume E.164 ISDN numbering plan, calling number complete */
+ /* Assume E.164 ISDN numbering plan, calling number complete */
+ parm[1] = ((c->presentation_ind == SS7_PRESENTATION_ADDR_NOT_AVAILABLE) ? 0 : (1 << 4)) |
((c->presentation_ind & 0x3) << 2) |
(c->screening_ind & 0x3);
-
+
+ return datalen + 2;
+}
+
+static FUNC_DUMP(connected_num_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\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(connected_num_receive)
+{
+ int oddeven = (parm[0] >> 7) & 0x1;
+
+ isup_get_number(c->connected_num, &parm[2], len - 2, oddeven);
+
+ c->connected_nai = parm[0] & 0x7f; /* Nature of Address Indicator */
+ c->connected_presentation_ind = (parm[1] >> 2) & 0x3;
+ c->connected_screening_ind = parm[1] & 0x3;
+
+ return len;
+
+}
+
+static FUNC_SEND(connected_num_transmit)
+{
+ int oddeven = 0, datalen = 0;
+
+ if (!c->col_req)
+ return 0; /* if they don't ask we won't tell */
+
+
+ if (!c->connected_num[0])
+ c->connected_presentation_ind = SS7_PRESENTATION_ADDR_NOT_AVAILABLE;
+ else
+ isup_put_number(&parm[2], c->connected_num, &datalen, &oddeven);
+
+
+ parm[0] = (oddeven << 7) | c->connected_nai; /* Nature of Address Indicator */
+ /* Assume E.164 ISDN numbering plan, calling number complete */
+ parm[1] = ((c->connected_presentation_ind & 0x3) << 2) | (c->connected_screening_ind & 0x3);
return datalen + 2;
}
@@ -1394,7 +1528,7 @@
switch ((parm[1] >> 4) & 0xf) {
case 0:
- orig_redir_reas = "Unknown/not available";
+ redir_reas = "Unknown/not available";
break;
case 1:
redir_reas = "User busy";
@@ -1426,11 +1560,21 @@
static FUNC_RECV(redirection_info_receive)
{
+ c->redirect_info = 1;
+ c->redirect_info_ind = parm[0] & 0x7;
+ c->redirect_info_orig_reas = (parm[0] >> 4) & 0xf;
+ c->redirect_info_counter = parm[1] & 0x7;
+ c->redirect_info_reas = (parm[1] >> 4) & 0xf;
return 2;
}
static FUNC_SEND(redirection_info_transmit)
{
+ if (!c->redirect_info)
+ return 0;
+
+ parm[0] = (c->redirect_info_ind & 0x7) | ((c->redirect_info_orig_reas << 4) & 0xf0);
+ parm[1] = (c->redirect_info_counter & 0x7) | ((c->redirect_info_reas << 4) & 0xf0);
return 2;
}
@@ -1607,7 +1751,19 @@
static FUNC_SEND(original_called_num_transmit)
{
- return len;
+ int oddeven, datalen;
+
+ if (!c->orig_called_num[0])
+ return 0;
+
+ isup_put_number(&parm[2], c->orig_called_num, &datalen, &oddeven);
+
+ parm[0] = (oddeven << 7) | c->orig_called_nai; /* Nature of Address Indicator */
+ parm[1] = (1 << 4) | /* Assume E.164 ISDN numbering plan, calling number complete */
+ ((c->orig_called_pres_ind & 0x3) << 2) |
+ (c->orig_called_screening_ind & 0x3);
+
+ return datalen + 2;
}
static FUNC_DUMP(echo_control_info_dump)
@@ -1813,6 +1969,99 @@
}
static FUNC_RECV(tns_receive)
+{
+ return len;
+}
+
+static FUNC_DUMP(generic_notofication_ind_dump)
+{
+ int pos = 0;
+ ss7_message(ss7, "\t\t\tNotification indicator: ");
+
+ while (pos < len && (pos || !(parm[pos - 1] & 0x80))) {
+ switch (parm[pos] & 0x7f) {
+ case 0x00:
+ ss7_message(ss7, "user suspended; ");
+ break;
+ case 0x01:
+ ss7_message(ss7, "user resumed; ");
+ break;
+ case 0x02:
+ ss7_message(ss7, "bearer service change; ");
+ break;
+ case 0x03:
+ ss7_message(ss7, "discriminator for extension to ASN.1; ");
+ break;
+ case 0x04:
+ ss7_message(ss7, "call completion delay; ");
+ break;
+ case 0x42:
+ ss7_message(ss7, "conference established; ");
+ break;
+ case 0x43:
+ ss7_message(ss7, "conference disconnected; ");
+ break;
+ case 0x44:
+ ss7_message(ss7, "other party added; ");
+ break;
+ case 0x45:
+ ss7_message(ss7, "isolated; ");
+ break;
+ case 0x46:
+ ss7_message(ss7, "reattached; ");
+ break;
+ case 0x47:
+ ss7_message(ss7, "other party isolated; ");
+ break;
+ case 0x48:
+ ss7_message(ss7, "other party reattached; ");
+ break;
+ case 0x49:
+ ss7_message(ss7, "other party split; ");
+ break;
+ case 0x4a:
+ ss7_message(ss7, "other party disconnected; ");
+ break;
+ case 0x4b:
+ ss7_message(ss7, "other party floating; ");
+ break;
+ case 0x60:
+ ss7_message(ss7, "call is a waiting call; ");
+ break;
+ case 0x68:
+ ss7_message(ss7, "diversion activated; ");
+ break;
+ case 0x69:
+ ss7_message(ss7, "call transfer, alerting; ");
+ break;
+ case 0x6a:
+ ss7_message(ss7, "call transfer, active; ");
+ break;
+ case 0x79:
+ ss7_message(ss7, "remote hold; ");
+ break;
+ case 0x7a:
+ ss7_message(ss7, "remote retrieval; ");
+ break;
+ case 0x7b:
+ ss7_message(ss7, "remote is diverting; ");
+ break;
+
+ default:
+ ss7_message(ss7, "reserved; ");
+ }
+ pos++;
+ }
+ ss7_message(ss7, "\n");
+ return len;
+}
+
+static FUNC_SEND(generic_notofication_ind_transmit)
+{
+ return 0;
+}
+
+static FUNC_RECV(generic_notofication_ind_receive)
{
return len;
}
@@ -1955,8 +2204,110 @@
static FUNC_SEND(redirecting_number_transmit)
{
- return 0;
+ int oddeven, datalen;
+
+ if (!c->redirecting_num[0])
+ return 0;
+
+ isup_put_number(&parm[2], c->redirecting_num, &datalen, &oddeven);
+ parm[0] = (oddeven << 7) | c->redirecting_num_nai; /* Nature of Address Indicator */
+ parm[1] = (1 << 4) | /* Assume E.164 ISDN numbering plan, calling number complete */
+ ((c->redirecting_num_presentation_ind & 0x3) << 2) |
+ (c->redirecting_num_screening_ind & 0x3);
+
+ return datalen + 2;
}
+
+static FUNC_DUMP(redirect_counter_dump)
+{
+ ss7_message(ss7, "\t\t\tRedirect count: %i\n", parm[0] & 0x1f);
+ return 1;
+}
+
+static FUNC_RECV(redirect_counter_receive)
+{
+ c->redirect_counter = parm[0] & 0x1f;
+ return 1;
+}
+
+static FUNC_SEND(redirect_counter_transmit)
+{
+ if (!c->redirect_counter)
+ return 0;
+
+ parm[0] = c->redirect_counter & 0x1f;
+ return 1;
+}
+
+static FUNC_DUMP(susres_ind_dump)
+{
+ ss7_message(ss7, "\t\t\tSUS/RES indicator: %s (%i)\n", (parm[0] & 1) ? "network initiated" : "ISDN subscriber initiated", parm[0] & 1);
+ return 1;
+}
+
+static FUNC_RECV(susres_ind_receive)
+{
+ c->susres_ind = parm[0] & 1;
+ return 1;
+}
+
+static FUNC_SEND(susres_ind_transmit)
+{
+ parm[0] = c->susres_ind & 1;
+ return 1;
+}
+
+static FUNC_DUMP(inr_ind_dump)
+{
+ ss7_message(ss7, "\t\t\tCalling party address %srequested\n", (parm[0] & 0x1) ? "" : "not ");
+ ss7_message(ss7, "\t\t\tHolding %srequested\n", (parm[0] & 0x2) ? "" : "not ");
+ ss7_message(ss7, "\t\t\tCalling party category %srequested\n", (parm[0] & 0x8) ? "" : "not ");
+ ss7_message(ss7, "\t\t\tCharge information %srequested\n", (parm[0] & 0x10) ? "" : "not ");
+ ss7_message(ss7, "\t\t\tMalicous call identification %srequested\n", (parm[0] & 0x80) ? "" : "not ");
+ return 2;
+}
+
+static FUNC_RECV(inr_ind_receive)
+{
+ c->inr_ind[0] = parm[0];
+ c->inr_ind[1] = parm[1];
+ return 2;
+}
+
+static FUNC_SEND(inr_ind_transmit)
+{
+ parm[0] = c->inr_ind[0];
+ parm[1] = c->inr_ind[1];
+ return 2;
+}
+
+static FUNC_DUMP(inf_ind_dump)
+{
+ ss7_message(ss7, "\t\t\tCalling party address: %s\n",
+ (parm[0] & 0x2) ? ((parm[0] & 0x1) ? "included" : "spare" ) : ((parm[0] & 0x1) ? "not available" : "not included") );
+ ss7_message(ss7, "\t\t\tHold: %sprovided\n", (parm[0] & 0x4) ? "" : "not ");
+ ss7_message(ss7, "\t\t\tCalling party's category %sincluded\n", (parm[0] & 0x20) ? "" : "not ");
+ ss7_message(ss7, "\t\t\tCharge information %sincluded\n", (parm[0] & 0x40) ? "" : "not ");
+ ss7_message(ss7, "\t\t\t%s\n", (parm[0] & 0x80) ? "Unsolicated" : "Solicated");
+
+ return 2;
+}
+
+static FUNC_RECV(inf_ind_receive)
+{
+ c->inf_ind[0] = parm[0];
+ c->inf_ind[1] = parm[1];
+ if ((parm[0] & 0x3) == 0x1)
+ c->presentation_ind = SS7_PRESENTATION_ADDR_NOT_AVAILABLE;
+ return 2;
+}
+
+static FUNC_SEND(inf_ind_transmit)
+{
+ parm[0] = c->inf_ind[0];
+ parm[1] = c->inf_ind[1];
+ return 2;
+}
static FUNC_DUMP(access_transport_dump)
{
@@ -1972,6 +2323,79 @@
return len;
}
+static FUNC_DUMP(subs_num_dump)
+{
+ int oddeven = (parm[0] >> 7) & 0x1;
+ char numbuf[64];
+
+ isup_get_number(numbuf, &parm[1], len - 1, oddeven);
+ ss7_message(ss7, "\t\t\tSubsequent signals: %s\n", numbuf);
+
+ return len;
+}
+
+static FUNC_RECV(subs_num_receive)
+{
+ int oddeven = (parm[0] >> 7) & 0x1;
+
+ isup_get_number(c->called_party_num, &parm[1], len - 1, oddeven);
+
+ return len;
+}
+
+static FUNC_SEND(subs_num_transmit)
+{
+ int oddeven, datalen;
+
+ isup_put_number(&parm[1], c->called_party_num, &datalen, &oddeven);
+ parm[0] = (oddeven << 7);
+
+ return datalen + 1;
+}
+
+static FUNC_DUMP(cug_interlock_code_dump)
+{
+ char ni[5];
+ unsigned short code;
+
+ ni[0] = digit2char(parm[0] >> 4);
+ ni[1] = digit2char(parm[0] & 0x0f);
+ ni[2] = digit2char(parm[1] >> 4);
+ ni[3] = digit2char(parm[1] & 0x0f);
+ ni[4] = '\0';
+
+ code = (parm[2] << 8) | parm [3];
+
+ ss7_message(ss7, "\t\t\tNetwork Identify: %s\n", ni);
+ ss7_message(ss7, "\t\t\tBinary Code: %d\n", code);
+ return 4;
+}
+
+static FUNC_RECV(cug_interlock_code_receive)
+{
+ c->cug_interlock_ni[0] = digit2char(parm[0] >> 4);
+ c->cug_interlock_ni[1] = digit2char(parm[0] & 0x0f);
+ c->cug_interlock_ni[2] = digit2char(parm[1] >> 4);
+ c->cug_interlock_ni[3] = digit2char(parm[1] & 0x0f);
+ c->cug_interlock_ni[4] = '\0';
+
+ c->cug_interlock_code = (parm[2] << 8) | parm [3];
+ return 4;
+}
+
+static FUNC_SEND(cug_interlock_code_transmit)
+{
+ if (!(c->cug_indicator == ISUP_CUG_OUTGOING_ALLOWED || c->cug_indicator == ISUP_CUG_OUTGOING_NOT_ALLOWED))
+ return 0;
+
+ parm[0] = (char2digit(c->cug_interlock_ni[0]) << 4) | char2digit(c->cug_interlock_ni[1]);
+ parm[1] = (char2digit(c->cug_interlock_ni[2]) << 4) | char2digit(c->cug_interlock_ni[3]);
+
+ parm[2] = c->cug_interlock_code >> 8;
+ parm[3] = c->cug_interlock_code & 0xff;
+
+ return 4;
+}
static struct parm_func parms[] = {
{ISUP_PARM_NATURE_OF_CONNECTION_IND, "Nature of Connection Indicator", nature_of_connection_ind_dump, nature_of_connection_ind_receive, nature_of_connection_ind_transmit },
@@ -1991,13 +2415,13 @@
{ISUP_PARM_CHARGE_NUMBER, "Charge Number", charge_number_dump, charge_number_receive, charge_number_transmit},
{ISUP_PARM_CIRCUIT_ASSIGNMENT_MAP, "Circuit Assignment Map"},
{ISUP_PARM_CONNECTION_REQ, "Connection Request"},
- {ISUP_PARM_CUG_INTERLOCK_CODE, "Interlock Code"},
+ {ISUP_PARM_CUG_INTERLOCK_CODE, "Interlock Code", cug_interlock_code_dump, cug_interlock_code_receive, cug_interlock_code_transmit},
{ISUP_PARM_EGRESS_SERV, "Egress Service"},
{ISUP_PARM_GENERIC_ADDR, "Generic Address", generic_address_dump, generic_address_receive, generic_address_transmit},
{ISUP_PARM_GENERIC_DIGITS, "Generic Digits", generic_digits_dump, generic_digits_receive, generic_digits_transmit},
{ISUP_PARM_GENERIC_NAME, "Generic Name", generic_name_dump, generic_name_receive, generic_name_transmit},
{ISUP_PARM_TRANSIT_NETWORK_SELECTION, "Transit Network Selection", tns_dump, tns_receive, tns_transmit},
- {ISUP_PARM_GENERIC_NOTIFICATION_IND, "Generic Notification Indication"},
+ {ISUP_PARM_GENERIC_NOTIFICATION_IND, "Generic Notification Indication", generic_notofication_ind_dump, generic_notofication_ind_receive, generic_notofication_ind_transmit},
{ISUP_PARM_PROPAGATION_DELAY, "Propagation Delay Counter", propagation_delay_cntr_dump},
{ISUP_PARM_HOP_COUNTER, "Hop Counter", hop_counter_dump, hop_counter_receive, hop_counter_transmit},
{ISUP_PARM_BACKWARD_CALL_IND, "Backward Call Indicator", backward_call_ind_dump, backward_call_ind_receive, backward_call_ind_transmit},
@@ -2005,7 +2429,7 @@
{ISUP_PARM_CIRCUIT_GROUP_SUPERVISION_IND, "Circuit Group Supervision Indicator", circuit_group_supervision_dump, circuit_group_supervision_receive, circuit_group_supervision_transmit},
{ISUP_PARM_RANGE_AND_STATUS, "Range and status", range_and_status_dump, range_and_status_receive, range_and_status_transmit},
{ISUP_PARM_EVENT_INFO, "Event Information", event_info_dump, event_info_receive, event_info_transmit},
- {ISUP_PARM_OPT_FORWARD_CALL_INDICATOR, "Optional forward call indicator"},
+ {ISUP_PARM_OPT_FORWARD_CALL_INDICATOR, "Optional forward call indicator", opt_forward_call_ind_dump, opt_forward_call_ind_receive, opt_forward_call_ind_transmit},
{ISUP_PARM_LOCATION_NUMBER, "Location Number"},
{ISUP_PARM_ORIG_LINE_INFO, "Originating line information", originating_line_information_dump, originating_line_information_receive, originating_line_information_transmit},
{ISUP_PARM_REDIRECTION_INFO, "Redirection Information", redirection_info_dump, redirection_info_receive, redirection_info_transmit},
@@ -2018,6 +2442,12 @@
{ISUP_PARM_FACILITY_IND, "Facility Indicator", facility_ind_dump, facility_ind_receive, facility_ind_transmit},
{ISUP_PARM_REDIRECTING_NUMBER, "Redirecting Number", redirecting_number_dump, redirecting_number_receive, redirecting_number_transmit},
{ISUP_PARM_ACCESS_DELIVERY_INFO, "Access Delivery Information", },
+ {ISUP_PARM_REDIRECT_COUNTER, "Redirect Counter", redirect_counter_dump, redirect_counter_receive, redirect_counter_transmit},
+ {ISUP_PARM_SUSRES_IND, "SUS/RES Indicator", susres_ind_dump, susres_ind_receive, susres_ind_transmit},
+ {ISUP_PARM_INR_IND, "Information Request Indicators", inr_ind_dump, inr_ind_receive, inr_ind_transmit},
+ {ISUP_PARM_INF_IND, "Information Indicators", inf_ind_dump, inf_ind_receive, inf_ind_transmit},
+ {ISUP_PARM_SUBSEQUENT_NUMBER, "Subsequent Number", subs_num_dump, subs_num_receive, subs_num_transmit},
+ {ISUP_CONNECTED_NUMBER, "Connected Number", connected_num_dump, connected_num_receive, connected_num_transmit}
};
static char * param2str(int parm)
@@ -2033,7 +2463,12 @@
static void init_isup_call(struct isup_call *c)
{
+ int x;
+ for (x = 0; x < ISUP_MAX_TIMERS; x++)
+ c->timer[x] = -1;
c->oli_ani2 = -1;
+ c->range = 0;
+ c->got_sent_msg = 0;
}
static struct isup_call * __isup_new_call(struct ss7 *ss7, int nolink)
@@ -2079,7 +2514,6 @@
snprintf(c->called_party_num, sizeof(c->called_party_num), "%s", called);
c->called_nai = called_nai;
}
-
}
void isup_set_oli(struct isup_call *c, int oli_ani2)
@@ -2089,12 +2523,70 @@
void isup_set_calling(struct isup_call *c, const char *calling, unsigned char calling_nai, unsigned char presentation_ind, unsigned char screening_ind)
{
- if (calling && calling[0]) {
- strncpy(c->calling_party_num, calling, sizeof(c->calling_party_num));
+ if ((calling && calling[0]) || presentation_ind == SS7_PRESENTATION_ADDR_NOT_AVAILABLE) {
+ if (calling)
+ strncpy(c->calling_party_num, calling, sizeof(c->calling_party_num));
c->calling_nai = calling_nai;
c->presentation_ind = presentation_ind;
c->screening_ind = 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)
+ strncpy(c->connected_num, connected, sizeof(c->connected_num));
+ c->connected_nai = connected_nai;
+ c->connected_presentation_ind = connected_presentation_ind;
+ c->connected_screening_ind = 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)
+{
+ if (redirecting_number && redirecting_number[0]) {
+ strncpy(c->redirecting_num, redirecting_number, sizeof(c->redirecting_num));
+ c->redirecting_num_nai = redirecting_num_nai;
+ c->redirecting_num_presentation_ind = redirecting_num_presentation_ind;
+ c->redirecting_num_screening_ind = redirecting_num_screening_ind;
+ }
+}
+
+void isup_set_redirectiong_info(struct isup_call *c, unsigned char redirect_info_ind, unsigned char redirect_info_orig_reas,
+ unsigned char redirect_info_counter, unsigned char redirect_info_reas)
+{
+ c->redirect_info = 1;
+ c->redirect_info_ind = redirect_info_ind;
+ c->redirect_info_orig_reas = redirect_info_orig_reas;
+ c->redirect_info_counter = redirect_info_counter;
+ c->redirect_info_reas = redirect_info_reas;
+}
+
+void isup_set_redirect_counter(struct isup_call *c, unsigned char redirect_counter)
+{
+ c->redirect_counter = redirect_counter;
+}
+
+void isup_set_orig_called_num(struct isup_call *c, const char *orig_called_num, unsigned char orig_called_nai, unsigned char orig_called_pres_ind, unsigned char orig_called_screening_ind)
+{
+ if (orig_called_num && orig_called_num[0]) {
+ strncpy(c->orig_called_num, orig_called_num, sizeof(c->orig_called_num));
+ c->orig_called_nai = orig_called_nai;
+ c->orig_called_pres_ind = orig_called_pres_ind;
+ c->orig_called_screening_ind = orig_called_screening_ind;
+ }
+}
+
+void isup_set_col_req(struct isup_call *c)
+{
+ c->col_req = 1;
+}
+
+void isup_set_cug(struct isup_call *c, unsigned char cug_indicator, const char *cug_interlock_ni, unsigned short cug_interlock_code)
+{
+ c->cug_indicator = cug_indicator;
+ strncpy(c->cug_interlock_ni, cug_interlock_ni, sizeof(c->cug_interlock_ni));
+ c->cug_interlock_code = cug_interlock_code;
}
void isup_set_charge(struct isup_call *c, const char *charge, unsigned char charge_nai, unsigned char charge_num_plan)
@@ -2194,9 +2686,12 @@
return winner;
}
-static void isup_free_call(struct ss7 *ss7, struct isup_call *c)
+void isup_free_call(struct ss7 *ss7, struct isup_call *c)
{
struct isup_call *cur, *prev = NULL, *winner = NULL;
+
+ if (!ss7 || !c)
+ return;
cur = ss7->calls;
while (cur) {
@@ -2213,9 +2708,12 @@
ss7->calls = winner->next;
else
prev->next = winner->next;
- }
-
- free(c);
+
+ isup_stop_all_timers(ss7, c);
+ free(c);
+ } else
+ ss7_error(ss7, "Requested free an unlinked call!!!\n");
+
return;
}
@@ -2461,7 +2959,7 @@
ss7_msg_userpart_len(msg, offset + rlsize + CIC_SIZE + 1); /* Message type length is 1 */
- return mtp3_transmit(ss7, SIG_ISUP, rl.sls, msg);
+ return mtp3_transmit(ss7, SIG_ISUP, rl, msg);
}
int isup_dump(struct ss7 *ss7, struct mtp2 *link, unsigned char *buf, int len)
@@ -2473,10 +2971,12 @@
int offset = 0;
int fixedparams = 0, varparams = 0, optparams = 0;
int res, x;
- unsigned char *opt_ptr = NULL;
+ unsigned char *param_pointer = NULL;
mh = (struct isup_h*) buf;
+ len -= 3; /* ISUP msg header size !*/
+
if (ss7->switchtype == SS7_ITU) {
cic = mh->cic[0] | ((mh->cic[1] & 0x0f) << 8);
} else {
@@ -2531,33 +3031,44 @@
offset += res;
}
+ if (len < 1)
+ return 0;
+
+ if (varparams || optparams) {
+ param_pointer = &mh->data[offset];
+ } else
+ return 0;
+
+ x = 0;
if (varparams) {
- offset += varparams; /* add one for the optionals */
- len -= varparams;
- }
+ ss7_message(ss7, "\t\t--VARIABLE LENGTH PARMS[%d]--\n", varparams);
+
+ for (; x < varparams && len > 0; x++) {
+ if (!param_pointer[0])
+ return 0;
+ res = dump_parm(ss7, mh->type, parms[fixedparams + x],
+ (void *)(param_pointer + param_pointer[0]), len, PARM_TYPE_VARIABLE);
+
+ if (res < 0) {
+ ss7_error(ss7, "!! Unable to parse mandatory variable parameter '%s'\n", param2str(parms[fixedparams + x]));
+ return -1;
+ }
+ len -= (res + 1); /* 1byte for pointer */
+ param_pointer++;
+ offset++;
+ }
+ }
+
+ if (len < 1 || !param_pointer[0])
+ return 0;
+
+ /* Optional paramter parsing code */
if (optparams) {
- opt_ptr = &mh->data[offset++];
- len++;
- }
-
- if (varparams)
- ss7_message(ss7, "\t\t--VARIABLE LENGTH PARMS[%d]--\n", varparams);
- for (; (x - fixedparams) < varparams; x++) {
- res = dump_parm(ss7, mh->type, parms[x], (void *)(mh->data + offset), len, PARM_TYPE_VARIABLE);
-
- if (res < 0) {
- ss7_error(ss7, "!! Unable to parse mandatory variable parameter '%s'\n", param2str(parms[x]));
- return -1;
- }
-
- len -= res;
- offset += res;
- }
-
- /* Optional paramter parsing code */
- if (optparams && *opt_ptr) {
- if (len > 0)
- ss7_message(ss7, "\t\t--OPTIONAL PARMS--\n");
+
+ ss7_message(ss7, "\t\t--OPTIONAL PARMS--\n");
+ offset += param_pointer[0];
+ len-- ; /* optional parameter pointer */
+
while ((len > 0) && (mh->data[offset] != 0)) {
struct isup_parm_opt *optparm = (struct isup_parm_opt *)(mh->data + offset);
@@ -2577,6 +3088,33 @@
}
return 0;
+}
+
+/* Checking we whether got more 1 bits back in the status */
+static int isup_check_status(unsigned char *sent_status, unsigned char *got_status, int range)
+{
+ int i;
+ for (i = 0; i <= range; i++)
+ if (got_status[i] > sent_status[i])
+ return 1;
+
+ return 0;
+}
+
+static int isup_handle_unexpected (struct ss7 *ss7, struct isup_call *c, unsigned int opc) {
+ int res;
+
+ if (c->got_sent_msg & (ISUP_CALL_CONNECTED)) {
+ ss7_message(ss7, "ignoring... \n");
+ } else {
+ ss7_message(ss7, "reseting the cic\n");
+ res = ss7_hangup(ss7, c->cic, opc, 16, SS7_HANGUP_SEND_RSC);
+ if (res == SS7_CIC_IDLE)
+ isup_rsc(ss7, c);
+ else if (res == SS7_CIC_NOT_EXISTS)
+ isup_free_call(ss7, c);
+ }
+ return 0;
}
int isup_receive(struct ss7 *ss7, struct mtp2 *link, struct routing_label *rl, unsigned char *buf, int len)
@@ -2590,12 +3128,14 @@
int ourmessage = -1;
int fixedparams = 0, varparams = 0, optparams = 0;
int res, x;
- unsigned char *opt_ptr = NULL;
+ unsigned char *param_pointer = NULL;
unsigned int opc = rl->opc;
ss7_event *e;
mh = (struct isup_h*) buf;
+ len -= 3; /* ISUP msg header size !*/
+
if (ss7->switchtype == SS7_ITU) {
cic = mh->cic[0] | ((mh->cic[1] & 0x0f) << 8);
} else {
@@ -2630,30 +3170,7 @@
}
}
- /* Make sure we don't hijack a call associated isup_call for non call
- * associated messages */
- switch (mh->type) {
- /* All of these messages are ones where a persistent call is associated with them and
- should not generate a new, unlinked call, or free a call (unless explicitly done, link in RLC) */
- case ISUP_IAM:
- case ISUP_ANM:
- case ISUP_ACM:
- case ISUP_CPG:
- case ISUP_COT:
- case ISUP_CON:
- case ISUP_REL:
- case ISUP_RLC:
- case ISUP_RSC:
- case ISUP_FAA:
- case ISUP_FAR:
- c = isup_find_call(ss7, rl, cic);
- break;
- default:
- c = __isup_new_call(ss7, 1);
- c->dpc = rl->opc;
- c->cic = cic;
- break;
- }
+ c = isup_find_call(ss7, rl, cic);
if (!c) {
ss7_error(ss7, "Huh? No call!!!???\n");
@@ -2673,29 +3190,30 @@
offset += res;
}
- if (varparams) {
- offset += varparams; /* add one for the optionals */
- res -= varparams;
- }
- if (optparams) {
- /* ANSI doesn't have optional parameters on RLC */
- opt_ptr = &mh->data[offset++];
- }
-
- for (; (x - fixedparams) < varparams; x++) {
- res = do_parm(ss7, c, mh->type, parms[x], (void *)(mh->data + offset), len, PARM_TYPE_VARIABLE, 0);
-
- if (res < 0) {
- ss7_error(ss7, "!! Unable to parse mandatory variable parameter '%s'\n", param2str(parms[x]));
- return -1;
+ if (varparams || optparams)
+ param_pointer = &mh->data[offset];
+
+ if (varparams && len > 0) {
+ for (x = 0; x < varparams && len && param_pointer[0]; x++) {
+ res = do_parm(ss7, c, mh->type, parms[fixedparams + x],
+ (void *)(param_pointer + param_pointer[0]), len, PARM_TYPE_VARIABLE, 0);
+
+ if (res < 0) {
+ ss7_error(ss7, "!! Unable to parse mandatory variable parameter '%s'\n", param2str(parms[fixedparams + x]));
+ return -1;
+ }
+
+ len -= (res + 1); /* 1byte for pointer */
+ param_pointer++;
+ offset++;
}
-
- len -= res;
- offset += res;
}
/* Optional paramter parsing code */
- if (optparams && *opt_ptr) {
+ if (optparams && len > 0 && param_pointer[0]) {
+ offset += param_pointer[0];
+ len-- ; /* optional parameter pointer */
+
while ((len > 0) && (mh->data[offset] != 0)) {
struct isup_parm_opt *optparm = (struct isup_parm_opt *)(mh->data + offset);
@@ -2714,58 +3232,71 @@
switch (mh->type) {
case ISUP_IAM:
+ return isup_event_iam(ss7, c, opc);
+ case ISUP_SAM:
+ if (c->got_sent_msg != ISUP_GOT_IAM) {
+ ss7_message(ss7, "Got unexpected SAM on CIC %d PC %d ", c->cic, opc);
+ return isup_handle_unexpected(ss7, c, opc);
+ }
+
e = ss7_next_empty_event(ss7);
if (!e) {
+ ss7_call_null(ss7, c, 1);
isup_free_call(ss7, c);
return -1;
}
- e->e = ISUP_EVENT_IAM;
- e->iam.cic = c->cic;
- e->iam.transcap = c->transcap;
- e->iam.cot_check_required = c->cot_check_required;
- strncpy(e->iam.called_party_num, c->called_party_num, sizeof(e->iam.called_party_num));
- e->iam.called_nai = c->called_nai;
- strncpy(e->iam.calling_party_num, c->calling_party_num, sizeof(e->iam.calling_party_num));
- e->iam.calling_nai = c->calling_nai;
- e->iam.presentation_ind = c->presentation_ind;
- e->iam.screening_ind = c->screening_ind;
- strncpy(e->iam.charge_number, c->charge_number, sizeof(e->iam.charge_number));
- e->iam.charge_nai = c->charge_nai;
- e->iam.charge_num_plan = c->charge_num_plan;
- e->iam.oli_ani2 = c->oli_ani2;
- e->iam.gen_add_nai = c->gen_add_nai;
- e->iam.gen_add_num_plan = c->gen_add_num_plan;
- strncpy(e->iam.gen_add_number, c->gen_add_number, sizeof(e->iam.gen_add_number));
- e->iam.gen_add_pres_ind = c->gen_add_pres_ind;
- e->iam.gen_add_type = c->gen_add_type;
- strncpy(e->iam.gen_dig_number, c->gen_dig_number, sizeof(e->iam.gen_dig_number));
- e->iam.gen_dig_type = c->gen_dig_type;
- e->iam.gen_dig_scheme = c->gen_dig_scheme;
- strncpy(e->iam.jip_number, c->jip_number, sizeof(e->iam.jip_number));
- strncpy(e->iam.generic_name, c->generic_name, sizeof(e->iam.generic_name));
- e->iam.generic_name_typeofname = c->generic_name_typeofname;
- e->iam.generic_name_avail = c->generic_name_avail;
- e->iam.generic_name_presentation = c->generic_name_presentation;
- e->iam.lspi_type = c->lspi_type;
- e->iam.lspi_scheme = c->lspi_scheme;
- e->iam.lspi_context = c->lspi_context;
- strncpy(e->iam.lspi_ident, c->lspi_ident, sizeof(e->iam.lspi_ident));
- strncpy(e->iam.orig_called_num, c->orig_called_num, sizeof(e->iam.orig_called_num));
- e->iam.orig_called_nai = c->orig_called_nai;
- e->iam.orig_called_pres_ind = c->orig_called_pres_ind;
- e->iam.orig_called_screening_ind = c->orig_called_screening_ind;
- strncpy(e->iam.redirecting_num, c->redirecting_num, sizeof(e->iam.redirecting_num));
- e->iam.redirecting_num_nai = c->redirecting_num_nai;
- e->iam.redirecting_num_presentation_ind = c->redirecting_num_presentation_ind;
- e->iam.redirecting_num_screening_ind = c->redirecting_num_screening_ind;
- e->iam.calling_party_cat = c->calling_party_cat;
- e->iam.call = c;
- e->iam.opc = opc; /* keep OPC information */
+ e->e = ISUP_EVENT_SAM;
+ e->sam.cic = c->cic;
+ e->sam.call = c;
+ e->sam.opc = opc; /* keep OPC information */
+ strncpy(e->sam.called_party_num, c->called_party_num, sizeof(e->sam.called_party_num));
+ e->sam.called_nai = c->called_nai;
+ e->sam.got_sent_msg = c->got_sent_msg;
+ e->sam.cot_check_passed = c->cot_check_passed;
+ isup_start_timer(ss7, c, ISUP_TIMER_T35);
+ return 0;
+ case ISUP_INF:
+ if (!(c->got_sent_msg & ISUP_SENT_INR) && !(c->inf_ind[0] & 0x80)) {
+ ss7_message(ss7, "Got solicated INF but we didn't send INR on CIC %d PC %d ", c->cic, opc);
+ return isup_handle_unexpected(ss7, c, opc);
+ }
+ if ((ss7->flags & SS7_INR_IF_NO_CALLING) &&
+ !c->calling_party_num[0] &&
+ c->presentation_ind != SS7_PRESENTATION_ADDR_NOT_AVAILABLE) {
+ isup_rel(ss7, c, 16);
+ return 0;
+ }
+
+ if (c->inf_ind[0] & 0x80) {
+ /* unsolicated */
+ if (!isup_free_call_if_clear(ss7, c))
+ ss7_call_null(ss7, c, 1);
+ return 0;
+ } else {
+ isup_stop_timer(ss7, c, ISUP_TIMER_T33);
+ c->got_sent_msg &= ~ISUP_SENT_INR;
+ return isup_event_iam(ss7, c, opc);
+ }
+ case ISUP_INR:
+ if (!(c->got_sent_msg & ISUP_SENT_IAM)) {
+ ss7_message(ss7, "Got INF but no outgoing call on CIC %d PC %d ", c->cic, opc);
+ return isup_handle_unexpected(ss7, c, opc);
+ }
+
+ int inf_parm0 = 0x20; /* Calling party category included, solicated */
+ if (!c->calling_party_num[0])
+ inf_parm0 |= 0x1; /* Calling party address not available */
+ else
+ inf_parm0 |= 0x3; /* Calling party address included */
+ isup_inf(ss7, c, inf_parm0, 0);
+ if (!isup_free_call_if_clear(ss7, c))
+ ss7_call_null(ss7, c, 1);
return 0;
case ISUP_CQM:
e = ss7_next_empty_event(ss7);
if (!e) {
+ ss7_call_null(ss7, c, 1);
isup_free_call(ss7, c);
return -1;
}
@@ -2774,11 +3305,12 @@
e->cqm.startcic = cic;
e->cqm.endcic = cic + c->range;
e->cqm.opc = opc; /* keep OPC information */
- isup_free_call(ss7, c); /* Won't need this again */
+ e->cqm.call = c;
return 0;
case ISUP_GRS:
e = ss7_next_empty_event(ss7);
if (!e) {
+ ss7_call_null(ss7, c, 1);
isup_free_call(ss7, c);
return -1;
}
@@ -2786,12 +3318,23 @@
e->e = ISUP_EVENT_GRS;
e->grs.startcic = cic;
e->grs.endcic = cic + c->range;
- isup_free_call(ss7, c); /* Won't need this again */
+ e->grs.call = c;
e->grs.opc = opc; /* keep OPC information */
return 0;
case ISUP_GRA:
+ if (!(c->got_sent_msg & ISUP_SENT_GRS)) {
+ ss7_message(ss7, "Got GRA but we didn't send GRS on CIC %d PC %d ", c->cic, opc);
+ return isup_handle_unexpected(ss7, c, opc);
+ }
+ /* checking the answer */
+ if (c->range != c->sent_grs_endcic - c->cic) {
+ ss7_message(ss7, "Got GRA doesn't match with the sent GRS on CIC %d DPC %d\n", c->cic, opc);
+ return 0;
+ }
+
e = ss7_next_empty_event(ss7);
if (!e) {
+ ss7_call_null(ss7, c, 1);
isup_free_call(ss7, c);
return -1;
}
@@ -2802,41 +3345,63 @@
for (i = 0; i < (c->range + 1); i++)
e->gra.status[i] = c->status[i];
e->gra.opc = opc; /* keep OPC information */
-
- isup_free_call(ss7, c); /* Won't need this again */
+ e->gra.call = c;
+ e->gra.sent_endcic = c->sent_grs_endcic;
+ e->gra.got_sent_msg = c->got_sent_msg;
+ c->got_sent_msg &= ~ISUP_SENT_GRS;
+ isup_stop_timer(ss7, c, ISUP_TIMER_T22);
+ isup_stop_timer(ss7, c, ISUP_TIMER_T23);
return 0;
case ISUP_RSC:
e = ss7_next_empty_event(ss7);
if (!e) {
+ ss7_call_null(ss7, c, 1);
isup_free_call(ss7, c);
return -1;
}
-
+ isup_stop_all_timers(ss7, c);
e->e = ISUP_EVENT_RSC;
e->rsc.cic = cic;
e->rsc.call = c;
e->rsc.opc = opc; /* keep OPC information */
+ e->rsc.got_sent_msg = c->got_sent_msg;
+ c->got_sent_msg = 0;
return 0;
case ISUP_REL:
e = ss7_next_empty_event(ss7);
if (!e) {
+ ss7_call_null(ss7, c, 1);
isup_free_call(ss7, c);
return -1;
}
+ isup_stop_timer(ss7, c, ISUP_TIMER_T7);
+ isup_stop_timer(ss7, c, ISUP_TIMER_T2);
+ isup_stop_timer(ss7, c, ISUP_TIMER_T6);
+ isup_stop_timer(ss7, c, ISUP_TIMER_T35);
+ c->got_sent_msg &= ~(ISUP_CALL_CONNECTED | ISUP_SENT_IAM | ISUP_GOT_IAM | ISUP_GOT_CCR | ISUP_SENT_INR);
e->e = ISUP_EVENT_REL;
e->rel.cic = c->cic;
e->rel.call = c;
e->rel.cause = c->cause;
e->rel.opc = opc; /* keep OPC information */
+ e->rel.got_sent_msg = c->got_sent_msg;
return 0;
case ISUP_ACM:
+ if (!(c->got_sent_msg & ISUP_SENT_IAM)) {
+ ss7_message(ss7, "Got ACM but we didn't send IAM on CIC %d PC %d ", c->cic, opc);
+ return isup_handle_unexpected(ss7, c, opc);
+ }
+
e = ss7_next_empty_event(ss7);
if (!e) {
+ ss7_call_null(ss7, c, 1);
isup_free_call(ss7, c);
return -1;
}
+ isup_stop_timer(ss7, c, ISUP_TIMER_T7);
+ c->got_sent_msg |= ISUP_GOT_ACM;
e->e = ISUP_EVENT_ACM;
e->acm.cic = c->cic;
e->acm.call_ref_ident = c->call_ref_ident;
@@ -2844,34 +3409,66 @@
e->acm.call = c;
e->acm.opc = opc; /* keep OPC information */
e->acm.called_party_status_ind = c->called_party_status_ind;
+ e->acm.got_sent_msg = c->got_sent_msg;
return 0;
case ISUP_CON:
+ if (!(c->got_sent_msg & ISUP_SENT_IAM)) {
[... 5024 lines stripped ...]
More information about the libss7-commits
mailing list