function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RIteshMRIteshM 

Making a call using a visualforce page using twilio integration

i am trying to develop visualforce page. i want to make a call. iwrite a code 

 

public class SampleClass{

String account = 'XXXXXXXXXXXXXXXXXXX';
String token = 'YYYYYYYYYYYYYYYYYY';

public PageReference hello(){
TwilioRestClient client = new TwilioRestClient(account, token);

Map<String,String> params = new Map<String,String> {
        'To'   => '+919953938584',
        'From' => '+919910728457',
        'Url' => 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient'
    };
TwilioCall call = client.getAccount().getCalls().create(params);
return null ;

}

}

 

and vsualforce page

 

<apex:page controller="SampleClass">

    <apex:form >
            <apex:commandButton action="{!hello}" value="Make a Call"/>
    </apex:form>

</apex:page>

 

 

both the numbers are verified so call is going and a music is playing.now i want that when the user click  make a call button then he can talk to the dialled phone number.means his voice went to the number which is dialled and he can hear that voice.in other way that user can dial a phone number and talk to a  person using only browser .is this possible .Please guideline .

Ashish_SFDCAshish_SFDC
vygala sainathvygala sainath
Hi,
Iam getting the following error can anyone resolve


TwilioRestException: Script-thrown exception
Error is in expression '{!hello}' in component <apex:commandButton> in page twilio_message: Class.TwilioRestClient: line 591, column 1
Class.TwilioResource.ListResource: line 444, column 1
Class.TwilioMessageList: line 50, column 1
Class.testtwilio.hello: line 14, column 1
Class.TwilioRestClient: line 591, column 1
Class.TwilioResource.ListResource: line 444, column 1
Class.TwilioMessageList: line 50, column 1
Class.testtwilio.hello: line 14, column 1


my code is given below

VF Page:
<apex:page controller="testtwilio">
 <apex:form >
   <apex:commandButton action="{!hello}" value="Make a Call"/>
 </apex:form>
</apex:page>

Apex Class

public class testtwilio {

String account = 'ACe8e44b316e6a15009f6ccb688cf56d19';
String token = '279daad95178678bcb199d328ff5ca31';

public PageReference hello(){
TwilioRestClient client = new TwilioRestClient(account, token);

Map<String,String> properties = new Map<String,String> {
            'To'   => '+918147430168',
            'From' => '+2015826854',
            'Body' => 'Hello!'
    };
TwilioMessage message = client.getAccount().getMessages().create(properties);
return null;
}
}