Created
April 19, 2019 14:35
Star
You must be signed in to star a gist
confirmation call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[confirmation_call_original2] | |
exten=>_.,1,Answer() | |
same=>n(wish),Set(message=pls-entr-num-uwish2-call) | |
same=>n(rec),read(exten,${message},4,,,5) | |
same=>n,GotoIf($["${exten}"=""]?wish) | |
same=>n,Playback(pls-rcrd-name-at-tone) | |
same=>n,Record(/root/demo/recording/${UNIQUEID}.wav,,20,y) | |
same=>n,Playback(pls-wait-connect-call) | |
same=>n,Set(__dst=${exten}) | |
same=>n,Set(__file_name=${UNIQUEID}) | |
same=>n,Set(__caller=${CHANNEL}) | |
same=>n,Set(__callercid=${CALLERID(num)}) | |
same=>n,Dial(Local/s@moh2&Local/${EXTEN}@response2) | |
[moh2] | |
exten=>s,1,Answer() | |
same=>n,MusicOnHold() | |
same=>n,Hangup() | |
[response2] | |
exten=>_x.,1,Noop( calling the destination ${dst}) | |
same=>n,System(/usr/bin/php /var/www/html/ami/conf_originate.php ${dst} ${file_name} ${caller}) | |
[hello2] | |
exten=>_.,1,Answer() | |
same=>n,Noop( variables ${audio} ${channel}) | |
same => n(confim),read(confirm,/root/demo/recording/${audio},1) | |
same=>n,Noop( ** ${confirm} **) | |
same=>n,GotoIf($["${confirm}"="1"]?bridge) | |
same=>n,GotoIf($["${confirm}"="2"]?vmcaller) | |
same=>n,Noop(${confirm}) | |
same=>n,GotoIf($["${exten}"=""]?confirm) | |
same=>n,Hangup() | |
same=>n(bridge),Bridge(${channel}) | |
same=>n,Hangup() | |
same=>n(vmcaller),System(/usr/sbin/asterisk -x "Channel Redirect ${channel} vm,${EXTEN},1") | |
same=>n,hangup() | |
[vm] | |
exten=>_.,1,Noop(${EXTEN} leave a vm) | |
same=>n,Playback(im-sorry) | |
same=>n(vm),VoiceMail(6001@default,ug(8)) | |
same=>n,hangup() | |
;;;;;;;;;end of confirmation call;;;;;;;;;;;;;;;;;; | |
php script | |
<?php | |
$timeout=10; | |
$host="127.0.0.1"; | |
$port=5038; | |
$dst = preg_replace('/\s+/', '', $argv[1]); | |
$audio = preg_replace('/\s+/', '', $argv[2]); | |
$channel = preg_replace('/\s+/', '', $argv[3]); | |
$cid="1000<Call screening>"; | |
$socket = fsockopen("$host",$port,$errno, $errstr, $timeout); | |
fputs($socket, "Action: Login\r\n"); | |
fputs($socket, "UserName: admin\r\n"); // | |
fputs($socket, "Secret: 4556\r\n\r\n"); // // | |
$wrets=fgets($socket,128); | |
fputs($socket, "Action: Originate\r\n" ); | |
fputs($socket, "Channel: PJSIP/$dst\r\n" ); | |
fputs($socket, "Exten: s\r\n" ); | |
fputs($socket, "Context: hello2\r\n" ); | |
fputs($socket, "Priority: 1\r\n" ); | |
fputs($socket, "CallerID: $cid\r\n" ); | |
fputs($socket, "Variable: __audio=$audio\r\n" ); | |
fputs($socket, "Variable: __channel=$channel\r\n" ); | |
fputs($socket, "Variable: __dst=$dst\r\n" ); | |
fputs($socket, "Variable: __cid=$cid\r\n" ); | |
fputs($socket, "Async: yes\r\n\r\n" ); | |
fputs($socket, "Action: Logoff\r\n\r\n"); | |
sleep (1); | |
$wrets=fgets($socket,128); | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment