[svn-commits] rmudgett: trunk r323 - /trunk/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 9 14:48:55 CDT 2014


Author: rmudgett
Date: Mon Jun  9 14:48:47 2014
New Revision: 323

URL: http://svnview.digium.com/svn/libss7?view=rev&rev=323
Log:
libss7: Dual seizure improvements.

* Dual seizure - check for IAM pending in addition to IAM sent.

* ISUP_RSC - we should still respond to RSC.

* Ignore unexpected messages when relevant timers are active and we are
waiting for RLC.  - Thanks to Pavel Troller for discovering and suggested
fix.

* Check both DPC and OPC when receiving a message to confirm it is for us.
- Thanks to Pavel Troller and Gustavo Marsico for discovering.

* Fixed handling of got_sent_msg flags on RSC/REL/RLC - no more stale
channels or missed blocking messages.

* Check for DPC only for signalling messages in mtp3_receive().

* Minor FAR message fixes, added FRJ message support.

* Improve SS7 debug message decoding to know about more fields.

SS7-27
Reported by: adomjan
Patches:
      SS7-27_libss7_trunk2_v13.diff (license #5506) patch uploaded by Kaloyan Kovachev

Review: https://reviewboard.asterisk.org/r/2150/

Modified:
    trunk/isup.c
    trunk/isup.h
    trunk/libss7.h
    trunk/mtp3.c
    trunk/ss7_internal.h
    trunk/ss7linktest.c

Modified: trunk/isup.c
URL: http://svnview.digium.com/svn/libss7/trunk/isup.c?view=diff&rev=323&r1=322&r2=323
==============================================================================
--- trunk/isup.c (original)
+++ trunk/isup.c Mon Jun  9 14:48:47 2014
@@ -77,6 +77,8 @@
 
 
 static int acm_params[] = {ISUP_PARM_BACKWARD_CALL_IND, -1};
+
+static int frj_params[] = {ISUP_PARM_FACILITY_IND, ISUP_PARM_CALL_REF, -1};
 
 static int faa_params[] = {ISUP_PARM_FACILITY_IND, ISUP_PARM_CALL_REF, -1};
 
@@ -142,6 +144,7 @@
 	{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_FRJ, 1, 0, 1, -1, frj_params},
 	{ISUP_FAA, 1, 0, 1, -1, faa_params},
 	{ISUP_FAR, 1, 0, 1, -1, far_params},
 	{ISUP_CFN, 0, 1, 1, 0, rel_params},
@@ -2656,56 +2659,114 @@
 }
 
 static struct parm_func parms[] = {
+	{ISUP_PARM_CALL_REF, "Call Reference", call_ref_dump, call_ref_receive, call_ref_transmit},
+	{ISUP_PARM_TRANSMISSION_MEDIUM_REQS, "Transmission Medium Requirements", transmission_medium_reqs_dump, transmission_medium_reqs_receive, transmission_medium_reqs_transmit},
+	{ISUP_PARM_ACCESS_TRANS, "Access Transport", access_transport_dump, access_transport_receive, access_transport_transmit},
+	{ISUP_PARM_CALLED_PARTY_NUM, "Called Party Number", called_party_num_dump, called_party_num_receive, called_party_num_transmit},
+	{ISUP_PARM_SUBSEQUENT_NUMBER, "Subsequent Number", subs_num_dump, subs_num_receive, subs_num_transmit},
 	{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 },
 	{ISUP_PARM_FORWARD_CALL_IND, "Forward Call Indicators", forward_call_ind_dump, forward_call_ind_receive, forward_call_ind_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_CALLING_PARTY_CAT, "Calling Party's Category", calling_party_cat_dump, calling_party_cat_receive, calling_party_cat_transmit},
-	{ISUP_PARM_TRANSMISSION_MEDIUM_REQS, "Transmission Medium Requirements", transmission_medium_reqs_dump, transmission_medium_reqs_receive, transmission_medium_reqs_transmit},
+	{ISUP_PARM_CALLING_PARTY_NUM, "Calling Party Number", calling_party_num_dump, calling_party_num_receive, calling_party_num_transmit},
+	{ISUP_PARM_REDIRECTING_NUMBER, "Redirecting Number", redirecting_number_dump, redirecting_number_receive, redirecting_number_transmit},
+	{ISUP_PARM_REDIRECTION_NUMBER, "Redirection Number"},
+	{ISUP_PARM_CONNECTION_REQ, "Connection Request"},
+	{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_CONTINUITY_IND, "Continuity Indicator", continuity_ind_dump, continuity_ind_receive, continuity_ind_transmit},
+	{ISUP_PARM_BACKWARD_CALL_IND, "Backward Call Indicator", backward_call_ind_dump, backward_call_ind_receive, backward_call_ind_transmit},
+	{ISUP_PARM_CAUSE, "Cause Indicator", cause_dump, cause_receive, cause_transmit},
+	{ISUP_PARM_REDIRECTION_INFO, "Redirection Information", redirection_info_dump, redirection_info_receive, redirection_info_transmit},
+	{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_CALL_MODIFICATION_IND, "Call modification indicators"},
+	{ISUP_PARM_FACILITY_IND, "Facility Indicator", facility_ind_dump, facility_ind_receive, facility_ind_transmit},
+	{ISUP_PARM_CUG_INTERLOCK_CODE, "CUG Interlock Code", cug_interlock_code_dump, cug_interlock_code_receive, cug_interlock_code_transmit},
 	{ISUP_PARM_USER_SERVICE_INFO, "User Service Information", NULL, user_service_info_receive, user_service_info_transmit},
-	{ISUP_PARM_CALLED_PARTY_NUM, "Called Party Number", called_party_num_dump, called_party_num_receive, called_party_num_transmit},
-	{ISUP_PARM_CAUSE, "Cause Indicator", cause_dump, cause_receive, cause_transmit},
-	{ISUP_PARM_CONTINUITY_IND, "Continuity Indicator", continuity_ind_dump, continuity_ind_receive, continuity_ind_transmit},
-	{ISUP_PARM_ACCESS_TRANS, "Access Transport", access_transport_dump, access_transport_receive, access_transport_transmit},
-	{ISUP_PARM_BUSINESS_GRP, "Business Group"},
-	{ISUP_PARM_CALL_REF, "Call Reference", call_ref_dump, call_ref_receive, call_ref_transmit},
-	{ISUP_PARM_CALLING_PARTY_NUM, "Calling Party Number", calling_party_num_dump, calling_party_num_receive, calling_party_num_transmit},
-	{ISUP_PARM_CARRIER_ID, "Carrier Identification", carrier_identification_dump, carrier_identification_receive, carrier_identification_transmit},
-	{ISUP_PARM_SELECTION_INFO, "Selection Information"},
-	{ISUP_PARM_CHARGE_NUMBER, "Charge Number", charge_number_dump, charge_number_receive, charge_number_transmit},
+	{ISUP_PARM_SIGNALLING_PC, "Signalling point code"},
+	{ISUP_PARM_USER_TO_USER_INFO, "User to user information"},
+	{ISUP_CONNECTED_NUMBER, "Connected Number", connected_num_dump, connected_num_receive, connected_num_transmit},
+	{ISUP_PARM_SUSPEND_RESUME_IND, "Suspend/Resume Indicators", suspend_resume_ind_dump, suspend_resume_ind_receive, suspend_resume_ind_transmit},
+	{ISUP_PARM_TRANSIT_NETWORK_SELECTION, "Transit Network Selection", tns_dump, tns_receive, tns_transmit},
+	{ISUP_PARM_EVENT_INFO, "Event Information", event_info_dump, event_info_receive, event_info_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_EGRESS_SERV, "Egress Service"},
+	{ISUP_PARM_CIRCUIT_STATE_IND, "Circuit State Indicator", circuit_state_ind_dump, NULL, circuit_state_ind_transmit},
+	{ISUP_PARAM_AUTOMATIC_CONGESTION_LEVEL, "Automatic congestion level"},
+	{ISUP_PARM_ORIGINAL_CALLED_NUM, "Original called number", original_called_num_dump, original_called_num_receive, original_called_num_transmit},
+	{ISUP_PARM_OPT_BACKWARD_CALL_IND, "Optional Backward Call Indicator", opt_backward_call_ind_dump, opt_backward_call_ind_receive, NULL},
+	{ISUP_PARM_USER_TO_USER_IND, "User to user indicators"},
+	{ISUP_PARM_ORIGINATION_ISC_PC, "Origination ISC point code"},
+	{ISUP_PARM_GENERIC_NOTIFICATION_IND, "Generic Notification Indication", generic_notification_ind_dump, generic_notification_ind_receive, generic_notification_ind_transmit},
+	{ISUP_PARM_CALL_HISTORY_INFO, "Call history information"},
+	{ISUP_PARM_ACCESS_DELIVERY_INFO, "Access Delivery Information", },
+	{ISUP_PARM_NETWORK_SPECIFIC_FACILITY, "Network specific facility"},
+	{ISUP_PARM_USER_SERVICE_INFO_PRIME, "User service information prime"},
+	{ISUP_PARM_PROPAGATION_DELAY, "Propagation Delay Counter", propagation_delay_cntr_dump},
+	{ISUP_PARM_REMOTE_OPERATIONS, "Remote operations"},
+	{ISUP_PARM_SERVICE_ACTIVATION, "Service activation"},
+	{ISUP_PARM_USER_TELESERVICE_INFO, "User teleservice information"},
+	{ISUP_PARM_TRANSMISSION_MEDIUM_USED, "Transmission medium used"},
+	{ISUP_PARM_CALL_DIVERSION_INFO, "Call diversion information"},
+	{ISUP_PARM_ECHO_CONTROL_INFO, "Echo Control Information", echo_control_info_dump, NULL, NULL},
+	{ISUP_PARM_MESSAGE_COMPAT_INFO, "Message compatibility information"},
+	{ISUP_PARM_PARAMETER_COMPAT_INFO, "Parameter Compatibility Information", parameter_compat_info_dump, NULL, NULL},
+	{ISUP_PARM_MLPP_PRECEDENCE, "MLPP precedence"},
+	{ISUP_PARM_MCID_REQUEST_IND, "MCID request indicators"},
+	{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_REDIRECTION_NUM_RESTRICTION, "Redirection number restriction"},
+	{ISUP_PARM_CALL_TRANSFER_REFERENCE, "Call transfer reference"},
+	{ISUP_PARM_LOOP_PREVENTION_IND, "Loop prevention indicators"},
+	{ISUP_PARM_CALL_TRANSFER_NUMBER, "Call transfer number"},
+	{ISUP_PARM_CCSS, "CCSS"},
+	{ISUP_PARM_FORWARD_GVNS, "Forward GVNS"},
+	{ISUP_PARM_BACKWARD_GVNS, "Backward GVNS"},
+	{ISUP_PARM_REDIRECT_CAPABILITY, "Redirect capability"},
+	{ISUP_PARM_NETWORK_MANAGEMENT_CONTROL, "Network management controls"},
+	{ISUP_PARM_CORRELATION_ID, "Correlation id"},
+	{ISUP_PARM_SCF_ID, "SCF id"},
+	{ISUP_PARM_CALL_DIVERSION_TREATMENT_IND, "Call diversion treatment indicators"},
+	{ISUP_PARM_CALLED_IN_NUMBER, "Called IN number"},
+	{ISUP_PARM_CALL_OFFERING_TREATMENT_IND, "Call offering treatment indicators"},
+	{ISUP_PARM_CHARGED_PARTY_IDENT, "Charged party identification"},
+	{ISUP_PARM_CONFERENCE_TREATMENT_IND, "Conference treatment indicators"},
+	{ISUP_PARM_DISPLAY_INFO, "Display information"},
+	{ISUP_PARM_UID_ACTION_IND, "UID action indicators"},
+	{ISUP_PARM_UID_CAPABILITY_IND, "UID capability indicators"},
+	{ISUP_PARM_REDIRECT_COUNTER, "Redirect Counter", redirect_counter_dump, redirect_counter_receive, redirect_counter_transmit},
+	{ISUP_PARM_APPLICATION_TRANSPORT, "Application transport"},
+	{ISUP_PARM_COLLECT_CALL_REQUEST, "Collect call request"},
+	{ISUP_PARM_CCNR_POSSIBLE_IND, "CCNR possible indicator"},
+	{ISUP_PARM_PIVOT_CAPABILITY, "Pivot capability"},
+	{ISUP_PARM_PIVOT_ROUTING_IND, "Pivot routing indicators"},
+	{ISUP_PARM_CALLED_DIRECTORY_NUMBER, "Called directory number"},
+	{ISUP_PARM_ORIGINAL_CALLED_IN_NUM, "Original called IN number"},
+	{ISUP_PARM_CALLING_GEODETIC_LOCATION, "Calling geodetic location"},
+	{ISUP_PARM_HTR_INFO, "HTR information"},
+	{ISUP_PARM_NETWORK_ROUTING_NUMBER, "Network routing number"},
+	{ISUP_PARM_QUERY_ON_RELEASE_CAPABILITY, "Query on release capability"},
+	{ISUP_PARM_PIVOT_STATUS, "Pivot status"},
+	{ISUP_PARM_PIVOT_COUNTER, "Pivot counter"},
+	{ISUP_PARM_PIVOT_ROUTING_FORWARD_IND, "Pivot routing forward information"},
+	{ISUP_PARM_PIVOT_ROUTING_BACKWARD_IND, "Pivot routing backward information"},
+	{ISUP_PARM_REDIRECT_STATUS, "Redirect status"},
+	{ISUP_PARM_REDIRECT_FORWARD_INFO, "Redirect forward information"},
+	{ISUP_PARM_REDIRECT_BACKWARD_INFO, "Redirect backward information"},
+	{ISUP_PARM_NUM_PORTABILITY_FORWARD_INFO, "Number portability forward information"},
 	{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_EGRESS_SERV, "Egress Service"},
+	{ISUP_PARM_JIP, "Jurisdiction Information Parameter", jip_dump, jip_receive, jip_transmit},
+	{ISUP_PARM_CARRIER_ID, "Carrier Identification", carrier_identification_dump, carrier_identification_receive, carrier_identification_transmit},
+	{ISUP_PARM_BUSINESS_GRP, "Business Group"},
 	{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_notification_ind_dump, generic_notification_ind_receive, generic_notification_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},
-	{ISUP_PARM_OPT_BACKWARD_CALL_IND, "Optional Backward Call Indicator", opt_backward_call_ind_dump, opt_backward_call_ind_receive, NULL},
-	{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_LOCATION_NUMBER, "Location Number"},
+	{ISUP_PARM_LOCAL_SERVICE_PROVIDER_IDENTIFICATION, "Local Service Provider ID", lspi_dump, lspi_receive, lspi_transmit},
 	{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},
-	{ISUP_PARM_ORIGINAL_CALLED_NUM, "Original called number", original_called_num_dump, original_called_num_receive, original_called_num_transmit},
-	{ISUP_PARM_JIP, "Jurisdiction Information Parameter", jip_dump, jip_receive, jip_transmit},
-	{ISUP_PARM_ECHO_CONTROL_INFO, "Echo Control Information", echo_control_info_dump, NULL, NULL},
-	{ISUP_PARM_PARAMETER_COMPAT_INFO, "Parameter Compatibility Information", parameter_compat_info_dump, NULL, NULL},
-	{ISUP_PARM_CIRCUIT_STATE_IND, "Circuit State Indicator", circuit_state_ind_dump, NULL, circuit_state_ind_transmit},
-	{ISUP_PARM_LOCAL_SERVICE_PROVIDER_IDENTIFICATION, "Local Service Provider ID", lspi_dump, lspi_receive, lspi_transmit},
-	{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_SUSPEND_RESUME_IND, "Suspend/Resume Indicators", suspend_resume_ind_dump, suspend_resume_ind_receive, suspend_resume_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}
+	{ISUP_PARM_CHARGE_NUMBER, "Charge Number", charge_number_dump, charge_number_receive, charge_number_transmit},
+	{ISUP_PARM_SELECTION_INFO, "Selection Information"}
 };
 
 static char * param2str(int parm)
@@ -2732,6 +2793,17 @@
 	c->calling_party_cat = 0x0a;	/* Default to Ordinary calling subscriber */
 }
 
+static void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, unsigned int dpc)
+{
+	c->cic = cic;
+	c->dpc = dpc;
+	if (ss7->switchtype == SS7_ANSI) {
+		c->sls = ansi_sls_next(ss7);
+	} else {
+		c->sls = cic & 0xf;
+	}
+}
+
 static struct isup_call * __isup_new_call(struct ss7 *ss7, int nolink)
 {
 	struct isup_call *c, *cur;
@@ -2760,9 +2832,17 @@
 	return c;
 }
 
-struct isup_call * isup_new_call(struct ss7 *ss7)
-{
-	return __isup_new_call(ss7, 0);
+struct isup_call * isup_new_call(struct ss7 *ss7, int cic, unsigned int dpc, int outgoing)
+{
+	struct isup_call *c = __isup_new_call(ss7, 0);
+
+	if (c) {
+		isup_init_call(ss7, c, cic, dpc);
+		if (outgoing) {
+			c->got_sent_msg |= ISUP_PENDING_IAM;
+		}
+	}
+	return c;
 }
 
 void isup_set_call_dpc(struct isup_call *c, unsigned int dpc)
@@ -2948,17 +3028,6 @@
 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;
-	c->dpc = dpc;
-	if (ss7->switchtype == SS7_ANSI) {
-		c->sls = ansi_sls_next(ss7);
-	} else {
-		c->sls = cic & 0xf;
-	}
 }
 
 static struct isup_call * isup_find_call(struct ss7 *ss7, struct routing_label *rl, int cic)
@@ -3410,7 +3479,10 @@
 {
 	int res;
 
-	if (c->got_sent_msg & (ISUP_CALL_CONNECTED)) {
+	if ((c->got_sent_msg & (ISUP_CALL_CONNECTED)) ||
+			(c->got_sent_msg & (ISUP_SENT_REL | ISUP_SENT_RSC) &&
+			(ss7->isup_timers[ISUP_TIMER_T1] && ss7->isup_timers[ISUP_TIMER_T5]
+			&& ss7->isup_timers[ISUP_TIMER_T16] && ss7->isup_timers[ISUP_TIMER_T17]))) {
 		ss7_message(ss7, "ignoring... \n");
 	} else {
 		ss7_message(ss7, "reseting the cic\n");
@@ -3676,8 +3748,8 @@
 			return 0;
 		case ISUP_RSC:
 			if (c->got_sent_msg & ISUP_SENT_RSC) {
-				ss7_message(ss7, "Got RSC on CIC %d DPC %d, but we have sent RSC too. Ignoring!!!\n", c->cic, opc);
-				return 0;
+				ss7_debug_msg(ss7, SS7_DEBUG_ISUP, "Got RSC on CIC %d DPC %d, but we have sent RSC too.\n", c->cic, opc);
+				return isup_send_message(ss7, c, ISUP_RLC, empty_params);
 			}
 			e = ss7_next_empty_event(ss7);
 			if (!e) {
@@ -3707,7 +3779,7 @@
 			isup_stop_timer(ss7, c, ISUP_TIMER_T6);
 			isup_stop_timer(ss7, c, ISUP_TIMER_T35);
 			isup_stop_timer(ss7, c, ISUP_TIMER_T10);
-			c->got_sent_msg &= ~(ISUP_CALL_CONNECTED | ISUP_SENT_IAM | ISUP_GOT_IAM | ISUP_GOT_CCR | ISUP_SENT_INR);
+			c->got_sent_msg &= ~(ISUP_CALL_CONNECTED | ISUP_CALL_PENDING);
 			e->e = ISUP_EVENT_REL;
 			e->rel.cic = c->cic;
 			e->rel.call = c;
@@ -3809,7 +3881,11 @@
 			e->rlc.opc = opc;	/* keep OPC information */
 			e->rlc.call = c;
 			e->rlc.got_sent_msg = c->got_sent_msg;
-			c->got_sent_msg &= ~(ISUP_SENT_REL | ISUP_SENT_RSC);
+			if (c->got_sent_msg & ISUP_SENT_RSC) {
+				c->got_sent_msg &= ~(ISUP_SENT_REL | ISUP_SENT_RSC | ISUP_CALL_CONNECTED | ISUP_CALL_PENDING);
+			} else {
+				c->got_sent_msg &= ~(ISUP_SENT_REL | ISUP_SENT_RSC);
+			}
 			isup_stop_timer(ss7, c, ISUP_TIMER_T1);
 			isup_stop_timer(ss7, c, ISUP_TIMER_T2);
 			isup_stop_timer(ss7, c, ISUP_TIMER_T5);
@@ -4037,6 +4113,21 @@
 			e->ucic.opc = opc;	/* keep OPC information */
 			e->ucic.call = c;
 			return 0;
+		case ISUP_FRJ:
+			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_FRJ;
+			e->frj.cic = c->cic;
+			e->frj.call_ref_ident = c->call_ref_ident;
+			e->frj.call_ref_pc = c->call_ref_pc;
+			e->frj.opc = opc;	/* keep OPC information */
+			e->frj.call = c;
+			return 0;
 		case ISUP_FAA:
 			e = ss7_next_empty_event(ss7);
 			if (!e) {
@@ -4064,7 +4155,7 @@
 			e->far.cic = c->cic;
 			e->far.call_ref_ident = c->call_ref_ident;
 			e->far.call_ref_pc = c->call_ref_pc;
-			e->ucic.opc = opc;	/* keep OPC information */
+			e->far.opc = opc;	/* keep OPC information */
 			e->far.call = c;
 			return 0;
 		case ISUP_CGBA:
@@ -4135,13 +4226,13 @@
 			isup_clear_callflags(ss7, c, ISUP_SENT_CGU);
 			return 0;
 		case ISUP_SUS:
+			if (c->got_sent_msg & (ISUP_SENT_RSC | ISUP_SENT_REL)) {
+				return 0;	/* ignoring SUS we are in hangup now */
+			}
+
 			if (!(c->got_sent_msg & (ISUP_GOT_IAM | ISUP_SENT_IAM))) {
 				ss7_message(ss7, "Got SUS but no call on CIC %d PC %d ", c->cic, opc);
 				return isup_handle_unexpected(ss7, c, opc);
-			}
-
-			if (c->got_sent_msg & (ISUP_SENT_RSC | ISUP_SENT_REL)) {
-				return 0;	/* ignoring SUS we are in hangup now */
 			}
 
 			e = ss7_next_empty_event(ss7);
@@ -4202,7 +4293,7 @@
 	ss7_event *e;
 
 	/* Checking dual seizure Q.764 2.9.1.4 */
-	if (c->got_sent_msg & ISUP_SENT_IAM) {
+	if (c->got_sent_msg & (ISUP_SENT_IAM | ISUP_PENDING_IAM)) {
 		if ((ss7->pc > opc) ? (~c->cic & 1) : (c->cic & 1)) {
 			ss7_message(ss7, "Dual seizure on CIC %d DPC %d we are the controlling, ignore IAM\n", c->cic, opc);
 			return 0;
@@ -4543,6 +4634,7 @@
 	if (res > -1) {
 		isup_start_timer(ss7, c, ISUP_TIMER_T7);
 		c->got_sent_msg |= ISUP_SENT_IAM;
+		c->got_sent_msg &= ~ISUP_PENDING_IAM;
 	} else {
 		ss7_call_null(ss7, c, 0);
 		isup_free_call(ss7, c);
@@ -4570,6 +4662,25 @@
 		ss7_call_null(ss7, c, 0);
 		isup_free_call(ss7, c);
 		ss7_error(ss7, "Unable to send ACM to DPC: %d\n", c->dpc);
+	}
+
+	return res;
+}
+
+int isup_frj(struct ss7 *ss7, struct isup_call *c)
+{
+	int res;
+
+	if (!ss7 || !c) {
+		return -1;
+	}
+
+	res = isup_send_message(ss7, c, ISUP_FRJ, frj_params);
+
+	if (res == -1) {
+		ss7_call_null(ss7, c, 0);
+		isup_free_call(ss7, c);
+		ss7_error(ss7, "Unable to send FRJ to DPC: %d\n", c->dpc);
 	}
 
 	return res;
@@ -4693,7 +4804,7 @@
 		isup_start_timer(ss7, c, ISUP_TIMER_T5);
 
 		c->got_sent_msg |= ISUP_SENT_REL;
-		c->got_sent_msg &= ~(ISUP_SENT_IAM | ISUP_CALL_CONNECTED | ISUP_GOT_IAM | ISUP_GOT_CCR | ISUP_SENT_INR);
+		c->got_sent_msg &= ~(ISUP_CALL_PENDING | ISUP_CALL_CONNECTED);
 	} else {
 		ss7_call_null(ss7, c, 0);
 		isup_free_call(ss7, c);
@@ -5051,6 +5162,7 @@
 	while (c) {
 		buf_used = 0;
 		tmp_used = 0;
+		tmp_buf[0] = '\0';
 		if (c->got_sent_msg & ISUP_SENT_RSC) {
 			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "RSC ");
 		}
@@ -5072,6 +5184,9 @@
 		if (c->got_sent_msg & ISUP_SENT_GRS) {
 			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "GRS ");
 		}
+		if (c->got_sent_msg & ISUP_SENT_GRS2) {
+			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "GRS2 ");
+		}
 		if (c->got_sent_msg & ISUP_SENT_CGB) {
 			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "CGB ");
 		}
@@ -5086,6 +5201,9 @@
 		}
 		if (c->got_sent_msg & ISUP_SENT_INR) {
 			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "INR ");
+		}
+		if (c->got_sent_msg & ISUP_SENT_FAR) {
+			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "FAR ");
 		}
 		buf_used = ss7_snprintf(buf, buf_used, buf_size, "%5i %5i %3i  %-24s", c->cic, c->dpc, c->sls, tmp_buf);
 
@@ -5093,6 +5211,9 @@
 		if (c->got_sent_msg & ISUP_GOT_CCR) {
 			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "CCR ");
 		}
+		if (c->got_sent_msg & ISUP_PENDING_IAM) {
+			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "-IAM ");
+		}
 		if (c->got_sent_msg & ISUP_GOT_IAM) {
 			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "IAM ");
 		}
@@ -5104,6 +5225,12 @@
 		}
 		if (c->got_sent_msg & ISUP_GOT_CON) {
 			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "CON ");
+		}
+		if (c->got_sent_msg & ISUP_GOT_CGB) {
+			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "CGB ");
+		}
+		if (c->got_sent_msg & ISUP_GOT_CGU) {
+			tmp_used = ss7_snprintf(tmp_buf, tmp_used, buf_size, "CGU ");
 		}
 		buf_used = ss7_snprintf(buf, buf_used, buf_size, "  %-16s  ", tmp_buf);
 

Modified: trunk/isup.h
URL: http://svnview.digium.com/svn/libss7/trunk/isup.h?view=diff&rev=323&r1=322&r2=323
==============================================================================
--- trunk/isup.h (original)
+++ trunk/isup.h Mon Jun  9 14:48:47 2014
@@ -88,57 +88,137 @@
 #define ISUP_CVT	0xec	/*!< ???Used??? */
 #define ISUP_EXM	0xed	/*!< ??? */
 
-/* ISUP Parameters */
+
+/* ISUP Parameters ITU-T Q.763 */
+#define ISUP_PARM_CALL_REF						0x01
+#define ISUP_PARM_TRANSMISSION_MEDIUM_REQS		0x02
+#define ISUP_PARM_ACCESS_TRANS					0x03
+#define ISUP_PARM_CALLED_PARTY_NUM				0x04
+#define ISUP_PARM_SUBSEQUENT_NUMBER				0x05
 #define ISUP_PARM_NATURE_OF_CONNECTION_IND		0x06
-#define ISUP_PARM_FORWARD_CALL_IND			0x07
-#define ISUP_PARM_CALLING_PARTY_CAT			0x09
-#define ISUP_PARM_USER_SERVICE_INFO			0x1d
-#define ISUP_PARM_TRANSMISSION_MEDIUM_REQS		0x02
-#define ISUP_PARM_CALLED_PARTY_NUM			0x04
-#define ISUP_PARM_ACCESS_TRANS				0x03
-#define ISUP_PARM_BUSINESS_GRP				0xc6
-#define ISUP_PARM_CALL_REF				0x01
-#define ISUP_PARM_CALLING_PARTY_NUM			0x0a
-#define ISUP_PARM_CARRIER_ID				0xc5
-#define ISUP_PARM_SELECTION_INFO			0xee
-#define ISUP_PARM_CHARGE_NUMBER				0xeb
+#define ISUP_PARM_FORWARD_CALL_IND				0x07
+#define ISUP_PARM_OPT_FORWARD_CALL_INDICATOR	0x08
+#define ISUP_PARM_CALLING_PARTY_CAT				0x09
+#define ISUP_PARM_CALLING_PARTY_NUM				0x0a
+#define ISUP_PARM_REDIRECTING_NUMBER			0x0b
+#define ISUP_PARM_REDIRECTION_NUMBER			0x0c
+#define ISUP_PARM_CONNECTION_REQ				0x0d
+#define ISUP_PARM_INR_IND						0x0e
+#define ISUP_PARM_INF_IND						0x0f
+#define ISUP_PARM_CONTINUITY_IND				0x10
+#define ISUP_PARM_BACKWARD_CALL_IND				0x11
+#define ISUP_PARM_CAUSE							0x12
+#define ISUP_PARM_REDIRECTION_INFO				0x13
+/* 0x14 is Reserved / Event information */
+#define ISUP_PARM_CIRCUIT_GROUP_SUPERVISION_IND	0x15
+#define ISUP_PARM_RANGE_AND_STATUS				0x16
+#define ISUP_PARM_CALL_MODIFICATION_IND			0x17
+#define ISUP_PARM_FACILITY_IND					0x18
+/* 0x19 is Reserved */
+#define ISUP_PARM_CUG_INTERLOCK_CODE			0x1a
+/* 0x1b is Reserved */
+/* 0x1c is Reserved */
+#define ISUP_PARM_USER_SERVICE_INFO				0x1d
+#define ISUP_PARM_SIGNALLING_PC					0x1e
+/* 0x1f is Reserved */
+#define ISUP_PARM_USER_TO_USER_INFO				0x20
+#define ISUP_CONNECTED_NUMBER					0x21
+#define ISUP_PARM_SUSPEND_RESUME_IND			0x22
+#define ISUP_PARM_TRANSIT_NETWORK_SELECTION		0x23
+#define ISUP_PARM_EVENT_INFO					0x24
 #define ISUP_PARM_CIRCUIT_ASSIGNMENT_MAP		0x25
+#define ISUP_PARM_CIRCUIT_STATE_IND				0x26
+#define ISUP_PARAM_AUTOMATIC_CONGESTION_LEVEL	0x27
+#define ISUP_PARM_ORIGINAL_CALLED_NUM			0x28
 #define ISUP_PARM_OPT_BACKWARD_CALL_IND			0x29
-#define ISUP_PARM_CONNECTION_REQ			0x0d
-#define ISUP_PARM_CONTINUITY_IND			0x10
-#define ISUP_PARM_CUG_INTERLOCK_CODE			0x1a
-#define ISUP_PARM_EGRESS_SERV				0xc3
-#define ISUP_PARM_GENERIC_ADDR				0xc0
-#define ISUP_PARM_GENERIC_DIGITS			0xc1
-#define ISUP_PARM_GENERIC_NAME				0xc7
+#define ISUP_PARM_USER_TO_USER_IND				0x2a
+#define ISUP_PARM_ORIGINATION_ISC_PC			0x2b
 #define ISUP_PARM_GENERIC_NOTIFICATION_IND		0x2c
-#define ISUP_PARM_BACKWARD_CALL_IND			0x11
-#define ISUP_PARM_CAUSE					0x12
-#define ISUP_PARM_CIRCUIT_GROUP_SUPERVISION_IND		0x15
-#define ISUP_PARM_RANGE_AND_STATUS			0x16
-#define ISUP_PARM_PROPAGATION_DELAY			0x31
-#define ISUP_PARM_EVENT_INFO				0x24
-#define ISUP_PARM_HOP_COUNTER				0x3d
-#define ISUP_PARM_OPT_FORWARD_CALL_INDICATOR		0x08
-#define ISUP_PARM_LOCATION_NUMBER			0x3f
-#define ISUP_PARM_ORIG_LINE_INFO			0xea
-#define ISUP_PARM_REDIRECTION_INFO			0x13
-#define ISUP_PARM_ORIGINAL_CALLED_NUM			0x28
-#define ISUP_PARM_JIP					0xc4
-#define ISUP_PARM_ECHO_CONTROL_INFO			0x37
+#define ISUP_PARM_CALL_HISTORY_INFO				0x2d
+#define ISUP_PARM_ACCESS_DELIVERY_INFO			0x2e
+#define ISUP_PARM_NETWORK_SPECIFIC_FACILITY		0x2f
+#define ISUP_PARM_USER_SERVICE_INFO_PRIME		0x30
+#define ISUP_PARM_PROPAGATION_DELAY				0x31
+#define ISUP_PARM_REMOTE_OPERATIONS				0x32
+#define ISUP_PARM_SERVICE_ACTIVATION			0x33
+#define ISUP_PARM_USER_TELESERVICE_INFO			0x34
+#define ISUP_PARM_TRANSMISSION_MEDIUM_USED		0x35
+#define ISUP_PARM_CALL_DIVERSION_INFO			0x36
+#define ISUP_PARM_ECHO_CONTROL_INFO				0x37
+#define ISUP_PARM_MESSAGE_COMPAT_INFO			0x38
 #define ISUP_PARM_PARAMETER_COMPAT_INFO			0x39
-#define ISUP_PARM_CIRCUIT_STATE_IND			0x26
-#define ISUP_PARM_TRANSIT_NETWORK_SELECTION		0x23
+#define ISUP_PARM_MLPP_PRECEDENCE				0x3a
+#define ISUP_PARM_MCID_REQUEST_IND				0x3b
+#define ISUP_PARM_MCID_RESPONSE_IND				0x3c
+#define ISUP_PARM_HOP_COUNTER					0x3d
+#define ISUP_PARM_TRANSMISSION_MEDIUM_REQ_PRIME	0x3e
+#define ISUP_PARM_LOCATION_NUMBER				0x3f
+
+#define ISUP_PARM_REDIRECTION_NUM_RESTRICTION	0x40
+
+#define ISUP_PARM_CALL_TRANSFER_REFERENCE		0x43
+#define ISUP_PARM_LOOP_PREVENTION_IND			0x44
+#define ISUP_PARM_CALL_TRANSFER_NUMBER			0x45
+
+#define ISUP_PARM_CCSS							0x4b
+#define ISUP_PARM_FORWARD_GVNS					0x4c
+#define ISUP_PARM_BACKWARD_GVNS					0x4d
+#define ISUP_PARM_REDIRECT_CAPABILITY			0x4e
+
+#define ISUP_PARM_NETWORK_MANAGEMENT_CONTROL	0x5b
+
+#define ISUP_PARM_CORRELATION_ID				0x65
+#define ISUP_PARM_SCF_ID						0x66
+
+#define ISUP_PARM_CALL_DIVERSION_TREATMENT_IND	0x6e
+#define ISUP_PARM_CALLED_IN_NUMBER				0x6f
+#define ISUP_PARM_CALL_OFFERING_TREATMENT_IND	0x70
+#define ISUP_PARM_CHARGED_PARTY_IDENT			0x71
+#define ISUP_PARM_CONFERENCE_TREATMENT_IND		0x72
+#define ISUP_PARM_DISPLAY_INFO					0x73
+#define ISUP_PARM_UID_ACTION_IND				0x74
+#define ISUP_PARM_UID_CAPABILITY_IND			0x75
+
+#define ISUP_PARM_REDIRECT_COUNTER				0x77
+#define ISUP_PARM_APPLICATION_TRANSPORT			0x78
+#define ISUP_PARM_COLLECT_CALL_REQUEST			0x79
+#define ISUP_PARM_CCNR_POSSIBLE_IND				0x7a
+#define ISUP_PARM_PIVOT_CAPABILITY				0x7b
+#define ISUP_PARM_PIVOT_ROUTING_IND				0x7c
+#define ISUP_PARM_CALLED_DIRECTORY_NUMBER		0x7d
+
+#define ISUP_PARM_ORIGINAL_CALLED_IN_NUM		0x7f
+/* 0x80 reserved for future extension */
+#define ISUP_PARM_CALLING_GEODETIC_LOCATION		0x81
+#define ISUP_PARM_HTR_INFO						0x82
+
+#define ISUP_PARM_NETWORK_ROUTING_NUMBER		0x84
+#define ISUP_PARM_QUERY_ON_RELEASE_CAPABILITY	0x85
+#define ISUP_PARM_PIVOT_STATUS					0x86
+#define ISUP_PARM_PIVOT_COUNTER					0x87
+#define ISUP_PARM_PIVOT_ROUTING_FORWARD_IND		0x88
+#define ISUP_PARM_PIVOT_ROUTING_BACKWARD_IND	0x89
+#define ISUP_PARM_REDIRECT_STATUS				0x8a
+#define ISUP_PARM_REDIRECT_FORWARD_INFO			0x8b
+#define ISUP_PARM_REDIRECT_BACKWARD_INFO		0x8c
+#define ISUP_PARM_NUM_PORTABILITY_FORWARD_INFO	0x8d
+
+#define ISUP_PARM_GENERIC_ADDR					0xc0
+#define ISUP_PARM_GENERIC_DIGITS				0xc1
+
+#define ISUP_PARM_EGRESS_SERV					0xc3
+#define ISUP_PARM_JIP							0xc4
+#define ISUP_PARM_CARRIER_ID					0xc5
+#define ISUP_PARM_BUSINESS_GRP					0xc6
+#define ISUP_PARM_GENERIC_NAME					0xc7
+
 #define ISUP_PARM_LOCAL_SERVICE_PROVIDER_IDENTIFICATION	0xe4
-#define ISUP_PARM_FACILITY_IND				0x18
-#define ISUP_PARM_REDIRECTING_NUMBER			0x0b
-#define ISUP_PARM_ACCESS_DELIVERY_INFO			0x2e
-#define ISUP_PARM_REDIRECT_COUNTER			0x77
-#define ISUP_PARM_SUSPEND_RESUME_IND			0x22
-#define ISUP_PARM_INF_IND				0x0f
-#define ISUP_PARM_INR_IND				0x0e
-#define ISUP_PARM_SUBSEQUENT_NUMBER			0x05
-#define ISUP_CONNECTED_NUMBER				0x21
+
+#define ISUP_PARM_ORIG_LINE_INFO				0xea
+#define ISUP_PARM_CHARGE_NUMBER					0xeb
+
+#define ISUP_PARM_SELECTION_INFO				0xee
+
 
 /* ISUP TIMERS  */
 #define ISUP_TIMER_T1	1

Modified: trunk/libss7.h
URL: http://svnview.digium.com/svn/libss7/trunk/libss7.h?view=diff&rev=323&r1=322&r2=323
==============================================================================
--- trunk/libss7.h (original)
+++ trunk/libss7.h Mon Jun  9 14:48:47 2014
@@ -77,6 +77,7 @@
 #define ISUP_EVENT_CGUA		33	/*!< Circuit group unblocking acknowledgement */
 #define ISUP_EVENT_SAM		34	/*!< Subsequent address */
 #define ISUP_EVENT_DIGITTIMEOUT	35	/*!< ISUP T10 expired */
+#define ISUP_EVENT_FRJ		36	/*!< Facility rejected */
 
 /* ISUP MSG Flags */
 #define ISUP_SENT_GRS	(1 << 0)
@@ -100,8 +101,10 @@
 #define ISUP_SENT_ANM	(1 << 18)
 #define ISUP_SENT_INR	(1 << 19)
 #define ISUP_SENT_GRS2	(1 << 20)
+#define ISUP_PENDING_IAM	(1 << 21)
 
 #define ISUP_CALL_CONNECTED	(ISUP_GOT_ACM | ISUP_GOT_ANM | ISUP_GOT_CON |  ISUP_SENT_CON | ISUP_SENT_ACM | ISUP_SENT_ANM)
+#define ISUP_CALL_PENDING	(ISUP_GOT_IAM | ISUP_SENT_IAM | ISUP_PENDING_IAM | ISUP_GOT_CCR | ISUP_SENT_INR | ISUP_SENT_FAR)
 
 /* Different SS7 types */
 #define SS7_ITU		(1 << 0)
@@ -370,6 +373,15 @@
 	unsigned int call_ref_pc;
 	unsigned int opc;
 	struct isup_call *call;
+} ss7_event_frj;
+
+typedef struct {
+	int e;
+	int cic;
+	unsigned int call_ref_ident;
+	unsigned int call_ref_pc;
+	unsigned int opc;
+	struct isup_call *call;
 } ss7_event_faa;
 
 typedef struct {
@@ -430,6 +442,7 @@
 	ss7_event_cic rlc;
 	ss7_event_anm anm;
 	ss7_event_acm acm;
+	ss7_event_frj frj;
 	ss7_event_faa faa;
 	ss7_event_far far;
 	ss7_event_con con;
@@ -525,10 +538,12 @@
 
 int isup_con(struct ss7 *ss7, struct isup_call *c);
 
-struct isup_call * isup_new_call(struct ss7 *ss7);
+struct isup_call * isup_new_call(struct ss7 *ss7, int cic, unsigned int dpc, int outgoing);
 
 int isup_acm(struct ss7 *ss7, struct isup_call *c);
 
+int isup_frj(struct ss7 *ss7, struct isup_call *c);
+
 int isup_faa(struct ss7 *ss7, struct isup_call *c);
 
 int isup_far(struct ss7 *ss7, struct isup_call *c);
@@ -580,8 +595,6 @@
 void isup_clear_callflags(struct ss7 *ss7, struct isup_call *c, unsigned long flags);
 
 /* Various call related sets */
-void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, unsigned int dpc);
-
 void isup_free_call(struct ss7 *ss7, struct isup_call *c);
 
 void isup_set_call_dpc(struct isup_call *c, unsigned int dpc);

Modified: trunk/mtp3.c
URL: http://svnview.digium.com/svn/libss7/trunk/mtp3.c?view=diff&rev=323&r1=322&r2=323
==============================================================================
--- trunk/mtp3.c (original)
+++ trunk/mtp3.c Mon Jun  9 14:48:47 2014
@@ -1651,38 +1651,19 @@
 	mtp3_check(link->adj_sp);
 }
 
-static int std_test_receive(struct ss7 *ss7, struct mtp2 *mtp2, unsigned char *buf, int len)
-{
-	unsigned char *sif = buf;
+static int std_test_receive(struct ss7 *ss7, struct mtp2 *mtp2, struct routing_label rl, unsigned char *buf, int len)
+{
 	unsigned char *headerptr = buf + rl_size(ss7);
 	unsigned char h1, h0;
 	int testpatsize = 0;
-	struct routing_label rl;
 	struct routing_label drl;
 
-	get_routinglabel(ss7->switchtype, sif, &rl);
-
-	if (rl.dpc != ss7->pc) {
-		goto fail;
-	}
-
-	drl.type = ss7->switchtype;
+	/* just reverse the routing label - mtp3_receive() have checked it is correct */
+	drl.type = rl.type;
 	drl.dpc = rl.opc;
-	drl.opc = ss7->pc;
-#if 0
-	drl.sls = mtp2->slc;
-#else
-	/*
-	 * I hate that we would have to do this, but it would seem that
-	 * some telcos set things up stupid enough that we have to
-	 */
-
-	/*
-	 * The numbering of the sls have to restart on every STP!!!
-	 */
-
+	drl.opc = rl.dpc;
 	drl.sls = rl.sls;
-#endif
+
 	h1 = h0 = *headerptr;
 
 	h1 = get_h1(headerptr);
@@ -1877,8 +1858,18 @@
 	rlsize = get_routinglabel(ss7->switchtype, sif, &rl);
 
 	if (ss7->pc != rl.dpc) {
-		ss7_error(ss7, "Received message destined for point code 0x%x but we're 0x%x.  Dropping\n", rl.dpc, ss7->pc);
+		ss7_error(ss7, "Received message destined for point code 0x%x, but we are 0x%x.  Dropping\n", rl.dpc, ss7->pc);
 		return -1;
+	} else if (userpart == SIG_STD_TEST || userpart == SIG_SPEC_TEST || userpart == SIG_NET_MNG) {
+		if (link->dpc != rl.opc) {
+			ss7_error(ss7, "Received message from point code 0x%x but we are connected to DPC 0x%x.  Dropping\n", rl.opc, link->dpc);
+			return -1;
+		}
+
+		if (link->slc != rl.sls) {
+			ss7_error(ss7, "Received message for slc 0x%x, but we are 0x%x.  Dropping\n", rl.sls, link->slc);
+			return -1;
+		}
 	}
 
 	/* TODO: find out what to do with the priority in ANSI networks */
@@ -1887,7 +1878,7 @@
 	switch (userpart) {
 		case SIG_STD_TEST:
 		case SIG_SPEC_TEST:
-			return std_test_receive(ss7, link, sif, siflen);
+			return std_test_receive(ss7, link, rl, sif, siflen);
 		case SIG_ISUP:
 			/* Skip the routing label */
 			if (link->adj_sp->state == MTP3_UP) {

Modified: trunk/ss7_internal.h
URL: http://svnview.digium.com/svn/libss7/trunk/ss7_internal.h?view=diff&rev=323&r1=322&r2=323
==============================================================================
--- trunk/ss7_internal.h (original)
+++ trunk/ss7_internal.h Mon Jun  9 14:48:47 2014
@@ -55,8 +55,8 @@
 
 #define MAX_EVENTS			16
 #define MAX_SCHED			512	/* need a lot cause of isup timers... */
-#define SS7_MAX_LINKS		4
-#define SS7_MAX_ADJSPS		4
+#define SS7_MAX_LINKS		8
+#define SS7_MAX_ADJSPS		8
 
 #define SS7_STATE_DOWN		0
 #define SS7_STATE_UP		1

Modified: trunk/ss7linktest.c
URL: http://svnview.digium.com/svn/libss7/trunk/ss7linktest.c?view=diff&rev=323&r1=322&r2=323
==============================================================================
--- trunk/ss7linktest.c (original)
+++ trunk/ss7linktest.c Mon Jun  9 14:48:47 2014
@@ -61,12 +61,11 @@
 {
 	struct isup_call *c;
 
-	c = isup_new_call(ss7);
+	c = isup_new_call(ss7, (callcount % 12) + 1, dpc, 0);
 
 	if (c) {
 		isup_set_called(c, "12345", SS7_NAI_NATIONAL, ss7);
 		isup_set_calling(c, "7654321", SS7_NAI_NATIONAL, SS7_PRESENTATION_ALLOWED, SS7_SCREENING_USER_PROVIDED);
-		isup_init_call(ss7, c, (callcount % 12) + 1, dpc);
 		isup_iam(ss7, c);
 		printf("Callcount = %d\n ", ++callcount);
 	}
@@ -168,8 +167,7 @@
 				switch (e->e) {
 					case SS7_EVENT_UP:
 						printf("[%d] --- SS7 Up ---\n", linkset->linkno);
-						c = isup_new_call(ss7);
-						isup_init_call(ss7, c, 1, dpc);
+						c = isup_new_call(ss7, 1, dpc, 0);
 						isup_grs(ss7, c, 24);
 						break;
 					case MTP2_LINK_UP:




More information about the svn-commits mailing list