Skip to content

lfoxdev/PyHipathCSTA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

PyHipathCSTA

This library provides a CSTA (computer supported telecommunications applications) client for Siemens/Unify/Atos PBX (HiPath/OpenScape series).

Restrictions

  • The only tested PBX was HiPath 3000 v9, however, Siemens CSTA protocol is based on ECMA-269, so this library may suit other series, such as OpenScape Business, OpenScape Voice, and maybe HiPath/OpenScape 4000. Try it.
  • Only ASN.1 protocol supported because it suits both old and modern PBXs. Support of XML protocol is not planned.
  • TCP/IP CSTA connection, no RS-232.
  • Only Call Control Services subset is realized at now. Monitoring services are planned. If you need other services, please write an issue.

Usage

1. Creating CSTA connector

csta = HP3kCSTAConnector(address: str, port: int, login: str, password: str)

Known ports:

  • 7001 - HiPath 3000
  • 8800 - OpenScape Business

Default login - AMHOST; default password - 77777. You may change them in user management.

2 (Variant A). Automatic connection management

In this mode library will keep up CSTA connection, infinitely re-establishing it on any errors (network issues, PBX going off-line, CSTA protocol errors, incorrect usage or any other).
This is useful for applications where the CSTA connector can be running all the time, even if the CSTA commands are invoked irregularly (e.g. depending on user actions) - you do not need to ensure that the connection to the PBX is established before making a CSTA service invoke.
This option is also convenient for multithreaded requests.

csta.run()

2 (Variant B). Manual connection management

await csta.connect()
await csta.login()
while not csta.ready():
    await asyncio.sleep(1000)

3. CSTA services

Function CSTA service
alternate_call(held_call: UConnectionID, active_call: UConnectionID) -> None The Alternate Call service places an existing active call on hold and then retrieves a previously held call. This service is also used to place an active call on hold and then connect to an alerting or queued call at the same device (i.e., to answer a call-waiting call).
answer_call(call_to_be_answered: UConnectionID) -> None The Answer Call service connects an alerting or queued call. This service is typically associated with devices that have attached speakerphone units and headset telephones to connect to a call via hands-free operation.
clear_connection(connection_to_be_cleared: UConnectionID) -> None The Clear Connection service releases a specific device from a call. In the case of a two-party call, this may result in the call being torn down. In the case of a conference call, this results in the specific party being removed from the conference.
conference_call(held_call: UConnectionID, active_call: UConnectionID) -> UConnectionID The Conference Call service provides a conference of an existing held call and another active call at a conferencing device.
consultation_call(existing_call: UConnectionID, consulted_device: UDeviceID) -> UConnectionID The Consultation Call service places an existing active call at a device on hold and initiates a new call from the same device.
deflect_call(call_to_be_diverted: UConnectionID, new_destination: UDeviceID) -> None The Deflect Call service allows the computing function to divert an alerting, queued or failed call to another destination that may be inside or outside the switching sub-domain.
directed_pickup_call(call_to_be_picked_up: UConnectionID, requesting_device: UDeviceID) -> UConnectionID The Directed Pickup Call service moves a specified call and connects it at a new specified destination.
group_pickup_call(new_destination: UDeviceID) -> UConnectionID The Group Pickup Call service moves a call that is a member of a specified or default pickup group to a new specified destination.
hold_call(call_to_be_held: UConnectionID) -> None The Hold Call service places an external call on hold at the same device.
make_call(calling_device: UDeviceID, called_directory_number: UDeviceID) -> UConnectionID The Make Call service creates a new call and establishes an initiated or connected connection with the calling device.
reconnect_call(active_call: UConnectionID, held_call: UConnectionID) -> None The Reconnect Call service will clear a specified connection at the reconnecting device and retrieve a specified held connection at the same device.
retrieve_call(call_to_be_retrieved: UConnectionID) -> None The Retrieve Call service connects a specified held connection.
single_step_trans(active_call: UConnectionID, transferred_to: UDeviceID) -> UConnectionID The Single Step Transfer Call service transfers an existing connected connection at a device to another device.
transfer_call(held_call: UConnectionID, active_call: UConnectionID) -> UConnectionID The Transfer Call service transfers a call held at a device to an active call at the same device.

Examples

Enable Night Service (service code *44*) from authorized station 110

import asyncio

from PyHipathCSTA.FrontEndTypes import UDeviceID
from PyHipathCSTA.HP3kCSTAConnector import HP3kCSTAConnector

async def main():
    csta = HP3kCSTAConnector('192.168.0.1', 7001, 'AMHOST', '77777')
    csta.run()
    try:
        await csta.make_call(UDeviceID('110'), UDeviceID('*44*'))
    except:
        print('Call was not made')
    finally:
        await csta.close()

asyncio.run(main())

Logging

  • logging.ERROR - Uncorrectable problems (failed invokes, connection issues, incorrect messages) leading to unsuccessfully execution of user commands
  • logging.WARNING - ERROR + correctable problems (temporarily network issues, timeouts...)
  • logging.INFO - WARNING + successful operations info
  • logging.DEBUG - INFO + raw ASN.1 messages (encoded & decoded)

Troubleshooting

  1. Enable logging level DEBUG:
logging.basicConfig(level=logging.DEBUG)
  1. Check that CSTA and CSP flags are enabled (refer to PBX manual)
  2. Try using original CSTA browser developed by Siemens (link below)

Useful links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages