• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CallFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.twilio.sdk.resource.factory.CallFactory的典型用法代码示例。如果您正苦于以下问题:Java CallFactory类的具体用法?Java CallFactory怎么用?Java CallFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CallFactory类属于com.twilio.sdk.resource.factory包,在下文中一共展示了CallFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
  TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

  // Build a filter for the CallList
  List<NameValuePair> params = new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("Url", "http://demo.twilio.com/docs/voice.xml"));
  params.add(new BasicNameValuePair("To", "+14155551212"));
  params.add(new BasicNameValuePair("SendDigits", "1234#"));
  params.add(new BasicNameValuePair("From", "+18668675310"));
  params.add(new BasicNameValuePair("Method", "GET"));
  
  
  CallFactory callFactory = client.getAccount().getCallFactory();
  Call call = callFactory.create(params);
  System.out.println(call.getSid());
}
 
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:17,代码来源:example-3.6.x.java


示例2: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
  TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

  // Build a filter for the CallList
  List<NameValuePair> params = new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("Url", "http://demo.twilio.com/docs/voice.xml"));
  params.add(new BasicNameValuePair("To", "+14155551212"));
  params.add(new BasicNameValuePair("From", "+18668675310"));
  params.add(new BasicNameValuePair("Method", "GET"));
  params.add(new BasicNameValuePair("StatusCallback", "https://www.myapp.com/events"));
  params.add(new BasicNameValuePair("StatusCallbackMethod", "POST"));
  params.add(new BasicNameValuePair("StatusCallbackEvent", "initiated"));
  params.add(new BasicNameValuePair("StatusCallbackEvent", "ringing"));
  params.add(new BasicNameValuePair("StatusCallbackEvent", "answered"));
  params.add(new BasicNameValuePair("StatusCallbackEvent", "completed"));


  CallFactory callFactory = client.getAccount().getCallFactory();
  Call call = callFactory.create(params);
  System.out.println(call.getSid());
}
 
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:22,代码来源:example-4.6.x.java


示例3: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
  TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

  // Build a filter for the CallList
  List<NameValuePair> params = new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("Url", "http://www.example.com/sipdial.xml"));
  params.add(new BasicNameValuePair("To", "sip:[email protected]"));
  params.add(new BasicNameValuePair("From", "Jack"));
  params.add(new BasicNameValuePair("SipAuthPassword", "secret"));
  params.add(new BasicNameValuePair("SipAuthUsername", "jack"));
  
  
  CallFactory callFactory = client.getAccount().getCallFactory();
  Call call = callFactory.create(params);
  System.out.println(call.getSid());
}
 
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:17,代码来源:example-2.6.x.java


示例4: makeCall

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public void makeCall(String url, String to, String from) {
    try {
        TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("Url", url));
        params.add(new BasicNameValuePair("To", to));
        params.add(new BasicNameValuePair("From", from));
         
        CallFactory callFactory = client.getAccount().getCallFactory();
        Call call = callFactory.create(params);
    } 
    catch (TwilioRestException e) {
            System.out.println(e.getErrorMessage());
    }
}
 
开发者ID:Brodan,项目名称:warm-transfers-java,代码行数:17,代码来源:TwilioCallerServlet.java


示例5: makeCall

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
/**
 * Makes a twilio outgoing phone call
 * @param toPhone the target phone number
 * @param twmlUrl the twml to execute (ie "http://demo.twilio.com/docs/voice.xml")
 * @return
 */
public Call makeCall(final Phone toPhone,
					 final Url twmlUrl) throws TwilioRestException {
	Preconditions.checkArgument(toPhone != null,"The destination phone must NOT be null!");
	Preconditions.checkArgument(twmlUrl != null,"A twml URL is needed!");
	Preconditions.checkState(_apiData.existsAccountData() && _apiData.canMakeVoicePhoneCalls(),"The API is NOT configured properly to make phone calls");
	
       TwilioRestClient client = _createTwilioRESTClient();
       
       List<NameValuePair> params = new ArrayList<NameValuePair>(); 
	params.add(new BasicNameValuePair("To",toPhone.asString())); 
	params.add(new BasicNameValuePair("From",_apiData.getVoicePhone().asString()));   
	params.add(new BasicNameValuePair("Method","GET"));  
	params.add(new BasicNameValuePair("FallbackMethod","GET"));  
	params.add(new BasicNameValuePair("StatusCallbackMethod","GET"));    
	params.add(new BasicNameValuePair("Record","false")); 
	params.add(new BasicNameValuePair("Url",twmlUrl.asString()));
	
       // Make the call
       CallFactory callFactory = client.getAccount().getCallFactory(); 
       Call call = callFactory.create(params); 
       log.info("Call stablished with id={}",call.getSid());
       return call;
}
 
开发者ID:opendata-euskadi,项目名称:r01fb,代码行数:30,代码来源:TwilioService.java


示例6: makeCall

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public boolean makeCall(String phoneNumber, String code, String lang) {
    if (canRun()) {
        final Account account = TWILIO_CLIENT.getAccount(); // Make a call
        CallFactory callFactory = account.getCallFactory();
        Map<String, String> callParams = new HashMap<String, String>();
        callParams.put("To", phoneNumber);
        callParams.put("From", TWILIO_FROM_NUMBER);
        callParams.put("Url", CoreConfiguration.getConfiguration().applicationUrl()
                + "/external/partyContactValidation.do?method=validatePhone&code=" + code + "&lang=" + lang);
        try {
            callFactory.create(callParams);
            return true;
        } catch (TwilioRestException e) {
            logger.error("Error makeCall: " + e.getMessage(), e);
            return false;
        }
    } else {
        logger.info("Call to >" + phoneNumber + "<: Bem-vindo ao sistema Fénix. Introduza o código " + code + " . Obrigado!");
        return true;
    }
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:22,代码来源:PhoneValidationUtils.java


示例7: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
		TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
		Account mainAccount = client.getAccount();
		CallFactory callFactory = mainAccount.getCallFactory();
		Map<String, String> callParams = new HashMap<String, String>();
		final String toNumber = "4153263626";
		final String fromNumber = "3109862198";
		callParams.put("To", toNumber); // Replace with your phone number
		callParams.put("From", fromNumber); // Replace with a Twilio number
		callParams.put("Url", URL);
//		callParams.put("Url", "http://demo.twilio.com/welcome/voice?fromNumber="+toNumber);
		// Make the call
		Call call = callFactory.create(callParams);
		// Print the call SID (a 32 digit hex like CA123..)
		System.out.println("sid - " + call.getSid());
		System.out.println("dir - " + call.getDirection());
		System.out.println("fro - " + call.getFrom());
		System.out.println("answered by - " + call.getAnsweredBy());
		System.out.println("price" + call.getPrice());
		System.out.println("status - " + call.getStatus());
		System.out.println("to - " + call.getTo());
		System.out.println("callerName " + call.getCallerName());
		System.out.println("start time - " + call.getStartTime());
		System.out.println("duration - " + call.getDuration());
	}
 
开发者ID:ongoingjourney,项目名称:MyExperiments,代码行数:26,代码来源:MakeCall.java


示例8: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
  TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

  // Build a filter for the CallList
  List<NameValuePair> params = new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("Url", "http://demo.twilio.com/docs/voice.xml"));
  params.add(new BasicNameValuePair("To", "+14155551212"));
  params.add(new BasicNameValuePair("From", "+15017122661"));
  
  
  CallFactory callFactory = client.getAccount().getCallFactory();
  Call call = callFactory.create(params);
  System.out.println(call.getSid());
}
 
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:15,代码来源:example-1.6.x.java


示例9: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
  TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

  // Build a filter for the CallList
  List<NameValuePair> params = new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("Url", "http://demo.twilio.com/docs/voice.xml"));
  params.add(new BasicNameValuePair("To", "client:charlie"));
  params.add(new BasicNameValuePair("From", "+15017122661"));
  
  
  CallFactory callFactory = client.getAccount().getCallFactory();
  Call call = callFactory.create(params);
  System.out.println(call.getSid());
}
 
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:15,代码来源:example-2.6.x.java


示例10: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
  TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

  // Build a filter for the CallList
  List<NameValuePair> params = new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("Url", "http://demo.twilio.com/docs/voice.xml"));
  params.add(new BasicNameValuePair("To", "+15005550003"));
  params.add(new BasicNameValuePair("From", "+15005550006"));
  
  
  CallFactory callFactory = client.getAccount().getCallFactory();
  Call call = callFactory.create(params);
  System.out.println(call.getSid());
}
 
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:15,代码来源:test-calls-example-2.6.x.java


示例11: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
  TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

  // Build a filter for the CallList
  List<NameValuePair> params = new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("Url", "http://demo.twilio.com/docs/voice.xml"));
  params.add(new BasicNameValuePair("To", "+14108675310"));
  params.add(new BasicNameValuePair("From", "+15005550006"));
  
  
  CallFactory callFactory = client.getAccount().getCallFactory();
  Call call = callFactory.create(params);
  System.out.println(call.getSid());
}
 
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:15,代码来源:test-calls-example-1.6.x.java


示例12: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
  TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

  // Build a filter for the CallList
  List<NameValuePair> params = new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("Url", "http://www.example.com/sipdial.xml"));
  params.add(new BasicNameValuePair("To", "sip:[email protected]?hatchkey=4815162342"));
  params.add(new BasicNameValuePair("From", "Jack"));
  
  
  CallFactory callFactory = client.getAccount().getCallFactory();
  Call call = callFactory.create(params);
  System.out.println(call.getSid());
}
 
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:15,代码来源:example-3.6.x.java


示例13: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
  TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

  // Build a filter for the CallList
  List<NameValuePair> params = new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("Url", "http://www.example.com/sipdial.xml"));
  params.add(new BasicNameValuePair("To", "sip:[email protected]"));
  params.add(new BasicNameValuePair("From", "Jack"));
  
  
  CallFactory callFactory = client.getAccount().getCallFactory();
  Call call = callFactory.create(params);
  System.out.println(call.getSid());
}
 
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:15,代码来源:example-1.6.x.java


示例14: main

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the CallList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("Url", "http://demo.twilio.com/docs/voice.xml"));
    params.add(new BasicNameValuePair("To", "+14155551212"));
    params.add(new BasicNameValuePair("From", "+15017122661"));
    params.add(new BasicNameValuePair("Record", "true"));

    CallFactory callFactory = client.getAccount().getCallFactory();
    Call call = callFactory.create(params);
    System.out.println(call.getSid());
}
 
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:15,代码来源:example-1.6.x.java


示例15: call

import com.twilio.sdk.resource.factory.CallFactory; //导入依赖的package包/类
public static Result call() throws TwilioRestException {
    // Get POST data
    Map<String, String[]> params = request().body().asFormUrlEncoded();
    String to = params.get("to")[0];

    // Make a call
    CallFactory callFactory = mainAccount.getCallFactory();
    Map<String, String> callParams = new HashMap<String, String>();
    callParams.put("To", to);
    callParams.put("From", TWILIO_NUMBER);
    callParams.put("Url", "http://twimlets.com/message?Message%5B0%5D=http://demo.kevinwhinnery.com/audio/zelda.mp3");
    callFactory.create(callParams);
    
    return ok("Call is inbound!");
}
 
开发者ID:carlpratt,项目名称:cs638-twilio,代码行数:16,代码来源:Application.java



注:本文中的com.twilio.sdk.resource.factory.CallFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HdfsBlocksMetadata类代码示例发布时间:2022-05-22
下一篇:
Java IOUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap