📜 ⬆️ ⬇️

Elastix - Asterisk as an emergency voice alert system


It is required to make an emergency voice alert system in case of accidents and other incidents. The scheme of work is as follows:
The responsible person calls to a specific phone number, dials the code and enters the voice menu of the alert system. There he is invited to record a message, listen to it, save it, and the system must make calls simultaneously using 5 telephone lines to pre-set phone numbers in the file. And in case you didn’t pick up the phone, call the person you’ll notify. At the end of the notification, a file with telephone numbers to which they could not reach at all should be sent to the specified mail.

If it is interesting how it works please under cat.

For making calls in Asterisk there are call files. When a file is placed in the / var / spool / asterisk / outgoing directory, it automatically makes a call. Let's first understand what the call files consist of and what's inside them.

There can be several variables inside each file:
Channel: -
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
Channel: -
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
Channel: -
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
Channel: -
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
Channel: -
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
Channel: -
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
Channel: -
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
 Channel: -      
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
Channel: -
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
 Channel: -      
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
Channel: -
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
 Channel: -      
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .
Channel: -
CallerID: Name - ,
MaxRetries: - , 0, 1 .
RetryTime: - , , , - , - ( ). .
WaitTime: - . 60 , , .
Account:
- “account code” CDR,
Context: <context-name> - ( )
Extension: - Extension .
Priority: - Extension, .
Set:
- .
Application: - Asterisk, . - context, extension priority.
Data: - . .
Archive: Yes/No – .call "outgoing_done" "Status: ", : Completed, Expired Failed. .

, :

Channel: Local/11%1%@from-internal/n
CallerID: <5102>
MaxRetries: 4
RetryTime: 60
WaitTime: 60
Context: startmessage
Extension: 5102
Priority: 1


. Local CDR ( - ). , 5 60 , 60 . - startmessage. extension 5102, 1.

11, . FreePBX Outbound route 11 . " " .

/etc/asterisk/extensions_custom.conf ( Elastix)

exten => 9876,1,Goto(testcontext,s,1) , 9876 , .
2 . , . , , .

:
[testcontext]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/privet-zapis)
exten => s,n,Record(obzvon-message.wav)
exten => s,n,Playback(/var/lib/asterisk/sounds/obzvon-message)
exten => s,n,Playback(/var/lib/asterisk/sounds/custom/zapusk)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 999,1,System(echo "" > /var/log/asterisk/cdr-custom/Simple.csv)
exten => 999,n,System(/mnt/script/parser.bash /mnt/CallCenter/telefony.txt /mnt/script/main.call)
exten => 999,n,System(/mnt/script/startcall.bash)
exten => 0,1, Hangup()

- , 2 , /var/lib/asterisk/sounds/custom/privet-zapis , obzvon-message.wav , /var/lib/asterisk/sounds/custom/zapusk . 10 . 999, , - .

999, /var/log/asterisk/cdr-custom/Simple.csv ( ), /mnt/script/parser.bash , /mnt/CallCenter/telefony.txt - ( ), /mnt/script/main.call - call . call . /mnt/script/startcall.bash .

windows , .. , Notepad ++, Windows.

CDR - /etc/asterisk/cdr_custom.conf :

[mappings]
Simple.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},$$


.
/mnt/script/parser.bash :
#!/bin/bash # - , FILE=`cat $1 | sort -u` for I in $FILE do if [ -n "$I" ] then sed -e 's/\%1\%/'$I'/g' < $2 >> /mnt/script/tmp/$I.call fi done;

call %1%, /mnt/script/tmp/ " ".call .

/mnt/script/startcall.bash :
#!/bin/bash # - call OutDir="/mnt/script/tmp/" # call inDir="/var/spool/asterisk/outgoing/" # call ( ) CountIn=5; movefile () # inDir { CounFileInDir=$(find $inDir -name "*.call" | wc -l); # inDir - CountIn, . if (("$CounFileInDir" < "$CountIn")); then mv $I $inDir # 30 . else sleep 30; movefile; fi } # *.call OutDir. FILE=`find $OutDir -name "*.call"` # FILE, , movefile. for I in $FILE do if [ -n "$I" ] then movefile; fi done; # - . /mnt/script/result.bash

/mnt/script/result.bash :
#!/bin/bash # telefoni=/mnt/CallCenter/telefony.txt # . logfile=/var/log/asterisk/cdr-custom/Simple.csv; # . cp $telefoni telefoni.tmp # FILE . FILE=`cat telefoni.tmp | sort -u | uniq` # FILE , - logfile ANSWERED. # startmessage, , #, 11 ( ) @ temp for I in $FILE do if [ -n "$I" ] then rm temp.temp cat $logfile | grep "ANSWERED" | grep "startmessage" | grep $I | awk 'BEGIN{FS=","}{print $5}' | sed -e 's/.*\/11//g' -e 's/\@.*//g' | uniq >> temp$ fi done; # FILE1 temp.temp, . FILE1=`cat temp.temp | sort -u | uniq` # . for J in $FILE1 do if [ -n "$J" ] then cat telefoni.tmp | grep -v $J > telefoni1.tmp mv telefoni1.tmp telefoni.tmp fi done; rm temp.temp; cat telefoni.tmp | mail -s Ne_Dozvon testmail@example.com

- . Inbound routes CID . - , , . DID . destination Misc Destinations . Misc Destinations, 9876 dial. ( extensions_custom.conf? )

, , , , . , .

')

Source: https://habr.com/ru/post/170849/


All Articles