Страница 1 из 2

cel + userfield

Добавлено: 12 сен 2017, 18:40
akam
Здравствуйте,

третий день бьюсь над одной задачкой - надо в cel сохранить переменную в userfield. во все каналы.

есть тестовый диалплан, первым приоритетом в котором стоит Set(CHANNEL(userfield)=AAAAAA)
и в файле cel_custom.conf ${CSV_QUOTE(${CHANNEL(userfield)}

после звонка в этот контекст в cel попадает следующее:
"CHAN_START","2017-09-12 05:12:01","53003","34200","kamailio",""
"CHAN_START","2017-09-12 05:12:01","","s","kamailio",""
"ANSWER","2017-09-12 05:12:03","34200","34200","kamailio",""
"ANSWER","2017-09-12 05:12:03","53003","34200","kamailio","AAAAAA"
"BRIDGE_ENTER","2017-09-12 05:12:03","34200","","kamailio",""
"BRIDGE_ENTER","2017-09-12 05:12:03","53003","34200","kamailio","AAAAAA"
"BRIDGE_EXIT","2017-09-12 05:12:04","34200","","kamailio",""
"HANGUP","2017-09-12 05:12:04","34200","","kamailio",""
"CHAN_END","2017-09-12 05:12:04","34200","","kamailio",""
"BRIDGE_EXIT","2017-09-12 05:12:04","53003","34200","kamailio","AAAAAA"
"HANGUP","2017-09-12 05:12:04","53003","h","kamailio","AAAAAA"
"CHAN_END","2017-09-12 05:12:04","53003","h","kamailio","AAAAAA"
"LINKEDID_END","2017-09-12 05:12:04","53003","h","kamailio","AAAAAA"
то есть значение попадает не во все события cel. Каким то образом можно его туда запихнуть?)
так мне ответили на багтрекере:
CEL stores channel events, and you've only set the userfield on a single channel while your log shows two channels logging events. Since the second channel does not have a userfield set it is not placed into the logs.
но вот как можно объявить userfield на все каналы ума не приложу :(

Re: cel + userfield

Добавлено: 13 сен 2017, 06:12
virus_net

Код: Выделить всё

Set(__CHANNEL(userfield)=AAAAAA)
Поможет ?

Re: cel + userfield

Добавлено: 13 сен 2017, 06:55
akam
Channel вроде как не переменная, а функция. Скорее всего ошибку выдаст, на работе попробую

Re: cel + userfield

Добавлено: 13 сен 2017, 08:08
akam
не поможет.

[2017-09-13 05:07:53] ERROR[22026][C-00000009]: pbx_functions.c:699 ast_func_write: Function __CHANNEL not registered

Re: cel + userfield

Добавлено: 13 сен 2017, 08:50
april22

Re: cel + userfield

Добавлено: 13 сен 2017, 09:14
akam
Я так понимаю вы предлагаете использовать не CHANNEL(userfield) а переменную с двумя подчеркиваниями? И так я тоже пробовал - в диалплане - Set(__AAA=AAAA) а в cel_custom указал ${CSV_QUOTE(${AAA})}. В итоге в файле csv это поле пустое.

Или я не правильно понял ваш тонкий намек?

Re: cel + userfield

Добавлено: 13 сен 2017, 09:18
shader
попроруйте использовать опцию U в команде dial. Особенность этой опции заключается в том, что она обрабатывает Б канал, который Вам и нужен.
https://wiki.asterisk.org/wiki/display/ ... ation_Dial
Либо используйте опцию 'e' и обрабатывайте ОБА канала в h extension.

Re: cel + userfield

Добавлено: 13 сен 2017, 10:06
akam
Спасибо добрый человек! Теперь с опцией U заполняются почти все поля, кроме CHAN_START и первого ANSWER (Outgoing Line). Возможно и по этому поводу у вас хорошая найдется мысль?

..................
_XXXXX => {
Noop(CALL to ${EXTEN}@${SIPDOMAIN} from ${SIPURI});
&setheaders();
&record(${EXTEN});
Set(FMCTN=${ODBC_FMCTN(${EXT})});
Noop("FMCTN = ${FMCTN}, PSTN-Server = ${PSTN-Server}");
if("${FMCTN}" !="" & "${PSTN-Server}" !="") {
Dial(SIP/${EXTEN}@${SIPDOMAIN}&SIP/${FMCTN}@${SIP_HEADER(X-PSTN-Server)},60,RTtU(setheaders));
} else {
Dial(SIP/${EXTEN}@${SIPDOMAIN},60,RTtU(setheaders));
}
Hangup;
}
..................

macro setheaders() {
if("${Shared-ID}"=="") {
Set(__Shared-ID=${SIP_HEADER(X-Shared-ID)});
}
Set(CHANNEL(userfield)=${Shared-ID});
Set(__RECVIP=${CHANNEL(recvip)});
Set(__PSTN-Server=${SIP_HEADER(X-PSTN-Server)});
Set(__RDNIS=${SIP_HEADER(X-RDNIS)});
return;
}

"CHAN_START","2017-09-13 06:58:04","53003","34200","kamailio","SIP/sipchel-0000001e","","","3","","pbxchel-02-1505285884.235","pbxchel-02-1505285884.235","","","",""
"CHAN_START","2017-09-13 06:58:04","","s","kamailio","SIP/172.16.3.1-0000001f","","","3","","pbxchel-02-1505285884.237","pbxchel-02-1505285884.235","","","",""
"ANSWER","2017-09-13 06:58:06","34200","34200","kamailio","SIP/172.16.3.1-0000001f","AppDial","(Outgoing Line)","3","","pbxchel-02-1505285884.237","pbxchel-02-1505285884.235","","","",""
"ANSWER","2017-09-13 06:58:06","53003","34200","kamailio","SIP/sipchel-0000001e","Dial","SIP/34200@172.16.3.1,60,RTtU(setheaders)e","3","","pbxchel-02-1505285884.235","pbxchel-02-1505285884.235","","","","0_2130114307@172.16.3.3"
"BRIDGE_ENTER","2017-09-13 06:58:06","34200","","kamailio","SIP/172.16.3.1-0000001f","AppDial","(Outgoing Line)","3","","pbxchel-02-1505285884.237","pbxchel-02-1505285884.235","","","{""bridge_id"":""168e47f7-b702-4867-b028-a08808b7b572"",""bridge_technology"":""simple_bridge""}","0_2130114307@172.16.3.3"
"BRIDGE_ENTER","2017-09-13 06:58:06","53003","34200","kamailio","SIP/sipchel-0000001e","Dial","SIP/34200@172.16.3.1,60,RTtU(setheaders)e","3","","pbxchel-02-1505285884.235","pbxchel-02-1505285884.235","SIP/172.16.3.1-0000001f","","{""bridge_id"":""168e47f7-b702-4867-b028-a08808b7b572"",""bridge_technology"":""simple_bridge""}","0_2130114307@172.16.3.3"
"BRIDGE_EXIT","2017-09-13 06:58:07","34200","","kamailio","SIP/172.16.3.1-0000001f","AppDial","(Outgoing Line)","3","","pbxchel-02-1505285884.237","pbxchel-02-1505285884.235","SIP/sipchel-0000001e","","{""bridge_id"":""168e47f7-b702-4867-b028-a08808b7b572"",""bridge_technology"":""simple_bridge""}","0_2130114307@172.16.3.3"
"BRIDGE_EXIT","2017-09-13 06:58:07","53003","34200","kamailio","SIP/sipchel-0000001e","Dial","SIP/34200@172.16.3.1,60,RTtU(setheaders)e","3","","pbxchel-02-1505285884.235","pbxchel-02-1505285884.235","","","{""bridge_id"":""168e47f7-b702-4867-b028-a08808b7b572"",""bridge_technology"":""simple_bridge""}","0_2130114307@172.16.3.3"
"HANGUP","2017-09-13 06:58:07","34200","h","kamailio","SIP/172.16.3.1-0000001f","AppDial","(Outgoing Line)","3","","pbxchel-02-1505285884.237","pbxchel-02-1505285884.235","","","{""hangupcause"":16,""hangupsource"":""SIP/172.16.3.1-0000001f"",""dialstatus"":""""}","0_2130114307@172.16.3.3"
"CHAN_END","2017-09-13 06:58:07","34200","h","kamailio","SIP/172.16.3.1-0000001f","AppDial","(Outgoing Line)","3","","pbxchel-02-1505285884.237","pbxchel-02-1505285884.235","","","","0_2130114307@172.16.3.3"
"HANGUP","2017-09-13 06:58:07","53003","h","kamailio","SIP/sipchel-0000001e","","","3","","pbxchel-02-1505285884.235","pbxchel-02-1505285884.235","","","{""hangupcause"":16,""hangupsource"":""SIP/172.16.3.1-0000001f"",""dialstatus"":""ANSWER""}","0_2130114307@172.16.3.3"
"CHAN_END","2017-09-13 06:58:07","53003","h","kamailio","SIP/sipchel-0000001e","","","3","","pbxchel-02-1505285884.235","pbxchel-02-1505285884.235","","","","0_2130114307@172.16.3.3"
"LINKEDID_END","2017-09-13 06:58:07","53003","h","kamailio","SIP/sipchel-0000001e","","","3","","pbxchel-02-1505285884.235","pbxchel-02-1505285884.235","","","","0_2130114307@172.16.3.3"

Re: cel + userfield

Добавлено: 13 сен 2017, 10:18
shader
лично я с CEL не работаю. Предпочёл cdr_adaptive. Всё, что мне надо допилить в оном(финальная правка CDR, в т. ч. биллинг) я делаю (как я говорил выше) в h extension. Опция 'e' команды Dial заставляет отрабатывать h для ОБОИХ каналов одновременно.

Re: cel + userfield

Добавлено: 13 сен 2017, 16:23
virus_net
akam писал(а):Channel вроде как не переменная, а функция
true. мальца ступил с утра, а вы молодец подметили, что говорит о наличии базовых знаний.
shader писал(а):лично я с CEL не работаю
+1
на 1.8.Х включение CEL может приводить (и приводило) к выпадению Asterisk`а.