Edito
Voila voila, je refais mon infra…
Et j'ai donc envie de participer a une oeuvre commune :
Antoine.
Pub
Désolé de vous incommoder avec cela, c'est un mal aujourd'hui nécessaire. Je le souhaite juste utile, on verra.
Ceci est une ancienne révision du document !
asterisk@laotseu:~$ cat /tmp/hello-world.call Channel: SIP/FXO1/9930612345678 MaxRetries: 3 RetryTime: 60 WaitTime: 30 Context: interne Extension: 900 Priority: 1Ca marche comme ca:
asterisk@laotseu:~$ sleep 600; cp /tmp/hello-world.call /var/spool/asterisk/outgoing/
exten => 914,1,NoOp(On apprend a compter a partir de ${ADLPALL}) exten => 914,n,Set(i=1) exten => 914,n,Set(j=${CUT(ADLPALL,&,${i})}) exten => 914,n,While(${LEN(${j})} > 0) exten => 914,n,NoOp(ICI ON TRAITE LE TRUC DU MACHIN ${j} ${i}) exten => 914,n,Set(i=$[${i} + 1]) exten => 914,n,Set(j=${CUT(ADLPALL,&,${i})}) exten => 914,n,EndWhile exten => 914,n,HangUp
La macro
[macro-itexten] exten => s,1,NoOp(On apprend a compter a partir de ${ARG1}) exten => s,n,Set(k=${ARG1}) exten => s,n,Set(i=1) exten => s,n,Set(j=${CUT(k,&,${i})}) exten => s,n,While(${LEN(${j})} > 0) exten => s,n,NoOp(ICI ON TRAITE LE TRUC DU MACHIN ${j} ${i}) exten => s,n,Set(i=$[${i} + 1]) exten => s,n,Set(j=${CUT(k,&,${i})}) exten => s,n,EndWhile exten => s,n,HangUpSon appel
exten => 915,1,NoOp(Pouette) exten => 915,n,Macro(itexten,${ADLPALL})
Cette macro evite de :
[macro-CallBackScript] ;;;;; Macro(CallBackScript,SIP/pouette,"Pouette",MaxRetries-RetryTime-WaitTime-Account,Quand,Extention@Context,SetVars) ;;;;; Macro(CallBackScript,SIP/pouette,"Pouette",MaxRetries-RetryTime-WaitTime-Account,Quand,Application ,Params ) ;;;;; 1 2 3 4 5 6 ;;;;; * Specify where and how to call ;;;;; A o Channel: <channel>: Channel to use for the call. ;;;;; A o CallerID: "name" <number> Caller ID, Please note: It may not work if you do not respect the format: CallerID: "Some Name" <1234> ;;;;; B1o MaxRetries: <number> Number of retries before failing (not including the initial attempt, e.g. 0 = total of 1 attempt to make the call). Default is 0. ;;;;; B2o RetryTime: <number> Seconds between retries, Don't hammer an unavailable phone. Default is 300 (5 min). ;;;;; B3o WaitTime: <number> Seconds to wait for an answer. Default is 45. ;;;;; B4o Account: Set the account code to use. ;;;;; * If the call answers, connect it here: ;;;;; C o Context: <context-name> Context in extensions.conf ;;;;; C o Extension: <ext> Extension definition in extensions.conf ;;;;; o Priority: <priority> Priority of extension to start with ;;;;; C o Set: Set a variable for use in the extension logic (example: file1=/tmp/to ); in Asterisk 1.0.x use 'SetVar' instead of 'Set' ;;;;; D o Application: Asterisk Application to run (use instead of specifiying context, extension and priority) ;;;;; D o Data: The options to be passed to application ;;;;; * New (?) in Asterisk 1.4 ;;;;; o Set: Can now also write to dialplan functions like CDR() ;;;;; o AlwaysDelete: Yes/No - If the file's modification time is in the future, the call file will not be deleted ;;;;; o Archive: Yes/No - Move to subdir "outgoing_done" with "Status: value", where value can be Completed, Expired or Failed. exten => s,1,NoOp(Puttin) exten => s,n,Set(FiEx=${RAND(1,10000)}) exten => s,n,Set(MaxRet=${CUT(ARG3,-,1)}) exten => s,n,Set(MaxRet=${IF(${LEN(${MaxRet})} ? ${MaxRet} : 0)}) exten => s,n,Set(RetryT=${CUT(ARG3,-,2)}) exten => s,n,Set(RetryT=${IF(${LEN(${RetryT})} ? ${RetryT} : 200)}) exten => s,n,Set(WaitTi=${CUT(ARG3,-,3)}) exten => s,n,Set(WaitTi=${IF(${LEN(${WaitTi})} ? ${WaitTi} : 45)}) exten => s,n,Set(Accoun=${CUT(ARG3,-,4)}) exten => s,n,Set(Accoun=${IF(${LEN(${Accoun})} ? ${Accoun} : ScriptEd)}) exten => s,n,Set(A=Channel: ${ARG1}\\nCallerID: ${ARG2}\\nMaxRetries: ${MaxRet}\\nRetryTime: ${RetryT}\\nWaitTime: ${WaitTi}\\nAccount: ${Accoun}\\n) exten => s,n,Set(Cont=${CUT(ARG5,@,2)}) exten => s,n,Set(Exte=${CUT(ARG5,@,1)}) exten => s,n,Set(B=Context: ${Cont}\\nExtension: ${Exte}\\nPriority: 1\\n${ARG6}) exten => s,n,Set(C=Application: ${ARG5}\\nData: ${ARG6}) exten => s,n,Set(i=7) exten => s,n,While(${LEN(${ARG${i}})}) exten => s,n,Set(C=${C},${ARG${i}}) exten => s,n,Set(i=$[${i} + 1]) exten => s,n,EndWhile exten => s,n,Set(SysC=${IF(${LEN(${Cont})>0}?B:C)}) exten => s,n,system(echo "${A}${${SysC}}" >/tmp/recall.call-${FiEx}) exten => s,n,GotoIf($[${LEN(${ARG4})}=0]?touchfait) exten => s,n,Set(Touh=${ARG4}) exten => s,n,GotoIf($[${LEN(${CUT(ARG4,+,2)})}=0]?noaddi) exten => s,n,Set(i=${CUT(ARG4,+,2)}) exten => s,n,Set(j=${STRFTIME(${EPOCH},,%Y%m%d%H%M)}) exten => s,n,Set(Touh=${MATH(${i}+${j})}) exten => s,n,Set(Touh=${CUT(Touh,.,1)}) exten => s,n(noaddi),system(touch -t ${Touh} /tmp/recall.call-${FiEx}) exten => s,n(touchfait),NoOp(On va tenter de faire quelquechose de drole, ou pas...) exten => s,n,system(mv /tmp/recall.call-${FiEx} /var/spool/asterisk/outgoing/)TODO: Mettre des exemples d'appel Ci-joint des exemples d'usage de la macro
[interne] exten => 913,1,NoOp(On apprend a compter) exten => 913,n,Macro(CallBackScript,SIP/z6poi,,,,echo) exten => 913,n,HangUp() exten => 914,1,NoOp(On apprend a compter) exten => 914,n,Macro(CallBackScript,SIP/z6poi,,,,repondeur@interne) exten => 914,n,HangUp() exten => 915,1,NoOp(On apprend a compter) exten => 915,n,Macro(CallBackScript,SIP/z6poi,,,+5,Voicemail,1234,b) exten => 915,n,HangUp() exten => 916,1,NoOp(On demontre la conference) exten => 916,n,Macro(InMeetifAvailable,Chambre,${ADLPALLI},a Couchee) exten => 916,n,HangUp exten => repondeur,1,NoOp(Zi repondeur) exten => repondeur,n,Voicemail(1234,b) exten => repondeur,n,HangUp
Cette macro evite de :
Elle va
Conseil
Ce systeme permet de temporiser l'emission de fax…
Le fax physique n'imprime jamais d'AR en cas de succes, donc comme tout les fax pour lui aboutissent, plus de probleme, on lui juste coupe le sifflet en désactivant les beep sonore du modem…
(Je ne décris pas toutes les “subtilités” de la conf, je part du principe que vous savez configurer un peu un asterisk…)
(je vous laisse trouver la bonne zap ;) ) Chez nous c'est ca la Zap/3, ca donne donc ca ds le zapata.conf
context=poste-fax signalling=fxo_ks channel=>3
(2, c'est pas forcement pour la frime ;)) (pour la config des IAXmodem dans Hylafax, je vous fait confiance) (pour en faire 2, vous etes des grands…) /etc/iaxmodem/ttyIAX0
device /dev/ttyIAX0 owner uucp:uucp mode 660 port 4570 refresh 60 server 192.168.1.23 peername iaxmodem0 secret iaxmodem cidname Societe-Fax codec slinear cidnumber 003--------
/etc/asterisk/iax.conf
[...] [iaxmodem0] type=friend secret=iaxmodem context=poste-interne host=dynamic disallow=all allow=ulaw,alaw,slinear permit=192.168.0.0/255.255.0.0 qualify=3600 jitterbuffer=no [...]
(Cette config permet de forcer mon fax a sortir en direct si le numero de sortie utilisé est le 1 a la place du 0 habituel)
[poste-fax] exten => _1X.,1,NoOp(poste Fax emmet en direct !!!!) exten => _1X.,n,Set(FAXDST=FaxBounce-${EXTEN}) exten => _1X.,n,Goto(comp-sortie,0${EXTEN:1},1) exten => _X.,1,NoOp(poste Fax emmet via TampFax!!!!) exten => _X.,n,Set(FAXDST=FaxBounce-${EXTEN}) exten => _X.,n,Goto(in-fax,fax,1)
(Comme vs le comprenez plus haut, le CALLID4 sera ici initilialisé à “FaxBounce-XXXXXXX”, donc la, dans ce cas le fax est envoye a un utilisateur fictif, un alias de messagerie)
/etc/hylafax/FaxDispatch
FROMADDR=fax@domaine.tld SENDER=Fax Server FILETYPE=pdf case "$CALLID4" in FaxStd) SENDTO=faxstd@domaine.tld ;; FaxCommercial) SENDTO=faxcommercial@domaine.tld ;; FaxBounce-*) FILETYPE=tif ; CALLID1=$CALLID4; SENDTO=faxatil,faxbounce@domaine.tld ;; *) SENDTO=faxlost@domaine.tld;; esac
(Pour envoyer un fax en ligne de commande, il faut donc, le decouper du mail, mercu munpack, mais aussi un utilisateur dument autorisé dans hylafax…. je vous laisse vous regaler) (spécial dédicace pour Silmaril, regarde le parametre -h de sendfax) cat /etc/hylafax/hosts.hfaxd
localhost:21:: ^faxator@cat /etc/aliases
faxatil: | /usr/local/bin/faxatil.sh faxator: faxnotify@domaine.tldcat /usr/local/bin/faxatil.sh
/usr/bin/munpack -f -q -C /tmp 2>/dev/null| /usr/bin/tail --lines=1 | /usr/bin/cut -f1 -d"." | while read a do TO=`/bin/grep "CallID1: " /tmp/$a.desc | /usr/bin/cut -f2 -d"-"` /usr/bin/sendfax -o faxator -f faxator -Dnd $TO /tmp/$a.tif;rm /tmp/$a.* done
je pense n'avoir rien oublié…. Les avantages de cette solution c'est aussi l'archivage facile des fax emis….
Pour le moment, ca n'est pas mis en oeuvre: donc juste de la doc libre
Probleme:
Solutions
Interets de cette solutions
apt-get install asterisk-mobile
apt-get install bluetooth bluez bluez-alsa
DisablePlugins = network,input,pnat,halCela permet de “corriger un bug” que l'on retrouve dans ces points là
Pour information : il faut autant de dongle BT/USB qu'il y a de telephonne a enregistrer sur l'Asterisk....
root@harald:/etc/bluetooth# hcitool scan Scanning ... 00:25:00:00:00:00 adlp@taffe root@harald:/etc/bluetooth#
root@harald:/etc/asterisk# /usr/share/doc/bluez/examples/simple-agent hci1 00:25:00:00:00:00 RequestPinCode (/org/bluez/577/hci1/dev_00_25_00_00_00_00) Enter PIN Code: 0000 Release New device (/org/bluez/577/hci1/dev_00_25_00_00_00_00)
root@harald:~/BT# sdptool browse 00:25:00:00:00:00 Browsing 00:25:00:00:00:00 ... Service Name: Network Access Point Service Service Description: Personal Ad-hoc Network Service which provides access to a network Service RecHandle: 0x10000 Service Class ID List: "Network Access Point" (0x1116) Protocol Descriptor List: "L2CAP" (0x0100) PSM: 15 "BNEP" (0x000f) Version: 0x0100 SEQ8: dd 6 Language Base Attr List: code_ISO639: 0x656e encoding: 0x6a base_offset: 0x100 Profile Descriptor List: "Network Access Point" (0x1116) Version: 0x0100
root@harald:~/BT# hcitool dev Devices: hci0 00:11:00:00:00:00
root@harald:/etc/asterisk# cat mobile.conf [general] interval=10 ; Number of seconds between trying to connect to devices. ;; The following is a list of adapters we use. ;; id must be unique and address is the bdaddr of the adapter from hciconfig. ;; Each adapter may only have one device (headset or phone) connected at a time. ;; Add an [adapter] entry for each adapter you have. [adapter] id=apm0 address=00:11:00:00:00:00 ;;forcemaster=yes ; attempt to force adapter into master mode. default is no. ;;alignmentdetection=yes ; enable this if you sometimes get 'white noise' on asterisk side of the call ; ; its a bug in the bluetooth adapter firmware, enabling this will compensate for it. ; ; default is no. [adlp-gs] address=FC:00:00:00:00:01 port=10 context=in-gsm adapter=apm0 [adlp-taffe] address=00:25:00:00:00:00 port=12 context=in-gsm adapter=apm0 ;[NOKIA6630] ;address=00:11:9F:BE:79:60 ; the address of the phone ;port=28 ; the rfcomm port number (from mobile search) ;context=incoming-mobile ; dialplan context for incoming calls ;adapter=blue ; adapter to use ;group=1 ; this phone is in channel group 1 ;;sms=no ; support SMS, defaults to yes ;;nocallsetup=yes ; set this only if your phone reports that it supports call progress notification, but does not do it. Motorola L6 for example.
root@harald:~# asterisk -rfccccccvvvvvvvvggggg Asterisk 1.6.2.9-2+squeeze4, Copyright (C) 1999 - 2010 Digium, Inc. and others. Created by Mark Spencer <markster@digium.com> Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details. ========================================================================= == Parsing '/etc/asterisk/asterisk.conf': == Found == Parsing '/etc/asterisk/extconfig.conf': == Found Connected to Asterisk 1.6.2.9-2+squeeze4 currently running on harald (pid = 569) Verbosity was 0 and is now 8 harald*CLI> mo mobile module harald*CLI> mobile show devices ID Address Group Adapter Connected State SMS adlp-gs FC:00:00:00:00:00 0 apm0 Yes Free No