cel_pgsql Inserting duplicate columns - asterisk

The log shows there is duplicated columns, insert will fail.
[Aug 29 08:14:42] DEBUG[8683] cel_pgsql.c: Inserting a CEL record: [INSERT INTO cel ("id","eventtype","eventtime","userdeftype","cid_name","cid_num","cid_ani","cid_rdnis","cid_dnid","exten","context","channame","appname","appdata","amaflags","accountcode","peeraccount","uniqueid","linkedid","userfield","peer","id","eventtype","eventtime","userdeftype","cid_name","cid_num","cid_ani","cid_rdnis","cid_dnid","exten","context","channame","appname","appdata","amaflags","accountcode","peeraccount","uniqueid","linkedid","userfield","peer") VALUES (DEFAULT,'CHAN_END','2017-08-29 08:14:42.167195','','9004','9004','9004','','9001','9001','public','SIP/9004-00000008','','',3,'','','1503994474.12','1503994474.12','','',DEFAULT,'CHAN_END','2017-08-29 08:14:42.167195','','9004','9004','9004','','9001','9001','public','SIP/9004-00000008','','',3,'','','1503994474.12','1503994474.12','','')].
alp-test*CLI> core show version
Asterisk 14.4.1 built by buildozer # build-3-6-x86_64 on a x86_64 running Linux on 2017-05-22 06:13:12 UTC
There is no update for cel_pgsql from 2015
cel_pgsql.conf
[global]
hostname=127.0.0.1
port=5432
dbname=ast
password=ast
user=ast
table=cel
cel.conf
[general]
enable=yes
apps=dial,park
events=APP_START,CHAN_START,CHAN_END,ANSWER,HANGUP,BRIDGE_ENTER,BRIDGE_EXIT

Because I load cel_pgsql.so two times, after remove preload => cel_pgsql.so everything is fine.

Related

Asterisk use say with new mode

How do i use the new mode with say.conf?
I put in my dialplan same => n,Playback(num:55|say) but i get the following errors
[Aug 24 15:12:28] WARNING[2054461][C-000001a6]: file.c:789 ast_openstream_full: File num:55|say does not exist in any format
[Aug 24 15:12:28] WARNING[2054461][C-000001a6]: file.c:1262 ast_streamfile: Unable to open num:55|say (format (ulaw)): No such file or directory
I took the example from here https://www.voip-info.org/asterisk-config-sayconf/
How can i get it to work?
You are using '|' which was delimiter BEFORE 1.4 version(very very long time ago).
For all modern versions use comma instead of that (',')

Running multiple xdtool commands from activateResult

I'm creating a gnome shell extension and implementing the search provider. In the activateResult method I want to run some code like
GLib.spawn_command_line_sync('xdotool windowactivate ' + window_id);
GLib.spawn_command_line_sync('xdotool key "ctrl+r"');
GLib.spawn_command_line_sync('xdotool type ' + some_text);
The problem is that only the first command works, and I get some errors like:
Jul 27 20:05:09 comp org.gnome.Shell.desktop[3334]: Window manager warning: Received a NET_CURRENT_DESKTOP message from a broken (outdated) client who sent a 0 timestamp
Jul 27 20:05:09 comp org.gnome.Shell.desktop[3334]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x2e00001 (somestuff)
Jul 27 20:05:09 comp org.gnome.Shell.desktop[3334]: Window manager warning: last_focus_time (93207838) is greater than comparison timestamp (93207584). This most likely represents a buggy client sending inaccurate timestamps in messages such as _NET_ACTIVE_WINDOW. Trying to work around...
Jul 27 20:05:09 comp org.gnome.Shell.desktop[3334]: Window manager warning: last_user_time (93207838) is greater than comparison timestamp (93207584). This most likely represents a buggy client sending inaccurate timestamps in messages such as _NET_ACTIVE_WINDOW. Trying to work around...
Jul 27 20:05:09 comp org.gnome.Shell.desktop[3334]: Window manager warning: 0x2e00001 (somestuff) appears to be one of the offending windows with a timestamp of 93207838. Working around..
One thing I tried was to combine all the xdotool commands with bash -c "... ... ..." with no luck.
After selecting a search result, how can I switch to a window and simulate key presses?
(I'm brand new to gnome stuff, gjs stuff, and even JS, but, do write python daily)
edit: Just tried spawn_command_line_async and it works. Feels sloppy, someone with more experienced might have a better answer.
If you are writing a GNOME Shell extension, it's worth noticing that there are a number of GNOME platform libraries that you can rely on being available.
For simulating mouse and keyboard event, Atspi will work in most situations. As a simple example of simulating pressing the a key:
const Atspi = imports.gi.Atspi;
Atspi.generate_keyboard_event(0, 'a', Atspi.KeySynthType.STRING);
Activating a window, on the other hand, is probably something best done with the built-in window manager functions, however these aren't documented and you'd have to inspect the GNOME Shell JavaScript source or the source of another extension that does this.

Reading MarkLogic logs from Query Console using XQuery

I want to read MarkLogic logs (for eg : ErrorLog.txt) from query console using Xquery. I had the below code but the problem is output is not properly formatted. Result is like below
xquery version "1.0-ml";
for $hid in xdmp:hosts()
let $h := xdmp:host-name($hid)
return
xdmp:filesystem-file("file://" || $h || "/" ||xdmp:data-directory($hid) ||"/Logs/ErrorLog.txt")
Problem is result is coming as per host basis like first all log of one host is coming and then starting with time 00:00:01 of host 2 and then 00:00:01 of host 3 after running the Xquery.
2019-07-02 00:00:35.668 Info: Merging 2 MB from /cams/q06data02/testQA2/Forests/testQA2-2.2/0002b4cd to /cams/q06data02/testQA2/Forests/testQA2-2.2/0002b4ce, timestamp=15620394303480170
2019-07-02 00:00:36.007 Info: Merged 3 MB at 9 MB/sec to /cams/q06data02/testQA2/Forests/test2-2.2/0002b4ce
2019-07-02 00:00:38.161 Info: Deleted 3 MB at 399 MB/sec /cams/q06data02/test2/Forests/test2-2.2/0002b4cd
Is it possible to get the output with hostname included with log entries and also if we can sort the output by timelines something like
host 1 : 2019-07-02 00:00:01 : Info Merging ....
host 2 : 2019-07-02 00:00:02 : Info Deleted 3 MB at 399 MB/sec ...
Log files are text files. You can parse and sort them like any other text file.
Although they can get very large (GB+), so simple methods may not be performant.
Plus you need to be able to parse the text into fields in order to sort by a field.
Since the first 20 bytes of every line is the time stamp, and that timestamp is in ISO format which sorts lexically same as date, you can split the file by lines and sort using basic colation to get by time sorting of multiple files.
In V9 one can use the pair of xdmp:logfile-scan and xdmp:logmessage-parse to efficiently search over log files (remotely as well as local) and then transform the results into text, XML (attribute or element format) or JSON.
One can also use the REST API for the same.
see: https://docs.marklogic.com/REST/GET/manage/v2/logs
Once logfiles (ideally a selected subset of log messages that is small enough to manage) is converted to a structured format (xml , json or text lines) then sorting, searching, enriching etc is easily performed.
For something much better take a look at Ops Director https://docs.marklogic.com/guide/opsdir/intro

Why Oracle DataDump creates N-1 files if parallelism is set to N?

What am I doing wrong?
I set PARALLEL=4 but number of files created are 3.
time expdp data DIRECTORY=EXT_DIR TABLES=DATA.ST_EURKMORDER:P108 LOGFILE=log.txt CONTENT=DATA_ONLY COMPRESSION=DATA_ONLY DUMPFILE=DATA.ST_EURKMORDER_P108_compr_%U_out_of_4.dmp PARALLEL=4
Expected 4 files, but got 3:
ls -alh /data/DATA.ST_EURKMORDER_P108_compr_1*
-rw-r----- 1 oracle oinstall 170M Apr 11 13:38 /data/DATA.ST_EURKMORDER_P108_compr_01_out_of_4.dmp
-rw-r----- 1 oracle oinstall 159M Apr 11 13:38 /data/DATA.ST_EURKMORDER_P108_compr_02_out_of_4.dmp
-rw-r----- 1 oracle oinstall 151M Apr 11 13:38 /data/DATA.ST_EURKMORDER_P108_compr_03_out_of_4.dmp
According to the documentation, the PARALLEL setting (emphasis added):
Specifies the maximum number of processes of active execution operating on behalf of the export job.
It also shows an example similar to yours with PARALLEL set to four, which it says results in an export
... in which up to four files could be created ...
There are various other examples that refer to 'up to' as well. So, this is the expected behaviour. It could create four files, it could create fewer than that.

Debug, Unix. Run a program with a different time from the system

I am debugging a program in MacOSX,
and I need that this program thinks we are one year later than the one given by the operating system.
I cannot change the time of the operation system, because I need to run a second program concurrently with the correct time.
I could modify the code of the first program to add one year each time it gets the time from the operation system, but the code is too big to do that; I prefer not to use this solution.
I heard once that there is a command in Unix to run a program with a fake/mocked time.
Do you know about it?
I haven't tried it, but libfaketime claims to do what you need.
Quoted from the website:
As an example, we want the "date" command to report our faked time. To do so, we could use the following command line:
user#host> date
Tue Nov 23 12:01:05 CEST 2007
user#host> LD_PRELOAD=/usr/local/lib/libfaketime.so.1 FAKETIME="-15d" date
Mon Nov 8 12:01:12 CEST 2007
Assuming the lib works as advertised, you can trick your program into thinking it was running a year ahead using:
LD_PRELOAD=/usr/local/lib/libfaketime.so.1 FAKETIME="+1y" ./your_program

Resources