Hi all. I have a problem with realtime usage in asterisk 15.1.2.
And i want to save my config in postgres DB
I have install odbc driver and postgres DB, configure files
/etc/odbc.ini,
[Pg-aster-conf]
Description = PostgreSQL connection to 'asterisk' database
Driver = PostgreSQL
Database = asterisk
Servername = localhost
Port = 5432
Protocol = 9.2
ReadOnly = No
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No
ConnSettings =
/etc/asterisk/res_odbc.conf,
[asterisk-conf]
enabled => yes
dsn => Pg-aster-conf
username => asterisk
password => asterisk
pre-connect => yes
max_connections => 100
/etc/asterisk/extconfig.conf
[settings]
sipusers => odbc,asterisk-conf,sippeers
sippeers => odbc,asterisk-conf,sippeers
sipregs => odbc,asterisk-conf,sippeers
extensions => odbc,asterisk-conf,extensions
/etc/asterisk/extensions.conf
[outcoling]
exten => _XXXX,1,Dial(SIP/${EXTEN},,m)
switch => Realtime/sipusers@sippeers
switch => Realtime/sippeers@sippeers
switch => Realtime/sipregs@sippeers
switch => Realtime/extensions@extensions
I have created DB tables from src script contrib/realtime/postgresql/postgresql_config.sql
Insert data into tables sippeers and extensions.
And when i try to call, in postgres log i see, that asterisk try to select exten and primary column from table sippeers and then from extension. In sippeers table there is no such column, and they are situated in table extension.
How can i make to use extension table ?
asterisk=> SELECT * FROM extensions;
id | context | exten | priority | app | appdata
----+-----------+-------+----------------------+------+-------------------
3 | outcoling | _XXXX | 1 | Dial | (SIP/${EXTEN},,m)
asterisk=> SELECT name, host,type,context,nat,callgroup,disallow,allow,callerid FROM sippeers;
name | host | type | context | nat | callgroup | disallow | allow | callerid
--------+---------+--------+-----------+-----+-----------+----------+-----------+---------------
agent3 | dynamic | friend | outcoling | no | 1 | all | alaw,ulaw | "1003" <1003>
agent1 | dynamic | friend | outcoling | no | 1 | all | alaw,ulaw | "1001" <1001>
agent2 | dynamic | friend | outcoling | no | 1 | all | alaw,ulaw | "1002" <1002>
(3 строки)
From postgresql log
СООБЩЕНИЕ: оператор: PREPARE "_PLAN0x7fb4a8007480"(char, char, char) as SELECT * FROM sippeers WHERE exten = $1 AND priority = $2 AND context = $3;EXECUTE "_PLAN0x7fb4a8007480"('h','1','sipusers')
ОШИБКА: колонка "exten" не существует (символ 81)
ОПЕРАТОР: PREPARE "_PLAN0x7fb4a8007480"(char, char, char) as SELECT * FROM sippeers WHERE exten = $1 AND priority = $2 AND context = $3;EXECUTE "_PLAN0x7fb4a8007480"('h','1','sipusers')
СООБЩЕНИЕ: оператор: PREPARE "_PLAN0x7fb4a8003310"(char, char, char) as SELECT * FROM sippeers WHERE exten LIKE $1 AND priority = $2 AND context = $3 ORDER BY exten;EXECUTE "_PLAN0x7fb4a8003310"('\\_%','1','sipusers')
ОШИБКА: колонка "exten" не существует (символ 81)
ОПЕРАТОР: PREPARE "_PLAN0x7fb4a8003310"(char, char, char) as SELECT * FROM sippeers WHERE exten LIKE $1 AND priority = $2 AND context = $3 ORDER BY exten;EXECUTE "_PLAN0x7fb4a8003310"('\\_%','1','sipusers')
СООБЩЕНИЕ: оператор: PREPARE "_PLAN0x7fb4a8002660"(char, char, char) as SELECT * FROM sippeers WHERE exten = $1 AND priority = $2 AND context = $3;EXECUTE "_PLAN0x7fb4a8002660"('h','1','sippeers')
ОШИБКА: колонка "exten" не существует (символ 81)
ОПЕРАТОР: PREPARE "_PLAN0x7fb4a8002660"(char, char, char) as SELECT * FROM sippeers WHERE exten = $1 AND priority = $2 AND context = $3;EXECUTE "_PLAN0x7fb4a8002660"('h','1','sippeers')
СООБЩЕНИЕ: оператор: PREPARE "_PLAN0x7fb4a8002660"(char, char, char) as SELECT * FROM sippeers WHERE exten LIKE $1 AND priority = $2 AND context = $3 ORDER BY exten;EXECUTE "_PLAN0x7fb4a8002660"('\\_%','1','sippeers')
ОШИБКА: колонка "exten" не существует (символ 81)
ОПЕРАТОР: PREPARE "_PLAN0x7fb4a8002660"(char, char, char) as SELECT * FROM sippeers WHERE exten LIKE $1 AND priority = $2 AND context = $3 ORDER BY exten;EXECUTE "_PLAN0x7fb4a8002660"('\\_%','1','sippeers')
СООБЩЕНИЕ: оператор: PREPARE "_PLAN0x7fb4a8004dd0"(char, char, char) as SELECT * FROM sippeers WHERE exten = $1 AND priority = $2 AND context = $3;EXECUTE "_PLAN0x7fb4a8004dd0"('h','1','sipregs')
ОШИБКА: колонка "exten" не существует (символ 81)
ОПЕРАТОР: PREPARE "_PLAN0x7fb4a8004dd0"(char, char, char) as SELECT * FROM sippeers WHERE exten = $1 AND priority = $2 AND context = $3;EXECUTE "_PLAN0x7fb4a8004dd0"('h','1','sipregs')
СООБЩЕНИЕ: оператор: PREPARE "_PLAN0x7fb4a8002660"(char, char, char) as SELECT * FROM sippeers WHERE exten LIKE $1 AND priority = $2 AND context = $3 ORDER BY exten;EXECUTE "_PLAN0x7fb4a8002660"('\\_%','1','sipregs')
ОШИБКА: колонка "exten" не существует (символ 81)
ОПЕРАТОР: PREPARE "_PLAN0x7fb4a8002660"(char, char, char) as SELECT * FROM sippeers WHERE exten LIKE $1 AND priority = $2 AND context = $3 ORDER BY exten;EXECUTE "_PLAN0x7fb4a8002660"('\\_%','1','sipregs')
СООБЩЕНИЕ: оператор: PREPARE "_PLAN0x7fb4a8002660"(char, char, char) as SELECT * FROM extensions WHERE exten = $1 AND priority = $2 AND context = $3;EXECUTE "_PLAN0x7fb4a8002660"('h','1','extensions')
СООБЩЕНИЕ: продолжительность: 0.275 мс
СООБЩЕНИЕ: оператор: DEALLOCATE "_PLAN0x7fb4a8002660"
СООБЩЕНИЕ: продолжительность: 0.066 мс
СООБЩЕНИЕ: оператор: PREPARE "_PLAN0x7fb4a8002660"(char, char, char) as SELECT * FROM extensions WHERE exten LIKE $1 AND priority = $2 AND context = $3 ORDER BY exten;EXECUTE "_PLAN0x7fb4a8002660"('\\_%','1','extensions')
*CLI> sip show peers
Name/username Host Dyn Forcerport Comedia ACL Port Status Description Realtime
agent1/agent1 192.168.161.12 D No No 22869 OK (5 ms) Cached RT
agent2/agent2 192.168.134.93 D No No 43835 OK (52 ms) Cached RT
agent3/agent3 192.168.156.30 D No No 65072 OK (5 ms) Cached RT
3 sip peers [Monitored: 3 online, 0 offline Unmonitored: 0 online, 0 offline]