Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $client = new Services_Twilio('MyAccountSID', 'My auth token');
- $client->account->calls->create($from_number, $to_number, $url_or_AppSID, array(
- 'TwilioParam1' => 'value1',
- 'TwilioParam2' => 'value2',
- 'MyCustomParameter1' => 'CustomValue1',
- 'MyCustomParamete2' => 'CustomValue2'
- ));
- Map<String, String> params = new HashMap<String, String>();
- params.put("From", myTwilioPhoneNumber);
- params.put("To", customerPhone);
- params.put("Url", myHandlerUrl));
- Call call = client.getAccount().getCallFactory().create(params);
- // THE LINE BELOW IS THE KEY TO PARAMETER PASSING
- db.store(call.getSid(), myCustomParametersJSON);
- Sting callSid = request.getParameter("CallSid");
- // Optionally sleep 20 ms to make sure that data written by
- // db.store(call.getSid(), myCustomParametersJSON);
- // can now be read.
- CustomData customData = parseJSON(db.fetchKey(callSid));
- TwiMLResponse twimlResponse = new TwiMLResponse();
- Say sayMessage = new Say(makeCustomMessage(customData));
- twimlResponse.append(sayMessage);
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement