Browse Source

Zeichnen ergänzt aber noch nicht übertragen

RTP
Normal 5 years ago
parent
commit
77657a69f5

+ 2
- 4
src/controller/commands/CommandInvite.java View File

@@ -36,17 +36,15 @@ public class CommandInvite implements CommandInterface
public void execute()
{
try
{ view.getTxtArea().append("Einladung an " + view.getTxtServerIP().getText() + " gesendet\n");
{ view.getTxtArea().append("Einladung an " + view.getTxtcallIP().getText() + " gesendet\n");
model.sendInvitation(view.getTxtcallIP().getText(), 5078);
}
catch (ParseException|InvalidArgumentException|SdpException|SipException ex)
{
view.getTxtArea().append("Einladung fehlgeschlagen");
view.getTxtArea().append("Einladung fehlgeschlagen\n");
lginvite.getLogger(CommandInvite.class.getName()).log(Level.SEVERE, null, ex);
}
}

@Override
public void undo()
{

+ 2
- 1
src/controller/commands/CommandRegister.java View File

@@ -37,12 +37,13 @@ public class CommandRegister implements CommandInterface
try
{
view.getTxtArea().append("Registrierung an " + view.getTxtServerIP().getText() + " gesendet\n");
System.out.println("Test: "+ view.getTxtServerIP().getText());
model.sendRegister(view.getTxtServerIP().getText(), 5078);
}
catch (ParseException|InvalidArgumentException|SipException ex)
{
view.getTxtArea().append("Registrierung fehlgeschlagen");
view.getTxtArea().append("Registrierung fehlgeschlagen\n");
lgregister.getLogger(CommandRegister.class.getName()).log(Level.SEVERE, null, ex);
}
}

+ 14
- 9
src/model/VoIP.java View File

@@ -70,7 +70,7 @@ public class VoIP implements SipListenerExt
{
//wird an sich erstmal nicht gebraucht aber später sinnvoll um eigene Daten zu initialisieren
String abc = InetAddress.getLocalHost().getHostAddress();
/*
this.myIPAddress = InetAddress.getLocalHost().getHostAddress();

this.sipFactory = SipFactory.getInstance();
@@ -78,7 +78,7 @@ public class VoIP implements SipListenerExt
this.properties = new Properties();
this.properties.setProperty("javax.sip.STACK_NAME", "stack");
this.sipStack = this.sipFactory.createSipStack(this.properties);
this.messageFactory = this.sipFactory.createMessageFactory();
this.messageFactory = this.sipFactory.createMessageFactory();
this.headerFactory = this.sipFactory.createHeaderFactory();
this.addressFactory = this.sipFactory.createAddressFactory();
this.listeningPoint = this.sipStack.createListeningPoint(this.myIPAddress, this.myPort, this.protocolTyp);
@@ -86,6 +86,7 @@ public class VoIP implements SipListenerExt
this.sipProvider.addSipListener(this);
this.contactAddress = this.addressFactory.createAddress("sip:129@" + this.myIPAddress + ":" + this.myPort); //+ ":" + this.myPort
this.contactHeader = this.headerFactory.createContactHeader(contactAddress);
*/
}
catch (Exception e)
{
@@ -103,8 +104,12 @@ public class VoIP implements SipListenerExt

public void sendRegister(String serverIP, int serverPort) throws ParseException, InvalidArgumentException, SipException
{
System.out.println("Test");
System.out.println(serverIP);
lg.info("Vorbereiten des Registrierungs Headers");
Address addressto = this.addressFactory.createAddress("sip:192.168.100.11"); //evtl. mit Port: sip:192.168.100.11:5060
//Address addressto = this.addressFactory.createAddress("sip:"+serverIP); //evtl. mit Port: sip:192.168.100.11:5060
Address addressto = this.addressFactory.createAddress("sip:192.168.100.11");
System.out.println("Warum" + addressto);
ToHeader to = this.headerFactory.createToHeader(addressto, null); // Integer.toString(tag) address + tag
URI requestURI = addressto.getURI();
CallIdHeader callId = this.sipProvider.getNewCallId();
@@ -121,12 +126,11 @@ public class VoIP implements SipListenerExt
request.addHeader(allow);
request.addHeader(expire);
this.sipProvider.sendRequest(request);
view.getTxtArea().append("Erfolgreiche Registierung\n");
lg.info("Erfolgreiches Senden der Registrierung");
}
public void sendInvitation(String sipaddresse, int serverPort)throws ParseException, InvalidArgumentException, SipException, SdpException
{
Address addressto = this.addressFactory.createAddress(sipaddresse); //evtl. mit Port: sip:192.168.100.11:5060
Address addressto = this.addressFactory.createAddress("sip:"+sipaddresse); //evtl. mit Port: sip:192.168.100.11:5060
ToHeader to = this.headerFactory.createToHeader(addressto, null); // Integer.toString(tag) address + tag
URI requestURI = addressto.getURI();
CallIdHeader callId = this.sipProvider.getNewCallId();
@@ -138,7 +142,7 @@ public class VoIP implements SipListenerExt
MaxForwardsHeader maxForwards = this.headerFactory.createMaxForwardsHeader(70);
AllowHeader allow = this.headerFactory.createAllowHeader("NOTIFY,INVITE,ACK,CANCEL,BYE,REFER,INFO,OPTIONS,MESSAGE");
ExpiresHeader expire = this.headerFactory.createExpiresHeader(3600); //int value
Request request = this.messageFactory.createRequest(requestURI, "REGISTER", callId, cSeq, from, to, via, maxForwards);
Request request = this.messageFactory.createRequest(requestURI, "INVITE", callId, cSeq, from, to, via, maxForwards);
request.addHeader(contactHeader);
request.addHeader(allow);
request.addHeader(expire);
@@ -193,7 +197,7 @@ public class VoIP implements SipListenerExt
//Aktive Kommunikation
else if ((Request.INVITE).equals(requestEvent.getRequest().getMethod())) // Invite von anderem Benutzer
{
view.getTxtArea().append("Werde von xxx angerufen");
view.getTxtArea().append("Werde von xxx angerufen\n");
lg.info("Hab Invitation bekommen");
try
{
@@ -213,6 +217,7 @@ public class VoIP implements SipListenerExt
responsetry.addHeader(supp);
responsetry.addHeader(allow);
this.sipProvider.sendResponse(responsetry);
view.getTxtArea().append("Trying geschickt");
lg.info("Trying ist raus");

//Ringing Message to Server (Responste Ringing)
@@ -233,9 +238,8 @@ public class VoIP implements SipListenerExt
AllowEventsHeader allowevent = this.headerFactory.createAllowEventsHeader("talk,hold");// für was gebraucht
responsering.addHeader(allowevent);
this.sipProvider.sendResponse(responsering);
System.out.println("Response ist raus");
view.getTxtArea().append("Ringing geschickt");

System.out.println("Erstelle 200 Ok + SDP Header(contentHeader)");
//Jetzt kommt 200 Ok SIP Header + SDP (SIP/SDP)
//Sdp Header erstellen nächster Schritt
System.out.println(requestEvent.getDialog());
@@ -319,6 +323,7 @@ public class VoIP implements SipListenerExt
request.addHeader(expire);
request.addHeader(auth);
this.sipProvider.sendRequest(request);
view.getTxtArea().append("Erfolgreich registriert");
}
catch (ParseException | SipException | InvalidArgumentException ex)
{

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

@@ -30,7 +30,8 @@ public class Start
view.getLblmyIP().setText(InetAddress.getLocalHost().getHostAddress());
view.getTxtServerIP().setText("192.168.100.11");
view.getTxtcallIP().setText("192.168.100.xxx");
view.setExtendedState(view.MAXIMIZED_BOTH);
//view.setExtendedState(view.MAXIMIZED_BOTH);
view.setSize(300, 200);
view.setTitle("TestOberfläche VoIP Phone");
view.setVisible(true);


Loading…
Cancel
Save