ВидеоКонф(ВКС)  ::   FAQ  ::   Поиск  ::   Регистрация  ::   Вход

CEL.conf , поле eventtime и необходимый формат

Новичком считается только что прочитавший «Астериск - будущее телефонии»
http://asterisk.ru/knowledgebase/books
и пытающийся сделать большее

Модераторы: april22, Zavr2008

CEL.conf , поле eventtime и необходимый формат

Сообщение andrewshkovskii » 12 ноя 2012, 11:10

В примере конфига явно указано,
что астер может писать CEL с форматом eventtime как секунды.микросенду, если не указан иной формат.
Так и поступил, исключил строку с dateformat из cel.conf, сделалй в таблице тип Double, результат - вместо времени, записывается 2012 в каждый ивент, т.е. - год, а не секунды или микросекунды. В чем может быть проблема?

; Date Format
;
; Use the 'dateformat' keyword to specify the date format used when CEL events
; are raised.
;
; Accepted values: A strftime format string (see man strftime)
;
; Example: "%F %T"
; -> This gives the date and time in the format "2009-06-23 17:02:35"
;
; If this option is not specified, the default format is "<seconds>.<microseconds>"
; since epoch. The microseconds field will always be 6 digits in length, meaning it
; may have leading zeros.
;
;dateformat = %F %T




Вот код таблицы и сам файл cel.conf :

Код: выделить все
-- Table: cel

-- DROP TABLE cel;

CREATE TABLE cel
(
  id serial NOT NULL,
  contractor_id integer NOT NULL,
  eventtype integer,
  eventtime double precision,
  userdeftype character varying(255) NOT NULL,
  cid_name character varying(80),
  cid_num character varying(80),
  cid_ani character varying(80),
  cid_rdnis character varying(80),
  cid_dnid character varying(80),
  exten character varying(80) NOT NULL,
  context character varying(80) NOT NULL,
  channame character varying(80) NOT NULL,
  appname character varying(80) NOT NULL,
  appdata character varying(80) NOT NULL,
  amaflags bigint NOT NULL,
  accountcode character varying(20),
  peeraccount character varying(80) NOT NULL,
  uniqueid character varying(150),
  userfield character varying(255) NOT NULL,
  linkedid character varying(150),
  peer character varying(80) NOT NULL,
  CONSTRAINT cel_pkey PRIMARY KEY (id ),
  CONSTRAINT cel_contractor_id_fkey FOREIGN KEY (contractor_id)
      REFERENCES contractors_contractor (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED,
  CONSTRAINT cel_eventtype_fkey FOREIGN KEY (eventtype)
      REFERENCES cel_event (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED
)
WITH (
  OIDS=FALSE
);



cel.conf :
Код: выделить все
[general]
enable=yes
;dateformat=%F %T.%6q
events = ALL
apps = noop,answer,playback,hangup,background,waitexten,goto,dial,congestion,set,playtones,busy,macro
andrewshkovskii
 
Сообщений: 22
Зарегистрирован: 01 ноя 2012, 12:19

Re: CEL.conf , поле eventtime и необходимый формат

Сообщение Vlad1983 » 12 ноя 2012, 11:17

если так
Код: выделить все
dateformat = %S.%3q
?
ЛС: @rostel
Vlad1983
 
Сообщений: 4251
Зарегистрирован: 09 авг 2011, 11:51

Re: CEL.conf , поле eventtime и необходимый формат

Сообщение andrewshkovskii » 12 ноя 2012, 11:33

и так тоже, - 2012 и все. Какое-то странное поведение.
Кстати, астериск - 1.8, сборка из сорцов, платформа - Mac OS X 10.8.2
Вот что в логах астериска, при попытке положить CEL в таблицу(одна из записей):

Код: выделить все
  > [INSERT INTO cel (contractor_id,eventtype,eventtime,userdeftype,cid_name,cid_num,cid_ani,cid_rdnis,cid_dnid,exten,context,channame,appname,appdata,amaflags,accountcode,peeraccount,uniqueid,userfield,linkedid,peer) VALUES (2,22,2012.000000,'','Andrey 101','101','101','','100','100','from_101','SIP/101-00000000','','',3,'','','1352705733.0','','1352705733.0','')]
andrewshkovskii
 
Сообщений: 22
Зарегистрирован: 01 ноя 2012, 12:19

Re: CEL.conf , поле eventtime и необходимый формат

Сообщение Vlad1983 » 12 ноя 2012, 11:37

найти это странное поведение с сорцах и убить на корню
или найти там же как сделать из конфига нормальное поведение
ЛС: @rostel
Vlad1983
 
Сообщений: 4251
Зарегистрирован: 09 авг 2011, 11:51

Re: CEL.conf , поле eventtime и необходимый формат

Сообщение andrewshkovskii » 12 ноя 2012, 11:47

Править сорцы решение радикальное, конечно, но наверное действенное. Пока хотелось бы обойтись без таких решений..
Спасибо за совет и потраченное время.
andrewshkovskii
 
Сообщений: 22
Зарегистрирован: 01 ноя 2012, 12:19

Re: CEL.conf , поле eventtime и необходимый формат

Сообщение ded » 12 ноя 2012, 11:47

А какой формат при нативном выводе команды
$ date ??
ded
 
Сообщений: 15803
Зарегистрирован: 26 авг 2010, 19:00

Re: CEL.conf , поле eventtime и необходимый формат

Сообщение andrewshkovskii » 12 ноя 2012, 12:01

Mon 12 Nov 2012 12:01:09 MSK
andrewshkovskii
 
Сообщений: 22
Зарегистрирован: 01 ноя 2012, 12:19

Re: CEL.conf , поле eventtime и необходимый формат

Сообщение ded » 12 ноя 2012, 12:46

Во как! МасОсь виновата! А Линух выгружает вот так:
Mon Nov 12 12:45:49 MSK 2012
А FreeBSD тоже так -
Mon Nov 12 10:47:45 EET 2012
поэтому и несовпадает, и вылазит везде 2012 у Вас.

Код: выделить все
date --help
Usage: date [OPTION]... [+FORMAT]
  or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.

  -d, --date=STRING         display time described by STRING, not `now'
  -f, --file=DATEFILE       like --date once for each line of DATEFILE
  -r, --reference=FILE      display the last modification time of FILE
  -R, --rfc-2822            output date and time in RFC 2822 format.
                            Example: Mon, 07 Aug 2006 12:34:56 -0600
      --rfc-3339=TIMESPEC   output date and time in RFC 3339 format.
                            TIMESPEC=`date', `seconds', or `ns' for
                            date and time to the indicated precision.
                            Date and time components are separated by
                            a single space: 2006-08-07 12:34:56-06:00
  -s, --set=STRING          set time described by STRING
  -u, --utc, --universal    print or set Coordinated Universal Time
      --help     display this help and exit
      --version  output version information and exit

FORMAT controls the output.  Interpreted sequences are:

  %%   a literal %
  %a   locale's abbreviated weekday name (e.g., Sun)
  %A   locale's full weekday name (e.g., Sunday)
  %b   locale's abbreviated month name (e.g., Jan)
  %B   locale's full month name (e.g., January)
  %c   locale's date and time (e.g., Thu Mar  3 23:05:25 2005)
  %C   century; like %Y, except omit last two digits (e.g., 20)
  %d   day of month (e.g, 01)
  %D   date; same as %m/%d/%y
  %e   day of month, space padded; same as %_d
  %F   full date; same as %Y-%m-%d
  %g   last two digits of year of ISO week number (see %G)
  %G   year of ISO week number (see %V); normally useful only with %V
  %h   same as %b
  %H   hour (00..23)
  %I   hour (01..12)
  %j   day of year (001..366)
  %k   hour ( 0..23)
  %l   hour ( 1..12)
  %m   month (01..12)
  %M   minute (00..59)
  %n   a newline
  %N   nanoseconds (000000000..999999999)
  %p   locale's equivalent of either AM or PM; blank if not known
  %P   like %p, but lower case
  %r   locale's 12-hour clock time (e.g., 11:11:04 PM)
  %R   24-hour hour and minute; same as %H:%M
  %s   seconds since 1970-01-01 00:00:00 UTC
  %S   second (00..60)
  %t   a tab
  %T   time; same as %H:%M:%S
  %u   day of week (1..7); 1 is Monday
  %U   week number of year, with Sunday as first day of week (00..53)
  %V   ISO week number, with Monday as first day of week (01..53)
  %w   day of week (0..6); 0 is Sunday
  %W   week number of year, with Monday as first day of week (00..53)
  %x   locale's date representation (e.g., 12/31/99)
  %X   locale's time representation (e.g., 23:13:48)
  %y   last two digits of year (00..99)
  %Y   year
  %z   +hhmm numeric timezone (e.g., -0400)
  %:z  +hh:mm numeric timezone (e.g., -04:00)
  %::z  +hh:mm:ss numeric time zone (e.g., -04:00:00)
  %:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30)
  %Z   alphabetic time zone abbreviation (e.g., EDT)
ded
 
Сообщений: 15803
Зарегистрирован: 26 авг 2010, 19:00

Re: CEL.conf , поле eventtime и необходимый формат

Сообщение tma » 12 ноя 2012, 14:17

Нужно всегда задавать желаемый формат и не париться, например: date "+%Y-%m-%d %H:%M:%S %Z"
SkyTel OU - облачная АТС, DID, SIP-транк с посекундной тарификаицей, мобильная связь
http://skytel24.com | Эстония: +372.333.55.10 | Россия: +7(495)4019900
tma
 
Сообщений: 1809
Зарегистрирован: 18 сен 2010, 20:50

Re: CEL.conf , поле eventtime и необходимый формат

Сообщение andrewshkovskii » 12 ноя 2012, 15:12

Всем спасибо за наводу на проблему.
Есть вопрос. Я задаю формат даты в cel.conf : dateformat = %S.%3q
Получаю теже 2012. Значит либо в этом случае формат игнорируется, либо происходит лажа с системным форматом даты. Но если задать формат %F %T - то CEl создается с eventtime согласно указанному формату.
andrewshkovskii
 
Сообщений: 22
Зарегистрирован: 01 ноя 2012, 12:19

След.

Вернуться в Вопросы новичков

Кто сейчас на форуме

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 31

© 2008 — 2024 Asterisk.ru
Digium, Asterisk and AsteriskNOW are registered trademarks of Digium, Inc.
Design and development by PostMet-Netzwerk GmbH