Genesys CTI User Forum > Genesys-related Development

start campaign

<< < (3/3)

K.Palyanichka:
Thank you.

I have everything worked out

K.Palyanichka:
Good afternoon.
Help please.
When you try to execute this code produces an error

package snippet;

import javax.swing.*;

import java.awt.*;
import java.awt.event.*;
import java.beans.EventHandler;
import java.lang.reflect.InvocationTargetException;

import com.genesyslab.platform.commons.protocol.Endpoint;
import com.genesyslab.platform.commons.protocol.ProtocolException;
import com.genesyslab.platform.commons.protocol.RegistrationException;
import com.genesyslab.platform.outbound.protocol.OutboundServerProtocol;
import com.genesyslab.platform.outbound.protocol.outbounddesktop.UpdateCallCompletionStats;
import com.genesyslab.platform.outbound.protocol.outboundserver.requests.RequestLoadCampaign;
import com.genesyslab.platform.outbound.protocol.outboundserver.requests.RequestStartDialing;
import com.genesyslab.platform.outbound.protocol.outboundserver.requests.RequestUnloadCampaign;

public class T1 extends JFrame {

    private JButton b1, b2,b3, b4 ;
    public int x ;
  public  int  y;
    private eHandler handler = new eHandler();

    public T1(String s){
        super(s);
        setLayout(new FlowLayout());
        b1 = new JButton("Kiev Diler");
        b2 = new JButton("Kiev Diler 2");
        b3 = new JButton("Kiev Diler 1  ");
        b4 = new JButton("Вывод переменной Y ");

        add(b1);
        add(b2);
        add(b3);
        //add(b4);

        b1.addActionListener(handler);
        b2.addActionListener(handler);
        b3.addActionListener(handler);
        b4.addActionListener(handler);}
 


    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

class eHandler implements ActionListener {
       
        private Outbound outbound = new Outbound();

        public void actionPerformed(ActionEvent e) {
            try {
                if (e.getSource() ==b1 ){
                    x =135;
                    y=149;
                    JOptionPane.showMessageDialog(null, "Kiev Diler Load " + x + " " + y);
                }
                if (e.getSource() ==b2 ){
                    x= 147;
                    y= 169;
                    JOptionPane.showMessageDialog(null, "Kiev Diler 2 Load " + x + " " + y);
                }
                if (e.getSource() ==b3 ){
                    x=146;
                    y=168;
                    JOptionPane.showMessageDialog(null, "Kiev Diler 1 Load " + x + " " + y);
                }
                outbound.Outb(new int[]{x, y});
            } catch (Exception ex){
                JOptionPane.showMessageDialog(null, "Ошибка ");
            }           
        }
    }

    class Outbound {
    public void Outb (int [] args) throws RegistrationException, ProtocolException, IllegalStateException, InterruptedException{
    Endpoint outboundserverEndpoint = new Endpoint ("default", "eostvgen14", 7060);
    OutboundServerProtocol outboundserverProtocol = new OutboundServerProtocol(outboundserverEndpoint);
    outboundserverProtocol.open();
   
   
    /*RequestLoadCampaign req = RequestLoadCampaign.create();
    req.setCampaignId(args[0]);
    req.setGroupId(args[1]);
    req.setReferenceId(0);
    outboundserverProtocol.send(req);*/
   
    RequestStartDialing req1 = RequestStartDialing.create();
    req1.setCampaignId(args[0]);
    req1.setGroupId(args[1]);
    req1.setReferenceId(0);
    req1.setDialMode(1);
    req1.setOptimizeBy(1);
    req1.setOptimizeGoal(80)  ;
   
   
   
    outboundserverProtocol.send(req1);
   
   
        outboundserverProtocol.close();
    }
    }
   
 
    public static void main(String[] args) throws InvocationTargetException, InterruptedException{
             
    EventQueue.invokeLater(new Runnable() {
   
   
            @Override
            public void run() {
                T1 t1 = new T1("LoadCampaign");
                t1.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                t1.pack();
                t1.setVisible(true);
            }
        });
   
   
    }

}


Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems:
The method setDialMode(DialMode) in the type RequestStartDialing is not applicable for the arguments (String)
The method setOptimizeBy(OptimizationMethod) in the type RequestStartDialing is not applicable for the arguments (int)

at snippet.T1$Outbound.Outb(T1.java:99)
at snippet.T1$eHandler.actionPerformed(T1.java:75)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Timur Karimov:
Hi Konstantin
You just need more carefully read the specification of called function. You use a simple string and numbers as DialMode and OptimizationMethod type. However is not an auto conversion method. You need to use existing type enum like DialMode.Predict and OptimizationMethod.NoOptimizationMethod
WBR Tim

Navigation

[0] Message Index

[*] Previous page

Go to full version