Picture of Pierre 3641
Registered 7 years 239 days
Pierre 3641 Monday, 4 May 2020, 03:34 PM
Trigger on call
I'm trying to get a list of active calls on the PBX using the SOAP API.
Purpose is to trigger some actions when a call is coming in or a call is initiated.
We would like to save some basis data from this call to a MySQL database using some PHP script.
Anyone an idea how to get this working with the innopbx class?
Picture of Christoph Künkel (innovaphone)
Moderator Registered 15 years 189 days
Christoph Künkel (innovaphone) Monday, 4 May 2020, 04:05 PM
Re: Trigger on call
Pierre,

  • create a PBX (edit: user) that is allowed to monitor all users your are interested in (active in group where others are also group members but not active)
  • call Initialize() on this user
  • start a loop where you call Poll() forever
  • when a result is returned
    • look at the UserInfo. If there is an info regarding that you have not done a UserInitialize for yet, call UserInitialize
    • look at the CallInfos. Do whatever you need to do with that information
  • once in a while, call Echo(). When it fails, close all your connections and restart
You might think to use the Calls() function. Would work but you run the risk to miss some call information in between 2 calls.

Christoph

PS: You might be even better off looking at the PBX CDRs. Depends on what you intend to do.
← You can define your color theme preference here