[OpenSIPS-Users] hep rtcp data dump to postgres
Pasan Meemaduma
pasandev at ymail.com
Tue Jul 3 00:54:22 EDT 2018
We were able to fix this with following change. Let me know if you need a pull request if you are happy with that change.
--- opensips-2.3.4.orig/modules/sipcapture/sipcapture.c
+++ opensips-2.3.4/modules/sipcapture/sipcapture.c
@@ -5070,7 +5070,7 @@ static int report_capture(struct sip_msg
db_vals[10].val.str_val = capture_node;
}
- db_vals[11].type = DB_BLOB;
+ db_vals[11].type = DB_STR;
/* we can have other pyload than sip only for hepv3 */
On Tuesday, 3 July 2018, 8:16:50 AM GMT+5:30, Pasan Meemaduma via Users <users at lists.opensips.org> wrote:
I figured its json data encoded in hex, so it appears DB_BLOB in OpenSIPS/opensips
|
|
|
| | |
|
|
|
| |
OpenSIPS/opensips
opensips - OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-l...
|
|
|
On Monday, 2 July 2018, 1:20:31 PM GMT+5:30, Pasan Meemaduma via Users <users at lists.opensips.org> wrote:
Hi Guys,
I'm dumping my rtcp data which collect over hep interface of my opensips in to postgres and it doesn't store the json string in the database instead it pushes an encoded string which blows homer api when querying rtcp data. Same setup with mysql DB works perfectly fine, and data is saved as json string. It appears it stores the hep encoded msg into db without decoding. :/ Appreciate if you can look in to this. Let me know if you need any more info
OS: debian stretch
opensips : 2.3.3
/etc/opensips/opensips.cfg
listen=hep_udp:10.3.1.150:9060
loadmodule "db_postgres.so"
loadmodule "sipcapture.so"
loadmodule "proto_hep.so"
modparam("sipcapture", "db_url", "postgres://sipcapture:Apo31f24vna@127.0.0.1/homer_data")
modparam("sipcapture", "capture_on", 1)
modparam("sipcapture", "hep_capture_on", 1)
modparam("sipcapture", "hep_route", "my_hep_route")
modparam("sipcapture", "rtcp_table_name", "rtcp_capture")
route[my_hep_route] {
### hep_get([data type,] chunk_id, vendor_id_pvar, chunk_data_pvar)
### data type is optional for most of the generic chunks
### Full list here: http://www.opensips.org/html/docs/modules/2.2.x/sipcapture#hep_set_id
#Protocol ID
hep_get("11", "$var(vid)", "$var(data)");
$var(proto) = $(var(data){s.int});
#xlog("L_INFO", "Dumping $var(data) pkts via HEP");
#Logs Or Stats
if($var(proto) == 100 || $var(proto) == 99) {
#hep_set("uint8", "2", , "1");
hep_get("utf8-string", "0x11", "$var(vid)", "$var(correlation_id)");
report_capture("logs_capture", "$var(correlation_id)", "1");
exit;
} else if ( $var(data) == "RTCP") {
hep_get("utf8-string", "0x11", "$var(vid)", "$var(correlation_id)");
report_capture("rtcp_capture", "$var(correlation_id)", "5");
exit;
}
if($var(data) == "SIP") {
hep_resume_sip();
} else {
exit;
}
}
debug log
Jul 2 17:42:39 voip2-homer /usr/sbin/opensips[17258]: DBG:sipcapture:db_sync_store: storing info...
Jul 2 17:42:39 voip2-homer /usr/sbin/opensips[17258]: DBG:db_postgres:db_postgres_val2str: PQescapeStringConn: in: 121 chars, out: 121 chars
Jul 2 17:42:39 voip2-homer /usr/sbin/opensips[17258]: DBG:db_postgres:db_postgres_val2str: PQescapeStringConn: in: 12 chars, out: 12 chars
Jul 2 17:42:39 voip2-homer /usr/sbin/opensips[17258]: DBG:db_postgres:db_postgres_val2str: PQescapeStringConn: in: 13 chars, out: 13 chars
Jul 2 17:42:39 voip2-homer /usr/sbin/opensips[17258]: DBG:db_postgres:db_postgres_val2str: PQescapeStringConn: in: 9 chars, out: 9 chars
Jul 2 17:42:39 voip2-homer /usr/sbin/opensips[17258]: DBG:db_postgres:db_postgres_submit_query: 0x7fcc64b62a98 PQsendQuery(insert into rtcp_capture (date,micro_ts,correlation_id,source_ip,source_port,destination_ip,destination_port,proto,family,type,node,msg ) values ('2018-07-02 17:42:39',1530517359466892,'0gQAAC8WAAACBAAALxYAALesqTJJyH2xO7MoiUXzBE8wM7k5guQDJr3dDDdK19yGM3EIud2vT1YL3QYtviLXYUkO7n48a2Qtwkv2C38+rns- at 210.87.44.32','210.87.44.32',58871,'10.239.238.68',15997,1,2,5,'homer01:2','\x7b2273737263223a313630353339313435302c2274797065223a3230302c227265706f72745f636f756e74223a312c2273656e6465725f696e666f726d6174696f6e223a7b226e74705f74696d657374616d705f736563223a2232303835393739303632222c226e74705f74696d657374616d705f75736563223a22363334343939222c227274705f74696d657374616d70223a2d36323238383439332c227061636b657473223a31383231362c226f6374657473223a323931343536307d2c227265706f72745f626c6f636b73223a5b7b22736f757263655f73737263223a3937353539343236322c226672616374696f6e5f6c6f7374223a302c227061636b6574735f6c6f7374223a312c22686967686573745f7365715f6e6f223a34373337312c2269615f6a6974746572223a302c226c7372223a2231343431363437323835222c22646c7372223a3130383932307d5d7d'))
_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20180703/056a4f18/attachment-0001.html>
More information about the Users
mailing list