Hello all.
I’m in one step of running Asterisk Realtime.
I’m setting up connection with PostgreSQL via ODBC. Asterisk 1.8.13.
In general, everything works - sip peers are stored in the database. I just wonder if it is normal - when I change the password for my sip-phone in the database, the phone still works well; then I tried to do ‘sip reload’. The phone still works well, even when the ‘sip show users’ showed the new password.
The phone stopped working only after reboot (or , as I think, after re-registration, but I haven’t tried because of much time to wait before it re-registers).
I just compare all these with static text file configuration: when you change peer’s password and do ‘sip reload’, the phone will not work. And now - I have to wait for some time, right ?
ADDED: re-registration haven’t changed anything, the phone still works despite changing the secret in Postgres database. But if I reboot it, it will detect that the passord inside it differs from the password, specified in the database.
All in all, everything is not so bad, but only one thing.
If I need to disable some account, I don’t have an opportunity to do it quickly. I will change a secret in database. I can do ‘sip reload’. But the phone will still work, until being rebooted.
If to compare this with a traditional configuration from text files, it seemes to be not so nice: it’s enough to do ‘sip reload’ after editing sip.conf to quickly disable some phone account.
I’m assuming, You have rtcachefriends=yes in Your sip.conf (general) ?
In this (standard) case for realtime changed properties in the database will only propageted in case of
[ul]asterisk restart
issuing either sip prune realtime all or sip prune realtime peer in the asterisk cli[/ul]
It could be automated by using a database trigger filling up a change info for a peer to another table which would be read from a simple shell script (running every minute via cron) issuing the asterisk cli command.
Alternatively You may set rtcachefriends=no in Your sip.conf (general) and all changes in the database should be propagated immediately (which means in Your case: Client may non re-register on password change)
I’ve read that we have to specify ‘rtcachefriends=yes’ in case of using ARA, that’s why I followed this advice. I’ll try to play with this option once again and be more careful to notice changes.
And I totally forgot about ‘sip prune …’ , thanks for remind.
[quote=“abw1oim”]
Alternatively You may set rtcachefriends=no in Your sip.conf (general) and all changes in the database should be propagated immediately (which means in Your case: Client may non re-register on password change)[/quote]
Setting it to ‘no’ haven’t helped much. 18 minutes left from changing the secret in the database to understanding it by sip-phone.
And there’s also no opportunity to see the peer’s status and peer’s information from the Asterisk CLI.
So, I think in my case dynamic realtime is not so nice for being used.
But anyway, tnaks to everybody for the discussion.
Noticed that the phone tries to register every 20 minutes. Cisco SPA 303.
And there’s the real problem: Any change to a sip-account regarding account-date comes into effect due to re-registration. Set the registration interval to a value lower the 20 minutes and You’ll see the effect.
The effect could not be the same:
A sip reload in config-files is equvivalent to a sip prune realtime all or sip prune realtime peer and just changes the sip-configuration in asterisk (or only the per specific one) (and drops existing registrations).
The Re-Register of the phone is anyhow not effected.
Is there any script to import data from text config files to the PostgreSQL database?
I created the DB table like shown in /asterisk-11.x.0/contrib/realtime/postgresql (pastebin.com/vhkw7cwX)
In several .conf files I have about 600 peers. Not very nice work to fill the table manually.
UPDATE: the problem is partly solved (a collegue gave me a ready txt file with ‘INSERT INTO …’). Not all table columns though, but now it’s time to use sed, so I hope I’ll come with it.
One more question appeared.
How to use ‘setvar’ with realtime?
There is no such a column in the table structure. Of course it is possible to leave such peers (I don’t have many such peers) in text config file, as Asterisk can use both text and database configuration.