title: twilio, parse.com cloud code passing parameters/data
body: <p>i have objc code that calls a PFCloud function (to parse.com cloud code) that initiates an outbound call via twilio api.  that part works well.  the outbound call made by twilio plays an mp3 audio message, the mp3 url is hard coded in my parse.com cloud code.  how to make the mp3 a variable, and to pass it in when i set the GET url for twilio?  following is my code, the commented lines are ways i have tried/failed to pass in the fileName (mp3 file url) data.  thank you.</p>
  
  <p>objective c code</p>
  
  <pre><code>-(void)makeCallViaTwilio {
      NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
      params[@"to"] = @"+12319818818";
      params[@"fileName"] = @"https://s3.amazonaws.com/shuang/voiceMessageTest.mp3";
      [PFCloud callFunctionInBackground:@"makeCall" withParameters:params block:^(id object, NSError *error) {
          if (!error) {
              // succeeded
          }
      }];
  
  }
  </code></pre>
  
  <p>parse.com cloud code to make call</p>
  
  <pre><code>// Use Parse's RPC functionality to make an outbound call
  Parse.Cloud.define('makeCall', function(request, response) {
      // Create a Twilio REST API client - get your account SID and
      // auth token at https://www.twilio.com/user/account
      var client = new twilio.RestClient(
          'number...', // Account SID
          'number...' // auth token
      );
  
  var getUrl = "https://easedrop.parseapp.com/hello?fileName=";
  var messageUrl = "request.params.fileName";
  var getUrlWithFileName = getUrl.concat(messageUrl); 
  
      // Place an outbound call
      client.makeCall({
          to: request.params.to, // the number you wish to call
          from: '+12318288183', // a valid Twilio number you own
   //     url: 'https://easedrop.parseapp.com/hello'
          url: getUrlWithFileName, // TwiML URL
          method: 'GET' // HTTP method with which to fetch the TwiML
  //      params: {@"fileName": request.params.fileName}
      }, function(error, data) {
          // Handle the result of placing the outbound call
          if (error) {
              response.error('there was a problem :(');
          } else {
              response.success('call incoming!');
          }
      });
  });
  </code></pre>
  
  <p>TwiML code</p>
  
  <pre><code>    // Create a route that will respond to am HTTP GET request with some
      // simple TwiML instructions
      app.get('/hello', function(request, response) {
          // Create a TwiML response generator object
          var twiml = new twilio.TwimlResponse();
  
      //    twiml.record;
  
          // twiml.play('https://s3.amazonaws.com/shuang/voiceMessageTest.mp3');
          twiml.play(request.params.fileName);
          // twiml.play(request);
          // twiml.play(fileName);
  
  
              twiml.say('To send, reply or ease drop on voice messages, download Easedrop from the app store.', {
              voice:'woman'
              }); 
  
      twiml.say('E', {
          voice:'woman'
          });
      twiml.pause();
  
      twiml.say('Ay', {
          voice:'woman'
          }); 
      twiml.pause();
  
      twiml.say('S', {
          voice:'woman'
          }); 
      twiml.pause();
  
      twiml.say('E', {
          voice:'woman'
          }); 
      twiml.pause();
  
      twiml.say('D R O P', {
          voice:'woman'
          }); 
      twiml.pause();
  
      twiml.say('ease drop', {
          voice:'woman'
          }); 
      twiml.pause();
  
      twiml.say('Good day.', {
          voice:'woman'
          }); 
  
  
      // Render the TwiML XML document
      response.type('text/xml');
      response.send(twiml.toString());
  });
  
  // Start the Express app
  app.listen();
  </code></pre>