| | package AcrossCommunication.Samples; |
| | import AcrossCommunication.ACProxies.*; |
| | public class LibPhoneClient{ |
| | Personalizer pers = null; |
| | Session sess = null; |
| | public LibPhoneClient(String userName, String pwd) { |
| | try{ |
| | pers = new Personalizer(); |
| | sess = pers.CreateSession(userName, pwd); |
| | } catch(Exception exc){ |
| | System.out.println("Initializing error."); |
| | System.out.println(exc); |
| | } |
| | } |
| | public static void main(String[] args) { |
| | LibPhoneClient client1 = new LibMailClient("user", "pwd"); |
| | client1.SendPhoneMessageAndGetDigitResult(); |
| | } |
| | |
| | public boolean SendPhoneMessageAndGetDigitResult(){ |
| | boolean Result = false; |
| | if(sess == null){ |
| | return false; |
| | } |
| | try{ |
| | Phone p = sess.CreatePhoneNotification(true); |
| | p.Call("4161234567"); |
| | p.Say("You have a meeting with the manager at 12.00, please press 1 to confirm the time."); |
| | String DigitResponse = p.WaitDigits(10, 1, "#"); |
| | p.HangUp(); |
| | p.Release(); |
| | sess.Release(); |
| | if( DigitResponse.compareTo("1")== 0 ){ |
| | return true; |
| | } |
| | else{ |
| | return false; |
| | } |
| | } |
| | catch (Exception ex){ |
| | System.out.println("Internal exception during Send.. method!"); |
| | System.out.println(ex); |
| | if(sess != null){ |
| | try{ |
| | sess.Release(); |
| | } |
| | catch(Exception exc){ |
| | System.out.println("Can't release session object!"); |
| | System.out.println(exc); |
| | } |
| | } |
| | return false; |
| | } |
| | } |