allow non resolvable SIP contacts when SIMPLE presence is on

when adding a SIP contact:
- send a SUBSCRIPTION_CREATED event before any network connection. It
  doesn't matter whether the contact will be later resolved or not.
- do not send SUBSCRIPTION_RESOLVED event when SIMPLE presence is
  disabled (faking a resolved contact altered the meaning of the event
  and no consumer is interested in this event for now)
- do not send SUBSCRIPTION_FAILED if an error happens or the other end
  does not support presence subscription, so as not to prevent the
  contact from being added
cusax-fix
Sebastien Mazy 17 years ago
parent d8fe3531be
commit d6eee81727

@ -1110,32 +1110,20 @@ public void subscribe(ContactGroup parentGroup, String contactIdentifier)
contactIdentifier + " is not a valid string.", exc);
}
if (this.presenceEnabled == false)
{
// create the contact
contact = new ContactSipImpl(contactAddress,
this.parentProvider);
((ContactGroupSipImpl) parentGroup).addContact(contact);
// pretend that the contact is created
fireSubscriptionEvent(contact,
parentGroup,
SubscriptionEvent.SUBSCRIPTION_CREATED);
// create a new contact, marked as resolvable and non resolved
contact = new ContactSipImpl(contactAddress, this.parentProvider);
((ContactGroupSipImpl) parentGroup).addContact(contact);
// and resolved
fireSubscriptionEvent(contact,
parentGroup,
SubscriptionEvent.SUBSCRIPTION_RESOLVED);
fireSubscriptionEvent(contact,
parentGroup,
SubscriptionEvent.SUBSCRIPTION_CREATED);
// do not query the presence state
if (this.presenceEnabled == false)
return;
}
assertConnected();
// create the contact
contact = new ContactSipImpl(contactAddress, this.parentProvider);
contact.setParentGroup((ContactGroupSipImpl)parentGroup);
//create the subscription
Request subscription;
try
@ -1906,15 +1894,12 @@ else if (response.getStatusCode() == Response.UNAUTHORIZED
contact.setClientDialog(null);
}
// 408 480 486 600 603 : non definitive reject
// others: definitive reject (or not implemented)
}
else if (response.getStatusCode() == Response.REQUEST_TIMEOUT
|| response.getStatusCode() == Response
.TEMPORARILY_UNAVAILABLE
|| response.getStatusCode() == Response.BUSY_HERE
|| response.getStatusCode() == Response.BUSY_EVERYWHERE
|| response.getStatusCode() == Response.DECLINE)
else
{
logger.debug("error received from the network" + response);
logger.debug("error received from the network:\n"
+ response);
if (response.getStatusCode() == Response
.TEMPORARILY_UNAVAILABLE)
@ -1931,27 +1916,8 @@ else if (response.getStatusCode() == Response.REQUEST_TIMEOUT
this.subscribedContacts.remove(idheader.getCallId());
contact.setClientDialog(null);
fireSubscriptionEvent(contact, contact.getParentContactGroup(),
SubscriptionEvent.SUBSCRIPTION_FAILED,
response.getStatusCode(),
response.getReasonPhrase());
// definitive reject (or not implemented)
}
else
{
logger.debug("error received from the network" + response);
// we'll never be able to resolve this contact
contact.setResolvable(false);
changePresenceStatusForContact(contact,
sipStatusEnum.getStatus(SipStatusEnum.UNKNOWN));
this.subscribedContacts.remove(idheader.getCallId());
contact.setClientDialog(null);
fireSubscriptionEvent(contact, contact.getParentContactGroup(),
SubscriptionEvent.SUBSCRIPTION_FAILED,
response.getStatusCode(),
response.getReasonPhrase());
}
}

Loading…
Cancel
Save