In default extconfig.conf file that comes with asterisk there is following comment:
; Realtime configuration engine
;
; maps a particular family of realtime
; configuration to a given database driver,
; database and table (or uses the name of
; the family if the table is not specified
;
;example => odbc,asterisk,alttable,1
;example => mysql,asterisk,alttable,2
;example2 => ldap,"dc=oxymium,dc=net",example2
;
; Additionally, priorities are now supported for use as failover methods
; for retrieving realtime data. If one connection fails to retrieve any
; information, the next sequential priority will be tried next. This
; especially works well with ODBC connections, since res_odbc now caches
; when connection failures occur and prevents immediately retrying those
; connections until after a specified timeout. Note: priorities must
; start at 1 and be sequential (i.e. if you have only priorities 1, 2,
; and 4, then 4 will be ignored, because there is no 3).
So I’ve tried to use this feature like this:
sipusers => pgsql,general,asterisk_sip_config
sippeers => pgsql,general,asterisk_sip_config
sipusers1 => pgsql,general,asterisk_sip_config2 ; this doesn't work even it should
sippeers1 => pgsql,general,asterisk_sip_config2 ; this doesn't work even it should
There is no table with name asterisk_sip_config2 in my database and I expect to see some errors when trying to connect with user that doesn’t exist in first table, though there is nothing in the logs apart “wrong password” message.
My final goal was to make asterisk use two databases as sources for sipusers and original idea was to do following:
sipusers1 => pgsql,staging,asterisk_sip_config
sippeers1 => pgsql,staging,asterisk_sip_config
sipusers2 => pgsql,nightly,asterisk_sip_config
sippeers2 => pgsql,nightly,asterisk_sip_config
I.e. if user is not found in first source it will be searched in second (as comment suggests). This is also paired with respective res_pgsql.conf file:
[nightly]
; ... here are first db config
[staging]
; ... here are second db config
Though res_config_pgsql.c
is clearly hard coded to only use “general” section and this idea was abandoned.
But this priority stuff - does it work at all? And if it does maybe I was somehow misinterpreted comment above and need to write configuration in some different way?