Parse platform twilio,parse.com云代码传递参数/数据

Parse platform twilio,parse.com云代码传递参数/数据,parse-platform,twilio,Parse Platform,Twilio,我有一个objc代码,它调用PFCloud函数来解析.com云代码,该代码通过TwilioAPI启动出站调用。那部分很好用。twilio发出的出站呼叫播放mp3音频消息,mp3 url在my parse.com云代码中硬编码。如何使mp3成为变量,并在设置twilio的GET url时将其传入?以下是我的代码,注释行是我尝试/未能传递文件名mp3文件url数据的方式。多谢各位 目标c代码 -(void)makeCallViaTwilio { NSMutableDictionary * p

我有一个objc代码,它调用PFCloud函数来解析.com云代码,该代码通过TwilioAPI启动出站调用。那部分很好用。twilio发出的出站呼叫播放mp3音频消息,mp3 url在my parse.com云代码中硬编码。如何使mp3成为变量,并在设置twilio的GET url时将其传入?以下是我的代码,注释行是我尝试/未能传递文件名mp3文件url数据的方式。多谢各位

目标c代码

-(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
        }
    }];

}
解析.com云代码以进行调用

// 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!');
        }
    });
});
TwiML代码

    // 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();

一位同事修复了代码,我在这里发布,以防其他人有类似的问题。要使原始问题中的main.js代码正常工作,需要以下几行代码->

var getUrl = "https://easedrop.parseapp.com/hello?fileName=" + request.params.fileName;

url: getUrl, // TwiML URL

twiml.play(request.query.fileName);

sarvesh,系统说我需要等18个小时才能接受我的答案。只要系统允许,我会尽快接受。