aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/OperationSetTelephonyBLFSipImpl.java72
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java12
-rw-r--r--src/net/java/sip/communicator/plugin/busylampfield/BLFActivator.java10
-rw-r--r--src/net/java/sip/communicator/service/protocol/OperationSetTelephonyBLF.java18
4 files changed, 84 insertions, 28 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetTelephonyBLFSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetTelephonyBLFSipImpl.java
index 644c85a..a9aefbe 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetTelephonyBLFSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetTelephonyBLFSipImpl.java
@@ -72,6 +72,10 @@ public class OperationSetTelephonyBLFSipImpl
* Account property suffix to set/provision monitored line group.
*/
public static final String BLF_LINE_GROUP_ACC_PROP_PREFIX = "Group";
+ /**
+ * Account property suffix to set/provision monitored line pickup template.
+ */
+ public static final String BLF_LINE_PICKUP_ACC_PROP_PREFIX = "Pickup";
/**
* The name of the event package supported by
@@ -195,7 +199,7 @@ public class OperationSetTelephonyBLFSipImpl
String[] lineValues = lines.get(ix);
if(lineValues == null)
{
- lineValues = new String[3];
+ lineValues = new String[4];
lines.put(ix, lineValues);
}
@@ -211,13 +215,17 @@ public class OperationSetTelephonyBLFSipImpl
{
lineValues[2] = entryValue;
}
+ else if(pName.contains(BLF_LINE_PICKUP_ACC_PROP_PREFIX))
+ {
+ lineValues[3] = entryValue;
+ }
}
for(Map.Entry<String, String[]> en : lines.entrySet())
{
String[] vals = en.getValue();
- this.lines.add(new Line(vals[0], vals[1], vals[2], this.provider));
+ this.lines.add(new Line(vals[0], vals[1], vals[2], vals[3], this.provider));
}
}
@@ -263,16 +271,25 @@ public class OperationSetTelephonyBLFSipImpl
if(details == null)
return;
- if(StringUtils.isNullOrEmpty(details.callID)
- || StringUtils.isNullOrEmpty(details.localTag)
- || StringUtils.isNullOrEmpty(details.remoteTag))
- return;
-
// replaces
Address targetAddress = null;
try
{
- targetAddress = provider.parseAddressString(line.getAddress());
+ String address = line.getAddress();
+ if(asteriskMode(details))
+ {
+ // broken mode for Asterisk, doesn't provide us with
+ // the proper call-id, etc. attributes.
+ // send an unspecified pickup-call if a template is set
+ if (StringUtils.isNullOrEmpty(line.getPickupTemplate(), true))
+ {
+ return;
+ }
+
+ address = line.getPickupTemplate().replace("\\1", address);
+ }
+
+ targetAddress = provider.parseAddressString(address);
}
catch (ParseException ex)
{
@@ -281,6 +298,16 @@ public class OperationSetTelephonyBLFSipImpl
OperationFailedException.ILLEGAL_ARGUMENT, ex, logger);
}
+ OperationSetBasicTelephonySipImpl telOpSet
+ = (OperationSetBasicTelephonySipImpl)provider
+ .getOperationSet(OperationSetBasicTelephony.class);
+
+ if (asteriskMode(details))
+ {
+ telOpSet.createOutgoingCall(targetAddress, null, null);
+ return;
+ }
+
Replaces replacesHeader = null;
SipURI sipURI = (SipURI) targetAddress.getURI();
@@ -315,12 +342,14 @@ public class OperationSetTelephonyBLFSipImpl
OperationFailedException.INTERNAL_ERROR, ex, logger);
}
- OperationSetBasicTelephonySipImpl telOpSet
- = (OperationSetBasicTelephonySipImpl)provider
- .getOperationSet(OperationSetBasicTelephony.class);
-
- CallSipImpl call
- = telOpSet.createOutgoingCall(targetAddress, null, null);
+ telOpSet.createOutgoingCall(targetAddress, null, null);
+ }
+
+ private boolean asteriskMode(LineDetails details)
+ {
+ return StringUtils.isNullOrEmpty(details.callID)
+ || StringUtils.isNullOrEmpty(details.localTag)
+ || StringUtils.isNullOrEmpty(details.remoteTag);
}
/**
@@ -549,6 +578,8 @@ public class OperationSetTelephonyBLFSipImpl
Node dialogNode = dialogList.item(i);
Element dialogElem = (Element)dialogNode;
+ details.id = dialogElem.getAttribute("id");
+ details.direction = dialogElem.getAttribute("direction");
details.callID = dialogElem.getAttribute("call-id");
details.localTag = dialogElem.getAttribute("local-tag");
details.remoteTag = dialogElem.getAttribute("remote-tag");
@@ -698,12 +729,25 @@ public class OperationSetTelephonyBLFSipImpl
*/
private class LineDetails
{
+
/**
* The current status of the line, the last event fired for it.
*/
int lastStatusEvent = BLFStatusEvent.STATUS_OFFLINE;
/**
+ * id of the dialog. Mandatory.
+ */
+ String id = null;
+
+ /**
+ * either initiator or recipient, and indicates whether the observed
+ * user was the initiator of the dialog, or the recipient of the INVITE
+ * that created it.
+ */
+ String direction;
+
+ /**
* call-id of the dialog if any, used for remote pickup.
*/
String callID = null;
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
index 009af86..a2a98b8 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
@@ -1589,16 +1589,16 @@ public class ProtocolProviderServiceSipImpl
Set<ProtocolProviderServiceSipImpl> instances
= new HashSet<ProtocolProviderServiceSipImpl>();
BundleContext context = SipActivator.getBundleContext();
- ServiceReference[] references = context.getServiceReferences(
- ProtocolProviderService.class.getName(),
- null
- );
- for(ServiceReference reference : references)
+ Collection<ServiceReference<ProtocolProviderService>> references =
+ context.getServiceReferences(ProtocolProviderService.class,
+ null);
+ for(ServiceReference<ProtocolProviderService> ref : references)
{
- Object service = context.getService(reference);
+ ProtocolProviderService service = context.getService(ref);
if(service instanceof ProtocolProviderServiceSipImpl)
instances.add((ProtocolProviderServiceSipImpl) service);
}
+
return instances;
}
catch(InvalidSyntaxException ex)
diff --git a/src/net/java/sip/communicator/plugin/busylampfield/BLFActivator.java b/src/net/java/sip/communicator/plugin/busylampfield/BLFActivator.java
index 036442b..94ea374 100644
--- a/src/net/java/sip/communicator/plugin/busylampfield/BLFActivator.java
+++ b/src/net/java/sip/communicator/plugin/busylampfield/BLFActivator.java
@@ -181,15 +181,11 @@ public class BLFActivator
}
else
{
- BLFContactSourceService css
- = new BLFContactSourceService(
+ BLFContactSourceService css = new BLFContactSourceService(
groupName, currentBLFGroups.size() + 1);
- serviceReg = (ServiceRegistration<ContactSourceService>)
- bundleContext.registerService(
- ContactSourceService.class.getName(),
- css,
- null);
+ serviceReg = bundleContext.registerService(
+ ContactSourceService.class, css, null);
currentBLFGroups.put(groupName, serviceReg);
css.addLine(line);
diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetTelephonyBLF.java b/src/net/java/sip/communicator/service/protocol/OperationSetTelephonyBLF.java
index 028c2ae..f6a50dc 100644
--- a/src/net/java/sip/communicator/service/protocol/OperationSetTelephonyBLF.java
+++ b/src/net/java/sip/communicator/service/protocol/OperationSetTelephonyBLF.java
@@ -80,6 +80,11 @@ public interface OperationSetTelephonyBLF
private String group;
/**
+ * Asterisk pickup prefix.
+ */
+ private String pickupTemplate;
+
+ /**
* The parent provider.
*/
private ProtocolProviderService provider;
@@ -90,14 +95,16 @@ public interface OperationSetTelephonyBLF
* @param address the address of the line.
* @param name the display name if any
* @param group the group name if any
+ * @param pickup the pickup dial template
* @param provider the parent provider.
*/
- public Line(String address, String name, String group,
+ public Line(String address, String name, String group, String pickup,
ProtocolProviderService provider)
{
this.address = address;
this.name = name;
this.group = group;
+ this.pickupTemplate = pickup;
this.provider = provider;
}
@@ -129,6 +136,15 @@ public interface OperationSetTelephonyBLF
}
/**
+ * The pickup template.
+ * @return the pickup template.
+ */
+ public String getPickupTemplate()
+ {
+ return pickupTemplate;
+ }
+
+ /**
* The provider.
* @return the provider.
*/