0

I am able to call a number with following code from the link https://www.twilio.com/docs/api/voice/making-calls

Is it possible to enable dual channel recording with following code ?. if yes, how ?

SDK Version: 6.x 7.x
// Install the Java helper library from twilio.com/docs/java/install
import java.net.URI;
import java.net.URISyntaxException;

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Call;
import com.twilio.type.PhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACd6b6b7dc8ae6f3e6f7ff72c8dbbd457f";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws URISyntaxException {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    Call call = Call.creator(new PhoneNumber("+14155551212"), new PhoneNumber("+15017250604"),
        new URI("http://demo.twilio.com/docs/voice.xml")).create();

    System.out.println(call.getSid());
  }
}
user754657
  • 388
  • 3
  • 14

1 Answers1

0

Twilio developer evangelist here.

You are missing the parameter to record the call in your API call here. When building the call object you need something like the following:

Call call = Call.creator(
  new PhoneNumber("+14155551212"),
  new PhoneNumber("+15017250604"),
  new URI("https://example.com/voice")
)
.setRecord(true)
.setRecordingChannels("dual")
.setRecordingStatusCallback("https://example.com/recording")
.create();

The URL that you pass to the call creator should point at an application that you control as well. This application needs to return TwiML that will connect the first call to another to give you the two legs to record. You need to use <Dial> with either <Number>, <Client>, <Sip> or <Sim>. Like this:

<Response>
  <Dial>
    <Number>NUMBER TO CONNECT TO</Number>
  </Dial>
</Response>

Let me know if this helps at all.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Following coe helps me connect to gotomeeting. Why do i need to configure TwiML if call is already connected and dual channel recording is also configured using Call.creator. `code` Call call = Call.creator( new PhoneNumber(FROM_NUMBER), new PhoneNumber(TO_NUMBER), new URI("https://example.com/voice") ) .setRecord(true) .setRecordingChannels("dual").setSendDigits("1234") .setRecordingStatusCallback("https://example.com/recording") .create(); `code` – user754657 Oct 12 '17 at 21:11
  • I'm not sure what you're asking here. What is your full use case here and what are you hoping to achieve? – philnash Oct 13 '17 at 11:59
  • I would like Twilio number to programmatically call GTM and start recording on dual channel. – user754657 Oct 14 '17 at 16:47
  • So you want to call into an existing conference run by GoToMeeting and record your end of the call and in a different channel, everyone else in the meeting? – philnash Oct 16 '17 at 09:59
  • You can drop me an email at philnash@twilio.com and I'll try to help :) – philnash Oct 17 '17 at 09:51