diff --git a/classes/swagger/index.jsp b/classes/swagger/index.jsp index 69f3a2d..327be01 100644 --- a/classes/swagger/index.jsp +++ b/classes/swagger/index.jsp @@ -85,7 +85,7 @@ }); window.swaggerUi.load(); - window.swaggerUi.api.clientAuthorizations.add("ofchat", new SwaggerClient.ApiKeyAuthorization("Authorization", "<%= JiveGlobals.getProperty("plugin.restapi.secret", null) %>", "header")); + window.swaggerUi.api.clientAuthorizations.add("ofchat", new SwaggerClient.ApiKeyAuthorization("Authorization", "<%= JiveGlobals.getProperty("plugin.ofchat.secret", null) %>", "header")); function log() { if ('console' in window) { diff --git a/plugin.xml b/plugin.xml index 606416d..18992cf 100644 --- a/plugin.xml +++ b/plugin.xml @@ -28,7 +28,7 @@ - + diff --git a/src/java/org/ifsoft/meet/MeetController.java b/src/java/org/ifsoft/meet/MeetController.java index 24210bb..5ef92fa 100644 --- a/src/java/org/ifsoft/meet/MeetController.java +++ b/src/java/org/ifsoft/meet/MeetController.java @@ -67,7 +67,12 @@ public static MeetController getInstance() { */ public boolean performAction(String action, String callId, String destination) { - Log.debug("performAction " + action + " " + callId + " " + destination + " " + callList.get(callId)); + JSONObject call = callList.get(callId); + String otherCallid = otherCallid = callId + " -bleg"; // use " -both" for consultative transfer + + if (call.has("otherCallId")) otherCallid = call.getString("otherCallId"); + + Log.debug("performAction " + action + " " + callId + " " + destination + " " + call); boolean processed = false; @@ -83,7 +88,7 @@ public boolean performAction(String action, String callId, String destination) } else - if ("transfer".equals(action) && RESTServicePlugin.getInstance().sendAsyncFWCommand("uuid_transfer " + callId + " -bleg " + destination) != null) + if ("transfer".equals(action) && RESTServicePlugin.getInstance().sendAsyncFWCommand("uuid_transfer " + otherCallid + " " + destination) != null) { processed = true; } diff --git a/src/java/org/jivesoftware/openfire/plugin/rest/RESTServicePlugin.java b/src/java/org/jivesoftware/openfire/plugin/rest/RESTServicePlugin.java index ad6abbd..50c2ab4 100644 --- a/src/java/org/jivesoftware/openfire/plugin/rest/RESTServicePlugin.java +++ b/src/java/org/jivesoftware/openfire/plugin/rest/RESTServicePlugin.java @@ -183,7 +183,7 @@ public void initializePlugin(PluginManager manager, File pluginDirectory) SessionEventDispatcher.addListener(this); - secret = JiveGlobals.getProperty("plugin.restapi.secret", ""); + secret = JiveGlobals.getProperty("plugin.ofchat.secret", ""); // If no secret key has been assigned, assign a random one. if ("".equals(secret)) { @@ -191,7 +191,7 @@ public void initializePlugin(PluginManager manager, File pluginDirectory) setSecret(secret); } - permission = JiveGlobals.getProperty("plugin.restapi.permission", ""); + permission = JiveGlobals.getProperty("plugin.ofchat.permission", ""); // If no permission key has been assigned, assign a random one. if ("".equals(permission)) { @@ -202,10 +202,10 @@ public void initializePlugin(PluginManager manager, File pluginDirectory) Log.info("Initialize REST"); // See if Custom authentication filter has been defined - customAuthFilterClassName = JiveGlobals.getProperty("plugin.restapi.customAuthFilter", ""); + customAuthFilterClassName = JiveGlobals.getProperty("plugin.ofchat.customAuthFilter", ""); // See if the service is enabled or not. - enabled = JiveGlobals.getBooleanProperty("plugin.restapi.enabled", false); + enabled = JiveGlobals.getBooleanProperty("plugin.ofchat.enabled", false); smsEnabled = JiveGlobals.getBooleanProperty("ofchat.sms.enabled", false); emailEnabled = JiveGlobals.getBooleanProperty("ofchat.email.enabled", false); smsProvider = JiveGlobals.getProperty("ofchat.sms.provider", "mexmo"); @@ -213,11 +213,11 @@ public void initializePlugin(PluginManager manager, File pluginDirectory) swaggerSecure = JiveGlobals.getBooleanProperty("ofchat.swagger.secure", false); // See if the HTTP Basic Auth is enabled or not. - httpAuth = JiveGlobals.getProperty("plugin.restapi.httpAuth", "basic"); + httpAuth = JiveGlobals.getProperty("plugin.ofchat.httpAuth", "basic"); // Get the list of IP addresses that can use this service. An empty list // means that this filter is disabled. - allowedIPs = StringUtils.stringToCollection(JiveGlobals.getProperty("plugin.restapi.allowedIPs", "")); + allowedIPs = StringUtils.stringToCollection(JiveGlobals.getProperty("plugin.ofchat.allowedIPs", "")); // Listen to system property events PropertyEventDispatcher.addListener(this); @@ -649,7 +649,7 @@ public String getSecret() { * the secret key. */ public void setSecret(String secret) { - JiveGlobals.setProperty("plugin.restapi.secret", secret); + JiveGlobals.setProperty("plugin.ofchat.secret", secret); this.secret = secret; } @@ -669,7 +669,7 @@ public String getPermission() { * the permission key. */ public void setPermission(String permission) { - JiveGlobals.setProperty("plugin.restapi.permission", permission); + JiveGlobals.setProperty("plugin.ofchat.permission", permission); this.permission = permission; } @@ -708,7 +708,7 @@ public Collection getAllowedIPs() { * @param allowedIPs the new allowed i ps */ public void setAllowedIPs(Collection allowedIPs) { - JiveGlobals.setProperty("plugin.restapi.allowedIPs", StringUtils.collectionToString(allowedIPs)); + JiveGlobals.setProperty("plugin.ofchat.allowedIPs", StringUtils.collectionToString(allowedIPs)); this.allowedIPs = allowedIPs; } @@ -731,7 +731,7 @@ public boolean isEnabled() { */ public void setEnabled(boolean enabled) { this.enabled = enabled; - JiveGlobals.setProperty("plugin.restapi.enabled", enabled ? "true" : "false"); + JiveGlobals.setProperty("plugin.ofchat.enabled", enabled ? "true" : "false"); } public boolean isEmailEnabled() { @@ -795,22 +795,22 @@ public String getHttpAuth() { */ public void setHttpAuth(String httpAuth) { this.httpAuth = httpAuth; - JiveGlobals.setProperty("plugin.restapi.httpAuth", httpAuth); + JiveGlobals.setProperty("plugin.ofchat.httpAuth", httpAuth); } /* (non-Javadoc) * @see org.jivesoftware.util.PropertyEventListener#propertySet(java.lang.String, java.util.Map) */ public void propertySet(String property, Map params) { - if (property.equals("plugin.restapi.secret")) { + if (property.equals("plugin.ofchat.secret")) { this.secret = (String) params.get("value"); - } else if (property.equals("plugin.restapi.permission")) { + } else if (property.equals("plugin.ofchat.permission")) { this.permission = (String) params.get("value"); - } else if (property.equals("plugin.restapi.enabled")) { + } else if (property.equals("plugin.ofchat.enabled")) { this.enabled = Boolean.parseBoolean((String) params.get("value")); - } else if (property.equals("plugin.restapi.allowedIPs")) { + } else if (property.equals("plugin.ofchat.allowedIPs")) { this.allowedIPs = StringUtils.stringToCollection((String) params.get("value")); - } else if (property.equals("plugin.restapi.httpAuth")) { + } else if (property.equals("plugin.ofchat.httpAuth")) { this.httpAuth = (String) params.get("value"); } else if(property.equals(CUSTOM_AUTH_FILTER_PROPERTY_NAME)) { this.customAuthFilterClassName = (String) params.get("value"); @@ -821,15 +821,15 @@ public void propertySet(String property, Map params) { * @see org.jivesoftware.util.PropertyEventListener#propertyDeleted(java.lang.String, java.util.Map) */ public void propertyDeleted(String property, Map params) { - if (property.equals("plugin.restapi.secret")) { + if (property.equals("plugin.ofchat.secret")) { this.secret = ""; - } else if (property.equals("plugin.restapi.permission")) { + } else if (property.equals("plugin.ofchat.permission")) { this.permission = ""; - } else if (property.equals("plugin.restapi.enabled")) { + } else if (property.equals("plugin.ofchat.enabled")) { this.enabled = false; - } else if (property.equals("plugin.restapi.allowedIPs")) { + } else if (property.equals("plugin.ofchat.allowedIPs")) { this.allowedIPs = Collections.emptyList(); - } else if (property.equals("plugin.restapi.httpAuth")) { + } else if (property.equals("plugin.ofchat.httpAuth")) { this.httpAuth = "basic"; } else if(property.equals(CUSTOM_AUTH_FILTER_PROPERTY_NAME)) { this.customAuthFilterClassName = null; diff --git a/src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java b/src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java index 8d0804e..4849783 100644 --- a/src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java +++ b/src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java @@ -26,10 +26,10 @@ public class JerseyWrapper extends ServletContainer { /** The Constant CUSTOM_AUTH_PROPERTY_NAME */ - private static final String CUSTOM_AUTH_PROPERTY_NAME = "plugin.restapi.customAuthFilter"; + private static final String CUSTOM_AUTH_PROPERTY_NAME = "plugin.ofchat.customAuthFilter"; /** The Constant REST_AUTH_TYPE */ - private static final String REST_AUTH_TYPE = "plugin.restapi.httpAuth"; + private static final String REST_AUTH_TYPE = "plugin.ofchat.httpAuth"; /** The Constant AUTHFILTER. */ private static final String AUTHFILTER = "org.jivesoftware.openfire.plugin.rest.AuthFilter"; diff --git a/src/web/rest-api.jsp b/src/web/rest-api.jsp index 6802ed0..fb91242 100644 --- a/src/web/rest-api.jsp +++ b/src/web/rest-api.jsp @@ -113,7 +113,7 @@ Chat API Properties - +