On Mon, Nov 1, 2010 at 11:31 AM, StephanDiplom
<[email protected]> wrote:
> Am 22.10.2010 13:04, schrieb George Niculae:
>>
>> On Fri, Oct 22, 2010 at 1:15 PM, StephanDiplom
>> <[email protected]>  wrote:
> I'm still trying to add new callgroup functions to the soap-api but I've got
> some issues. Is there any function to get the id of a callgroup by its name?
> I'd like to use the removeCallGroups function to delete callgroups via Soap,
> but i got no idea how to get their ids. I also got some problems rebuilding
> my project. I added the console output to this mail.
> I'm working on a virtual machine (Virtual Box) with CentOS 5.2 as
> recommended in developers wiki.
> I also added the files I changed, so if there is anything wrong please let
> me know.
>

Files looks OK, I modified a little bit the wsdl one to receive call
group alias (name or extension) and added
CallGroupContext.removeCallGroupByAlias method. The message to be send
should be something like

   <soapenv:Body>
      <con:DeleteCallGroup>
         <callGroupAlias>test</callGroupAlias>
      </con:DeleteCallGroup>
   </soapenv:Body>

Please test it and if everything OK we could add unit tests and
integrate it in main (run make && make install from sipXconfig build
directory, also every time you change the wsdl file go to
sipXconfig/web and issue ant wsdl so the java objects get generated)

George
From 6dd00837d1191a62be6d9bfc83112df19c41a846 Mon Sep 17 00:00:00 2001
From: George Niculae <[email protected]>
Date: Mon, 1 Nov 2010 18:17:06 +0200
Subject: [PATCH] delete call group via SOAP

---
 .../admin/callgroup/CallGroupContext.java          |    2 +
 .../admin/callgroup/CallGroupContextImpl.java      |    7 +++++
 .../sipxconfig/api/CallGroupServiceImpl.java       |    6 +++++
 .../org/sipfoundry/sipxconfig/api/sipxconfig.wsdl  |   24 ++++++++++++++++++++
 4 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/admin/callgroup/CallGroupContext.java b/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/admin/callgroup/CallGroupContext.java
index ad51264..be88cca 100644
--- a/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/admin/callgroup/CallGroupContext.java
+++ b/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/admin/callgroup/CallGroupContext.java
@@ -37,4 +37,6 @@ public interface CallGroupContext extends AliasOwner, AliasProvider {
     void clear();
 
     void generateSipPasswords();
+
+    void removeCallGroupByAlias(String name);
 }
diff --git a/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/admin/callgroup/CallGroupContextImpl.java b/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/admin/callgroup/CallGroupContextImpl.java
index 9eac15e..0aea6e3 100644
--- a/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/admin/callgroup/CallGroupContextImpl.java
+++ b/sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/admin/callgroup/CallGroupContextImpl.java
@@ -218,4 +218,11 @@ public class CallGroupContextImpl extends SipxHibernateDaoSupport implements Cal
         // no need to trigger replication - do not use storeCallGroup
         getHibernateTemplate().saveOrUpdateAll(changed);
     }
+
+    @Override
+    public void removeCallGroupByAlias(String alias) {
+        List ids = getHibernateTemplate().findByNamedQueryAndNamedParam(
+                QUERY_CALL_GROUP_IDS_WITH_ALIAS, VALUE, alias);
+        removeCallGroups(ids);
+    }
 }
diff --git a/sipXconfig/web/src/org/sipfoundry/sipxconfig/api/CallGroupServiceImpl.java b/sipXconfig/web/src/org/sipfoundry/sipxconfig/api/CallGroupServiceImpl.java
index 69bd870..9ba44cf 100644
--- a/sipXconfig/web/src/org/sipfoundry/sipxconfig/api/CallGroupServiceImpl.java
+++ b/sipXconfig/web/src/org/sipfoundry/sipxconfig/api/CallGroupServiceImpl.java
@@ -10,7 +10,9 @@
 package org.sipfoundry.sipxconfig.api;
 
 import java.rmi.RemoteException;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.sipfoundry.sipxconfig.admin.callgroup.CallGroupContext;
 
@@ -46,4 +48,8 @@ public class CallGroupServiceImpl implements CallGroupService {
         return response;
     }
 
+    public void deleteCallGroup(DeleteCallGroup group) throws RemoteException {
+        m_context.removeCallGroupByAlias(group.getCallGroupAlias());
+    }
+
 }
diff --git a/sipXconfig/web/src/org/sipfoundry/sipxconfig/api/sipxconfig.wsdl b/sipXconfig/web/src/org/sipfoundry/sipxconfig/api/sipxconfig.wsdl
index dba431b..aadbcdc 100644
--- a/sipXconfig/web/src/org/sipfoundry/sipxconfig/api/sipxconfig.wsdl
+++ b/sipXconfig/web/src/org/sipfoundry/sipxconfig/api/sipxconfig.wsdl
@@ -216,6 +216,13 @@
           </xsd:sequence>
         </xsd:complexType>
       </xsd:element>
+      <xsd:element name="DeleteCallGroup">
+        <xsd:complexType>
+          <xsd:sequence>
+            <xsd:element name="callGroupAlias" type="xsd:string" minOccurs="1" maxOccurs="1" />
+          </xsd:sequence>
+        </xsd:complexType>
+      </xsd:element>
 
       <!-- P A R K   O R B I T -->
       <xsd:element name="GetParkOrbitsResponse">
@@ -387,6 +394,10 @@
   <message name="getCallGroupsResponse">
     <part name="getCallGroups" element="tns:GetCallGroupsResponse" />
   </message>
+  <message name="deleteCallGroupResponse" />
+  <message name="deleteCallGroupRequest">
+    <part name="deleteCallGroup" element="tns:DeleteCallGroup" />
+  </message>
   <message name="getCallGroupsRequest" />
   <portType name="CallGroupService">
     <documentation>Any change to call groups updates all servers automatically and asynchronously.</documentation>
@@ -398,6 +409,10 @@
       <input message="tns:getCallGroupsRequest" />
       <output message="tns:getCallGroupsResponse" />
     </operation>
+    <operation name="deleteCallGroup">
+      <input message="tns:deleteCallGroupRequest" />
+      <output message="tns:deleteCallGroupResponse" />
+    </operation>
   </portType>
 
   <binding name="CallGroupServiceSoapBinding" type="tns:CallGroupService">
@@ -420,6 +435,15 @@
         <soapbind:body use="literal" />
       </output>
     </operation>
+    <operation name="deleteCallGroup">
+      <soapbind:operation />
+      <input>
+        <soapbind:body use="literal" />
+      </input>
+      <output>
+        <soapbind:body use="literal" />
+      </output>
+    </operation>
   </binding>
 
   <!-- C O N F E R E N C E   B R I D G E   S E R V I C E -->
-- 
1.6.0.6

_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev/

Reply via email to