[OpenSIPS-Users] hep rtcp data dump to postgres
Pasan Meemaduma
pasandev at ymail.com
Mon Jul 2 06:20:22 EDT 2018
mysql debug log with same setup.
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:sipcapture:db_sync_store: storing info...Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:has_stmt_ctx: ctx found for rtcp_capture
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_do_prepared_query: conn=0x7f610eda28c8 (tail=140054837734000) MC=0x7f610eda2ae8
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_do_prepared_query: set values for the statement run
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (0): len=40; type=12; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (1): len=8; type=8; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (2): len=121; type=254; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (3): len=12; type=254; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (4): len=4; type=3; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (5): len=13; type=254; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (6): len=4; type=3; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (7): len=4; type=3; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (8): len=4; type=3; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (9): len=4; type=3; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (10): len=9; type=254; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_val2bind: added val (11): len=338; type=252; is_null=0
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:db_mysql_do_prepared_query: doing BIND_PARAM in...
Jul 2 20:15:48 voip2-homer /usr/sbin/opensips[19488]: DBG:db_mysql:mysql_raise_event: MySQL status has not changed: connected
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20180702/d3a8015b/attachment-0001.html>
More information about the Users
mailing list