Discussion:
Using mISDN+CAPI with asterisk on RasperryPI
Jan Neuhäußer
2017-09-17 19:04:29 UTC
Permalink
Hi,

some weeks ago I followed a discussion on this list ("Using mISDN with recent asterisk and Debian") that encouraged me trying to get asterisk working on a raspberrypi together with mISDN, CAPI and chan_capi.

While capiinfo seems to report success (see below), asterisk gives me the following messages on startup:

[2017-09-17 18:55:19] VERBOSE[1822] loader.c: Loading chan_capi.so.
[2017-09-17 18:55:19] VERBOSE[1822] config.c: Parsing '/etc/asterisk/capi.conf': Found
[2017-09-17 18:55:19] WARNING[1822] chan_capi.c: CAPI not installed, chan_capi disabled!
[2017-09-17 18:55:19] VERBOSE[1822] loader.c: chan_capi.so => (Common ISDN API Driver ($Revision: 963 $))


Has anyone on this list an idea what might have gone wrong?

Btw. there is no device /dev/capi*, but I thought this not needed anymore with mISDN V2?


Any help is appreciated, please have a look at the info below.

Cheers Jan



This is what I have done:

- Installed RASPBX on the raspberrypi, it comes with asterisk 13.15.0 (after upgrade of the distro).
- compiled mISDN, libcapi and capiinfo from isdn4k-utils (https://github.com/b1-systems/mISDN.git + mISDNuser.git)
- compiled chan_capi (tp://ftp.chan-capi.org/chan-capi)

I followed the hints on:

https://www.misdn.eu/wiki/Howto_for_Debian/
https://www.misdn.eu/wiki/Capi/
http://www.melware.org/ChanCapi


Here is some information about the system:


capiinfo:

***@raspbx:/var/log/asterisk# capiinfo
capi20.c: 164 CapiDebug():[capi20_isinstalled]: standard loop - module: standard
capi20.c: 164 CapiDebug():[capi20_isinstalled]: capi_fd: -1
capi20.c: 164 CapiDebug():[capi20_isinstalled]: standard loop - module: misdn
capi20.c: 164 CapiDebug():[capi20_isinstalled]: other loop - module: standard
capi20.c: 164 CapiDebug():[capi20_isinstalled]: other loop - module: misdn
capi20.c: 164 CapiDebug():[capi20_isinstalled]: capi_fd: 4
Number of Controllers : 1
Controller 1:
Manufacturer: mISDN
CAPI Version: 2.0
Manufacturer Version: 0.1
Serial Number: 0000001
BChannels: 2
Global Options: 0x00000009
internal controller supported
DTMF supported
B1 protocols support: 0x00000003
64 kbit/s with HDLC framing
64 kbit/s bit-transparent operation
B2 protocols support: 0x00000003
ISO 7776 (X.75 SLP)
Transparent
B3 protocols support: 0x00000001
Transparent

0100
0200
09000000
03000000
03000000
01000000
00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000

Supplementary services support: 0x00000000


mISDN modules (I use an usb isdn adaptor from x-tensions, said to be supported by hfcsusb):

***@raspbx:/var/log/asterisk# lsmod | grep mISDN
mISDN_dsp_oslec 6264 0
mISDN_dsp 205391 1 mISDN_dsp_oslec
mISDN_core 98372 2 hfcsusb,mISDN_dsp

***@raspbx:/usr/local/src/isdn4k-utils/capi20# lsusb
Bus 001 Device 004: ID 1ae7:0525 X-TENSIONS
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


mISDNcapid is running and the socket exists:

***@raspbx:/var/log/asterisk# mISDNcapid
Sep 17 19:04:44.917785 I daemon.c:2238 main(02385):Init mISDN lib version 20005, debug = 0 (0)
Sep 17 19:04:44.919870 I daemon.c:2250 main(02385):Did set eGID to dialout gid:20
Sep 17 19:04:44.919957 I mc_buffer.c: 40 mc_buffer_init(02385):Setup mc buffer MI_MCBUFFER_DEBUG
debug=0x13 do_daemon=1 config=/etc/capi20.conf

***@raspbx:/var/log/asterisk# ps wwwaux | grep mISDNcapid
root 2386 0.0 0.0 3252 188 ? Ss 19:04 0:00 mISDNcapid
root 2440 0.0 0.1 4292 1884 pts/1 S+ 19:06 0:00 grep mISDNcapid

***@raspbx:/var/log/asterisk# ls -l /var/run/mISDNcapid
insgesamt 0
srw-rw---- 1 root dialout 0 Sep 17 19:04 sock


These are the configs:

***@raspbx:/var/log/asterisk# cat /etc/capi20.conf
debugmask 0x13 - example default debuglevel
mISDN 0 1 1 - first mISDN device is mapped to CAPI20 controller 1 and enabled
#mISDN 1 2 0 - second mISDN device is disabled for CAPI20


***@raspbx:/var/log/asterisk# cat /etc/asterisk/capi.conf
;
; CAPI config
;
;

; general section

[general]

language=de ;set default language

nationalprefix=0
internationalprefix=049

rxgain=0.8 ;linear receive gain (1.0 = no change)
txgain=0.8 ;linear transmit gain (1.0 = no change)


; interface sections ...


[ISDN1] ;this example interface gets name 'ISDN1' and may be any
;name not starting with 'g' or 'contr'.
;Use one interface section for each ISDN port!

isdnmode=MSN ;'MSN' (point-to-multipoint) or 'DID' (direct inward dial)

incomingmsn=* ;allow incoming calls to this list of MSNs/DIDs, * = any

controller=1 ;CAPI controller number of this interface/port

softdtmf=on ;enable/disable software DTMF detection, recommended for AVM cards

context=isdn-in ;context for incoming calls

devices=2 ;number of concurrent calls (B-Channels) on this controller
;(2 makes sense for single BRI, 30/23 for PRI/T1)


Unloading and loading chan_capi.so:

***@raspbx:/var/log/asterisk# asterisk -rvvv
Asterisk 13.15.0, Copyright (C) 1999 - 2014, Digium, Inc. and others.
Created by Mark Spencer <***@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 13.15.0 currently running on raspbx (pid = 1822)
raspbx*CLI> module unload chan_capi.so
Unloaded chan_capi.so
Unloading chan_capi.so
[2017-09-17 19:28:39] ERROR[2875]: astobj2.c:131 INTERNAL_OBJ: FRACK!, Failed assertion bad magic number 0x0 for object 0x710730d0 (0)
Got 0 backtrace records
raspbx*CLI> module load chan_capi.so
Loaded chan_capi.so
== Parsing '/etc/asterisk/capi.conf': Found
[2017-09-17 19:29:06] WARNING[2875]: chan_capi.c:8751 cc_init_capi: CAPI not installed, chan_capi disabled!
Loaded chan_capi.so => (Common ISDN API Driver ($Revision: 963 $))


The system itself:

***@raspbx:~# uname -a
Linux raspbx 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux
Maciej S. Szmigiero
2017-09-17 21:47:47 UTC
Permalink
Hi Jan,
Post by Jan Neuhäußer
Hi,
some weeks ago I followed a discussion on this list ("Using mISDN with recent asterisk and Debian") that encouraged me trying to get asterisk working on a raspberrypi together with mISDN, CAPI and chan_capi.
[2017-09-17 18:55:19] VERBOSE[1822] loader.c: Loading chan_capi.so.
[2017-09-17 18:55:19] VERBOSE[1822] config.c: Parsing '/etc/asterisk/capi.conf': Found
[2017-09-17 18:55:19] WARNING[1822] chan_capi.c: CAPI not installed, chan_capi disabled!
[2017-09-17 18:55:19] VERBOSE[1822] loader.c: chan_capi.so => (Common ISDN API Driver ($Revision: 963 $))
Has anyone on this list an idea what might have gone wrong?
Btw. there is no device /dev/capi*, but I thought this not needed anymore with mISDN V2?
Any help is appreciated, please have a look at the info below.
Attach strace (strace -f -p PID) to the asterisk server process and see what happens when it (re)loads chan_capi module.
Maybe it isn't able to load mISDN CAPI .so or access mISDNcapid socket for some reason.
Post by Jan Neuhäußer
Cheers Jan
Maciej
Thomas Jarosch
2017-09-18 08:32:37 UTC
Permalink
Hi Jan,
Post by Jan Neuhäußer
..
looks similiar to my output:

# capiinfo
Number of Controllers : 1
Controller 1:
Manufacturer: mISDN
CAPI Version: 2.0
Manufacturer Version: 0.1
Serial Number: 0000001
BChannels: 2
Global Options: 0x00000001
internal controller supported
B1 protocols support: 0x00000013
64 kbit/s with HDLC framing
64 kbit/s bit-transparent operation
T.30 modem for fax group 3
B2 protocols support: 0x00000013
ISO 7776 (X.75 SLP)
Transparent
T.30 for fax group 3
B3 protocols support: 0x00000031
Transparent
T.30 for fax group 3
T.30 for fax group 3 with extensions

0100
0200
01000000
13000000
13000000
31000000
00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000

Supplementary services support: 0x00000000

-> I just added fax support during compile time.
Post by Jan Neuhäußer
debugmask 0x13 - example default debuglevel
mISDN 0 1 1 - first mISDN device is mapped to CAPI20 controller 1 and
enabled #mISDN 1 2 0 - second mISDN device is disabled for CAPI20
my config just says "hfcsusb". But your capiinfo output seems happy.

[asterisk startup]
Post by Jan Neuhäußer
== Parsing '/etc/asterisk/capi.conf': Found
[2017-09-17 19:29:06] WARNING[2875]: chan_capi.c:8751 cc_init_capi: CAPI not
installed, chan_capi disabled! Loaded chan_capi.so => (Common ISDN API
Driver ($Revision: 963 $))
is the system user for asterisk part of the group "dialout"
so it can access "/var/run/mISDNcapid/sock"?

Try running "capiinfo" as the same user as asterisk.

Like Maciej suggested, running strace might help
as it would show file access permission problems.

Cheers,
Thomas
Jan Neuhäußer
2017-09-19 19:51:09 UTC
Permalink
Hi Maciej and Thomas,

thank you for your hints.
Post by Thomas Jarosch
is the system user for asterisk part of the group "dialout"
so it can access "/var/run/mISDNcapid/sock"?
Try running "capiinfo" as the same user as asterisk.
Yes it is and I ran capiinfo as user "asterisk" with no change.
Post by Thomas Jarosch
Like Maciej suggested, running strace might help
as it would show file access permission problems.
here it comes, the output of strace (I have reduced it to pid 2816, which I felt was the important one):

[pid 2816] poll([{fd=13, events=POLLIN}, {fd=20, events=POLLIN}], 2, -1 <unfinished ...>
[pid 2816] <... poll resumed> ) = 1 ([{fd=13, revents=POLLIN}])
[pid 2816] read(13, "module load chan_capi.so\0", 512) = 25
[pid 2816] getsockopt(13, SOL_SOCKET, SO_PEERCRED, {pid=2815, uid=0, gid=0}, [12]) = 0
[pid 2816] open("/usr/lib/asterisk/modules/chan_capi.so", O_RDONLY|O_CLOEXEC) = 26
[pid 2816] read(26, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0xv\0\0004\0\0\0"..., 512) = 512
[pid 2816] lseek(26, 981060, SEEK_SET) = 981060
[pid 2816] read(26, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1440) = 1440
[pid 2816] lseek(26, 322655, SEEK_SET) = 322655
[pid 2816] read(26, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\24\1\25"..., 47) = 47
[pid 2816] fstat64(26, {st_mode=S_IFREG|0755, st_size=982500, ...}) = 0
[pid 2816] mmap2(NULL, 408936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 26, 0) = 0x74261000
[pid 2816] mprotect(0x742ae000, 61440, PROT_NONE) = 0
[pid 2816] mmap2(0x742bd000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 26, 0x4c000) = 0x742bd000
[pid 2816] mmap2(0x742c0000, 19816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0 <unfinished ...>
[pid 2816] <... mmap2 resumed> ) = 0x742c0000
[pid 2816] close(26 <unfinished ...>
[pid 2816] <... close resumed> ) = 0
[pid 2816] munmap(0x74261000, 408936) = 0
[pid 2816] open("/usr/lib/asterisk/modules/chan_capi.so", O_RDONLY|O_CLOEXEC) = 26
[pid 2816] read(26, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0xv\0\0004\0\0\0"..., 512) = 512
[pid 2816] lseek(26, 981060, SEEK_SET) = 981060
[pid 2816] read(26, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1440) = 1440
[pid 2816] lseek(26, 322655, SEEK_SET) = 322655
[pid 2816] read(26, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\24\1\25"..., 47) = 47
[pid 2816] fstat64(26, {st_mode=S_IFREG|0755, st_size=982500, ...}) = 0
[pid 2816] mmap2(NULL, 408936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 26, 0) = 0x74261000
[pid 2816] mprotect(0x742ae000, 61440, PROT_NONE) = 0
[pid 2816] mmap2(0x742bd000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 26, 0x4c000) = 0x742bd000
[pid 2816] mmap2(0x742c0000, 19816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x742c0000
[pid 2816] close(26) = 0
[pid 2816] stat64("/etc/asterisk/capi.conf", {st_mode=S_IFREG|0664, st_size=972, ...}) = 0
[pid 2816] open("/etc/asterisk/capi.conf", O_RDONLY|O_LARGEFILE <unfinished ...>
[pid 2816] <... open resumed> ) = 26
[pid 2816] gettimeofday( <unfinished ...>
[pid 2816] <... gettimeofday resumed> {1505849557, 289763}, NULL) = 0
[pid 2816] gettid( <unfinished ...>
[pid 2816] <... gettid resumed> ) = 2816
[pid 2816] futex(0x25daec, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x25dae8, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
[pid 2816] fstat64(26, <unfinished ...>
[pid 2816] <... fstat64 resumed> {st_mode=S_IFREG|0664, st_size=972, ...}) = 0
[pid 2816] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 <unfinished ...>
[pid 2816] <... mmap2 resumed> ) = 0x76fa3000
[pid 2816] read(26, <unfinished ...>
[pid 2816] <... read resumed> ";\n; CAPI config\n;\n;\n\n; general s"..., 4096) = 972
[pid 2816] read(26, <unfinished ...>
[pid 2816] <... read resumed> "", 4096) = 0
[pid 2816] close(26 <unfinished ...>
[pid 2816] <... close resumed> ) = 0
[pid 2816] munmap(0x76fa3000, 4096 <unfinished ...>
[pid 2816] <... munmap resumed> ) = 0
[pid 2816] open("/etc/capi20.conf", O_RDONLY <unfinished ...>
[pid 2816] <... open resumed> ) = 26
[pid 2816] fstat64(26, <unfinished ...>
[pid 2816] <... fstat64 resumed> {st_mode=S_IFREG|0644, st_size=773, ...}) = 0
[pid 2816] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 <unfinished ...>
[pid 2816] <... mmap2 resumed> ) = 0x76fa3000
[pid 2816] read(26, <unfinished ...>
[pid 2816] <... read resumed> "# This is a example config file "..., 4096) = 773
[pid 2816] read(26, <unfinished ...>
[pid 2816] <... read resumed> "", 4096) = 0
[pid 2816] close(26 <unfinished ...>
[pid 2816] <... close resumed> ) = 0
[pid 2816] munmap(0x76fa3000, 4096) = 0
[pid 2816] open("/dev/capi20", O_RDWR) = -1 ENOENT (No such file or directory)
[pid 2816] open("/dev/isdn/capi20", O_RDWR) = -1 ENOENT (No such file or directory)
[pid 2816] gettimeofday({1505849557, 294820}, NULL) = 0
[pid 2816] gettid() = 2816
[pid 2816] futex(0x25daec, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x25dae8, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
[pid 2816] gettimeofday( <unfinished ...>
[pid 2816] <... gettimeofday resumed> {1505849557, 295383}, NULL) = 0
[pid 2816] gettid( <unfinished ...>
[pid 2816] <... gettid resumed> ) = 2816
[pid 2816] gettimeofday( <unfinished ...>
[pid 2816] <... gettimeofday resumed> {1505849557, 295983}, NULL) = 0
[pid 2816] gettimeofday( <unfinished ...>
[pid 2816] <... gettimeofday resumed> {1505849557, 296376}, NULL) = 0
[pid 2816] poll([{fd=13, events=POLLOUT}], 1, 100 <unfinished ...>
[pid 2816] <... poll resumed> ) = 1 ([{fd=13, revents=POLLOUT}])
[pid 2816] write(13, "Loaded chan_capi.so\n", 20 <unfinished ...>
[pid 2816] <... write resumed> ) = 20
[pid 2816] gettimeofday( <unfinished ...>
[pid 2816] <... gettimeofday resumed> {1505849557, 297688}, NULL) = 0
[pid 2816] poll([{fd=13, events=POLLIN}, {fd=20, events=POLLIN}], 2, -1 <unfinished ...>
[pid 2816] <... poll resumed> ) = 1 ([{fd=20, revents=POLLIN}])
[pid 2816] read(20, <unfinished ...>
[pid 2816] <... read resumed> "\375Parsing '/etc/asterisk/capi.con"..., 512) = 218
[pid 2816] getsockopt(20, SOL_SOCKET, SO_PEERCRED, <unfinished ...>
[pid 2816] <... getsockopt resumed> {pid=1816, uid=1000, gid=1000}, [12]) = 0
[pid 2816] write(13, "\375Parsing '/etc/asterisk/capi.con"..., 218 <unfinished ...>
[pid 2816] <... write resumed> ) = 218
[pid 2816] poll([{fd=13, events=POLLIN}, {fd=20, events=POLLIN}], 2, -1 <unfinished ...>

And I think I have allready found the reason:

[pid 2816] open("/dev/capi20", O_RDWR) = -1 ENOENT (No such file or directory)
[pid 2816] open("/dev/isdn/capi20", O_RDWR) = -1 ENOENT (No such file or directory)

chan_capi comes with an own version of libcapi20. The makefile contains the option:

USE_OWN_LIBCAPI=yes

I will try recompile chan_capi with this option set to "no" and will give you feedback.


Cheers
Jan
Thomas Jarosch
2017-09-19 14:02:33 UTC
Permalink
Hi Jan,
Post by Jan Neuhäußer
some weeks ago I followed a discussion on this list ("Using mISDN with
recent asterisk and Debian") that encouraged me trying to get asterisk
working on a raspberrypi together with mISDN, CAPI and chan_capi.
one more thing: Do you plan to use mISDNuserd to drive an old ISDN telephone
or do you want to use VoIP phone + asterisk + a ISDN telephone line?

mISDNuserd does not support the "NT" (=server mode) yet
to drive a local ISDN bus. chan_capi supports the NT mode,
but mISDNuserd is not compatible with that yet.

Last week I ordered a cheap 4 port Dialogic ISDN PCI card from ebay
so I can play around with a working chan_capi + asterisk. The Dialogic cards
have an own CAPI stack independent of mISDNuserd. If that works fine, I want
to look into adding NT mode to mISDNuserd, it shouldn't be too hard.
No ETA on anything though ;)

Cheers,
Thomas
Jan Neuhäußer
2017-09-20 20:57:37 UTC
Permalink
Hi Thomas,
Post by Maciej S. Szmigiero
Hi Jan,
Post by Jan Neuhäußer
some weeks ago I followed a discussion on this list ("Using mISDN with
recent asterisk and Debian") that encouraged me trying to get asterisk
working on a raspberrypi together with mISDN, CAPI and chan_capi.
one more thing: Do you plan to use mISDNuserd to drive an old ISDN telephone
or do you want to use VoIP phone + asterisk + a ISDN telephone line?
I plan to use a VoIP softphone with asterisk and a ISDN telephone line = internal S0 bus behind the existing old ISDN T-concept XI420 telephone system.

So I think the TE mode will be the right setting for me.

Cheers,
Jan
Thomas Jarosch
2017-09-21 07:48:09 UTC
Permalink
Hi Jan,
Post by Jan Neuhäußer
Post by Thomas Jarosch
one more thing: Do you plan to use mISDNuserd to drive an old ISDN
telephone or do you want to use VoIP phone + asterisk + a ISDN telephone
line?
I plan to use a VoIP softphone with asterisk and a ISDN telephone line =
internal S0 bus behind the existing old ISDN T-concept XI420 telephone
system.
So I think the TE mode will be the right setting for me
yes, the TE mode works in your case. At least for a year or so
until the Deutsche Telekom will cancel your ISDN line :o)

Your analysis regarding the CAPI library is also correct,
you need the one supplied by isdn4-utils.

When I run "strace capiinfo", it first checks for /dev/capi20
and then opens the mISDNuserd socket in /var/run/mISDNcapid/sock:

open("/dev/capi20", O_RDWR) = 4
ioctl(4, CAPI_INSTALLED, 0) = -1 ENXIO (No such device or address)
socket(PF_FILE, SOCK_SEQPACKET, 0) = 5
connect(5, {sa_family=AF_FILE, path="/var/run/mISDNcapid/sock"}, 110) = 0

Cheers,
Thomas
Jan Neuhäußer
2017-09-27 20:47:47 UTC
Permalink
Dears,
Post by Maciej S. Szmigiero
Hi Jan,
Your analysis regarding the CAPI library is also correct,
you need the one supplied by isdn4-utils.
When I run "strace capiinfo", it first checks for /dev/capi20
open("/dev/capi20", O_RDWR) = 4
ioctl(4, CAPI_INSTALLED, 0) = -1 ENXIO (No such device or address)
socket(PF_FILE, SOCK_SEQPACKET, 0) = 5
connect(5, {sa_family=AF_FILE, path="/var/run/mISDNcapid/sock"}, 110) = 0
Cheers,
Thomas
Now "module load chan_capi.so" looks at two locations within the dev-tree and then tries to connect to the mISDNcapid socket, but gets the response "permission denied". Snippets from strace:

open("/dev/capi20", O_RDWR) = -1 ENOENT (No such file or directory)
open("/dev/isdn/capi20", O_RDWR) = -1 ENOENT (No such file or directory)

socket(PF_LOCAL, SOCK_SEQPACKET, 0) = 19
connect(19, {sa_family=AF_LOCAL, sun_path="/run/mISDNcapid/sock"}, 110) = -1 EACCES (Permission denied)
close(19) = 0

(/var/run or /run makes no difference, one is a softlink to the other, (/var/run -> /run) )

The rights on the socket were as follows:

***@raspbx:/run/mISDNcapid# ls -l
insgesamt 0
srw-rw-rw- 1 root dialout 0 Sep 26 21:34 sock

Still asterisk is member of group dialout.

The strace of capiinfo looks similar, only it uses fd 4:

socket(PF_LOCAL, SOCK_SEQPACKET, 0) = 4
connect(4, {sa_family=AF_LOCAL, sun_path="/run/mISDNcapid/sock"}, 110) = 0


Any ideas?
@Thomas: what are the permissions of the socket on your system, and owner/group?



You may find the full strace for pid 3371 below.

Cheers,
Jan


[pid 3371] poll([{fd=24, events=POLLIN}, {fd=25, events=POLLIN}], 2, -1 <unfinished ...>
[pid 3371] <... poll resumed> ) = 1 ([{fd=24, revents=POLLIN}])
[pid 3371] read(24, "module load chan_capi.so\0", 512) = 25
[pid 3371] getsockopt(24, SOL_SOCKET, SO_PEERCRED, {pid=3370, uid=0, gid=0}, [12]) = 0
[pid 3371] open("/usr/lib/asterisk/modules/chan_capi.so", O_RDONLY|O_CLOEXEC) = 19
[pid 3371] read(19, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250i\0\0004\0\0\0"..., 512) = 512
[pid 3371] lseek(19, 897424, SEEK_SET) = 897424
[pid 3371] read(19, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1440) = 1440
[pid 3371] lseek(19, 298479, SEEK_SET) = 298479
[pid 3371] read(19, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\24\1\25"..., 47) = 47
[pid 3371] fstat64(19, {st_mode=S_IFREG|0755, st_size=898864, ...}) = 0
[pid 3371] mmap2(NULL, 365220, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 19, 0) = 0x7429b000
[pid 3371] mprotect(0x742e2000, 65536, PROT_NONE) = 0
[pid 3371] mmap2(0x742f2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 19, 0x47000) = 0x742f2000
[pid 3371] mmap2(0x742f4000, 676, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x742f4000
[pid 3371] close(19) = 0
[pid 3371] munmap(0x7429b000, 365220) = 0
[pid 3371] open("/usr/lib/asterisk/modules/chan_capi.so", O_RDONLY|O_CLOEXEC) = 19
[pid 3371] read(19, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250i\0\0004\0\0\0"..., 512) = 512
[pid 3371] lseek(19, 897424, SEEK_SET) = 897424
[pid 3371] read(19, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1440) = 1440
[pid 3371] lseek(19, 298479, SEEK_SET) = 298479
[pid 3371] read(19, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\24\1\25"..., 47) = 47
[pid 3371] fstat64(19, {st_mode=S_IFREG|0755, st_size=898864, ...}) = 0
[pid 3371] mmap2(NULL, 365220, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 19, 0) = 0x7429b000
[pid 3371] mprotect(0x742e2000, 65536, PROT_NONE) = 0
[pid 3371] mmap2(0x742f2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 19, 0x47000) = 0x742f2000
[pid 3371] mmap2(0x742f4000, 676, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x742f4000
[pid 3371] close(19) = 0
[pid 3371] stat64("/etc/asterisk/capi.conf", {st_mode=S_IFREG|0664, st_size=972, ...}) = 0
[pid 3371] open("/etc/asterisk/capi.conf", O_RDONLY|O_LARGEFILE) = 19
[pid 3371] gettimeofday({1506458386, 231984}, NULL) = 0
[pid 3371] gettid() = 3371
[pid 3371] futex(0x25daec, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x25dae8, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
[pid 3371] futex(0x2457d8, FUTEX_WAKE_PRIVATE, 1) = 1
[pid 3371] fstat64(19, <unfinished ...>
[pid 3371] <... fstat64 resumed> {st_mode=S_IFREG|0664, st_size=972, ...}) = 0
[pid 3371] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 <unfinished ...>
[pid 3371] <... mmap2 resumed> ) = 0x76f89000
[pid 3371] read(19, <unfinished ...>
[pid 3371] <... read resumed> ";\n; CAPI config\n;\n;\n\n; general s"..., 4096) = 972
[pid 3371] read(19, <unfinished ...>
[pid 3371] <... read resumed> "", 4096) = 0
[pid 3371] close(19 <unfinished ...>
[pid 3371] <... close resumed> ) = 0
[pid 3371] munmap(0x76f89000, 4096 <unfinished ...>
[pid 3371] <... munmap resumed> ) = 0
[pid 3371] write(2, " capi20.c: 164 "..., 51) = 51
[pid 3371] write(2, "Already initialized\n", 20) = 20
[pid 3371] open("/etc/capi20.conf", O_RDONLY) = 19
[pid 3371] fstat64(19, {st_mode=S_IFREG|0644, st_size=773, ...}) = 0
[pid 3371] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76f89000
[pid 3371] read(19, "# This is a example config file "..., 4096) = 773
[pid 3371] read(19, "", 4096) = 0
[pid 3371] close(19) = 0
[pid 3371] munmap(0x76f89000, 4096) = 0
[pid 3371] write(2, " capi20.c: 164 "..., 51) = 51
[pid 3371] write(2, "[capi20_isinstalled]: standard l"..., 55) = 55
[pid 3371] open("/dev/capi20", O_RDWR) = -1 ENOENT (No such file or directory)
[pid 3371] open("/dev/isdn/capi20", O_RDWR) = -1 ENOENT (No such file or directory)
[pid 3371] write(2, " capi20.c: 164 "..., 51) = 51
[pid 3371] write(2, "[capi20_isinstalled]: capi_fd: -"..., 34) = 34
[pid 3371] write(2, " capi20.c: 164 "..., 51) = 51
[pid 3371] write(2, "[capi20_isinstalled]: standard l"..., 52) = 52
[pid 3371] write(2, " capi20.c: 164 "..., 51) = 51
[pid 3371] write(2, "[capi20_isinstalled]: other loop"..., 52) = 52
[pid 3371] write(2, " capi20.c: 164 "..., 51) = 51
[pid 3371] write(2, "[capi20_isinstalled]: other loop"..., 49) = 49
[pid 3371] socket(PF_LOCAL, SOCK_SEQPACKET, 0) = 19
[pid 3371] connect(19, {sa_family=AF_LOCAL, sun_path="/run/mISDNcapid/sock"}, 110) = -1 EACCES (Permission denied)
[pid 3371] close(19) = 0
[pid 3371] write(2, " capi20.c: 164 "..., 51) = 51
[pid 3371] write(2, "[capi20_isinstalled]: capi_fd: -"..., 34) = 34
[pid 3371] write(2, " capi20.c: 164 "..., 51) = 51
[pid 3371] write(2, "[capi20_isinstalled]: CapiRegNot"..., 42) = 42
[pid 3371] gettimeofday({1506458386, 237801}, NULL) = 0
[pid 3371] gettid() = 3371
[pid 3371] futex(0x25daec, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x25dae8, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
[pid 3371] futex(0x2457d8, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
[pid 3371] <... futex resumed> ) = 0
[pid 3371] gettimeofday( <unfinished ...>
[pid 3371] <... gettimeofday resumed> {1506458386, 238431}, NULL) = 0
[pid 3371] gettid( <unfinished ...>
[pid 3371] <... gettid resumed> ) = 3371
[pid 3371] gettimeofday( <unfinished ...>
[pid 3371] <... gettimeofday resumed> {1506458386, 238892}, NULL) = 0
[pid 3371] gettimeofday( <unfinished ...>
[pid 3371] <... gettimeofday resumed> {1506458386, 239087}, NULL) = 0
[pid 3371] poll([{fd=24, events=POLLOUT}], 1, 100 <unfinished ...>
[pid 3371] <... poll resumed> ) = 1 ([{fd=24, revents=POLLOUT}])
[pid 3371] write(24, "Loaded chan_capi.so\n", 20 <unfinished ...>
[pid 3371] <... write resumed> ) = 20
[pid 3371] gettimeofday( <unfinished ...>
[pid 3371] <... gettimeofday resumed> {1506458386, 239988}, NULL) = 0
[pid 3371] poll([{fd=24, events=POLLIN}, {fd=25, events=POLLIN}], 2, -1 <unfinished ...>
[pid 3371] <... poll resumed> ) = 1 ([{fd=25, revents=POLLIN}])
[pid 3371] read(25, <unfinished ...>
[pid 3371] <... read resumed> "\375Parsing '/etc/asterisk/capi.con"..., 512) = 218
[pid 3371] getsockopt(25, SOL_SOCKET, SO_PEERCRED, {pid=1835, uid=1000, gid=1000}, [12]) = 0
[pid 3371] write(24, "\375Parsing '/etc/asterisk/capi.con"..., 218) = 218
[pid 3371] poll([{fd=24, events=POLLIN}, {fd=25, events=POLLIN}], 2, -1 <unfinished ...>
Maciej S. Szmigiero
2017-09-27 21:50:25 UTC
Permalink
Hi Jan,
Post by Jan Neuhäußer
Dears,
(..)
Post by Jan Neuhäußer
socket(PF_LOCAL, SOCK_SEQPACKET, 0) = 19
connect(19, {sa_family=AF_LOCAL, sun_path="/run/mISDNcapid/sock"}, 110) = -1 EACCES (Permission denied)
close(19) = 0
(/var/run or /run makes no difference, one is a softlink to the other, (/var/run -> /run) )
insgesamt 0
srw-rw-rw- 1 root dialout 0 Sep 26 21:34 sock
Still asterisk is member of group dialout.
You can also check permissions of /run/mISDNcapid directory itself,
if this does not help then check if supplementary group list of the asterisk
process includes the dialout group, that is, if id of this group is in "Groups:"
line of /proc/PID/status (but because this socket has rw access also for other users
only the parent directory permissions should matter).

I remember there was a bug (at least on Gentoo) that Asterisk was being started
without any supplementary groups.

Otherwise, it might be something like SELinux blocking the access?
Post by Jan Neuhäußer
Cheers,
Jan
Maciej
Jan Neuhäußer
2017-10-03 20:42:36 UTC
Permalink
Hi Maciej,
Post by Maciej S. Szmigiero
Hi Jan,
Post by Jan Neuhäußer
Dears,
(..)
Post by Jan Neuhäußer
socket(PF_LOCAL, SOCK_SEQPACKET, 0) = 19
connect(19, {sa_family=AF_LOCAL, sun_path="/run/mISDNcapid/sock"}, 110) = -1 EACCES (Permission denied)
close(19) = 0
insgesamt 0
srw-rw-rw- 1 root dialout 0 Sep 26 21:34 sock
Still asterisk is member of group dialout.
You can also check permissions of /run/mISDNcapid directory itself,
Thanks for that hint, I changed the permissions of the directory and had success, but I had to set owner and group to asterisk:

After mISDNcapid started I found permissions 750, owner root, group dialout. Neither 770 nor 777 was successfull. At the end I created the directory before starting mISDNcapid, changed the permissions to 770 and the ownership to asterisk.asterisk.
Post by Maciej S. Szmigiero
if this does not help then check if supplementary group list of the asterisk
process includes the dialout group, that is, if id of this group is in "Groups:"
line of /proc/PID/status
Didn't check that, because the above helped.

Cheers,
Jan

Loading...