Browse Source

Ergänzung, Kommentar was bei SIP noch fehlt

RTP
Jan 5 years ago
parent
commit
057148f77f

+ 3
- 3
src/controller/CommandController.java View File

import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.logging.Logger; import java.util.logging.Logger;
import logger.OhmLogger; import logger.OhmLogger;
import model.VoIP;
import model.SIPmodel;


/** /**
* *
public class CommandController implements ActionListener public class CommandController implements ActionListener
{ {
private static final Logger lc = OhmLogger.getLogger(); private static final Logger lc = OhmLogger.getLogger();
private VoIP model;
private SIPmodel model;
private Hauptfenster view; private Hauptfenster view;
private CommandInvoker invoker; private CommandInvoker invoker;
public CommandController(VoIP model, Hauptfenster view)
public CommandController(SIPmodel model, Hauptfenster view)
{ {
this.model = model; this.model = model;
this.view = view; this.view = view;

+ 2
- 1
src/controller/CommandInterface.java View File

/** /**
* *
* @author Jan * @author Jan
* wird an sich noch nicht gebraucht aber später noch nützlich
* momentan wird nur execute gebraucht, undo später sinnvoll bzw. vielleicht
* bei cancel von Invite oder Anruf statt Anruf beenden.
*/ */
public interface CommandInterface public interface CommandInterface
{ {

+ 3
- 3
src/controller/commands/CommandAnnehmen.java View File

import gui.Hauptfenster; import gui.Hauptfenster;
import java.util.logging.Logger; import java.util.logging.Logger;
import logger.OhmLogger; import logger.OhmLogger;
import model.VoIP;
import model.SIPmodel;


/** /**
* *
public class CommandAnnehmen implements CommandInterface public class CommandAnnehmen implements CommandInterface
{ {
private static final Logger lginvite = OhmLogger.getLogger(); private static final Logger lginvite = OhmLogger.getLogger();
private VoIP model;
private SIPmodel model;
private Hauptfenster view; private Hauptfenster view;
public CommandAnnehmen(VoIP model, Hauptfenster view)
public CommandAnnehmen(SIPmodel model, Hauptfenster view)
{ {
this.model = model; this.model = model;
this.view = view; this.view = view;

+ 5
- 3
src/controller/commands/CommandBeenden.java View File

import gui.Hauptfenster; import gui.Hauptfenster;
import java.util.logging.Logger; import java.util.logging.Logger;
import logger.OhmLogger; import logger.OhmLogger;
import model.VoIP;
import model.SIPmodel;


/** /**
* *
* @author Jan * @author Jan
* Muss noch komplett implementiert werden * Muss noch komplett implementiert werden
* -> Bye bei laufendem Gespräch
* -> Cancel bei laufender Anfrage
*/ */
public class CommandBeenden implements CommandInterface public class CommandBeenden implements CommandInterface
{ {
private static final Logger lginvite = OhmLogger.getLogger(); private static final Logger lginvite = OhmLogger.getLogger();
private VoIP model;
private SIPmodel model;
private Hauptfenster view; private Hauptfenster view;
public CommandBeenden(VoIP model, Hauptfenster view)
public CommandBeenden(SIPmodel model, Hauptfenster view)
{ {
this.model = model; this.model = model;
this.view = view; this.view = view;

+ 3
- 3
src/controller/commands/CommandInvite.java View File

import javax.sip.InvalidArgumentException; import javax.sip.InvalidArgumentException;
import javax.sip.SipException; import javax.sip.SipException;
import logger.OhmLogger; import logger.OhmLogger;
import model.VoIP;
import model.SIPmodel;


/** /**
* *
public class CommandInvite implements CommandInterface public class CommandInvite implements CommandInterface
{ {
private static final Logger lginvite = OhmLogger.getLogger(); private static final Logger lginvite = OhmLogger.getLogger();
private VoIP model;
private SIPmodel model;
private Hauptfenster view; private Hauptfenster view;
public CommandInvite(VoIP model, Hauptfenster view)
public CommandInvite(SIPmodel model, Hauptfenster view)
{ {
this.model = model; this.model = model;
this.view = view; this.view = view;

+ 3
- 3
src/controller/commands/CommandRegister.java View File

import javax.sip.InvalidArgumentException; import javax.sip.InvalidArgumentException;
import javax.sip.SipException; import javax.sip.SipException;
import logger.OhmLogger; import logger.OhmLogger;
import model.VoIP;
import model.SIPmodel;


/** /**
* *
public class CommandRegister implements CommandInterface public class CommandRegister implements CommandInterface
{ {
private static final Logger lgregister = OhmLogger.getLogger(); private static final Logger lgregister = OhmLogger.getLogger();
private VoIP model;
private SIPmodel model;
private Hauptfenster view; private Hauptfenster view;
public CommandRegister(VoIP model, Hauptfenster view)
public CommandRegister(SIPmodel model, Hauptfenster view)
{ {
this.model = model; this.model = model;
this.view = view; this.view = view;

+ 1
- 1
src/logger/OhmLogger.java View File

import logger.myformatter.MyFormatter; import logger.myformatter.MyFormatter;


/** /**
*
* nobody
* *
*/ */
public class OhmLogger public class OhmLogger

src/model/VoIP.java → src/model/SIPmodel.java View File

/** /**
* *
* @author Jan * @author Jan
* komplettes Model für VoIP
komplettes Model für SIPmodel
*/ */
public class VoIP implements SipListenerExt
public class SIPmodel implements SipListenerExt
{ {
Hauptfenster view; //später entfernen wegen Zugriff Hauptfenster view; //später entfernen wegen Zugriff
private static final Logger lg = OhmLogger.getLogger(); private static final Logger lg = OhmLogger.getLogger();
Address contactAddress; Address contactAddress;
private ContactHeader contactHeader; private ContactHeader contactHeader;


public VoIP(Hauptfenster view) //Konstruktor für eigene Daten
public SIPmodel(Hauptfenster view) //Konstruktor für eigene Daten
{ {
this.view = view; this.view = view;
invite = true; invite = true;
} }
catch (ParseException | SipException ex) catch (ParseException | SipException ex)
{ {
lg.getLogger(VoIP.class.getName()).log(Level.SEVERE, null, ex);
lg.getLogger(SIPmodel.class.getName()).log(Level.SEVERE, null, ex);
} }
} }
//Aktive Kommunikation //Aktive Kommunikation
} }
catch (ParseException | SipException | InvalidArgumentException ex) catch (ParseException | SipException | InvalidArgumentException ex)
{ {
lg.getLogger(VoIP.class.getName()).log(Level.SEVERE, null, ex);
lg.getLogger(SIPmodel.class.getName()).log(Level.SEVERE, null, ex);
} }


} }
mediavec.add(sdpFactory.createAttribute("rtpmap", "18 G729/8000")); mediavec.add(sdpFactory.createAttribute("rtpmap", "18 G729/8000"));
mediavec.add(sdpFactory.createAttribute("ptime", "20")); mediavec.add(sdpFactory.createAttribute("ptime", "20"));
} }
else
else//Vergleich von eigenen Codecs mit Codecs der anruft und Rückgabe entsprechend wählen
{ {


} }
try try
{ {
//Trying Message to Server (Response Trying) //Trying Message to Server (Response Trying)
Response responsetry = this.messageFactory.createResponse(100, requestEvent.getRequest()); Response responsetry = this.messageFactory.createResponse(100, requestEvent.getRequest());
responsetry.addHeader((ViaHeader) requestEvent.getRequest().getHeader("Via")); responsetry.addHeader((ViaHeader) requestEvent.getRequest().getHeader("Via"));
responsetry.addHeader((FromHeader) requestEvent.getRequest().getHeader("From")); responsetry.addHeader((FromHeader) requestEvent.getRequest().getHeader("From"));
} }
catch (ParseException | SipException | SdpException ex) catch (ParseException | SipException | SdpException ex)
{ {
Logger.getLogger(VoIP.class.getName()).log(Level.SEVERE, null, ex);
Logger.getLogger(SIPmodel.class.getName()).log(Level.SEVERE, null, ex);


} }
} }
@Override @Override
public void processTimeout(TimeoutEvent timeoutEvent) public void processTimeout(TimeoutEvent timeoutEvent)
{ {
view.getTxtArea().append("processTimeout\n");
//view.getTxtArea().append("processTimeout\n");
} }


@Override @Override
public void processIOException(IOExceptionEvent exceptionEvent) public void processIOException(IOExceptionEvent exceptionEvent)
{ {
view.getTxtArea().append("processIOException\n");
//view.getTxtArea().append("processIOException\n");
} }


@Override @Override
public void processTransactionTerminated( public void processTransactionTerminated(
TransactionTerminatedEvent transactionTerminatedEvent) TransactionTerminatedEvent transactionTerminatedEvent)
{ {
view.getTxtArea().append("processTransactionTerminated\n");
//view.getTxtArea().append("processTransactionTerminated\n");
} }


@Override @Override
public void processDialogTerminated( public void processDialogTerminated(
DialogTerminatedEvent dialogTerminatedEvent) DialogTerminatedEvent dialogTerminatedEvent)
{ {
view.getTxtArea().append("processDialogTerminated\n");
//view.getTxtArea().append("processDialogTerminated\n");
} }
} }

+ 2
- 2
src/phone/Start.java View File

import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.text.ParseException; import java.text.ParseException;
import model.VoIP;
import model.SIPmodel;
/** /**
* Builder Class / Start Klasse des Programmes * Builder Class / Start Klasse des Programmes
* @author Jan * @author Jan
public Start() throws ParseException, UnknownHostException public Start() throws ParseException, UnknownHostException
{ {
Hauptfenster view = new Hauptfenster(); Hauptfenster view = new Hauptfenster();
VoIP model = new VoIP(view);
SIPmodel model = new SIPmodel(view);
CommandController controller = new CommandController(model, view); CommandController controller = new CommandController(model, view);
controller.registerEvents(); controller.registerEvents();

Loading…
Cancel
Save