# # $Id$ # # OpenSIPS residential configuration script # by OpenSIPS Solutions # # This script was generated via "make menuconfig", from # the "Residential" scenario. # You can enable / disable more features / functionalities by # re-generating the scenario with different options.# # # Please refer to the Core CookBook at: # http://www.opensips.org/Resources/DocsCookbooks # for a explanation of possible statements, functions and parameters. # ####### Global Parameters ######### log_level=3 log_stderror=yes log_facility=LOG_LOCAL2 children=4 /* uncomment the following line to enable debugging */ #debug_mode=yes /* uncomment the next line to enable the auto temporary blacklisting of not available destinations (default disabled) */ #disable_dns_blacklist=no /* uncomment the next line to enable IPv6 lookup after IPv4 dns lookup failures (default disabled) */ #dns_try_ipv6=yes /* comment the next line to enable the auto discovery of local aliases based on revers DNS on IPs */ auto_aliases=no listen=hep_tcp:127.0.0.1:6061 listen=hep_udp:127.0.0.1:6061 ####### Modules Section ######## #set module path mpath="/usr/local/lib/opensips/modules/" loadmodule "db_mysql.so" loadmodule "proto_hep.so" loadmodule "sipcapture.so" modparam("sipcapture", "db_url", "mysql://root:stud@127.0.0.1/opensips") modparam("sipcapture", "capture_on", 1) modparam("sipcapture", "hep_capture_on", 1) modparam("sipcapture", "hep_route", "hep_route") route[hep_route] { ### versions older than 3 will go directly through script since it can be only SIP if ($HEPVERSION != 3) { hep_resume_sip(); } ### clone the traffic to another destination ### here you can use dispatcher or any other routing module $du = "sip:1.2.3.4:9191"; hep_relay(); ### get chunk type 0x0b(11) storing the data type hep_get("utf8-string", "0x0b", "$var(vid)", "$var(data)"); ### SIP traffic will come JSON encapsulated ### parse it and pass it to the script if ($var(data) == "SIP") { ### it's a sip message but the body is still in JSON format ### fetch the payload hep_get("payload", "$var(vendor)", "$var(payload)"); ### parse the json payload $json(pld) := $var(payload); ### and set the new payload before going to sip routes hep_set("payload", "$json(pld/payload)"); hep_resume_sip(); } ### select a different table for each message type ### known protos have string values but they all have int values $var(proto) = $(var(data){s.int}); ### WARNING: you have to create all these tables by yourself if ($var(proto) == 86) { $var(table) = "xlog_capture"; } else if ($var(proto) == 87) { $var(table) = "mi_capture"; } else if ($var(proto) == 88) { $var(table) = "rest_capture"; } else if ($var(proto) == 89) { $var(table) = "net_capture; } ### fetch the correlation id chunk hep_get("utf8-string", "0x11", "$var(vendor)", "$var(correlation_id")); report_capture("$var(table)", "$var(correlation_id)"); exit; } # ####### Routing Logic ######## # main request routing logic route{ route(CAPTURE); exit; } onreply_route { route(CAPTURE); exit; } route[CAPTURE] { ### save the sip traffic based on type ### these table don't exist; they have to be created if ($rm == "REGISTER") { sip_capture("sip_capture_registration"); } else { sip_capture("sip_capture_call"); } exit; }