ugoviti / izpbx

izPBX is a Turnkey Cloud Native Telephony System powered by Asterisk Engine and FreePBX Management GUI
GNU General Public License v3.0
168 stars 69 forks source link

chan_dongle support #47

Closed ahmeaqas closed 1 year ago

ahmeaqas commented 1 year ago

Hello @ugoviti,

What a great project, I congratulate you for making Asterisk and FreeBPX install such easy.

I have just grabbed release 20.16.5, unzipped it and copied default.env to .env and deploy it using docker compose on a PC with fresh install of UBUNTU 20.04.

Containers are up and running with no error. As per changelog, Chan_dongle is supported since 18.16.10.

But I have accessed the asterisk CLI of the container but core show help does not show dongle supported commands.

May you please put light on further steps to go on?

luzrain commented 1 year ago

You need to create dongle.conf file in ./data/izpbx/etc/asterisk directory.

ahmeaqas commented 1 year ago

Thank you so much @luzrain for your help. Now I have one more issue,

WARNING[1238]: chan_dongle.c:229 opentty: unable to open /dev/ttyUSB2: Permission

ugoviti commented 1 year ago

WARNING[1238]: chan_dongle.c:229 opentty: unable to open /dev/ttyUSB2: Permission

Hi, if you enter inside the container the file /dev/ttyUSB2 exist? permissions? can you print ls -al /dev/ttyUSB2

Thank you

ahmeaqas commented 1 year ago

ls -al /dev/ttyUSB2

produce following output

crw-rw---- 1 root games 188, 2 Mar 22 14:52 /dev/ttyUSB2

ahmeaqas commented 1 year ago

This is my docker compose file

`version: '3'

networks: izpbx: driver: bridge

if you want run other izpbx deploy in the same docker host enable the macvlan interface driver

izpbx-ext:

#driver: macvlan
#driver_opts:
  #parent: eth0
#ipam:
  #config:
  #- subnet: 10.1.1.0/24

services:

https://hub.docker.com/_/mariadb?tab=tags&page=1&ordering=last_updated

db:

current long term release

#image: docker.io/mariadb:10.11.2
# previous long term release
image: docker.io/mariadb:10.6.12
container_name: izpbx-db
## WARNING: if you upgrade image tag enter the container and run mysql_upgrade:
## source .env ; docker exec -it izpbx-db mysql_upgrade -u root -p$MYSQL_ROOT_PASSWORD
command: --sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
restart: unless-stopped
env_file:
- .env
environment:
- TZ
- MYSQL_DATABASE
- MYSQL_USER
- MYSQL_PASSWORD
- MYSQL_ROOT_PASSWORD
#- MARIADB_RANDOM_ROOT_PASSWORD=${MYSQL_RANDOM_ROOT_PASSWORD}
#- MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=${MYSQL_ALLOW_EMPTY_ROOT_PASSWORD}
volumes:
#- /etc/localtime:/etc/localtime:ro
- ./data/db:/var/lib/mysql
## NOTE: to avoid nat management use: 'network_mode: host'
#network_mode: host
## WARNING: if 'network_mode: host' is disabled, comment out the following lines
networks:
  izpbx:
## WARNING: if commented out, the database will be exposed outside the container
ports:
- ${APP_PORT_MYSQL}:3306

https://hub.docker.com/r/izdock/izpbx-asterisk/tags?page=1&ordering=last_updated

izpbx: image: docker.io/izdock/izpbx-asterisk:20.16.5 container_name: izpbx

group_add:

- dialout

- lock

devices:
  - /dev/ttyUSB0:/dev/ttyUSB1
  - /dev/ttyUSB0:/dev/ttyUSB2
#hostname: ${APP_FQDN}
restart: unless-stopped
depends_on:
- db
env_file:
- .env
volumes:
#- /etc/localtime:/etc/localtime:ro
- ./data/izpbx:/data
## fail2ban need privileged mode to manage iptables
cap_add:
- NET_ADMIN
#security_opt:
#- seccomp=unconfined
privileged: true
ulimits:
  nofile:
    soft: 8192
    hard: 32768
## NOTE: to avoid SIP-RTP NAT issues use: 'network_mode: host'
network_mode: host
## WARNING: if 'network_mode: host' is disabled, comment out the following lines
##          ports are not needed if using 'network_mode: host' or macvlan network driver
##          if you want use macvlan network driver comment out 'izpbx-ext:' too and change exposed IP according your needs
#networks:
# izpbx:
# izpbx-ext:
#   ipv4_address: 10.1.1.221
#ports:
#- ${APP_PORT_HTTP}:${APP_PORT_HTTP}
#- ${APP_PORT_HTTPS}:${APP_PORT_HTTPS}
#- ${APP_PORT_IAX}:${APP_PORT_IAX}
#- ${APP_PORT_IAX}:${APP_PORT_IAX}/udp
#- ${APP_PORT_PJSIP}:${APP_PORT_PJSIP}
#- ${APP_PORT_PJSIP}:${APP_PORT_PJSIP}/udp
#- ${APP_PORT_SIP}:${APP_PORT_SIP}/udp
#- ${APP_PORT_SIP}:${APP_PORT_SIP}
#- ${APP_PORT_WEBRTC}:${APP_PORT_WEBRTC}
#- ${APP_PORT_UCP_HTTP}:${APP_PORT_UCP_HTTP}
#- ${APP_PORT_UCP_HTTPS}:${APP_PORT_UCP_HTTPS}
#- ${APP_PORT_AMI}:${APP_PORT_AMI}
#- ${APP_PORT_RTP_START}-${APP_PORT_RTP_END}:${APP_PORT_RTP_START}-${APP_PORT_RTP_END}
#- ${APP_PORT_RTP_START}-${APP_PORT_RTP_END}:${APP_PORT_RTP_START}-${APP_PORT_RTP_END}/udp
#- ${APP_PORT_DHCP}:${APP_PORT_DHCP}/udp
#- ${APP_PORT_TFTP}:${APP_PORT_TFTP}
#- ${APP_PORT_TFTP}:${APP_PORT_TFTP}/udp
#- ${APP_PORT_NTP}:${APP_PORT_NTP}/udp
#- ${APP_PORT_FOP2}:${APP_PORT_FOP2}
#- ${APP_PORT_ZABBIX}:${APP_PORT_ZABBIX}`
ugoviti commented 1 year ago

ls -al /dev/ttyUSB2

produce following output

crw-rw---- 1 root games 188, 2 Mar 22 14:52 /dev/ttyUSB2

can you run:

(izPBX)[root@pbx.initzero: /]# id asterisk
uid=1000(asterisk) gid=1000(asterisk) groups=1000(asterisk),10(wheel),48(apache)

(izPBX)[root@pbx.initzero: /]# gpasswd -a asterisk games 
Adding user asterisk to group games

(izPBX)[root@pbx.initzero: /]# id asterisk
uid=1000(asterisk) gid=1000(asterisk) groups=1000(asterisk),10(wheel),20(games),48(apache)
supervisorctl restart izpbx

if works I must add asterisk users to games (in your distro)....

anyway can you print the GID number?

ls -aln /dev/ttyUSB2

tnx

ahmeaqas commented 1 year ago

I have run the following commands and it produces the same out.

(izPBX)[root@pbx.initzero: /]# id asterisk uid=1000(asterisk) gid=1000(asterisk) groups=1000(asterisk),10(wheel),48(apache)

(izPBX)[root@pbx.initzero: /]# gpasswd -a asterisk games Adding user asterisk to group games

(izPBX)[root@pbx.initzero: /]# id asterisk uid=1000(asterisk) gid=1000(asterisk) groups=1000(asterisk),10(wheel),20(games),48(apache)

Moreover,

ls -aln /dev/ttyUSB2 produces the following output

crw-rw---- 1 0 20 188, 2 Mar 22 14:52 /dev/ttyUSB2

I am still getting the same permission error.

ugoviti commented 1 year ago

ok, you must add asterisk user to group id: 188 (the games group from what env came from? ouside or inside izpbx docker container)

anyway try with:

id asterisk ; usermod -G wheel,apache,188 asterisk ; id asterisk
supervisorctl restart izpbx
ahmeaqas commented 1 year ago

the games group from what env came from? ouside or inside izpbx docker

inside izpx docker

Error experienced

id asterisk ; usermod -G wheel,apache,188 asterisk ; id asterisk

usermod: group '188' does not exist

ahmeaqas commented 1 year ago

I have resolved the issue. Hope this article will help someone else.