Download Voicemail

The example below demonstrates how to download a voicemail using the API. The resulting data can then be saved or streamed to a browser.

Depending on your application, you will firstly need to know the uid of the CDR the voicemail file relates to. This can be retrieved by searching for the specific CDR, or you may already have it stored locally from a previous retrieval. To search for a specific CDR we can call the following Request

Request

<?xml version="1.0"?>
<NoveroRequest>
  <Request target="Auth" name="SessionLogin" id="SessionRequest">
    <Username>[email protected]</Username>
    <Password>secretpassword</Password>
    <VKey>a9d64e4c3289e7a14b51baf8adfec60a</VKey>
  </Request>
  <Request target="NoveroCDR" name="GetCDRs" id="Request1">
    <StartDate>2016-05-23</StartDate>
    <EndDate>2016-05-24</EndDate>
    <Number>01211234567</Number>
  </Request>
</NoveroRequest>

Response

<?xml version="1.0"?>
<NoveroResponse>
  <Response target="Auth" name="SessionLogin" Code="200" RequestId="SessionRequest">
    <SessionId>676fb75612b1e3a5691f4969f6503378</SessionId>
  </Response>
  <Response target="NoveroCDR" name="GetCDRs" Code="200" RequestId="Request1">
    <CDRs>
      <CDR>
        <uid>108119862</uid>
        <ref>!5224557B6062F</ref>
        <calldate>2013-09-02</calldate>
        <calltime>10:08:11</calltime>
        <anumber>1245123123</anumber>
        <anumber_location>UK Chelmsford</anumber_location>
        <bnumber>1211234567</bnumber>
        <alias>-</alias>
        <dialled>V:[email protected]</dialled>
        <dialled_location>Voice to Email</dialled_location>
        <duration>15</duration>
        <ring_time>0</ring_time>
        <user_cost>0.005</user_cost>
        <reason>1</reason>
        <reason_q805>1</reason_q805>
      </CDR>
      <CDR>
        <uid>108139023</uid>
        <ref>!522485C6323B</ref>
        <calldate>2013-09-02</calldate>
        <calltime>13:34:14</calltime>
        <anumber>1245123123</anumber>
        <anumber_location>UK Chelmsford</anumber_location>
        <bnumber>1211234567</bnumber>
        <alias>-</alias>
        <dialled>447512345678</dialled>
        <dialled_location>UK O2 Mobile</dialled_location>
        <duration>21</duration>
        <ring_time>14</ring_time>
        <user_cost>0.026</user_cost>
        <reason>1</reason>
        <reason_q805>1</reason_q805>
      </CDR>
    </CDRs>
  </Response>
</NoveroResponse>

Using the UID of the CDR that went to voicemail, we can then issue a NoveroVoicemails::EncodeAndGet Request in order to retrieve the voicemail file data:

Request

<?xml version="1.0"?>
<NoveroRequest>
  <Request target="Auth" name="SessionLogin" id="SessionRequest">
    <Username>[email protected]</Username>
    <Password>secretpassword</Password>
    <VKey>a9d64e4c3289e7a14b51baf8adfec60a</VKey>
  </Request>
  <Request target="NoveroVoicemails" name="EncodeAndGet" id="d70a66ac2f2591507529ca27d37e343f0edef8a2">
    <CDRUID>108119862</CDRUID>
  </Request>
</NoveroRequest>

The response contains the base64 encoded data representing the voicemail file itself. This can then be decoded and written to file or streamed to a client;

Response

<NoveroResponse>
  <Response target="Auth" name="SessionLogin" Code="200" RequestId="SessionRequest">
    <SessionId>676fb75612b1e3a5691f4969f6503378</SessionId>
  </Response>
  <Response target="NoveroEvents" name="EncodeAndGet" Code="200" RequestId="d70a66ac2f2591507529ca27d37e343f0edef8a2">
    <Voicemail><![CDATA[ /* base64 encoded data */ ]]></Voicemail>
  </Response>
</NoveroResponse>