Comments (31)
@felipecrs just did.
I'll let you know the results as soon as I run some tests.
Thanks
from asterisk-hass-addons.
I can confirm it's fixed (as well as the friendly_name
instead of id
fix)
from asterisk-hass-addons.
Just place the file at /config/asterisk/custom/manager.conf, which will always have precedence.
https://github.com/TECH7Fox/asterisk-hass-addons/blob/main/asterisk/DOCS.md#configuring-asterisk
from asterisk-hass-addons.
@felipecrs that's exactly what I did, maybe it wasn't clear.
By placing at /config/asterisk/custom/manager.conf
the file is rewritten whenever the container is restarted.
from asterisk-hass-addons.
I see. This feature was introduced in v3:
- You can now override/customize any Asterisk files (previously, the auto-generated Asterisk files could not be overriden).
https://github.com/TECH7Fox/asterisk-hass-addons/blob/main/asterisk/CHANGELOG.md#300
I'll try to reproduce it later.
from asterisk-hass-addons.
Code_fOd3ECAr19.mp4
It's working fine for me. The add-on may take a few seconds after initialization to properly replace the file.
from asterisk-hass-addons.
Thanks @felipecrs , I learned something new today...
- I'm using
docker-compose
to initialize all my containers and services (I have a cluster); - If I use
docker-compose down
and thendocker-compose up -d
then everything works as expected and the document is not changed back to defaults; - But I was using
docker-compose restart asterisk
and in this case the file IS ACTUALLY rewritten with the default.
What I didn't know, and learned today, is that down
+up
commands works differently than restart
, in docker.
I was using restart
for convenience, because as I was adjusting the asterisk settings, so I wanted to restart only the Asterisk container with the new values, but without necessarily having to shut down my entire cluster, which is what happens with "down".
Here's a note for the future, if you're having the same problem, don't use docker-compose restart [...]
However, I will not close this thread (I leave that to the owner's discretion) as I believe there is room for improvement
cc: @TECH7Fox
from asterisk-hass-addons.
I see. This is actually normal for this image. We use s6-overlay and the initialization scripts are executed as part of cont-init.d. cont-init.d only runs once per container, and that's why restart doesn't trigger it.
This is completely fine for add-on users, because when you click Restart, Supervisor would in fact destroy the container and create another.
And yeah, it would not hurt having this explained in the documentation.
from asterisk-hass-addons.
I'm closing this for now, but PRs to improve documentation are always welcome.
from asterisk-hass-addons.
by @netsoft-ruidias at #310:
I'm reopening this issue again (I can't reopen the original) because I have news and there is actually a BUG that must be fixed.
Note
For more context on what's going on, take a look at the original issue: #309
- If I use
docker-compose down
and thendocker-compose up -d
then everything works as expected and the file is not changed back to defaults;- If I use
docker-compose restart
the file IS ACTUALLY rewritten with the default values, losing all customizations;- If I have a power outage, when the container starts, the file IS ACTUALLY rewritten with the default values, losing all customizations.
✔️ The first point is (obviously) not a problem because it is the expected behavior ✖️ The second point is a problem but there is a workaround, don't run that command ❌ The third point is a MAJOR problem and happens because docker compose is a service that starts at machine startup, and the container definition declares
restart: unless-stopped
For context, this is my docker-compose yaml:
version: '3.9' services: (...)other services(...) asterisk: container_name: asterisk image: ghcr.io/tech7fox/asterisk-hass-addon:main build: context: ./asterisk tty: true network_mode: host environment: TZ: 'Europe/Lisbon' # Required to get the list of persons from Home Assistant HA_TOKEN: "--REDACTED--" HA_URL: 'https://xxxx.xxx.com' dns: - 192.168.1.2 - 8.8.8.8 - 8.8.4.4 volumes: - /srv/homeassistant/config/asterisk:/config - /srv/homeassistant/config/www/sounds:/media - /srv/homeassistant/config/ssl:/ssl restart: unless-stopped (...)other services(...)
from asterisk-hass-addons.
I see your point.
A note to myself or anyone else looking into this: it looks like s6-overlay is not executing cont-init.d
on container restart, but I don't know if this is intended or not.
from asterisk-hass-addons.
I'm also seeing this - there's no way to persist my changes to manager.conf
(and I'm guessing it also applies to every generated config file, with the exception of the sip configuration files that have separate -custom
files).
from asterisk-hass-addons.
@OnFreund workaround is to delete the container and recreate it rather than just restarting it.
from asterisk-hass-addons.
Wouldn't deleting the container execute cont-init.d
again and overwrite my changes?
from asterisk-hass-addons.
cont-init.d will never delete /config/asterisk/custom.
from asterisk-hass-addons.
If you are using docker compose, you can use docker compose up --force-recreate
.
from asterisk-hass-addons.
cont-init.d will never delete /config/asterisk/custom.
It does - that's exactly the problem we're describing here. I think it's because of the links - it's editing the file in /etc/asterisk/
, which is a link to the file in /config/asterisk/custom/
, thereby overwriting the latter.
from asterisk-hass-addons.
Not sure if I understood. Deleting a symlink (/etc/asterisk/yourfile) doesn't delete the original file (/config/asterisk/custom/yourfile).
from asterisk-hass-addons.
It doesn't delete the file, it overwrites it
from asterisk-hass-addons.
How come? cont-init.d never writes anything to /config/asterisk/custom. It only writes to /config/asterisk/default.
from asterisk-hass-addons.
How come? cont-init.d never writes anything to /config/asterisk/custom. It only writes to /config/asterisk/default.
It doesn't write to /config/asterisk/default/
, it writes to /etc/asterisk/
from asterisk-hass-addons.
Surely it writes to /etc/asterisk, what's the problem with that?
from asterisk-hass-addons.
That /etc/asterisk/manger.conf
is a link to /config/asterisk/custom/manager.conf
, so the latter gets overwritten.
from asterisk-hass-addons.
You mean /etc/asterisk/manger.conf gets overwritten by a link to /config/asterisk/custom/manager.conf?
from asterisk-hass-addons.
No no.
- Create
/config/asterisk/custom/manager.conf
/etc/asterisk/manger.conf
gets turned to a link to/config/asterisk/custom/manager.conf
- Restart the container
- Tempio executes, trying to overwrite
/etc/asterisk/manger.conf
- Because it's just a link to
/config/asterisk/custom/manager.conf
, the latter is the file that actually gets overwritten - Your changes are lost
from asterisk-hass-addons.
Oh, you nailed it. That's what's causing this issue then. Thank you, the fix should be simple.
Anyway, for now simply recreate the container rather than restart it. This way, there will be no symlink when tempio executes.
from asterisk-hass-addons.
Oh, interesting. However, as @netsoft-ruidias mentioned, we can't control this during a reboot or restart of the docker service.
I can avoid calling docker compose restart
, but I can't avoid the other scenarios, and the impact is quite severe - you lose all of your custom config.
from asterisk-hass-addons.
I think a solution could be:
- The target for tempio is always
/config/asterisk/default/
/etc/asterisk/manager.conf
(and same goes for other files) symlinks to/config/asterisk/custom/manager.conf
if it exists, otherwise to/config/asterisk/default/manager.conf
from asterisk-hass-addons.
I think #323 is a simpler solution.
from asterisk-hass-addons.
Cool. Hope we can get a release out soon
from asterisk-hass-addons.
@OnFreund @netsoft-ruidias please try again with 4.2.1.
from asterisk-hass-addons.
Related Issues (20)
- Add TFTPD option HOT 10
- No audio when outside my LAN HOT 2
- /config/asterisk/default/pjsip_custom.conf is purged at addon restart HOT 4
- stuff from custom does not make it to default HOT 5
- Asterisk GUI HOT 4
- Help needed: Install addon with docker-compose (without supervisor) HOT 5
- BUG: Can't edit the allowed networks for Manager login HOT 1
- rtsp-app not available on Pi builds HOT 10
- ARM support for app_rtsp_sip HOT 4
- Addon watchdog HOT 3
- No conifg.json file in ~/config/ HOT 10
- Suddenly no longer starting HOT 3
- Use `friendly_name` instead of `id` as the caller id HOT 3
- Cannot start in container mode HOT 2
- Doorbell parking extension does not work HOT 1
- Generate a call from HA ? HOT 6
- Error when upgrading to latest version HOT 2
- Can I use also a Dahua VTH monitor?
- Using asterisk addon with chan HW device drivers HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asterisk-hass-addons.