Hi Andy,
we will do. We are still testing the new stuff so we did not had
time to add docu for this.
For short:
you have to load "protocol_ss7" within "captagent.xml"
and add protocol_ss7.xml
<?xml version="1.0"?>
<document type="captagent_module/xml">
<module name="protocol_ss7" description="SS7 Protocol suite" serial="20161010">
<profile name="proto_ss7" description="PROTO SS7" enable="true" serial="20161010">
<settings>
</settings>
</profile>
</module>
</document>
this should enable sctp analysing for m2ua/m2pa and send the ISUP Messages via HEP to
a sipcapture server (kamailio).
In Kamailio, add ..
modparam("sipcapture", "nonsip_hook", 1)
event_route[sipcapture:request] {
xlog("HEP Request!\n");
xlog("received sipcapture request from $si:$sp\r\n");
xlog("HEP VERSION $hep(version) request from $si:$sp\r\n");
xlog("HEP CHUNK Source IP $hep(0x002) request from $si:$sp\r\n");
#Is it SIP ?
if($hep(0x00b) == 1){
#Do parsing internal
return 1;
}
else if ($hep(0x00b) == 8) {
# We are parsing M2UA now and want ISUP from it
$var(payload) = $hep(0x00f);
$var(res) = isup_to_json(8);
# It is ISUP so let us try to insert it into a database
if ($var(res) == 1) {
route(STORE_ISUP);
drop;
}
return 0;
}
else if ($hep(0x00b) == 13) {
$var(payload) = $hep(0x00f);
$var(res) = isup_to_json(13);
# It is ISUP so let us try to insert it into a database
if ($var(res) == 1) {
route(STORE_ISUP);
drop;
}
return 0;
}
else
{
#If report lets proceed here with payload
xlog("HEP CHUNK PAYLOAD $hep(0x00f) request from $si:$sp\r\n");
return 0;
}
}
route[STORE_ISUP] {
$var(json) = $(isup(1){sql.val});
$var(method) = $(isup(method){sql.val});
$var(opc) = $isup(opc);
$var(dpc) = $isup(dpc);
$var(cic) = $isup(cic);
if ($var(opc) > $var(dpc)) {
$var(corr_id) = "" + $var(opc) + "-" + $var(dpc) + "-" + $var(cic);
} else {
$var(corr_id) = "" + $var(dpc) + "-" + $var(opc) + "-" + $var(cic);
}
# Generic IPv4 data... assume that
$var(src_ip) = $(hep(0x003){sql.val});
$var(dst_ip) = $(hep(0x004){sql.val});
$var(src_port) = $(hep(0x007){sql.val});
$var(dst_port) = $(hep(0x008){sql.val});
xlog("HEP: src_ip: $var(src_ip) dst_ip: $var(dst_ip) src_port: $var(src_port) dst_port: $var(dst_port)\r\n");
$var(time_sec) = $(hep(0x009){sql.val});
$var(time_usec) = $(hep(0x00a){sql.val});
$var(proto) = $(hep(0x00b){sql.val});
$var(called_inn) = $(isup(called_inn){sql.val});
$var(called_ton) = $(isup(called_ton){sql.val});
$var(called_npi) = $(isup(called_npi){sql.val});
$var(called_num) = $(isup(called_num){sql.val});
$var(calling_ni) = $(isup(calling_ni){sql.val});
$var(calling_res) = $(isup(calling_restrict){sql.val});
$var(calling_scr) = $(isup(calling_screened){sql.val});
$var(calling_ton) = $(isup(calling_ton){sql.val});
$var(calling_npi) = $(isup(calling_npi){sql.val});
$var(calling_num) = $(isup(calling_num){sql.val});
$var(calling_cat) = $(isup(calling_category){sql.val});
$var(cause_std) = $(isup(cause_standard){sql.val});
$var(cause_loc) = $(isup(cause_location){sql.val});
$var(cause_cls) = $(isup(cause_itu_class){sql.val});
$var(cause_num) = $(isup(cause_itu_num){sql.val});
$var(event_num) = $(isup(event_num){sql.val});
$var(hop_count) = $(isup(hop_counter){sql.val});
$var(nci_sat) = $(isup(nature_of_conn_sat){sql.val});
$var(nci_con) = $(isup(nature_of_conn_con_check){sql.val});
$var(nci_ech) = $(isup(nature_of_conn_echo_device){sql.val});
$var(fwd_nic) = $(isup(fwd_call_international){sql.val});
$var(fwd_interw) = $(isup(fwd_call_interworking){sql.val});
$var(fwd_eemeth) = $(isup(fwd_call_end_to_end_method){sql.val});
$var(fwd_eeinf) = $(isup(fwd_call_end_to_end_method){sql.val});
$var(fwd_isup) = $(isup(fwd_call_isup){sql.val});
$var(fwd_isupp) = $(isup(fwd_call_isup_preference){sql.val});
$var(fwd_sccp) = $(isup(fwd_call_sccp_method){sql.val});
$var(fwd_isdn) = $(isup(fwd_call_isdn){sql.val});
$var(trans_med) = $(isup(transmission_medium){sql.val});
$var(ui_coding) = $(isup(user_info_coding_standard){sql.val});
$var(ui_tracap) = $(isup(user_info_transfer_cap){sql.val});
$var(ui_tramde) = $(isup(user_info_transfer_mode){sql.val});
$var(ui_trarte) = $(isup(user_info_transfer_rate){sql.val});
$var(ui_l1idnt) = $(isup(user_info_layer1_ident){sql.val});
$var(ui_l1prot) = $(isup(user_info_layer1_protocol){sql.val});
$var(utc) = $utimef(%Y%m%d);
$var(table) = "isup_capture_all_" + $var(utc);
sql_query("is", "INSERT INTO $var(table)
(correlation_id, method, opc, dpc, cic, called_inn, called_ton,
called_npi, called_number, calling_ni, calling_restrict,
calling_screened, calling_ton, calling_npi, calling_number,
calling_category, cause_standard, cause_location, cause_itu_class,
cause_itu_cause, event_num, hop_counter, nci_satellite,
nci_continuity_check, nci_echo_device, fwc_nic, fwc_etem,
fwc_iw, fwc_etei, fwc_isup, fwc_isup_pref, fwc_ia, fwc_sccpm,
transmission_medium, user_coding_standard,
user_transfer_cap, user_transfer_mode,
user_transfer_rate, user_layer1_ident, user_layer1_proto,
source_ip, source_port, destination_ip, destination_port,
proto, date, micro_ts, msg)
VALUES($(var(corr_id){sql.val}), $var(method), $(var(opc){sql.val}),
$(var(dpc){sql.val}), $(var(cic){sql.val}), $var(called_inn),
$var(called_ton), $var(called_npi), $var(called_num),
$var(calling_ni), $var(calling_res), $var(calling_scr),
$var(calling_ton), $var(calling_npi), $var(calling_num),
$var(calling_cat), $var(cause_std), $var(cause_loc),
$var(cause_cls), $var(cause_num), $var(event_num),
$var(hop_counter), $var(nci_sat), $var(nci_con),
$var(nci_ech), $var(fwd_nic), $var(fwd_eemeth),
$var(fwd_interw), $var(fwd_eeinf), $var(fwd_isup),
$var(fwd_isupp), $var(fwd_isdn), $var(fwd_sccp),
$var(trans_med), $var(ui_coding), $var(ui_tracap),
$var(ui_tramde), $var(ui_trarte), $var(ui_l1idnt),
$var(ui_l1prot), $var(src_ip), $var(src_port),
$var(dst_ip), $var(dst_port), $var(proto),
from_unixtime($var(time_sec)), $var(time_sec) * 1000000 + $var(time_usec),
$var(json));");
DB Schema looks like this:
CREATE TABLE `isup_capture_all_20170122` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`micro_ts` bigint(18) NOT NULL DEFAULT '0',
`method` varchar(4) NOT NULL DEFAULT '',
`correlation_id` varchar(256) NOT NULL DEFAULT '',
`opc` int(10) NOT NULL DEFAULT '0',
`dpc` int(10) NOT NULL DEFAULT '0',
`cic` int(10) NOT NULL DEFAULT '0',
`called_number` varchar(16) DEFAULT '',
`called_ton` int(10) DEFAULT '0',
`called_npi` int(10) DEFAULT '0',
`called_inn` int(10) DEFAULT '0',
`calling_number` varchar(16) DEFAULT '',
`calling_ton` int(10) DEFAULT '0',
`calling_npi` int(10) DEFAULT '0',
`calling_ni` int(10) DEFAULT '0',
`calling_restrict` int(10) DEFAULT '0',
`calling_screened` int(10) DEFAULT '0',
`calling_category` int(10) DEFAULT '0',
`cause_standard` int(10) DEFAULT '0',
`cause_location` int(10) DEFAULT '0',
`cause_itu_class` int(10) DEFAULT '0',
`cause_itu_cause` int(10) DEFAULT '0',
`event_num` int(10) DEFAULT '0',
`hop_counter` int(10) DEFAULT '0',
`nci_satellite` int(10) DEFAULT '0',
`nci_continuity_check` int(10) DEFAULT '0',
`nci_echo_device` int(10) DEFAULT '0',
`fwc_nic` int(10) DEFAULT '0',
`fwc_etem` int(10) DEFAULT '0',
`fwc_iw` int(10) DEFAULT '0',
`fwc_etei` int(10) DEFAULT '0',
`fwc_isup` int(10) DEFAULT '0',
`fwc_isup_pref` int(10) DEFAULT '0',
`fwc_ia` int(10) DEFAULT '0',
`fwc_sccpm` int(10) DEFAULT '0',
`transmission_medium` int(10) DEFAULT '0',
`user_coding_standard` int(10) DEFAULT '0',
`user_transfer_cap` int(10) DEFAULT '0',
`user_transfer_mode` int(10) DEFAULT '0',
`user_transfer_rate` int(10) DEFAULT '0',
`user_layer1_ident` int(10) DEFAULT '0',
`user_layer1_proto` int(10) DEFAULT '0',
`source_ip` varchar(60) NOT NULL DEFAULT '',
`source_port` int(10) NOT NULL DEFAULT '0',
`destination_ip` varchar(60) NOT NULL DEFAULT '',
`destination_port` int(10) NOT NULL DEFAULT '0',
`proto` int(5) NOT NULL DEFAULT '0',
`family` int(1) DEFAULT NULL,
`type` int(5) NOT NULL DEFAULT '0',
`node` varchar(125) NOT NULL DEFAULT '',
`msg` varchar(5000) NOT NULL DEFAULT '',
`expires` int(5) NOT NULL DEFAULT '-1',
PRIMARY KEY (`id`,`date`),
KEY `date` (`date`),
KEY `called_number` (`called_number`),
KEY `calling_number` (`calling_number`),
KEY `correlationid` (`correlation_id`(255))
) ENGINE=InnoDB
Might be this helps you to start testing this awesome new Feature.
Best Regards
Markus