Hello,
I have recently been integrating iSymphony with the newly added User Events described here http://www.freepbx.org/trac/ticket/2953. I recently ran into an issue involving the structure of the added UserEvent? calls. The call as it stands now looks like so:
$agi->exec("UserEvent", "UserDeviceAdded|Data:{$user},{$device}");
Which will result in a UserEvent? in the form:
Event: UserEvent
Privilege: ...
UserEvent: UserDeviceAdded
Data:100,100
The issue is that this event is malformed due to the lack of a space between Data: and 100,100. An appropriate event should look like:
Event: UserEvent
Privilege: ...
UserEvent: UserDeviceAdded
Data: 100,100
With the space after "Data:". Most AMI libraries, including the one we utilize for iSymphony will expect this space and attempt to remove it. In the case of the malformed event this will result in the data being interpreted as "00,100". The resolution for this is to change the call to look like so:
$agi->exec("UserEvent", "UserDeviceAdded|Data: {$user},{$device}");
With a space after "Data:". The issue is that phpagi will truncate the command at the space resulting in the call:
UserEvent(UserDeviceAdded|Data:)
Instead of:
UserEvent(UserDeviceAdded|Data: 100,100)
I believe the truncation occurs in the evaluate function in the phpagi library but I have been unable to track down the cause and provide a resolution as this function is quite complex. I have come up with a workaround for the issue by placing a dummy value in the UserEvent? call like so:
$agi->exec("UserEvent", "UserDeviceAdded|Data:*{$user},{$device}");
With this modification the Event is still malformed but our AMI library will pull the data correctly. Any help with an appropriate fix would be greatly appreciated.