Envoyé par
jean
la question est très, trop générique ! il suffit de configurer odbc sur ta machine, et de faire les inserts que tu veux dans le dialplan ! Sans être plus précis, dur de faire une meilleure réponse
J'ai dans mon CLI ceci:
Code:
Connected to Asterisk 13.21.0 currently running on asterisk (pid = 1329)
asterisk*CLI> odbc show all
ODBC DSN Settings
-----------------
Name: asterisk
DSN: asterisk-connector
Last connection attempt: 1970-01-01 00:00:00
Number of active connections: 1 (out of 1)
Name: calls-tracking
DSN: calls-tracking-connector
Last connection attempt: 1970-01-01 00:00:00
Number of active connections: 1 (out of 1)
asterisk*CLI>
Voici le code de mon fichier extensions.conf pour les appels sortant:
Code:
exten => _0X.,1,NoOp(Outgoing Call from ${CALLERID(all)} to ${EXTEN})
same => n,Set(POSTE=${CHANNEL:6:3})
same => n,NoOp(SendedCID = ${CALLERID(num)})
same => n,Set(CALLERID(num)=${DB(CID/${POSTE})})
same => n,NoOp(SendedCID = ${CALLERID(num)})
same => n,Set(NOW=${STRFTIME(${EPOCH},,%Y_%m_%d_%H_%M_%S)})
same => n,System(echo "--appel_sortant --- callerid : ${CALLERID(num)} ---- ${STRFTIME(${EPOCH},,%Y_%m_%d_%H_%M_%S)} ----" >> /var/spool/asterisk/log/debug.txt)
same => n,Set(REC_FILE_NAME=OUT_${NOW}_${EXTEN}_${POSTE}.wav)
same => n,Set(TYPE='Out')
same => n,Set(CALLSHISTORY()=${NOW},${POSTE},${CALLERID(num)},${EXTEN},${TYPE})
same => n,Answer()
Le résultat dans le CLI:
Code:
== Setting global variable 'SIPDOMAIN' to '192.168.40.55'
-- Executing [042680871@from-internal:1] NoOp("PJSIP/103-00000005", "Outgoing Call from "Arnold" <103> to 042680871") in new stack
-- Executing [042680871@from-internal:2] Set("PJSIP/103-00000005", "POSTE=103") in new stack
-- Executing [042680871@from-internal:3] NoOp("PJSIP/103-00000005", "SendedCID = 103") in new stack
-- Executing [042680871@from-internal:4] Set("PJSIP/103-00000005", "CALLERID(num)=028992018") in new stack
-- Executing [042680871@from-internal:5] NoOp("PJSIP/103-00000005", "SendedCID = 028992018") in new stack
-- Executing [042680871@from-internal:6] Set("PJSIP/103-00000005", "NOW=2018_05_28_11_38_00") in new stack
-- Executing [042680871@from-internal:7] System("PJSIP/103-00000005", "echo "--appel_sortant --- callerid : 028992018 ---- 2018_05_28_11_38_00 ----" >> /var/spool/asterisk/log/debug.txt") in new stack
-- Executing [042680871@from-internal:8] Set("PJSIP/103-00000005", "REC_FILE_NAME=OUT_2018_05_28_11_38_00_042680871_103.wav") in new stack
-- Executing [042680871@from-internal:9] Set("PJSIP/103-00000005", "TYPE='Out'") in new stack
-- Executing [042680871@from-internal:10] Set("PJSIP/103-00000005", "CALLSHISTORY()=2018_05_28_11_38_00,103,028992018,042680871,'Out'") in new stack
[May 28 11:38:00] ERROR[3953][C-00000003]: pbx_functions.c:699 ast_func_write: Function CALLSHISTORY not registered
La requête dans le fichier func_odbc.conf
Code:
[CALLSHISTORY]
dsn=calls-tracking-connector
writesql=INSERT INTO callshistory(date,numeroPoste,numeroDID,destinataire,sens) VALUES('${ARG1}','${ARG2}','${ARG3}','${ARG4}','${ARG5}')
Bien à vous,
Lordaker