You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CommandInvite.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package controller.commands;
  7. import controller.CommandInterface;
  8. import gui.Hauptfenster;
  9. import static java.lang.Thread.sleep;
  10. import java.util.logging.Level;
  11. import java.util.logging.Logger;
  12. import javax.sip.SipException;
  13. import model.SoundSenderDemo;
  14. //import jlibrtpDemos.SoundSenderDemo;
  15. import logger.OhmLogger;
  16. import model.SIPmodel;
  17. import java.lang.String;
  18. import java.net.UnknownHostException;
  19. import model.RTPSendSingleString;
  20. /**
  21. *
  22. * @author Jan Fehlende Ergänzungen(timer nach 10 sec für abbruchbedingung +
  23. * bedingung falls angenommen wurde -> Boolean)
  24. */
  25. public class CommandInvite implements CommandInterface {
  26. private static final Logger lginvite = OhmLogger.getLogger();
  27. private SIPmodel model;
  28. private Hauptfenster view;
  29. public CommandInvite(SIPmodel model, Hauptfenster view) {
  30. this.model = model;
  31. this.view = view;
  32. }
  33. @Override
  34. public void execute() {
  35. try {
  36. view.getTxtArea().append("Einladung an " + view.getTxtcallIP().getText() + " gesendet\n");
  37. model.sendInvitation(view.getTxtcallIP().getText(), view.getTxtServerIP().getText(), 5078);
  38. } catch (SipException ex) {
  39. view.getTxtArea().append("Einladung fehlgeschlagen\n");
  40. lginvite.getLogger(CommandInvite.class.getName()).log(Level.SEVERE, null, ex);
  41. }
  42. try {
  43. sleep(5000);
  44. } catch (InterruptedException ex) {
  45. Logger.getLogger(CommandInvite.class.getName()).log(Level.SEVERE, null, ex);
  46. }
  47. callDemo();
  48. }
  49. @Override
  50. public void undo() {
  51. }
  52. @Override
  53. public Boolean isundoable() {
  54. return false;
  55. }
  56. public void callDemo(){
  57. System.out.println("Starte RTP Session");
  58. String[] s = null;
  59. SoundSenderDemo aDemo = new SoundSenderDemo();
  60. try {
  61. aDemo.SendDemo(s);
  62. } catch (UnknownHostException | InterruptedException ex) {
  63. Logger.getLogger(CommandInvite.class.getName()).log(Level.SEVERE, null, ex);
  64. }
  65. System.out.println("Beende RTP Session");
  66. }
  67. public void callUnicastDemo(){
  68. System.out.println("Starte RTP Unicast Session");
  69. String[] s = null;
  70. RTPSendSingleString aDemo = new RTPSendSingleString();
  71. aDemo.main(s);
  72. System.out.println("Beende RTP Unicast Session");
  73. }
  74. }