Помогите разобраться в синтаксисе правильном.
asterisk 12.7 +mariadb + odbc.
При звонке что бы подставлялись в Caller ID русские буквы из бд mariadb + odbc.
БД называется asterbook
В ней таблица addressbook с параматрами
Код: Выделить всё
CREATE TABLE addressbook (
phone_number VARCHAR(40),
name VARCHAR(40),
PRIMARY KEY(phone_number)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Код: Выделить всё
INSERT INTO addressbook VALUES ('86', 'Федор');
INSERT INTO addressbook VALUES ('85', 'Гриша');
INSERT INTO addressbook VALUES ('2099', 'Влад');
Код: Выделить всё
[RUSNAME]
dsn=asterbook
readsql=SELECT name FROM addressbook WHERE phone_number='${ARG1}'
если подставлять имена из mysql напрямую, то все гуд
Код: Выделить всё
exten => _[3-7-8-9]X,1,NoOp()
exten => _[3-7-8-9]X,n,Noop(Now Caller ID is ${CALLERID(all)} that mean CID name = ${CALLERID(name)} and CID num = ${CALLERID(num)})
exten => _[3-7-8-9]X,n,GotoIf($[${CALLERID(num)}>999 & ${CALLERID(num)}<4234]?avaya:noavaya)
exten => _[3-7-8-9]X,n(avaya),MYSQL(Connect connid localhost root *** asterbook)
exten => _[3-7-8-9]X,n(avaya),MYSQL(Query resultid ${connid} SELECT name FROM addressbook WHERE phone_number=${CALLERID(num)})
exten => _[3-7-8-9]X,n(avaya),MYSQL(Fetch fetchid ${resultid} name)
exten => _[3-7-8-9]X,n(avaya),Set(CALLERID(name)=${name})
exten => _[3-7-8-9]X,n(avaya),MYSQL(Clear ${resultid})
exten => _[3-7-8-9]X,n(avaya),MYSQL(Disconnect ${connid})
exten => _[3-7-8-9]X,n(avaya),Dial(SIP/${EXTEN},20)
exten => _[3-7-8-9]X,n(avaya),Hangup()
Код: Выделить всё
-- Executing [85@vnutri:1] NoOp("H323/ip$192.168.0.96:39075/24", "") in new stack
-- Executing [85@vnutri:2] NoOp("H323/ip$192.168.0.96:39075/24", "Now Caller ID is "????>85" <2099> that mean CID name = ????>85 and CID num = 2099") in new stack
-- Executing [85@vnutri:3] GotoIf("H323/ip$192.168.0.96:39075/24", "1?avaya:noavaya") in new stack
-- Goto (vnutricmtu,85,4)
-- Executing [85@vnutri:4] MYSQL("H323/ip$192.168.0.96:39075/24", "Connect connid localhost root *** asterbook") in new stack
-- Executing [85@vnutri:5] MYSQL("H323/ip$192.168.0.96:39075/24", "Query resultid 1 SELECT name FROM addressbook WHERE phone_number=2099") in new stack
-- Executing [85@vnutri:6] MYSQL("H323/ip$192.168.0.96:39075/24", "Fetch fetchid 2 name") in new stack
-- Executing [85@vnutri:7] Set("H323/ip$192.168.0.96:39075/24", "CALLERID(name)=Влад") in new stack
-- Executing [85@vnutri:8] MYSQL("H323/ip$192.168.0.96:39075/24", "Clear 2") in new stack
-- Executing [85@vnutri:9] MYSQL("H323/ip$192.168.0.96:39075/24", "Disconnect 1") in new stack
-- Executing [85@vnutri:10] Dial("H323/ip$192.168.0.96:39075/24", "SIP/85,20") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/85
-- SIP/85-00000058 is ringing
extensions.conf
Код: Выделить всё
exten => _[3-7-8-9]X,1,NoOp()
exten => _[3-7-8-9]X,n,Noop(Now Caller ID is ${CALLERID(all)} that mean CID name = ${CALLERID(name)} and CID num = ${CALLERID(num)})
exten => _[3-7-8-9]X,n,GotoIf($[${CALLERID(num)}>999 & ${CALLERID(num)}<4234]?avaya:noavaya)
exten => _[3-7-8-9]X,n(avaya),Set(CALLERID(name)=${ODBC_RUSNAME(${EXTEN})})
exten => _[3-7-8-9]X,n(avaya),Dial(SIP/${EXTEN},20)
exten => _[3-7-8-9]X,n(avaya),Hangup()
Код: Выделить всё
-- Executing [85@vnutricmtu:1] NoOp("H323/ip$192.168.0.96:39761/29", "") in new stack
-- Executing [85@vnutri:2] NoOp("H323/ip$192.168.0.96:39761/29", "Now Caller ID is "????>85" <2099> that mean CID name = ????>85 and CID num = 2099") in new stack
-- Executing [85@vnutri:3] GotoIf("H323/ip$192.168.0.96:39761/29", "1?avaya:noavaya") in new stack
-- Goto (vnutri,85,4)
-- Executing [85@vnutri:4] Set("H323/ip$192.168.0.96:39761/29", "CALLERID(name)=Гриша") in new stack
-- Executing [85@vnutri:5] Dial("H323/ip$192.168.0.96:39761/29", "SIP/85,20") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/85
-- SIP/85-0000005d is ringing