We are using device and user mode with Freepbx and it shows all of the agents logged in all the time even if they do not have a device registered. How can I correct this? I need this solution for a call center deployment.
user_login_out.agi from FreePBX is broken on most versions of it.. it was corrected on latest releases. There are like, about, not sure, 50 posts in this forum talking about it and how to fix it. Here is one:
Perhaps you have that issue... cannot be sure as you are not specifying versions. Anyways, it works if the .agi from freepbx gets fixed and you use the login/logout feature codes (*11).
This doesn't appear to be the case. I am using asterisk 11.18.0 and the code references 1.8. I tried to add 11.18.0 and it still did not work. Any other ideas on what I can try we are running the latest stable version of FreePBX.
$current_user = get_user($device);
if ($current_user != '') {
$current_devices = get_devices($current_user);
$new_devices = remove_device($current_devices,$device);
cli_debug("remove_user: Setting user $current_user to devices $new_devices",5);
set_user_devices($current_user, $new_devices);
set_hint($current_user, $new_devices);
The bug is not in Asterisk, but a FreePBX AGI script, so you can have a broken .agi even if you run Asterisk 13. As for fixing the broken .agi, the format for Asterisk 1.8 is the same as for any newer version. Now, we did not develop FreePBX, I do not know for sure what versions have the broken .agi or not. If you run fop2_server in debug mode, and look at the UserEvents generated by the .agi script the problem will jump out immediately as you will see the broken format/event.
Again, I do not know if you have that problem/broken .agi or not. But I can tell you that the broken .agi result is not seeing the user login or logout state when you dial the feature code to login/out in FreePBX.
To start fop2 in debug mode you can do this
service fop2 stop
cd /usr/local/fop2
script capture.log
./fop2_server -X 1
(then log into fop2, and try to login and logout a user in freepbx)
ctrl-C
exit
service fop2 start
At that point you will have a capture.log file you can open and search for the "UserEvent" string.
In User & Device mode SIP Registration status is not monitored, only user login status in FreePBX system. FOP2 won't monitor sip registrations on that device and user mode, because it will return mixed states whenever you have more than one device associated to a user.
Is this still a problem now? I have the latest version of FreePBX 14 but am still getting the same problem as described here with extensions that are not online showing as online.
Comments
http://forum.fop2.com/1056-device-and-user-mode-status-updating/0
Perhaps you have that issue... cannot be sure as you are not specifying versions. Anyways, it works if the .agi from freepbx gets fixed and you use the login/logout feature codes (*11).
$current_user = get_user($device);
if ($current_user != '') {
$current_devices = get_devices($current_user);
$new_devices = remove_device($current_devices,$device);
cli_debug("remove_user: Setting user $current_user to devices $new_devices",5);
set_user_devices($current_user, $new_devices);
set_hint($current_user, $new_devices);
if(version_compare(get_var("ASTVERSION"), "1.8.0", "ge")) {
$user_event_body = "\"UserDeviceRemoved,Data: {$current_user}\\\\,{$device}\"";
} else if(version_compare(get_var("ASTVERSION"), "1.6.1", "ge")) {
$user_event_body = "\"UserDeviceRemoved|Data: {$current_user}\\,{$device}\"";
} else if(version_compare(get_var("ASTVERSION"), "1.6.0", "ge")) {
$user_event_body = "UserDeviceRemoved,\"Data: {$current_user}\\\\,{$device}\"";
} else {
$user_event_body = "\"UserDeviceRemoved|Data: {$current_user},{$device}\"";
}
Again, I do not know if you have that problem/broken .agi or not. But I can tell you that the broken .agi result is not seeing the user login or logout state when you dial the feature code to login/out in FreePBX.
To start fop2 in debug mode you can do this
service fop2 stop
cd /usr/local/fop2
script capture.log
./fop2_server -X 1
(then log into fop2, and try to login and logout a user in freepbx)
ctrl-C
exit
service fop2 start
At that point you will have a capture.log file you can open and search for the "UserEvent" string.
127.0.0.1 <- Event: PeerStatus
127.0.0.1 <- Privilege: system,all
127.0.0.1 <- ChannelType: SIP
127.0.0.1 <- Peer: SIP/3018
127.0.0.1 <- PeerStatus: Unregistered
127.0.0.1 <- Cause: Expired
127.0.0.1 <- Event: ExtensionStatus
127.0.0.1 <- Privilege: call,all
127.0.0.1 <- Exten: 3018
127.0.0.1 <- Context: ext-local
127.0.0.1 <- Hint: SIP/3018&Custom:DND3018,CustomPresence:3018
127.0.0.1 <- Status: 4
127.0.0.1 <- Event: ExtensionStatus
127.0.0.1 <- Privilege: call,all
127.0.0.1 <- Exten: *803018
127.0.0.1 <- Context: ext-local
127.0.0.1 <- Hint: SIP/3018&Custom:DND3018,CustomPresence:3018
127.0.0.1 <- Status: 4
All work fine, active only logged users.
[attachment:55c896f97958a]
In User & Device mode SIP Registration status is not monitored, only user login status in FreePBX system. FOP2 won't monitor sip registrations on that device and user mode, because it will return mixed states whenever you have more than one device associated to a user.