Call Control API: how to tell which number is calling which?

Discussion in '3CX Phone System - General' started by kr0st, Jan 18, 2012.

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

    Joined:
    Jan 8, 2012
    Messages:
    2
    Likes Received:
    0
    I am using PhoneSystem instance and handle events “Inserted” and “Updated”.
    When handler receives an event it gets “NotificationEventArgs e”. So, when “e.ConfObject is ActiveConnection” and status of connection is “ConnectionStatus.Connected” exactly at this moment I would like to know who called who. To be more precise, I would like to know if call was from our PBX or to our PBX, also number of the caller and number (caller id) that accepted the call (picked up the phone).

    Example: some external number 123456789 called to our PBX and call was connected to extension 123, so when call is connected I need to understand that it’s actually 123456789 called to 123 and not vice versa. It’s not clear to me how to get this info from members of ActiveConnection.

    I have read Call Control API manual and also compiled, ran and studied examples but it does not help – I see pattern when internal extension calls another extension, in this case I am able to tell who called who but when external line and sip trunks come into play everything breaks. It would be great if somebody knew the exact logic of what values and when are assigned to ActiveConnection members.

    Would be grateful for any advice from somebody who maybe already tried doing something similar.
     
  2. SY

    SY Well-Known Member
    3CX Support

    Joined:
    Jan 26, 2007
    Messages:
    1,825
    Likes Received:
    2
    Re: Call Control API: how to tell which number is calling wh

    You need to check documentation for ActiveConnection.DN and ActiveConnection.ExternalParty properties.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. simonatkins

    Joined:
    Nov 2, 2011
    Messages:
    9
    Likes Received:
    0
    Re: Call Control API: how to tell which number is calling wh

    Ok so this should help:

    Inserted Event:
    Dialling is a call noticed from DN (Caller) to externalparty (Callee)
    Ringing is the call offered DN is who it is offered to externalparty is offeredFrom
    Ignore the connected in this event!

    Updated Event
    ignore dialling and ringing events!
    ConnectionStatus.Connected is the call connected DN is who made the call, externalparty is who it is to

    Deleted Event:
    Dialing: the call abandoned whilst the user started dialling but never finished dialling the number.
    Ringing: the call abandoned whilst being offered/ringing
    Connected: the call disconnected having been connected. Note you can use the isInbound and isOutbound bools to work out who hung up first, caller or callee! I shall leave that as an exercise to the reader.

    rgds
     
Thread Status:
Not open for further replies.