Update with more optional headers
parent
a894db314b
commit
be7ae64dcf
|
@ -4,11 +4,12 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Asterisk Voicemail Transcribe Wrapper
|
Asterisk Voicemail Transcribe Wrapper
|
||||||
Version: 0.5.1
|
Version: 0.6.0
|
||||||
Date: 5/13/2022
|
Date: 5/13/2022
|
||||||
License: This work is licensed under CC BY-SA 4.0
|
License: This work is licensed under CC BY-SA 4.0
|
||||||
URL: https://git.sosdg.org/brielle/asterisk-scripts
|
URL: https://git.sosdg.org/brielle/asterisk-scripts
|
||||||
Requires: PHP 5 or 7, Mail and Mail_Mime libraries from Pear
|
Requires: PHP 5 or 7, Mail and Mail_Mime libraries from Pear
|
||||||
|
Tested With: PHP 7.4
|
||||||
Written by: Brie Bruns <bruns@2mbit.com>
|
Written by: Brie Bruns <bruns@2mbit.com>
|
||||||
|
|
||||||
Uses IBM's Watson Speech to Text API interface. Not pretty with
|
Uses IBM's Watson Speech to Text API interface. Not pretty with
|
||||||
|
@ -47,9 +48,9 @@ if (isset($wavFile)) {
|
||||||
curl_setopt_array($submitWatsonSTT, array(
|
curl_setopt_array($submitWatsonSTT, array(
|
||||||
CURLOPT_CONNECTTIMEOUT => '15',
|
CURLOPT_CONNECTTIMEOUT => '15',
|
||||||
CURLOPT_TIMEOUT => '120',
|
CURLOPT_TIMEOUT => '120',
|
||||||
CURLOPT_URL => $apiURL.$apiURLRecognize,
|
CURLOPT_URL => $apiURL.$apiURLRecognize,
|
||||||
CURLOPT_RETURNTRANSFER => TRUE,
|
CURLOPT_RETURNTRANSFER => TRUE,
|
||||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||||
CURLOPT_USERPWD => 'apikey:'.$apiKey,
|
CURLOPT_USERPWD => 'apikey:'.$apiKey,
|
||||||
CURLOPT_HTTPHEADER => array( 'Content-Type: audio/wav' ),
|
CURLOPT_HTTPHEADER => array( 'Content-Type: audio/wav' ),
|
||||||
CURLOPT_POSTFIELDS => $wavFile
|
CURLOPT_POSTFIELDS => $wavFile
|
||||||
|
@ -78,6 +79,26 @@ $headers = array(
|
||||||
"X-Asterisk-CallerIDName" => $mailData['headers']['x-asterisk-calleridname'],
|
"X-Asterisk-CallerIDName" => $mailData['headers']['x-asterisk-calleridname'],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($isset($mailData['headers']['cc'])) {
|
||||||
|
$headers['Cc'] = $mailData['headers']['cc'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isset($mailData['headers']['bcc'])) {
|
||||||
|
$headers['Bcc'] = $mailData['headers']['bcc'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isset($mailData['headers']['reply-to'])) {
|
||||||
|
$headers['Reply-To'] = $mailData['headers']['reply-to'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isset($mailData['headers']['user-agent'])) {
|
||||||
|
$headers['User-Agent'] = $mailData['headers']['user-agent'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isset($mailData['headers']['content-language'])) {
|
||||||
|
$headers['Content-Language'] = $mailData['headers']['content-language'];
|
||||||
|
}
|
||||||
|
|
||||||
$sendMimeMail = new Mail_mime();
|
$sendMimeMail = new Mail_mime();
|
||||||
$sendMimeMail->setTXTBody($textMsg);
|
$sendMimeMail->setTXTBody($textMsg);
|
||||||
$sendMimeMail->addAttachment(
|
$sendMimeMail->addAttachment(
|
||||||
|
@ -104,4 +125,4 @@ $sendMail->send($mailData['headers']['to'], $mailHeaders, $mailBody);
|
||||||
mailparse_msg_free($mail);
|
mailparse_msg_free($mail);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue