File tree Expand file tree Collapse file tree 12 files changed +39
-20
lines changed
snippets/src/main/java/voice Expand file tree Collapse file tree 12 files changed +39
-20
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ public static void main(String[] args) {
2525 String applicationKey = Settings .getApplicationKey ().orElse ("MY_APPLICATION_KEY" );
2626 String applicationSecret = Settings .getApplicationSecret ().orElse ("MY_APPLICATION_SECRET" );
2727
28+ // The Sinch virtual phone number to assign to the application, in E.164 format (e.g.,
29+ // +12025550123)
2830 String phoneNumber = Settings .getPhoneNumber ().orElse ("MY_SINCH_PHONE_NUMBER" );
2931
3032 Configuration configuration =
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public static void main(String[] args) {
2323 String applicationKey = Settings .getApplicationKey ().orElse ("MY_APPLICATION_KEY" );
2424 String applicationSecret = Settings .getApplicationSecret ().orElse ("MY_APPLICATION_SECRET" );
2525
26+ // The phone number to unassign from the application, in E.164 format (e.g., +12025550123)
2627 String phoneNumber = Settings .getPhoneNumber ().orElse ("MY_SINCH_PHONE_NUMBER" );
2728
2829 Configuration configuration =
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ public static void main(String[] args) {
2424 String applicationKey = Settings .getApplicationKey ().orElse ("MY_APPLICATION_KEY" );
2525 String applicationSecret = Settings .getApplicationSecret ().orElse ("MY_APPLICATION_SECRET" );
2626
27- String callbackURL = "A_WEBHOOK_URL" ;
27+ // The new callback URL to set for the application
28+ String callbackURL = "https://my.callback.url/voice" ;
2829
2930 Configuration configuration =
3031 Configuration .builder ()
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ public static void main(String[] args) {
2424 String applicationKey = Settings .getApplicationKey ().orElse ("MY_APPLICATION_KEY" );
2525 String applicationSecret = Settings .getApplicationSecret ().orElse ("MY_APPLICATION_SECRET" );
2626
27- String recipientPhoneNumber = "PHONE_NUMBER_TO_BE_CALLED" ;
27+ // The phone number you want to call, in E.164 format (e.g., +12025550123)
28+ String recipientPhoneNumber = "RECIPIENT_PHONE_NUMBER" ;
2829 String textToSpeech = "Hello, this is a call initiated from Sinch Java SDK. Goodbye." ;
2930
3031 Configuration configuration =
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ public static void main(String[] args) {
2323 String applicationKey = Settings .getApplicationKey ().orElse ("MY_APPLICATION_KEY" );
2424 String applicationSecret = Settings .getApplicationSecret ().orElse ("MY_APPLICATION_SECRET" );
2525
26- String callId = "A_CALL_ID" ;
26+ // The ID of the call to retrieve
27+ String callId = "CALL_ID" ;
2728
2829 Configuration configuration =
2930 Configuration .builder ()
Original file line number Diff line number Diff line change @@ -30,7 +30,10 @@ public static void main(String[] args) {
3030 String applicationKey = Settings .getApplicationKey ().orElse ("MY_APPLICATION_KEY" );
3131 String applicationSecret = Settings .getApplicationSecret ().orElse ("MY_APPLICATION_SECRET" );
3232
33- String callId = "A_CALL_ID" ;
33+ // The ID of the call to manage
34+ String callId = "CALL_ID" ;
35+ // The call leg to manage
36+ CallLeg callLeg = CallLeg .CALLEE ;
3437
3538 Configuration configuration =
3639 Configuration .builder ()
@@ -55,7 +58,7 @@ public static void main(String[] args) {
5558 SvamlControl request =
5659 SvamlControl .builder ().setInstructions (instructions ).setAction (action ).build ();
5760
58- callsService .manageWithCallLeg (callId , CallLeg . CALLEE , request );
61+ callsService .manageWithCallLeg (callId , callLeg , request );
5962
6063 LOGGER .info ("Done" );
6164 }
Original file line number Diff line number Diff line change @@ -29,7 +29,12 @@ public static void main(String[] args) {
2929 String applicationKey = Settings .getApplicationKey ().orElse ("MY_APPLICATION_KEY" );
3030 String applicationSecret = Settings .getApplicationSecret ().orElse ("MY_APPLICATION_SECRET" );
3131
32- String callId = "A_CALL_ID" ;
32+ // The ID of the call to update
33+ String callId = "CALL_ID" ;
34+ // The instruction to be performed
35+ SvamlInstruction instruction = SvamlInstructionSay .builder ().setText ("Goodbye" ).build ();
36+ // The instruction to add to the call
37+ SvamlAction action = SvamlActionHangup .DEFAULT ;
3338
3439 Configuration configuration =
3540 Configuration .builder ()
@@ -43,10 +48,6 @@ public static void main(String[] args) {
4348
4449 LOGGER .info (String .format ("Updating call with ID '%s'" , callId ));
4550
46- SvamlAction action = SvamlActionHangup .DEFAULT ;
47-
48- SvamlInstruction instruction = SvamlInstructionSay .builder ().setText ("Goodbye" ).build ();
49-
5051 Collection <SvamlInstruction > instructions = Collections .singletonList (instruction );
5152
5253 SvamlControl request =
Original file line number Diff line number Diff line change @@ -25,8 +25,11 @@ public static void main(String[] args) {
2525 String applicationSecret = Settings .getApplicationSecret ().orElse ("MY_APPLICATION_SECRET" );
2626 String phoneNumber = Settings .getPhoneNumber ().orElse ("MY_SINCH_PHONE_NUMBER" );
2727
28- String conferenceId = "AN_EXISTING_OR_TO_BE_CREATED_CONFERENCE_ID" ;
29- String phoneNumberToBeCalled = "PHONE_NUMBER_TO_BE_CALLED" ;
28+ // An existing or to be created conference ID
29+ String conferenceId = "CONFERENCE_ID" ;
30+ // The phone number to be called and added to the conference, in E.164 format (e.g.,
31+ // +12025550123)
32+ String recipientPhoneNumber = "RECIPIENT_PHONE_NUMBER" ;
3033
3134 Configuration configuration =
3235 Configuration .builder ()
@@ -40,11 +43,11 @@ public static void main(String[] args) {
4043
4144 LOGGER .info (
4245 String .format (
43- "Joining conference '%s' for phone number '%s'" , conferenceId , phoneNumberToBeCalled ));
46+ "Joining conference '%s' for phone number '%s'" , conferenceId , recipientPhoneNumber ));
4447
4548 CalloutRequestConference request =
4649 CalloutRequestConference .builder ()
47- .setDestination (DestinationPstn .from (phoneNumberToBeCalled ))
50+ .setDestination (DestinationPstn .from (recipientPhoneNumber ))
4851 .setCli (phoneNumber )
4952 .setConferenceId (conferenceId )
5053 .build ();
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ public static void main(String[] args) {
2323 String applicationKey = Settings .getApplicationKey ().orElse ("MY_APPLICATION_KEY" );
2424 String applicationSecret = Settings .getApplicationSecret ().orElse ("MY_APPLICATION_SECRET" );
2525
26- String conferenceId = "AN_EXISTING_CONFERENCE_ID" ;
26+ // The ID of the conference to retrieve
27+ String conferenceId = "CONFERENCE_ID" ;
2728
2829 Configuration configuration =
2930 Configuration .builder ()
Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ public static void main(String[] args) {
2222 String applicationKey = Settings .getApplicationKey ().orElse ("MY_APPLICATION_KEY" );
2323 String applicationSecret = Settings .getApplicationSecret ().orElse ("MY_APPLICATION_SECRET" );
2424
25- String conferenceId = "AN_EXISTING_CONFERENCE_ID" ;
25+ // The ID of the conference to remove all participants from
26+ String conferenceId = "CONFERENCE_ID" ;
2627
2728 Configuration configuration =
2829 Configuration .builder ()
You can’t perform that action at this time.
0 commit comments