|
I am retreiveing a voicemail message to my client
and am getting a sucessful completion from the call but have not been able to
actually play the message which is supposed to be a .WAV file. I suspect
the problem is still with my code and how I am creating the file and was hoping
for some ideas.
The WSDL for the message response is
this:
<message
name="PortalVoiceMail_getVoiceMailMessageResponse">
<part name="result"
type="xsd2:ArrayOfByte">
<documentation>byte array, binary, encoded representation of the VM
message</documentation>
</part> </message>
I can echo out the result of $message from the call
and see that it is an array. Albeit a very large array even for a 2 sec voice
message.
I have also tried to add the base64_decode in case
this was needed - just shooting in the dark on that one.
The file is open in binary mode.
I could have used a foreach to go through the array
but figured I had to go through the array and assemble the message, then write
it to the file.
Extract of my code:
$message
=
$this->_performAPICall('_portalVoiceMailSOAPID','getVoiceMailMessage',$parms);
$file =
fopen("C:/logs/message$id.wav","wb");
$content = ''; $recnum =
count($message); for ($i=0;
$i<= $recnum; $i++)
{ $content
.= $message[$i];
} //$vm =
base64_decode($content);
fwrite($file,$content);
fclose($file);
|