0

I am trying to connect to Unify OpenScape Business and monitor incoming calls. From what I found so far it seems that the best would be using CSTA protocol.

On the following page http://wiki.unify.com/wiki/Developer_Program_-_OpenScape_Voice I found openscape-csta-sdk-1.5.2.zip: http://wiki.unify.com/images/4/47/openscape-csta-sdk-1.5.2.zip

Now I am trying to establish connection based on the example from SDK. My OpenScape listens on the 8800 port. However when I telnet on that port or connect via enclosed example application after around 20 seconds I get some garbage.

When SDK based monitoring code starts it shows something like that in the logs:

2015-12-28 22:48:17,429 [main] INFO  com.sen.openscape.csta.provider.CstaProvider - Welcome to use OpenScape Voice CSTA SDK V1.5.2!
2015-12-28 22:48:17,525 [main] DEBUG com.sen.openscape.csta.transport.tcp.CstaTcpLink - Connected to CSTA Server.
2015-12-28 22:49:16,985 [main] INFO  com.sen.openscape.csta.transport.tcp.CstaTcpLink - Received CSTA Message: aDˇ+€Ş˘ ˇ    M-CM10.00   1.0.0.018ľ(   

2015-12-28 22:49:17,005 [main] DEBUG com.sen.openscape.csta.transport.CstaLink - Sending SystemRegister Request
2015-12-28 22:49:17,074 [main] INFO  com.sen.openscape.csta.transport.tcp.CstaTcpLink - Sent CSTA Message: 0001<?xml version="1.0" encoding="UTF-8"?>
<SystemRegister xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.ecma-international.org/standards/ecma-323/csta/ed4"><requestTypes><systemStatus>true</systemStatus><requestSystemStatus>true</requestSystemStatus><switchingFunctionCapsChanged>true</switchingFunctionCapsChanged><switchingFunctionDevicesChanged>true</switchingFunctionDevicesChanged></requestTypes></SystemRegister>
Failed to connect: CstaErrorCause=NetworkFailure; ErrorMessage=Timeout waiting for response

The garbage I receive is (hex dumped)

61 44 cb 87 07 06 05 2b 0c 20 c3 9a 01 cb 98 03 02 01 02 c5 81 05 cb 98 03 02 01 20 ef bf bd 02 06 e2 82 ac c5 9e 1c cb 98 1a c2 a0 18 cb 87 16 04 09 4d 2d 4f 4d 31 30 2e 30 30 04 09 33 2e 30 2e 30 2e 30 35 37 c4 be 0b 28 09 c2 a0 07 c2 a0 05 03 03 20 10 20  

This leads me to the conclusion that not necessarily connection on port 8800 is what I am looking for however I cannot find nothing else.

The "garbage" I receive may be ASN.1 encoded message, but I was unable to decode it properly.

The code to monitor is attached below,

import com.sen.openscape.csta.callcontrol.CstaDevice;
import com.sen.openscape.csta.callcontrol.CstaMonitor;
import com.sen.openscape.csta.provider.CstaEventListener;
import com.sen.openscape.csta.provider.CstaEventObject;
import com.sen.openscape.csta.provider.CstaProvider;
import com.sen.openscape.csta.util.CstaException;

public class CstaDeviceMonitor implements CstaEventListener {

    private CstaMonitor monitor;

    public boolean startMonitor(CstaProvider provider, String device) {

        CstaDevice myDevice = provider.addDevice(device);

        try {

            monitor = provider.MonitorStart(myDevice);

            provider.registerEventListener(this);

            System.out.println("\n---\nStarted monitoring " + monitor.fqnDn + "\n---\n");

            return true;

        } catch (CstaException e) {

            System.err.println("Failed to start monitor: " + e.toString());

            return false;

        }

    }

    public void stopMonitor(CstaProvider provider) {

        try {

            provider.MonitorStop(monitor.crossRefId);

            System.out.println("\n---\nStopped monitoring " + monitor.fqnDn + "\n---\n");

            provider.removeDevice(monitor.fqnDn);

        } catch (CstaException e) {

            System.err.println("Failed to stop monitor: " + e.toString());

        }

    }

    @Override

    public void newCstaEvent(CstaEventObject evt) {

        System.out.print("\n--- Device " + evt.fqnDn + " received event: type=" + evt.evtType
                + ", callID=" + evt.callID + "\n");

    }

}


import com.sen.openscape.csta.provider.CstaProvider;
import com.sen.openscape.csta.util.CstaConfiguration;
import com.sen.openscape.csta.util.CstaException;
import java.util.Scanner;

public class CstaMonitorMain {

    /**
     *
     * The IP address of the CSTA interface in OpenScape Voice
     *
     */
    private static final String CSTA_SERVER_IP_ADDRESS = "192.168.1.12";

    /**
     *
     * The port number - it's usually 1040, very rarely changed
     *
     */
    private static final int CSTA_SERVER_PORT = 8800;

    /**
     *
     * The phone number we will monitor Must match the configured in OSV and
     * must
     *
     * have CSTA service assigned
     *
     */
    private static final String DEVICE_TO_MONITOR = "101";

    public static void main(String[] args) {

        CstaProvider myProvider = connect();

        if (myProvider != null) {

            CstaDeviceMonitor monitor = new CstaDeviceMonitor();

            if (monitor.startMonitor(myProvider, DEVICE_TO_MONITOR)) {

                // Let it run until the user hits the enter key
                Scanner keyIn = new Scanner(System.in);

                System.out.print("\n\nPress Enter to exit\n\n");

                keyIn.nextLine();

                monitor.stopMonitor(myProvider);

            }

            disconnect(myProvider);

        }

    }

    private static CstaProvider connect() {

        CstaConfiguration cfg = new CstaConfiguration(CSTA_SERVER_IP_ADDRESS, CSTA_SERVER_PORT);
//        cfg.setTransportType(CstaTransports.HTTP_SOAP);

        try {

            CstaProvider provider = new CstaProvider();
            provider.connectToSystem(cfg);
            System.out.println("\n---\nConnected to " + CSTA_SERVER_IP_ADDRESS + "\n---\n");
            provider.startHeartbeat(60, 60);
            return provider;

        } catch (CstaException e) {
            System.err.println("Failed to connect: " + e.toString());
            return null;
        }
    }

    private static void disconnect(CstaProvider provider) {

        try {

            provider.endHeartbeat();

            provider.disconnectFromSystem();

            System.out.println("\n---\nDisconnected from " + CSTA_SERVER_IP_ADDRESS + "\n---\n");

        } catch (CstaException e) {

            System.err.println("Failed to disconnect: " + e.toString());

        }

    }

}

I also found CSTA client on the sourceforge but it was unable to monitor the device neither.

I also tried to post a question on Unify forum, but sadly it is the worst programmed forum I have ever met, in short I can't post my question there, that's way am trying to ask for help here.

I am looking for some hint regarding accessing OpenScape business V5 via CSTA. I would appreciate if somebody who programmed that already pointed me to the right direction, thank you.

Progress, step 1

Maybe somebody has similar problems like me ... I am posting first update then.

I made some progress, not full success yet, but there is a light :-) My primary approach to solve this via SDK was wrong. There is no SDK. I finally found some documentation here http://wiki.unify.com/wiki/Developer_Program_-_OpenScape_4000. The description of proper conversation is presented in the CSTA3_ADG1.pdf on that page, http://wiki.unify.com/images/1/11/Application_Guide_%28part_I%29.zip

Also I managed to get CSTA Browser tool which is very helpful in understanding asn.1 communication with PBX. I think that it is worth to make a note how the communication should look like, below is a dump from "conversation simulation" done in CSTA Browser, tool from Unify (Siemens)

<  aCSE.aarq
<  { -- SEQUENCE -- 
<      application-context-name = {iso(1) identified-organization(3) icd-ecma(12) standard(0) csta(218)},
<      sender-acse-requirements = '10'B -- NrBits = 2 --
<      { -- true bits -- 
<          authentication
<      },
<      calling-authentication-value.external
<      { -- SEQUENCE -- 
<          encoding.single-ASN1-type
<          { -- SEQUENCE -- 
<              sender-authentication
<              { -- SEQUENCE -- 
<                  authentication-name = "AMHOST" '41 4D 48 4F 53 54'H,
<                  authentication-password = "77777" '37 37 37 37 37'H
<              }
<          }
<      },
<      user-information
<      { -- SEQUENCE OF --
<          { -- SEQUENCE -- 
<              encoding.single-ASN1-type.newDefinition
<              { -- SEQUENCE -- 
<                  cSTAVersion = '0001000000000000'B -- NrBits = 16 --
<                  { -- true bits -- 
<                      versionFour
<                  }
<              }
<          }
<      }
<  }

Time = 22:13:49:992
S(00,AMHOST):  60 31 A1 07 06 05 2B 0C 00 81 5A 8A 02 06 80 AC 15 A2 13 A0 11 A0 0F 04 06 41 4D 48 4F 53 54 04 05 37 37 37 37 37 BE 0B 28 09 A0 07 A0 05 03 03 00 10 00 

Time = 22:13:49:992
R(00,AMHOST):  61 48 A1 07 06 05 2B 0C 00 81 5A A2 03 02 01 00 A3 05 A1 03 02 01 00 88 02 06 80 AA 21 A2 1F A0 1D A1 1B 04 10 48 45 35 32 30 4D 2E 30 30 2E 34 33 37 2E 35 31 04 07 34 33 37 2E 30 30 30 BE 0A 28 08 A0 06 A0 04 03 02 04 10 

Time = 22:13:49:992
>  aCSE.aare
>  { -- SEQUENCE -- 
>      application-context-name = {iso(1) identified-organization(3) icd-ecma(12) standard(0) csta(218)},
>      result = 0 (accepted),
>      result-source-diagnostic.acse-service-user = 0 (null),
>      responder-acse-requirements = '10'B -- NrBits = 2 --
>      { -- true bits -- 
>          authentication
>      },
>      responding-authentication-value.external
>      { -- SEQUENCE -- 
>          encoding.single-ASN1-type
>          { -- SEQUENCE -- 
>              responding-authentication
>              { -- SEQUENCE -- 
>                  aps-stamp = "HE520M.00.437.51" '48 45 35 32 30 4D 2E 30 30 2E 34 33 37 2E 35 31'H,
>                  system-version = "437.000" '34 33 37 2E 30 30 30'H
>              }
>          }
>      },
>      user-information
>      { -- SEQUENCE OF --
>          { -- SEQUENCE -- 
>              encoding.single-ASN1-type.newDefinition
>              { -- SEQUENCE -- 
>                  cSTAVersion = '0001'B -- NrBits = 4 --
>                  { -- true bits -- 
>                      versionFour
>                  }
>              }
>          }
>      }
>  }

Time = 22:13:50:003
R(00,AMHOST):  A1 0C 02 01 01 02 02 00 D3 30 03 0A 01 01 

Time = 22:13:50:007
>  rOSE.roiv-apdu
>  { -- SEQUENCE -- 
>      invokeID = 1,
>      operation-value = 211 (systemStatus),
>      argument
>      { -- SEQUENCE -- 
>          systemStatus = 1 (enabled)
>      }
>  }

Following the simulation I can send and aCSE.aarq message to CSTA PBX. For now I am storing it in simple array like that:

int[] aCSEaarq = {0x60, 0x31, 0xA1, 0x07, 0x06, 0x05, 0x2B, 0x0C, 0x00, 0x81, 0x5A, 0x8A, 0x02, 0x06, 0x80, 0xAC, 0x15, 0xA2, 0x13, 0xA0, 0x11, 0xA0, 0x0F, 0x04, 0x06, 0x41, 0x4D, 0x48, 0x4F, 0x53, 0x54, 0x04, 0x05, 0x37, 0x37, 0x37, 0x37, 0x37, 0xBE, 0x0B, 0x28, 0x09, 0xA0, 0x07, 0xA0, 0x05, 0x03, 0x03, 0x00, 0x10, 0x00};

When sending data do PBX it is important to calculate its length and pass it as first two bytes.

If I do that I receive the answer immediately. So the conversation dump from my simple java looks like that:

doWrite [aCSE.aarq]
60 31 A1 07 06 05 2B 0C 00 81 5A 8A 02 06 80 AC 15 A2 13 A0 11 A0 0F 04 06 41 4D 48 4F 53 54 04 05 37 37 37 37 37 BE 0B 28 09 A0 07 A0 05 03 03 00 10 00 

doRead [aCSE.aare]
00 46 (70 bytes)
61 44 A1 07 06 05 2B 0C 00 DA 01 A2 03 02 01 00 A3 05 A2 03 02 01 00 88 02 06 80 AA 1C A2 1A A0 18 A1 16 04 09 4D 2D 4F 4D 31 30 2E 30 30 04 09 33 2E 30 2E 30 2E 30 35 37 BE 0B 28 09 A0 07 A0 05 03 03 00 10 00 

doRead [rOSE.roiv-apdu]
00 0F (15 bytes)
A1 0D 02 02 1D 1D 02 02 00 D3 30 03 0A 01 02 

which is very similar to CSTA Browser simulation.

Now I am trying to find out how can I encode/decode messages. I guess I have to use asn.1 compiler for that, but don't know yet how to do it properly and where should I get asn1 source files from. When it comes to compiler I would prefer to stick to free solutions.

norbi771
  • 814
  • 2
  • 12
  • 29
  • Do you have an UC booster card or UC booster server installed? The CSTA interface will not work without this in OpenScape Business X5. – user797717 Jan 14 '16 at 10:03
  • Yes I have UC booster card installed. – norbi771 Jan 14 '16 at 14:25
  • I finally managed to establish the connection. For beginners like me. The crucial part is to send aCSEaarq message, then there is immediate answer from CSTA interface – norbi771 Jan 19 '16 at 21:10

2 Answers2

0

You say you're trying to communicate with a Unify OpenScape Business PBX device. Doesn't the OpenScape Business series of PBX devices communicate with BER messages instead of XML messages?

I think the Java API that you're using is just for the OpenScape Voice series, which is a different PBX series that uses XML messages.

So you may be sending XML messages to a PBX device that doesn't know how to deal with them.

Douglas Coup
  • 57
  • 1
  • 2
  • Thank you for your answer. You are right. In the meantime I came to the same conclusion. I'd like to study more that matter, however I cannot find any source that could show me how should I communicate with that PBX. I cannot find any source describing conversation that has to be done between me and PBX, could you advice something? I know there is http://www.ecma-international.org/ but either I can't read or I am missing something because based on the docs found there I am still unable to establish communication, don't even know where to start. I will appreciate ANY help. – norbi771 Jan 05 '16 at 11:26
  • ECMA is the organization that defines CSTA messaging. Establishing communication with a BER-based PBX is usually done using a different protocol, known as ACSE. The Unify OpenScape Business series uses ACSE messages for this initial communication establishment. But the ACSE Association Request message can be formatted numerous ways, and different vendors want different formats. You may be best served by using an off the shelf CSTA product (e.g., http://www.obj-sys.com/products/csta/index.php). – Douglas Coup Jan 05 '16 at 13:41
  • Thank you for your answer. I checked link you provided. There are prebuild APIs, CSTA Phase 1,2,3 and the only Phase 2 has java API. Unfortunately I don't really feel that CSTA / ASCE matter so please excuse maybe not very good question but Is there a way I can use CSTA Phase 2 for communication with PBX that is supposed to use Phase 3? Also in the API there is lib folder which is empty and from what I understood I need the lib to get the software working, but can't find the place I can get trial or whatever to try it if it meets my needs. – norbi771 Jan 12 '16 at 13:05
  • @norbi771 OpenScape Business does not support the CSTA Phase II protocol version. – user797717 Jan 14 '16 at 12:37
  • Thanks. I've got in my hands CSTA Browser and with help of included decoder some things are getting more clear to me. But still there are so many questions. Do you know maybe where I could find examples of "conversation" with the PBX? I am trying to read Ecma-285 documentation, and although I understand what is written there I have no clue what should I do to connect to the PBX, and after establishing the connection to monitor some events (like incoming connections), and how to do that. Kind of code example, if available somewhere, would be excellent help for me. – norbi771 Jan 14 '16 at 14:22
0

Short answer is, you need to know how asn.1 protocol works, (ITU-T X.680, X.690 and X.890 and more...), after that you need ECMA-285 csta phase 3 documentation, ACSE protocol documentation (for pbx login - ITU Rec. X.227 (ISO 8650), X.217 (ISO 8649)) and you're set to encode/decode asn.1. Unify csta documentation will tell you, what is actually supported by the pbx. But i guess you already know all this by now. For Hipath systems, csta port is 7001 (at least LIM card needed), for OSB, port is 8800 (booster card/server needed)

misterti
  • 615
  • 6
  • 15