Skip to content
This repository was archived by the owner on Mar 21, 2023. It is now read-only.

Commit c74b9ba

Browse files
authored
Merge pull request #179 from pasanmdev/master
* fixed GEO stats to properly log country code, fixed SDP Session data display for 183 responses
2 parents a38b0ef + 10b8d1a commit c74b9ba

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

api/RestApi/Report.php

+4
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,10 @@ public function getCodecsFromMessagesForTransaction($timestamp, $param) {
10271027
/* check if this is our reply */
10281028
if(in_array($d["cseq"], $cseq[$callid]["invcseq"]) || empty($cseq[$callid])) $preset[$callid]["bparty"][] = $d;
10291029
}
1030+
else if($d["method"] == "183" && preg_match("/INVITE/i", $d["cseq"]) && $d["content_type"] == "application/sdp") {
1031+
/* Its possible SDP to be contain in a 183 Session Progress message too */
1032+
if(in_array($d["cseq"], $cseq[$callid]["invcseq"]) || empty($cseq[$callid])) $preset[$callid]["bparty"][] = $d;
1033+
}
10301034
else if(preg_match("/BYE/i", $d["cseq"]) && strlen($d["rtp_stat"]) != 0) {
10311035
$rtpstats = $this->doXRTPReport($d["rtp_stat"]);
10321036
}

examples/sipcapture/sipcapture.opensips

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ modparam("sipcapture", "hep_route", "my_hep_route")
7979
modparam("avpops","db_url","mysql://homer_user:[email protected]/homer_statistic")
8080

8181

82-
modparam("mmgeoip", "mmgeoip_city_db_path", "/usr/share/GeoIP/GeoIP.dat")
82+
modparam("mmgeoip", "mmgeoip_city_db_path", "/usr/share/GeoIP/GeoIPCity.dat")
8383

8484

8585
route{
@@ -109,8 +109,8 @@ route{
109109
avp_db_query("INSERT INTO stats_ip_mem ( method, source_ip, total) VALUES('$rm', '$si', 1) ON DUPLICATE KEY UPDATE total=total+1");
110110

111111
#GEO
112-
if(mmg_lookup("lon:lat","$si","$avp(lat_lon)")) {
113-
avp_db_query("INSERT INTO stats_geo_mem ( method, country, lat, lon, total) VALUES('$rm', '$(avp(lat_lon)[3])', '$(avp(lat_lon)[0])', '$(avp(lat_lon)[1])', 1) ON DUPLICATE KEY UPDATE total=total+1");
112+
if(mmg_lookup("lon:lat:cc","$si","$avp(lat_lon)")) {
113+
avp_db_query("INSERT INTO stats_geo_mem ( method, country, lat, lon, total) VALUES('$rm', '$(avp(lat_lon)[0])', '$(avp(lat_lon)[1])', '$(avp(lat_lon)[2])', 1) ON DUPLICATE KEY UPDATE total=total+1");
114114
};
115115

116116

0 commit comments

Comments
 (0)