Dismiss Notice
We would like to remind you that we’re updating our login process for all 3CX forums whereby you will be able to login with the same credentials you use for the Partner or Customer Portal. Click here to read more.

Duplicate ActiveConnections seen with Call Control API

Discussion in 'CRM / Helpdesk / App Integration' started by cjewell, Mar 20, 2018.

Thread Status:
Not open for further replies.
  1. cjewell

    Mar 20, 2018
    Likes Received:
    I've been able to use the Call Control API to detect the start and stop of calls on my PBX server, but I've run into a hiccup. On our client's PBX server multiple/duplicate ActiveConnection objects are generated for a single call through to an extension, both starting and stopping. The system will Insert or Delete up to 3-4 ActiveConnections that only seem to differ in their AttachedData, specifically their sip property. Different ip address and ports for the same call through to an extension. Only one connection survives through the call; the rest are cleaned up quickly. However, those duplicates are making it a bit difficult to use the call starts and stops as triggers to our third party program.

    Specifically, I am listening to the Insert and Delete events, filtering out all but CONNECTION type Entities, and checking to see if the ActiveConnection's DN is an Extension type and that the call IsInbound=True. So Inserts that meet those criteria are starts, and Deletes are stops.

    I figure the problem is that there are other things on the system that are creating CONNECTIONs to the extension when the call goes through, but I don't see anything obvious that might differentiate between types of connections.

    Is there a way to detect the start and stop of calls that I'm not aware of?
    Is there a more specific type of ActiveConnection (like, CallConnection or something), that I can listen for instead?
    Is there some other way to get around or filter duplicate connection Inserts and Deletes?

    Very stumped! Any help or nudges in the right direction are greatly appreciated.
  2. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Jun 27, 2007
    Likes Received:
    Hello @cjewell,

    That's how 3CX works, that's totally normal. When some information of the call changes, new ActiveConnection objects might be created. You need to implement some filtering logic yourself, for example you can use some reference counter, incrementing it every time you get a new ActiveConnection and decrementing it when it is removed, and only notify your external app when this counter goes from 0 to 1 (call start) or when it goes from 1 to 0 (call end).

    Kind regards.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Thread Status:
Not open for further replies.