Настраивал АТС (оригинальный asterisk) в соответствии с wiki и этой темой http://www.telefon1c.ru/forum/forum18/topic779/messages/ Отличие в названии БД (asterisk вместо asteriskcdrdb) и таблицы (cdr вместо PT1C_cdr) При попытке получить историю в панели телефонии в консоли вижу следующее
-- Executing [10000555@miko_ajam:1] NoCDR("Local/10000555@miko_ajam-712e;2", "") in new stack -- Executing [10000555@miko_ajam:2] NoOp("Local/10000555@miko_ajam-712e;2", "internal calling application: 10000555 1C_CDR") in new stack -- Executing [10000555@miko_ajam:3] AGI("Local/10000555@miko_ajam-712e;2", "1C_CDR.php") in new stack -- Launched AGI Script /usr/share/asterisk/agi-bin/1C_CDR.php > 1C_CDR.php: Running SQL Command describe asterisk.cdr > 1C_CDR.php: Connected to MySQL database OK. > 1C_CDR.php: Sel ected database OK. 1C_CDR.php: SEVERE PROGRAMMING ERROR: For portability, COLUMNS must be surrounded by BACK TICKS (`), yet none were found. Continuing. 1C_CDR.php: SEVERE PROGRAMMING ERROR: For portability, FIELDS must be surrounded by SINGLE QUOTES ('), yet none were found. Continuing. > 1C_CDR.php: Running SQL Command SELECT > 1C_CDR.php: `a`.`calldate`, > 1C_CDR.php: `a`.`src`, > 1C_CDR.php: `a`.`dst`, > 1C_CDR.php: `a`.`channel`, > 1C_CDR.php: `a`.`dstchannel`, > 1C_CDR.php: `a`.`billsec`, > 1C_CDR.php: `a`.`disposition`, > 1C_CDR.php: `a`.`uniqueid`, > 1C_CDR.php: `a`.`recordingfile`, > 1C_CDR.php: `a`.`peer`, > 1C_CDR.php: `a`.`lastapp`, > 1C_CDR.php: `a`.`linkedid` > 1C_CDR.php: FR OM > 1C_CDR.php: (SEL ECT * fr om `asterisk`.`cdr` > 1C_CDR.php: > 1C_CDR.php: LEFT JOIN > 1C_CDR.php: > 1C_CDR.php: (SELECT `peer` AS `peer`, `linkedid` AS `link`, `uniqueid` AS `uid` > 1C_CDR.php: FR OM `asterisk`.`cel` > 1C_CDR.php: WHERE `eventtype`='BRIDGE_START' > 1C_CDR.php: ) AS `tmp_cel` > 1C_CDR.php: > 1C_CDR.php: ON > 1C_CDR.php: > 1C_CDR.php: (`asterisk`.`cdr`.`uniqueid` = `tmp_cel`.`link` OR `asterisk`.`cdr`.`uniqueid` = `tmp_cel`.`uid`) > 1C_CDR.php: > 1C_CDR.php: WHERE `calldate` BETWEEN '2014-12-05' AND '2014-12-06' ) > 1C_CDR.php: AS `a` > 1C_CDR.php: WH ERE (( `a`.`lastapp`='Transferred Call' AND `a`.`lastdata` like '%/200@%') > 1C_CDR.php: OR ((`a`.`lastapp`='Dial' OR `a`.`lastapp`='Queue') > 1C_CDR.php: AND (`a`.`channel` like '%/200-%' > 1C_CDR.php: OR `a`.`dstchannel` like '%/200-%' > 1C_CDR.php: OR `a`.`dstchannel` like '%/200@%' > 1C_CDR.php: OR `a`.`src`='200' > 1C_CDR.php: OR `a`.`dst`='200')) > 1C_CDR.php: OR (`a`.`peer` LIKE '%/200-%') > 1C_CDR.php: OR (`a`.`peer` LIKE '%/200@%') > 1C_CDR.php: )
Логи php Вы имеете ввиду те которые включаются php.ini? какой из php.ini используется cli или apache2?
В процессе попыток исправить эту проблему, получил новую, не могу понять чем вызвано, такое впечатление что в скрипт 1C_CDR передаются неправильные переменные
-- Executing [10000555@miko_ajam:1] NoCDR("Local/10000555@miko_ajam-fbea;2", "") in new stack -- Executing [10000555@miko_ajam:2] NoOp("Local/10000555@miko_ajam-fbea;2", "internal calling application: 10000555 1C_CDR") in new stack -- Executing [10000555@miko_ajam:3] AGI("Local/10000555@miko_ajam-fbea;2", "1C_CDR.php") in new stack -- Launched AGI Script /usr/share/asterisk/agi-bin/1C_CDR.php > 1C_CDR.php: Running SQL Command describe asterisk.cdr 1C_CDR.php: SEVERE: Unknown database type: 1C_CDR.php: SEVERE: Unable to connect to database. > 1C_CDR.php: Running SQL Command SEL ECT > 1C_CDR.php: `a`.`calldate`, > 1C_CDR.php: `a`.`src`, > 1C_CDR.php: `a`.`dst`, > 1C_CDR.php: `a`.`channel`, > 1C_CDR.php: `a`.`dstchannel`, > 1C_CDR.php: `a`.`billsec`, > 1C_CDR.php: `a`.`disposition`, > 1C_CDR.php: `a`.`uniqueid`, > 1C_CDR.php: `a`.`userfield`, > 1C_CDR.php: `a`.`peer`, > 1C_CDR.php: `a`.`lastapp`, > 1C_CDR.php: `a`.`linkedid` > 1C_CDR.php: FR OM > 1C_CDR.php: (SEL ECT * fr om `asterisk`.`cdr` > 1C_CDR.php: > 1C_CDR.php: LEFT JOIN > 1C_CDR.php: > 1C_CDR.php: (SELECT `peer` AS `peer`, `linkedid` AS `link`, `uniqueid` AS `uid` > 1C_CDR.php: FR OM `asterisk`.`cel` > 1C_CDR.php: WHERE `eventtype`='BRIDGE_START' > 1C_CDR.php: ) AS `tmp_cel` > 1C_CDR.php: > 1C_CDR.php: ON > 1C_CDR.php: > 1C_CDR.php: (`asterisk`.`cdr`.`uniqueid` = `tmp_cel`.`link` OR `asterisk`.`cdr`.`uniqueid` = `tmp_cel`.`uid`) > 1C_CDR.php: > 1C_CDR.php: WHERE `calldate` BETWEEN 'SIP/200' AND '2014-12-17' ) > 1C_CDR.php: AS `a` > 1C_CDR.php: WH ERE (( `a`.`lastapp`='Transferred Call' AND `a`.`lastdata` like '%/2014@%') > 1C_CDR.php: OR ((`a`.`lastapp`='Dial' OR `a`.`lastapp`='Queue') > 1C_CDR.php: AND (`a`.`channel` like '%/2014-%' > 1C_CDR.php: OR `a`.`dstchannel` like '%/2014-%' > 1C_CDR.php: OR `a`.`dstchannel` like '%/2014@%' > 1C_CDR.php: OR `a`.`src`='2014' > 1C_CDR.php: OR `a`.`dst`='2014')) > 1C_CDR.php: OR (`a`.`peer` LIKE '%/2014-%') > 1C_CDR.php: OR (`a`.`peer` LIKE '%/2014@%') > 1C_CDR.php: ) OR (( `a`.`lastapp`='Transferred Call' AND `a`.`lastdata` like '%/12@%') > 1C_CDR.php: OR ((`a`.`lastapp`='Dial' OR `a`.`lastapp`='Queue') > 1C_CDR.php: AND (`a`.`channel` like '%/12-%' > 1C_CDR.php: OR `a`.`dstchannel` like '%/12-%' > 1C_CDR.php: OR `a`.`dstchannel` like '%/12@%' > 1C_CDR.php: OR `a`.`src`='12' > 1C_CDR.php: OR `a`.`dst`='12')) > 1C_CDR.php: OR (`a`.`peer` LIKE '%/12-%') > 1C_CDR.php: OR (`a`.`peer` LIKE '%/12@%') > 1C_CDR.php: ) OR (( `a`.`lastapp`='Transferred Call' AND `a`.`lastdata` like '%/18@%') > 1C_CDR.php: OR ((`a`.`lastapp`='Dial' OR `a`.`lastapp`='Queue') > 1C_CDR.php: AND (`a`.`channel` like '%/18-%' > 1C_CDR.php: OR `a`.`dstchannel` like '%/18-%' > 1C_CDR.php: OR `a`.`dstchannel` like '%/18@%' > 1C_CDR.php: OR `a`.`src`='18' > 1C_CDR.php: OR `a`.`dst`='18')) > 1C_CDR.php: OR (`a`.`peer` LIKE '%/18-%') > 1C_CDR.php: OR (`a`.`peer` LIKE '%/18@%') > 1C_CDR.php: ) 1C_CDR.php: SEVERE: Unknown database type: 1C_CDR.php: SEVERE: Unable to connect to database. -- AGI Script Executing Application: (UserEvent) Options: (Refresh1CHistory,Channel:,Date:SIP/200) > Channel Local/10000555@miko_ajam-fbea;1 was answered. > Launching NoCDR() on Local/10000555@miko_ajam-fbea;1 -- <Local/10000555@miko_ajam-fbea;2>AGI Script 1C_CDR.php completed, returning 4 == Spawn extension (miko_ajam, 10000555, 3) exited non-zero on 'Local/10000555@miko_ajam-fbea;2'
Таблицы такие cdr ~81,859 InnoDB 43.1 МБ cel ~943,297 InnoDB 170.7 МБ
скопировал с ваших ресурсов еще раз файлы phpagi.php и 1C_CDR.php со своими коррективами и скрипт снова подключается к БД. С утра, когда звонков всего 2-3, отрабатывает и выдает в 1С историю
вывод в логах
[Dec 26 09:49:22] VERBOSE[4435] pbx.c: -- Executing [10000555@miko_ajam:1] NoCDR("Local/10000555@miko_ajam-171d;2", "") in new stack[Dec 26 09:49:22] VERBOSE[4435] pbx.c: -- Executing [10000555@miko_ajam:2] NoOp("Local/10000555@miko_ajam-171d;2", "internal calling application: 10000555 1C_CDR") in new stack [Dec 26 09:49:22] VERBOSE[4435] pbx.c: -- Executing [10000555@miko_ajam:3] AGI("Local/10000555@miko_ajam-171d;2", "1C_CDR.php") in new stack [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: -- Launched AGI Script /usr/share/asterisk/agi-bin/1C_CDR.php [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: Running SQL Command describe asterisk.cdr [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: Connected to MySQL database OK. [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: Sel ected database OK. [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: 1C_CDR.php: SEVERE PROGRAMMING ERROR: For portability, COLUMNS must be surrounded by BACK TICKS (`), yet none were found. Continuing. [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: 1C_CDR.php: SEVERE PROGRAMMING ERROR: For portability, FIELDS must be surrounded by SINGLE QUOTES ('), yet none were found. Continuing. [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: Running SQL Command SELECT [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`calldate`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`src`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`dst`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`channel`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`dstchannel`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`billsec`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`disposition`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`uniqueid`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`recordingfile`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`peer`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`lastapp`, [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: `a`.`linkedid` [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: FR OM [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: (SELECT * fr om `asterisk`.`cdr` [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: LEFT JOIN [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: (SELECT `peer` AS `peer`, `linkedid` AS `link`, `uniqueid` AS `uid` [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: FR OM `asterisk`.`cel` [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: WHERE `eventtype`='BRIDGE_START' [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: ) AS `tmp_cel` [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: ON [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: (`asterisk`.`cdr`.`uniqueid` = `tmp_cel`.`link` OR `asterisk`.`cdr`.`uniqueid` = `tmp_cel`.`uid`) [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: WH ERE `calldate` BETWEEN '2014-12-26' AND '2014-12-27' ) [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: AS `a` [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: WH ERE (( `a`.`lastapp`='Transferred Call' AND `a`.`lastdata` like '%/200@%') [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: OR ((`a`.`lastapp`='Dial' OR `a`.`lastapp`='Queue') [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: AND (`a`.`channel` like '%/200-%' [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: OR `a`.`dstchannel` like '%/200-%' [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: OR `a`.`dstchannel` like '%/200@%' [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: OR `a`.`src`='200' [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: OR `a`.`dst`='200')) [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: OR (`a`.`peer` LIKE '%/200-%') [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: OR (`a`.`peer` LIKE '%/200@%') [Dec 26 09:49:22] VERBOSE[4435] res_agi.c: > 1C_CDR.php: ) [Dec 26 09:49:23] VERBOSE[4424] res_agi.c: -- AGI Script Executing Application: (UserEvent) Options: (FromCDR,Channel:SIP/200,Date:2014-12-26,Lines:2014-12-26 09:49:15@.@200@.@200@.@SIP/200-00000002@.@SIP/200-00000003@.@0@.@NO ANSWER@ .@1419576555.14@.@@.@@.@Dial@.@1419576555.14@.@.....) [Dec 26 09:49:23] VERBOSE[4424] res_agi.c: -- AGI Script Executing Application: (UserEvent) Options: (Refresh1CHistory,Channel:SIP/200,Date:2014-12-26) [Dec 26 09:49:23] VERBOSE[4423] pbx.c: > Channel Local/10000555@miko_ajam-33cb;1 was answered. [Dec 26 09:49:23] VERBOSE[4446] pbx.c: > Launching NoCDR() on Local/10000555@miko_ajam-33cb;1 [Dec 26 09:49:23] VERBOSE[4424] res_agi.c: -- <Local/10000555@miko_ajam-33cb;2>AGI Script 1C_CDR.php completed, returning 4 [Dec 26 09:49:23] VERBOSE[4424] pbx.c: == Spawn extension (miko_ajam, 10000555, 3) exited non-zero on 'Local/10000555@miko_ajam-33cb;2'
но позже, когда звонков больше 3, уже не работает.