Skip to content

Commit 3876698

Browse files
author
atsakiridis
committed
Fixed #252: Code cleanup
1 parent 9df70d6 commit 3876698

File tree

4 files changed

+3
-98
lines changed

4 files changed

+3
-98
lines changed

restcomm.android.client.sdk/src/main/java/org/mobicents/restcomm/android/client/sdk/RCDevice.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ private void initializeSignalling(boolean connectivity)
177177
else {
178178
DeviceImpl.GetInstance().Register();
179179
}
180-
//state = DeviceState.READY;
181180
}
182181
}
183182

@@ -538,11 +537,6 @@ public void updateSipProfile(HashMap<String, Object> params) {
538537
if (key.equals("pref_proxy_domain")) {
539538
sipProfile.setRemoteEndpoint((String) params.get(key));
540539
}
541-
/*
542-
else if (key.equals("pref_proxy_port")) {
543-
sipProfile.setRemotePort(Integer.parseInt((String) params.get(key)));
544-
}
545-
*/
546540
else if (key.equals("pref_sip_user")) {
547541
sipProfile.setSipUserName((String) params.get(key));
548542
} else if (key.equals("pref_sip_password")) {

restcomm.android.client.sdk/src/main/java/org/mobicents/restcomm/android/client/sdk/RCDeviceListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ enum RCConnectivityStatus {
4444
public abstract void onStartListening(RCDevice device);
4545

4646
/**
47-
* RCDevice stopped listening for incoming connections (<b>Not Implemented yet</b>)
47+
* RCDevice stopped listening for incoming connections
4848
*
4949
* @param device Device of interest
5050
*/

restcomm.android.client.sdk/src/main/java/org/mobicents/restcomm/android/sipua/SipProfile.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ public class SipProfile {
3636
private String transport = "udp";
3737

3838
private String remoteEndpoint;
39-
//private String remoteIp = "";
40-
//private int remotePort = 5060;
4139
private String sipUserName;
4240
private String sipPassword;
4341

@@ -79,13 +77,6 @@ public String getRemoteIp(AddressFactory addressFactory) throws ParseException {
7977
return remoteIp;
8078
}
8179

82-
/*
83-
public void setRemoteIp(String remoteIp) {
84-
RCLogger.i(TAG, "Setting remoteIp:" + remoteIp);
85-
this.remoteIp = remoteIp;
86-
}
87-
*/
88-
8980
public int getRemotePort(AddressFactory addressFactory) throws ParseException {
9081
if (remoteEndpoint.isEmpty()) {
9182
return 0;
@@ -97,13 +88,6 @@ public int getRemotePort(AddressFactory addressFactory) throws ParseException {
9788
return remotePort;
9889
}
9990

100-
/*
101-
public void setRemotePort(int remotePort) {
102-
RCLogger.i(TAG, "Setting remotePort:" + remotePort);
103-
this.remotePort = remotePort;
104-
}
105-
*/
106-
10791
public String getRemoteEndpoint() {
10892
return this.remoteEndpoint;
10993
}
@@ -134,6 +118,4 @@ public void setTransport(String transport) {
134118
RCLogger.i(TAG, "Setting transport:" + transport);
135119
this.transport = transport;
136120
}
137-
138-
139121
}

restcomm.android.client.sdk/src/main/java/org/mobicents/restcomm/android/sipua/impl/SipManager.java

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ enum CallDirection {
9595

9696
private ListeningPoint udpListeningPoint;
9797
private SipProfile sipProfile;
98-
//private String latestProxyIp;
9998
private Dialog dialog;
10099

101100
private ArrayList<ISipEventListener> sipEventListenerList = new ArrayList<ISipEventListener>();
@@ -111,7 +110,6 @@ enum CallDirection {
111110
// could also use dialog.isServer() flag but have found mixed opinions about it)
112111
CallDirection direction = CallDirection.NONE;
113112
private int remoteRtpPort;
114-
//private Thread.UncaughtExceptionHandler exceptionHandler;
115113

116114
// Constructors/Initializers
117115
public SipManager(SipProfile sipProfile, boolean connectivity) {
@@ -143,8 +141,8 @@ private boolean initialize(boolean connectivity)
143141
// You need 16 for logging traces. 32 for debug + traces.
144142
// Your code will limp at 32 but it is best for debugging.
145143
//properties.setProperty("android.gov.nist.javax.sip.TRACE_LEVEL", "32");
146-
//properties.setProperty("android.gov.nist.javax.sip.DEBUG_LOG", "/storage/emulated/legacy/Download/debug.log");
147-
//properties.setProperty("android.gov.nist.javax.sip.SERVER_LOG", "/storage/emulated/legacy/Download/server.log");
144+
//properties.setProperty("android.gov.nist.javax.sip.DEBUG_LOG", "/storage/emulated/legacy/Download/debug-1.log");
145+
//properties.setProperty("android.gov.nist.javax.sip.SERVER_LOG", "/storage/emulated/legacy/Download/server-1.log");
148146

149147
try {
150148
if (udpListeningPoint != null) {
@@ -418,20 +416,6 @@ public void Register(int expiry) throws ParseException, TransactionUnavailableEx
418416
if (sipProvider == null) {
419417
return;
420418
}
421-
/*
422-
if (!latestProxyIp.equals(sipProfile.getRemoteIp())) {
423-
// proxy ip address has been updated, need to re-initialize
424-
if (initialized) {
425-
RCLogger.i(TAG, "Registrar changed, reinitializing stack");
426-
shutdown();
427-
initialize(true);
428-
}
429-
else {
430-
return;
431-
}
432-
}
433-
*/
434-
435419
Register registerRequest = new Register();
436420
try {
437421
final Request r = registerRequest.MakeRequest(this, expiry, null);
@@ -447,11 +431,6 @@ public void run() {
447431
dispatchSipError(ISipEventListener.ErrorContext.ERROR_CONTEXT_NON_CALL, RCClient.ErrorCodes.SIGNALLING_REGISTER_ERROR,
448432
e.getMessage());
449433
}
450-
/*
451-
catch (SipException e) {
452-
e.printStackTrace();
453-
}
454-
*/
455434
}
456435
};
457436
thread.start();
@@ -469,20 +448,6 @@ public void Unregister(Address contact) throws ParseException, TransactionUnavai
469448
return;
470449
}
471450

472-
/*
473-
if (!latestProxyIp.equals(sipProfile.getRemoteIp())) {
474-
// proxy ip address has been updated, need to re-initialize
475-
if (initialized) {
476-
RCLogger.i(TAG, "Registrar changed, reinitializing stack");
477-
shutdown();
478-
initialize(true);
479-
}
480-
else {
481-
return;
482-
}
483-
}
484-
*/
485-
486451
Register registerRequest = new Register();
487452
try {
488453
final Request r = registerRequest.MakeRequest(this, 0, contact);
@@ -498,11 +463,6 @@ public void run() {
498463
dispatchSipError(ISipEventListener.ErrorContext.ERROR_CONTEXT_NON_CALL, RCClient.ErrorCodes.SIGNALLING_REGISTER_ERROR,
499464
e.getMessage());
500465
}
501-
/*
502-
catch (SipException e) {
503-
e.printStackTrace();
504-
}
505-
*/
506466
}
507467
};
508468
thread.start();
@@ -537,13 +497,6 @@ public void run() {
537497
dispatchSipError(ISipEventListener.ErrorContext.ERROR_CONTEXT_CALL, RCClient.ErrorCodes.SIGNALLING_CALL_ERROR,
538498
e.getMessage());
539499
}
540-
/*
541-
catch (SipException e) {
542-
//e.printStackTrace();
543-
dispatchSipError(ISipEventListener.ErrorContext.ERROR_CONTEXT_CALL, RCClient.ErrorCodes.SIGNALLING_TIMEOUT,
544-
e.getMessage());
545-
}
546-
*/
547500
}
548501
};
549502
thread.start();
@@ -572,13 +525,6 @@ public void run() {
572525
dispatchSipError(ISipEventListener.ErrorContext.ERROR_CONTEXT_CALL, RCClient.ErrorCodes.SIGNALLING_CALL_ERROR,
573526
e.getMessage());
574527
}
575-
/*
576-
catch (SipException e) {
577-
//e.printStackTrace();
578-
dispatchSipError(ISipEventListener.ErrorContext.ERROR_CONTEXT_CALL, RCClient.ErrorCodes.SIGNALLING_TIMEOUT,
579-
e.getMessage());
580-
}
581-
*/
582528
}
583529
};
584530
thread.start();
@@ -758,19 +704,11 @@ public void processResponse(ResponseEvent arg0) {
758704
Response response = (Response) arg0.getResponse();
759705
RCLogger.i(TAG, "processResponse(), status code: " + response.getStatusCode());
760706

761-
//Dialog responseDialog = null;
762707
ClientTransaction tid = arg0.getClientTransaction();
763-
if (tid != null) {
764-
//responseDialog = tid.getDialog();
765-
} else {
766-
//responseDialog = arg0.getDialog();
767-
}
768708
CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
769709
if (response.getStatusCode() == Response.PROXY_AUTHENTICATION_REQUIRED
770710
|| response.getStatusCode() == Response.UNAUTHORIZED) {
771711
try {
772-
//Address remoteParty = responseDialog.getRemoteParty();
773-
//SipURI remoteUri = (SipURI)remoteParty.getURI();
774712
AuthenticationHelper authenticationHelper = ((SipStackExt) sipStack)
775713
.getAuthenticationHelper(
776714
new AccountManagerImpl(sipProfile.getSipUserName(),
@@ -804,19 +742,11 @@ public void processResponse(ResponseEvent arg0) {
804742
} catch (SipException e) {
805743
e.printStackTrace();
806744
}
807-
/*
808-
catch (ParseException e) {
809-
e.printStackTrace();
810-
}
811-
*/
812-
813-
814745
} else if (response.getStatusCode() == Response.OK) {
815746
if (cseq.getMethod().equals(Request.INVITE)) {
816747
RCLogger.i(TAG, "Dialog after 200 OK " + dialog);
817748
try {
818749
RCLogger.i(TAG, "Sending ACK");
819-
//Request ackRequest = dialog.createAck(cseq.getSeqNumber());
820750
Request ackRequest = dialog.createAck(((CSeqHeader)response.getHeader(CSeqHeader.NAME)).getSeqNumber());
821751
dialog.sendAck(ackRequest);
822752
byte[] rawContent = response.getRawContent();
@@ -1156,7 +1086,6 @@ private void sendOk(RequestEvent requestEvt) {
11561086
// is different -at some point we should merge those methods
11571087
private void sendByeClient(Transaction transaction) {
11581088
RCLogger.i(TAG, "sendByeClient()");
1159-
//final Dialog dialog = transaction.getDialog();
11601089
if (dialog == null) {
11611090
RCLogger.i(TAG, "Hmm, weird: dialog is already terminated -avoiding BYE");
11621091
}

0 commit comments

Comments
 (0)