简体   繁体   中英

How to retrieve incoming call number from SAP CDT in Python?

I work in a help desk and we use SAP Communication Desktop as our phone software, though don't know how common this is within the industry.

I've been developing a Python program for automating repeating parts of my work (writing tickets, searching number from ServiceNow etc.) Everything works fine, when i input the data manually, but i would love to automate the process and just have Python fetch the information from SAP when call arrives. The call number also is displayed near the task bar and I've tried searching Windows Event Viewer for it, but so far have been unable to find it.

Is this possible to do in Python?

在此处输入图片说明

Ilmari

You could make use of SAP's Online Interaction Interface (OII) .

It is an API which allows client applications (such as CDT) to interact with the BCM (make calls etc).

Get your client to connect to the OII and send a IciContainerInterface subscription request by giving it your line-number.

The OII will then send events containing information (such as call number) for every phone call pertaining to your line-number to your app.

Instructions

Download the WSDL from your OII:

http:// ip-address /OII/IciItemService.asmx?WSDL

Use WSDL to generate the OII classes

Obtain instance of OII connection:

    private Optional<IciContainerServiceSoap> getContainerPort() {
    return containerSubscriber.map(s -> {
        IciContainerServiceSoap port = s.getIciContainerServiceSoap12();
        BindingProvider binding = (BindingProvider) port;
        binding.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                createServerUrl(s.getServiceName().getLocalPart(), serverAddress, serverPort));

        return port;
    });
}

 public static String createServerUrl(@NotNull String localPart, @NotNull String serverAddress, int port) {
        StringBuilder sb = new StringBuilder();

        sb.append("http://");
        sb.append(serverAddress);

        if (port == 0) port = 80;

        if (port != 80) {
            sb.append(":");
            sb.append(String.valueOf(port));
        }

        sb.append("/oii/");
        sb.append(localPart);
        sb.append(".asmx");

        return sb.toString();
    }


    /*
    * Address and port on which your client app's webservice will be   
    * listening for events sent by OII.
    */
         public static String createAppURL() throws UnknownHostException {
        //   

   Example:  http://xxx.xxx.xxx.xxx:7007/sapws/services/cct?wsdl
            return "http://" + getHostName() + ":" + getListenPort() + "/sapws/services?wsdl";
        }

Send subscription request:

getContainerPort().map(p -> p.subscribe(appURL, getAppId(), "1", container)).orElseThrow(IllegalStateException::new);

Your app will now receive PhoneCallChanged events in the form of SOAP packets on the port specified in the appID (7007).

Note that I am using Java. I'll elaborate if needed. Goodluck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM