Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. $client = new Services_Twilio('MyAccountSID', 'My auth token');
  2. $client->account->calls->create($from_number, $to_number, $url_or_AppSID, array(
  3. 'TwilioParam1' => 'value1',
  4. 'TwilioParam2' => 'value2',
  5. 'MyCustomParameter1' => 'CustomValue1',
  6. 'MyCustomParamete2' => 'CustomValue2'
  7. ));
  8.  
  9. Map<String, String> params = new HashMap<String, String>();
  10. params.put("From", myTwilioPhoneNumber);
  11. params.put("To", customerPhone);
  12. params.put("Url", myHandlerUrl));
  13. Call call = client.getAccount().getCallFactory().create(params);
  14. // THE LINE BELOW IS THE KEY TO PARAMETER PASSING
  15. db.store(call.getSid(), myCustomParametersJSON);
  16.  
  17. Sting callSid = request.getParameter("CallSid");
  18. // Optionally sleep 20 ms to make sure that data written by
  19. // db.store(call.getSid(), myCustomParametersJSON);
  20. // can now be read.
  21. CustomData customData = parseJSON(db.fetchKey(callSid));
  22. TwiMLResponse twimlResponse = new TwiMLResponse();
  23. Say sayMessage = new Say(makeCustomMessage(customData));
  24. twimlResponse.append(sayMessage);
  25. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement