[svn-commits] mattf: branch mattf/libss7-ss7cluster r276 - /team/mattf/libss7-ss7cluster/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Jan 21 12:00:42 CST 2010
Author: mattf
Date: Thu Jan 21 12:00:38 2010
New Revision: 276
URL: http://svnview.digium.com/svn/libss7?view=rev&rev=276
Log:
Commit of new libss7 user interface as well as cluster code
Modified:
team/mattf/libss7-ss7cluster/Makefile
team/mattf/libss7-ss7cluster/isup.c
team/mattf/libss7-ss7cluster/isup.h
team/mattf/libss7-ss7cluster/isup_masq.c
team/mattf/libss7-ss7cluster/libss7.h
team/mattf/libss7-ss7cluster/mtp2.c
team/mattf/libss7-ss7cluster/mtp2.h
team/mattf/libss7-ss7cluster/mtp3.c
team/mattf/libss7-ss7cluster/mtp3.h
team/mattf/libss7-ss7cluster/ss7.c
team/mattf/libss7-ss7cluster/ss7_internal.h
Modified: team/mattf/libss7-ss7cluster/Makefile
URL: http://svnview.digium.com/svn/libss7/team/mattf/libss7-ss7cluster/Makefile?view=diff&rev=276&r1=275&r2=276
==============================================================================
--- team/mattf/libss7-ss7cluster/Makefile (original)
+++ team/mattf/libss7-ss7cluster/Makefile Thu Jan 21 12:00:38 2010
@@ -11,7 +11,7 @@
DYNAMIC_OBJS=mtp2.o ss7_sched.o ss7.o mtp3.o isup.o version.o isup_masq.o
STATIC_LIBRARY=libss7.a
DYNAMIC_LIBRARY=libss7.so.1.0
-CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC
+CFLAGS=-Wall -Wstrict-prototypes -Wmissing-prototypes -g -fPIC
LDCONFIG_FLAGS=-n
SOFLAGS=-Wl,-hlibss7.so.1
LDCONFIG=/sbin/ldconfig
@@ -19,7 +19,7 @@
#UTILITIES=parser_debug
ifneq ($(wildcard /usr/include/dahdi/user.h),)
-UTILITIES+=ss7test ss7linktest
+UTILITIES+=ss7d
endif
export SS7VERSION
@@ -67,11 +67,17 @@
ss7test: ss7test.c $(STATIC_LIBRARY)
gcc -g -o ss7test ss7test.c libss7.a -lpthread
+ss7d: ss7d.c $(STATIC_LIBRARY)
+ gcc -g -o ss7d ss7d.c libss7.a -lpthread
+
+ss7d-client: ss7d-client.c $(STATIC_LIBRARY)
+ gcc -g -o ss7d-client ss7d-client.c libss7.a -lpthread
+
ss7linktest: ss7linktest.c $(STATIC_LIBRARY)
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
+ gcc -g -o parser_debug parser_debug.c libss7.a
libss7: ss7_mtp.o mtp.o ss7.o ss7_sched.o
Modified: team/mattf/libss7-ss7cluster/isup.c
URL: http://svnview.digium.com/svn/libss7/team/mattf/libss7-ss7cluster/isup.c?view=diff&rev=276&r1=275&r2=276
==============================================================================
--- team/mattf/libss7-ss7cluster/isup.c (original)
+++ team/mattf/libss7-ss7cluster/isup.c Thu Jan 21 12:00:38 2010
@@ -31,12 +31,10 @@
#include <string.h>
#include <stdlib.h>
-#include <time.h>
#include "libss7.h"
#include "isup.h"
#include "ss7_internal.h"
#include "mtp3.h"
-#include "mtp2.h"
#define FUNC_DUMP(name) int ((name))(struct ss7 *ss7, int messagetype, unsigned char *parm, int len)
/* Length here is paramter length */
@@ -60,22 +58,13 @@
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, 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_TRANSMISSION_MEDIUM_REQS, ISUP_PARM_CALLED_PARTY_NUM, ISUP_PARM_CALLING_PARTY_NUM, -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, 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};
+ ISUP_PARM_LOCAL_SERVICE_PROVIDER_IDENTIFICATION, -1};
static int acm_params[] = {ISUP_PARM_BACKWARD_CALL_IND, -1};
@@ -84,9 +73,9 @@
static int far_params[] = {ISUP_PARM_FACILITY_IND, ISUP_PARM_CALL_REF, -1};
-static int anm_params[] = { ISUP_CONNECTED_NUMBER, -1};
-
-static int con_params[] = { ISUP_PARM_BACKWARD_CALL_IND, ISUP_CONNECTED_NUMBER, -1};
+static int anm_params[] = { -1};
+
+static int con_params[] = { ISUP_PARM_BACKWARD_CALL_IND, -1};
static int rel_params[] = { ISUP_PARM_CAUSE, -1};
@@ -99,14 +88,6 @@
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};
@@ -115,51 +96,40 @@
int mand_fixed_params;
int mand_var_params;
int opt_params;
- int ansi_priority;
int *param_list;
} messages[] = {
- {ISUP_IAM, 4, 1, 1, 0, iam_params},
- {ISUP_ACM, 1, 0, 1, 1, acm_params},
- {ISUP_ANM, 0, 0, 1, 2, anm_params},
- {ISUP_CON, 1, 0, 1, -1, con_params},
- {ISUP_REL, 0, 1, 1, 1, rel_params},
- {ISUP_RLC, 0, 0, 1, 2, empty_params},
- {ISUP_GRS, 0, 1, 0, 0, greset_params},
- {ISUP_GRA, 0, 1, 0, 0, greset_params},
- {ISUP_CGB, 1, 1, 0, 0, cicgroup_params},
- {ISUP_CGU, 1, 1, 0, 0, cicgroup_params},
- {ISUP_CGBA, 1, 1, 0, 0, cicgroup_params},
- {ISUP_CGUA, 1, 1, 0, 0, cicgroup_params},
- {ISUP_COT, 1, 0, 0, 1, cot_params},
- {ISUP_CCR, 0, 0, 0, 1, empty_params},
- {ISUP_BLO, 0, 0, 0, 0, empty_params},
- {ISUP_LPA, 0, 0, 0, 1, empty_params},
- {ISUP_UBL, 0, 0, 0, 0, empty_params},
- {ISUP_BLA, 0, 0, 0, 0, empty_params},
- {ISUP_UBA, 0, 0, 0, 0, empty_params},
- {ISUP_RSC, 0, 0, 0, 0, empty_params},
- {ISUP_CVR, 0, 0, 0, 0, empty_params},
- {ISUP_CVT, 0, 0, 0, 0, empty_params},
- {ISUP_CPG, 1, 0, 1, 1, cpg_params},
- {ISUP_UCIC, 0, 0, 0, 1, empty_params},
- {ISUP_CQM, 0, 1, 0, 0, greset_params},
- {ISUP_CQR, 0, 2, 0, 0, cqr_params},
- {ISUP_FAA, 1, 0, 1, -1, faa_params},
- {ISUP_FAR, 1, 0, 1, -1, far_params},
- {ISUP_CFN, 0, 1, 0, 0, rel_params},
- {ISUP_SUS, 1, 0, 1, 1, susres_params},
- {ISUP_RES, 1, 0, 1, 1, susres_params},
- {ISUP_INR, 1, 0, 0, 1, inr_params},
- {ISUP_INF, 1, 0, 2, 1, inf_params},
- {ISUP_SAM, 0, 1, 0, -1, sam_params}
+ {ISUP_IAM, 4, 1, 1, iam_params},
+ {ISUP_ACM, 1, 0, 1, acm_params},
+ {ISUP_ANM, 0, 0, 1, anm_params},
+ {ISUP_CON, 1, 0, 1, con_params},
+ {ISUP_REL, 0, 1, 1, rel_params},
+ {ISUP_RLC, 0, 0, 1, empty_params},
+ {ISUP_GRS, 0, 1, 0, greset_params},
+ {ISUP_GRA, 0, 1, 0, greset_params},
+ {ISUP_CGB, 1, 1, 0, cicgroup_params},
+ {ISUP_CGU, 1, 1, 0, cicgroup_params},
+ {ISUP_CGBA, 1, 1, 0, cicgroup_params},
+ {ISUP_CGUA, 1, 1, 0, cicgroup_params},
+ {ISUP_COT, 1, 0, 0, cot_params},
+ {ISUP_CCR, 0, 0, 0, empty_params},
+ {ISUP_BLO, 0, 0, 0, empty_params},
+ {ISUP_LPA, 0, 0, 0, empty_params},
+ {ISUP_UBL, 0, 0, 0, empty_params},
+ {ISUP_BLA, 0, 0, 0, empty_params},
+ {ISUP_UBA, 0, 0, 0, empty_params},
+ {ISUP_RSC, 0, 0, 0, empty_params},
+ {ISUP_CVR, 0, 0, 0, empty_params},
+ {ISUP_CVT, 0, 0, 0, empty_params},
+ {ISUP_CPG, 1, 0, 1, cpg_params},
+ {ISUP_UCIC, 0, 0, 0, empty_params},
+ {ISUP_CQM, 0, 1, 0, greset_params},
+ {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}
};
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)
{
@@ -170,8 +140,6 @@
return "ACM";
case ISUP_ANM:
return "ANM";
- case ISUP_CON:
- return "CON";
case ISUP_REL:
return "REL";
case ISUP_RLC:
@@ -220,16 +188,6 @@
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";
}
@@ -365,9 +323,6 @@
if (c->cot_check_required)
parm[0] |= 0x04;
- if (c->local_echocontrol_ind)
- parm[0] |= 0x10;
-
return 1; /* Length plus size of type header */
}
@@ -380,16 +335,6 @@
else
c->cot_check_required = 0;
- if (cci == 0x2)
- c->cot_performed_on_previous_cic = 1;
- else
- c->cot_performed_on_previous_cic = 0;
-
- if (parm[0] & 0x10)
- c->echocontrol_ind = 1;
- else
- c->echocontrol_ind = 0;
-
return 1;
}
@@ -427,11 +372,7 @@
static FUNC_SEND(forward_call_ind_transmit)
{
parm[0] = 0x60;
- parm[1] = 0x0;
-
- if (ss7->flags & SS7_ISDN_ACCESS_INDICATOR)
- parm [1] |= 0x01;
-
+ parm[1] = 0x01;
return 2;
}
@@ -507,7 +448,7 @@
static FUNC_SEND(calling_party_cat_transmit)
{
- parm[0] = c->calling_party_cat;
+ parm[0] = 0x0a; /* Default to Ordinary calling subscriber */
return 1;
}
@@ -681,21 +622,13 @@
static FUNC_RECV(backward_call_ind_receive)
{
c->called_party_status_ind = (parm[0] >> 2) & 0x3;
- c->echocontrol_ind = (parm[1] >> 5) & 0x1;
return 2;
}
static FUNC_SEND(backward_call_ind_transmit)
{
parm[0] = 0x40;
- parm[1] = 0x04;
-
- if (c->local_echocontrol_ind)
- parm[1] |= 0x20;
-
- if (ss7->flags | SS7_ISDN_ACCESS_INDICATOR)
- parm[1] |= 0x10;
-
+ parm[1] = 0x14;
return 2;
}
@@ -748,50 +681,6 @@
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;
@@ -957,9 +846,15 @@
statuslen = (numcics / 8) + !!(numcics % 8);
- for (i = 0; i < numcics; i++) {
- if (c->status[i])
- parm[1 + (i/8)] |= (1 << (i % 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));
+ }
}
return statuslen + 1;
@@ -1001,74 +896,16 @@
{
int oddeven, datalen;
- if (!c->calling_party_num[0] && c->presentation_ind != SS7_PRESENTATION_ADDR_NOT_AVAILABLE)
+ if (!c->calling_party_num[0])
return 0;
- 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;
- }
+ isup_put_number(&parm[2], c->calling_party_num, &datalen, &oddeven);
parm[0] = (oddeven << 7) | c->calling_nai; /* Nature of Address Indicator */
- /* Assume E.164 ISDN numbering plan, calling number complete */
- parm[1] = ((c->presentation_ind == SS7_PRESENTATION_ADDR_NOT_AVAILABLE) ? 0 : (1 << 4)) |
+ parm[1] = (1 << 4) | /* Assume E.164 ISDN numbering plan, calling number complete */
((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;
}
@@ -1557,7 +1394,7 @@
switch ((parm[1] >> 4) & 0xf) {
case 0:
- redir_reas = "Unknown/not available";
+ orig_redir_reas = "Unknown/not available";
break;
case 1:
redir_reas = "User busy";
@@ -1589,21 +1426,11 @@
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;
}
@@ -1780,19 +1607,7 @@
static FUNC_SEND(original_called_num_transmit)
{
- 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;
+ return len;
}
static FUNC_DUMP(echo_control_info_dump)
@@ -2002,99 +1817,6 @@
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;
-}
-
static FUNC_SEND(lspi_transmit)
{
/* On Nortel this needs to be set to ARM the RLT functionality. */
@@ -2233,110 +1955,8 @@
static FUNC_SEND(redirecting_number_transmit)
{
- 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;
+ return 0;
}
-
-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)
{
@@ -2352,79 +1972,6 @@
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 },
@@ -2444,13 +1991,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", cug_interlock_code_dump, cug_interlock_code_receive, cug_interlock_code_transmit},
+ {ISUP_PARM_CUG_INTERLOCK_CODE, "Interlock Code"},
{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", generic_notofication_ind_dump, generic_notofication_ind_receive, generic_notofication_ind_transmit},
+ {ISUP_PARM_GENERIC_NOTIFICATION_IND, "Generic Notification Indication"},
{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},
@@ -2458,7 +2005,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", opt_forward_call_ind_dump, opt_forward_call_ind_receive, opt_forward_call_ind_transmit},
+ {ISUP_PARM_OPT_FORWARD_CALL_INDICATOR, "Optional forward call indicator"},
{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},
@@ -2471,12 +2018,6 @@
{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)
@@ -2492,13 +2033,7 @@
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;
- c->calling_party_cat = 0x0a; /* Default to Ordinary calling subscriber */
}
static struct isup_call * __isup_new_call(struct ss7 *ss7, int nolink)
@@ -2544,6 +2079,7 @@
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)
@@ -2553,75 +2089,12 @@
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]) || presentation_ind == SS7_PRESENTATION_ADDR_NOT_AVAILABLE) {
- if (calling)
- strncpy(c->calling_party_num, calling, sizeof(c->calling_party_num));
+ if (calling && calling[0]) {
+ 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_echocontrol(struct isup_call *c, unsigned char ec)
-{
- c->local_echocontrol_ind = ec;
}
void isup_set_charge(struct isup_call *c, const char *charge, unsigned char charge_nai, unsigned char charge_num_plan)
@@ -2688,11 +2161,6 @@
c->call_ref_pc = call_ref_pc;
}
-void isup_set_calling_party_category(struct isup_call *c, unsigned int category)
-{
- c->calling_party_cat = category;
-}
-
void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, unsigned int dpc)
{
c->cic = cic;
@@ -2729,9 +2197,6 @@
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) {
@@ -2748,12 +2213,9 @@
ss7->calls = winner->next;
else
prev->next = winner->next;
-
- isup_stop_all_timers(ss7, c);
- free(c);
- } else
- ss7_error(ss7, "Requested free an unlinked call!!!\n");
-
+ }
+
+ free(c);
return;
}
@@ -2876,7 +2338,6 @@
int offset = 0;
int x = 0;
int i = 0;
- int priority = -1;
/* Do init stuff */
msg = ss7_msg_new();
@@ -2889,7 +2350,7 @@
rlptr = ss7_msg_userpart(msg);
- rl.opc = ss7->pc;
+ rl.opc = ss7->isup_pc;
/* use CIC's DPC instead of linkset's DPC */
rl.dpc = c->dpc;
rl.sls = c->sls;
@@ -2920,7 +2381,6 @@
fixedparams = messages[ourmessage].mand_fixed_params;
varparams = messages[ourmessage].mand_var_params;
optparams = messages[ourmessage].opt_params;
- priority = messages[ourmessage].ansi_priority;
/* Again, the ANSI exception */
if (ss7->switchtype == SS7_ANSI) {
@@ -2929,10 +2389,6 @@
varparams = 2;
} else if (messages[ourmessage].messagetype == ISUP_RLC) {
optparams = 0;
- } else if (messages[ourmessage].messagetype == ISUP_GRS) {
- optparams = 1;
- } else if (messages[ourmessage].messagetype == ISUP_GRA) {
- optparams = 1;
}
}
@@ -3005,7 +2461,7 @@
ss7_msg_userpart_len(msg, offset + rlsize + CIC_SIZE + 1); /* Message type length is 1 */
- return mtp3_transmit(ss7, SIG_ISUP, rl, priority, msg);
+ return mtp3_transmit(ss7, ss7->isup_ni, SIG_ISUP, rl, 0, msg);
}
int isup_dump(struct ss7 *ss7, struct mtp2 *link, unsigned char *buf, int len)
@@ -3017,18 +2473,16 @@
int offset = 0;
int fixedparams = 0, varparams = 0, optparams = 0;
int res, x;
- unsigned char *param_pointer = NULL;
+ unsigned char *opt_ptr = 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 {
cic = mh->cic[0] | ((mh->cic[1] & 0x3f) << 8);
}
-
+
ss7_message(ss7, "\t\tCIC: %d\n", cic);
ss7_dump_buf(ss7, 2, buf, 2);
ss7_message(ss7, "\t\tMessage Type: %s\n", message2str(mh->type), mh->type & 0xff);
@@ -3077,44 +2531,33 @@
offset += res;
}
- if (len < 1)
- return 0;
-
- if (varparams || optparams) {
- param_pointer = &mh->data[offset];
- } else
- return 0;
-
- x = 0;
if (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++;
+ offset += varparams; /* add one for the optionals */
+ len -= varparams;
+ }
+ 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;
}
- }
-
- if (len < 1 || !param_pointer[0])
- return 0;
+
+ len -= res;
+ offset += res;
+ }
/* Optional paramter parsing code */
- if (optparams) {
-
- ss7_message(ss7, "\t\t--OPTIONAL PARMS--\n");
- offset += param_pointer[0];
- len-- ; /* optional parameter pointer */
-
+ if (optparams && *opt_ptr) {
+ if (len > 0)
+ ss7_message(ss7, "\t\t--OPTIONAL PARMS--\n");
while ((len > 0) && (mh->data[offset] != 0)) {
struct isup_parm_opt *optparm = (struct isup_parm_opt *)(mh->data + offset);
@@ -3136,37 +2579,9 @@
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;
-}
-
-int isup_needs_masquerade(struct ss7 *ss7, struct routing_label *rl, unsigned int cic, unsigned char *buf, int len);
-
-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)
+int isup_needs_masquerade(struct ss7 *ss7, unsigned char ni, struct routing_label *rl, unsigned int cic, unsigned char *buf, int len);
+
+int isup_receive(struct ss7 *ss7, struct mtp2 *link, unsigned char ni, struct routing_label *rl, unsigned char *buf, int len)
{
unsigned short cic;
struct isup_h *mh;
@@ -3177,7 +2592,7 @@
int ourmessage = -1;
int fixedparams = 0, varparams = 0, optparams = 0;
int res, x;
- unsigned char *param_pointer = NULL;
+ unsigned char *opt_ptr = NULL;
unsigned int opc = rl->opc;
ss7_event *e;
@@ -3189,11 +2604,9 @@
cic = mh->cic[0] | ((mh->cic[1] & 0x3f) << 8);
}
- if (isup_needs_masquerade(ss7, rl, cic, buf, len))
+ if (isup_needs_masquerade(ss7, ni, rl, cic, buf, len))
return 0;
- len -= 3; /* ISUP msg header size !*/
-
/* Find us in the message list */
for (x = 0; x < sizeof(messages)/sizeof(struct message_data); x++)
if (messages[x].messagetype == mh->type)
@@ -3219,14 +2632,33 @@
parms = ansi_iam_params;
} else if (messages[ourmessage].messagetype == ISUP_RLC) {
optparams = 0;
- } else if (messages[ourmessage].messagetype == ISUP_GRS) {
- optparams = 1;
- } else if (messages[ourmessage].messagetype == ISUP_GRA) {
- optparams = 1;
}
}
- c = isup_find_call(ss7, rl, cic);
+ /* 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;
+ }
if (!c) {
ss7_error(ss7, "Huh? No call!!!???\n");
@@ -3246,30 +2678,29 @@
offset += res;
}
- 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++;
+ 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;
}
+
+ len -= res;
+ offset += res;
}
/* Optional paramter parsing code */
- if (optparams && len > 0 && param_pointer[0]) {
- offset += param_pointer[0];
- len-- ; /* optional parameter pointer */
-
+ if (optparams && *opt_ptr) {
while ((len > 0) && (mh->data[offset] != 0)) {
struct isup_parm_opt *optparm = (struct isup_parm_opt *)(mh->data + offset);
@@ -3288,73 +2719,58 @@
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_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;
- e->sam.cot_check_required = c->cot_check_required;
- e->sam.cot_performed_on_previous_cic = c->cot_performed_on_previous_cic;
[... 4209 lines stripped ...]
More information about the svn-commits
mailing list