shazeb
June 25, 2025, 9:49am
1
Hello All,
I am new here in Asterisk. Can any help me line by line on below error
Couldn’t execute statement: SQL logic error
Unable to open file /var/log/asterisk//cdr-csv//Master.csv : Permission denied
Unable to write CSV record to master ‘/var/log/asterisk//cdr-csv//Master.csv’ : Permission denied
Thanks
jcolp
June 25, 2025, 9:50am
2
I would guess you are running Asterisk as a user that doesn’t have permission to access such things.
Pooh
June 25, 2025, 9:57am
3
On Wednesday 25 June 2025 at 11:50:49, shazeb via Asterisk Community wrote:
Couldn’t execute statement: SQL logic error
No idea about that unless you tell us what you’re doing with SQL in an
Asterisk setup.
Give us more context for that error message.
Unable to open file /var/log/asterisk//cdr-csv//Master.csv : Permission
denied
The ownership and permissions on that file do not allow the user Asterisk is
run as to open it.
Show us the output of:
ls -l /var/log/asterisk//cdr-csv/Master.csv
and
ps aux | grep asterisk
Unable to write CSV record to master ‘/var/log/asterisk//cdr-
csv//Master.csv’ : Permission denied
Same as above.
Antony.
–
“The tofu battle I saw last weekend was quite brutal.”
Marija Danute Brigita Kuncaitis
shazeb
June 25, 2025, 10:01am
4
Thanks for prompt reply jcolp
I am using Ubuntu operating system and running all command in root user.
shazeb
June 25, 2025, 10:02am
5
ls: cannot access ‘/var/log/asterisk//cdr-csv/Master.csv’: No such file or directory
Pooh
June 25, 2025, 10:15am
6
On Wednesday 25 June 2025 at 12:13:30, shazeb via Asterisk Community wrote:
ls: cannot access ‘/var/log/asterisk//cdr-csv/Master.csv’: No such file or
directory
Okay, so let’s see
ls -l /var/log/asterisk/cdr-csv
Don’t forget also to show us
ps aux | grep asterisk
Antony.
–
“I estimate there’s a world market for about five computers.”
Thomas J Watson, Chairman of IBM
Pooh
June 25, 2025, 10:16am
7
On Wednesday 25 June 2025 at 12:12:03, shazeb via Asterisk Community wrote:
I am using Ubuntu operating system
How did you install Asterisk?
Antony.
–
Too many people spend money they haven’t earned
to buy things they don’t want,
to impress people they don’t like.
shazeb
June 25, 2025, 10:19am
8
root@user-H610M-K-DDR4:~# ps aux | grep asterisk
asterisk 1970 0.7 0.2 5421292 87064 ? Ssl 13:51 0:54 /usr/sbin/asterisk -U asterisk -G asterisk
root 2193 0.0 0.0 49400 8792 pts/0 T 13:55 0:00 rasterisk vrrr
root 14221 0.0 0.0 49400 8756 pts/0 T 15:45 0:00 rasterisk r
root 14447 0.0 0.0 9040 724 pts/0 S+ 15:47 0:00 grep --color=auto asterisk
shazeb
June 25, 2025, 10:23am
9
https://computingforgeeks.com/install-asterisk-20-lts-on-ubuntu/
to followed the step from above URL. I am in learning stage, if you have any suggestion thn please help me to build asterisk
Pooh
June 25, 2025, 10:46am
10
On Wednesday 25 June 2025 at 12:30:06, shazeb via Asterisk Community wrote:
asterisk 1970 0.7 0.2 5421292 87064 ? Ssl 13:51 0:54
/usr/sbin/asterisk -U asterisk -G asterisk
So, Asterisk is running as the user “asterisk” and you have not yet shown us
the output of:
ls -l /var/log/asterisk/cdr-csv
My guess is that the directory is owned by root and the “asterisk” user cannot
write to it.
Antony.
–
International affairs can be complicated.
On 28th June 1914 a Serb shot an Austrian in Bosnia, so five weeks later
Germany invaded Luxembourg, declared war on France, and then invaded Belgium,
which caused Britain to enter the war.
Pooh
June 25, 2025, 10:50am
11
On Wednesday 25 June 2025 at 12:34:25, shazeb via Asterisk Community wrote:
https://computingforgeeks.com/install-asterisk-20-lts-on-ubuntu/
Those instructions include:
sudo chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk
Please confirm whether you did that, and show us the output of the command:
ls -ld /var/{lib,log,spool}/asterisk
Antony.
–
What do you call a dinosaur with only one eye? A Doyouthinkesaurus.
shazeb
June 25, 2025, 11:05am
12
I just run command - ```
sudo chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk
and after that - ls -ld /var/{lib,log,spool}/asterisk
Getting below result
root@user-H610M-K-DDR4:~# ls -ld /var/{lib,log,spool}/asterisk
drwxr-xr-x 14 asterisk asterisk 4096 Jun 24 19:33 /var/lib/asterisk
drwxr-xr-x 5 asterisk asterisk 4096 Jun 24 19:33 /var/log/asterisk
drwxr-xr-x 10 asterisk asterisk 4096 Jun 24 19:33 /var/spool/asterisk
shazeb
June 25, 2025, 11:08am
13
now i am not getting the access denied statement but getting Couldn’t execute statement: "SQL logic error " after hangup the call
Pooh
June 25, 2025, 11:20am
14
On Wednesday 25 June 2025 at 13:16:11, shazeb via Asterisk Community wrote:
I just run command -
sudo chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk
So now we have no idea whether the ownerships were set correctly beforehand or
not.
Antony.
–
Schrödinger’s rule of data integrity: the condition of any backup is unknown
until a restore is attempted.
Pooh
June 25, 2025, 11:22am
15
On Wednesday 25 June 2025 at 13:18:52, shazeb via Asterisk Community wrote:
now i am not getting the access denied statement
This tells me that you did not follow all the steps in the instructions you
pointed to, and that the command you just ran to set the ownership on the
directories has corrected this omission.
We have no way of knowing whether you missed any other steps in the
instructions.
Couldn’t execute statement: "SQL logic error "
Explain what you are doing with SQL in an Asterisk setup.
Antony.
–
BASIC is to computer languages what Roman numerals are to arithmetic.
shazeb
June 25, 2025, 11:34am
16
Actually when i am dialing the number from soft phone using extension, there is no live logs generate and getting SQL error.
[Jun 25 16:42:28] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:43:23] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:44:17] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:44:37] NOTICE[2030]: chan_sip.c:28829 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 100
[Jun 25 16:45:11] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:46:06] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:47:00] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:47:37] NOTICE[2030]: chan_sip.c:28829 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 100
[Jun 25 16:47:54] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:48:48] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:49:43] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:50:37] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:50:37] NOTICE[2030]: chan_sip.c:28829 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 100
[Jun 25 16:51:31] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:51:35] WARNING[2042]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:51:35] WARNING[2042]: db.c:362 ast_db_put: Couldn’t execute statement: attempt to write a readonly database
[Jun 25 16:52:25] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:53:20] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:53:38] NOTICE[2030]: chan_sip.c:28829 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 100
[Jun 25 16:54:14] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:55:08] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:56:03] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:56:33] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
[Jun 25 16:56:38] NOTICE[2030]: chan_sip.c:28829 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 100
[Jun 25 16:56:57] WARNING[2030]: db.c:362 ast_db_put: Couldn’t execute statement: SQL logic error
Pooh
June 25, 2025, 12:03pm
17
On Wednesday 25 June 2025 at 13:45:03, shazeb via Asterisk Community wrote:
Actually when i am dialing the number from soft phone using extension,
there is no live logs generate and getting SQL error.
Please explain what you are doing with SQL in this Asterisk setup.
There is nothing to do with SQL in the instructions you pointed to previously,
so what have you done in addition which involves SQL?
Antony.
–
It is also possible that putting the birds in a laboratory setting
inadvertently renders them relatively incompetent.
shazeb
June 25, 2025, 12:29pm
18
i am not doing any thing with sql in asterisk . I just wanted to know why this error is coming and when i am not getting live packet.
Actually i am just beginner in asterisk.
This is astdb, which is used for data persistence in some Asterisk modules, even without explicit requests from user configuration. I’d say that Asterisk hadn’t been installed properly, so I’d want to know how it had been installed.
Pooh
June 25, 2025, 12:46pm
20
On Wednesday 25 June 2025 at 14:40:31, shazeb via Asterisk Community wrote:
i am not doing any thing with sql in asterisk
In that case please give us a lot more context for that error message.
At a minimum (give us as much detail as you think could be helpful):
where does it appear?
when does it appear?
what precedes it?
Antony.
–
Ich habe gerade ein besonderes Bier getrunken.
Jetzt habe ich kein Bock mehr