Roaming User Hints

I don’t know if this is the right place to post this, but I am trying to get on top of creating and removing hints for Roaming users.

I found in the latest that the file extensions.conf.ADHOC had parts relating to this issue, and I have been playing with the syntax, and can successfully get users logged on, and a Hint is created for them, and other phones then pick up the BLF’s on their phones. Snom 370’s in my case. I’m using * 1.4.10 for reference.

; check device type
exten => s,1,Set(DEVICETYPE=${DB(DEVICE/${CALLERID(number)}/type)})
exten => s,2,GotoIf($["${DEVICETYPE}" = “fixed”]?s-FIXED,1)
; get user’s extension
exten => s,3,Set(AMPUSER=${ARG1})
exten => s,4,GotoIf($["${AMPUSER}" = “”]?5:9)
exten => s,5,BackGround(please-enter-your)
exten => s,6,Playback(extension)
exten => s,7,Read(AMPUSER,then-press-pound)
; get user’s password and authenticate
exten => s,8,Wait(1)
exten => s,9,Set(AMPUSERPASS=${DB(AMPUSER/${AMPUSER}/password)})
exten => s,10,GotoIf($[${LEN(${AMPUSERPASS})} = 0]?s-NOPASSWORD,1)
; do not continue if the user has already logged onto this device
exten => s,11,Set(DEVICEUSER=${DB(DEVICE/${CALLERID(number)}/user)})
exten => s,12,GotoIf($["${DEVICEUSER}" = “${AMPUSER}”]?s-ALREADYLOGGEDON,1)
exten => s,13,Authenticate(${AMPUSERPASS})
; devices can only be mapped to one user - loggoff anyone else who is here
exten => s,14,Macro(user-logoff)
; map user to device
exten => s,15,Set(AMPUSERDEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => s,16,GotoIf($[${LEN(${AMPUSERDEVICES})} = 0]?18)
exten => s,19,Set(DB(AMPUSER/${AMPUSER}/device)=${AMPUSERDEVICES})
; map device to user
exten => s,20,Set(DB(DEVICE/${CALLERID(number)}/user)=${AMPUSER})
; create symlink from dummy device mailbox to user’s mailbox
exten => s,21,System(/bin/ln -s ${ASTSPOOLDIR}/voicemail/default/${AMPUSER}/ ${ASTSPOOLDIR}/voicemail/device/${CALLERID(number)})
exten => s,22,System(/usr/sbin/asterisk -rx “dialplan add extension ${AMPUSER},hint,SIP/${AMPUSERDEVICES} into ext-local replace”)

exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged into)
exten => s-FIXED,2,Playback(ha/phone)
exten => s-FIXED,3,SayDigits(${CALLERID(number)})
exten => s-FIXED,4,Playback(is-curntly-unavail)
exten => s-FIXED,5,Playback(vm-goodbye)
exten => s-FIXED,6,Hangup ;TODO should play msg indicated device cannot be logged into

exten => s-ALREADYLOGGEDON,1,NoOp(This device has already been logged into by this user)
exten => s-ALREADYLOGGEDON,2,Playback(vm-goodbye)
exten => s-ALREADYLOGGEDON,3,Hangup ;TODO should play msg indicated device is already logged into

exten => s-NOPASSWORD,1,NoOp(This extension does not exist or no password is set)
exten => s-NOPASSWORD,2,Playback(an-error-has-occured)
exten => s-NOPASSWORD,3,Playback(vm-goodbye)
exten => s-NOPASSWORD,4,Hangup ;TODO should play msg indicated device is already logged into

NOTE exten s,22 for the hint creation.

And also did this for when they logoff.

; check device type
exten => s,1,Set(DEVICETYPE=${DB(DEVICE/${CALLERID(number)}/type)})
exten => s,2,GotoIf($["${DEVICETYPE}" = “fixed”]?s-FIXED,1)
; remove entry from user’s DEVICE key
; delete the symlink to user’s voicemail box
exten => s,3,System(rm -f ${ASTSPOOLDIR}/voicemail/device/${CALLERID(number)})
exten => s,4,Set(DEVAMPUSER=${DB(DEVICE/${CALLERID(number)}/user)})
exten => s,5,Set(AMPUSERDEVICES=${DB(AMPUSER/${DEVAMPUSER}/device)})
exten => s,6,AGI(list-item-remove.php,${AMPUSERDEVICES},${CALLERID(number)},AMPUSERDEVICES,&)
; reset user -> device mapping
; users can log onto multiple devices, need to just remove device from value
exten => s,7,Set(DB(AMPUSER/${DEVAMPUSER}/device)=${AMPUSERDEVICES})
; reset device -> user mapping
exten => s,8,Set(DB(DEVICE/${CALLERID(number)}/user)=none)
exten => s,9,System(asterisk -rx “dialplan remove extension ${DEVAMPUSER}@ext-local”)
exten => s,10,System(asterisk -rx “dialplan add extension ${DEVAMPUSER},1,Macro(exten-vm|${DEVAMPUSER}|${DEVAMPUSER}) into ext-lo
exten => s,11,System(asterisk -rx “dialplan add extension ${DEVAMPUSER},2,Hangup() into ext-local”)
exten => s,12,Playback(vm-goodbye)

exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged out of)
exten => s-FIXED,2,Playback(an-error-has-occured)
exten => s-FIXED,3,Playback(vm-goodbye)
exten => s-FIXED,4,Hangup ;TODO should play msg indicated device cannot be logged into

Here exten s,9 removes the extension altogether so of course I added the standard parts that the Dialpan wants so that while they are not logged in calls go to Voicemail.

My problem only now is that the phones that are subscribed to the Roaming extension get their BLF stuck on after the roaming user logs off. I gather because of the way I am deleting them out of the system. Can I change up the order of things so that the roaming users phone hangs up so subscribers have their light go out, and then do all of the deleting ??

If someone could help out here that would be great … it’s basically the last piece in the puzzle for me. And if anyone can think of a more refined way of doing the above, please let me know. My users would really like to have BLF’s for roaming users.

Keep up the good work all, you’ve got a great product.

Thanks again, Brett

See this ticket:

What you have is not quite right, details in the ticket. Also - some ideas in the ticket wrt to ‘surviving a reload’ with this plan, at least a reload from within FreePBX. There are other ideas that could be used to survive a reload from the CLI (with the use of #EXEC).

Philippe Lindheimer - FreePBX Project Lead
http// - IRC #freepbx

I have upgraded my test box to FreePBX version, after seeing in the Trac that the Hints problem for adhoc extension has supposedly been sorted out.
Had a look through all of the code etc, and cannot find anywhere that would suggest that when a user logs in at a phone the hints would be created.

Could someone enlighten me on how I might get this feature working, or what I should be looking for or change.

Thanks, Brett

sorted out in 2.4

Philippe Lindheimer - FreePBX Project Lead
http// - IRC #freepbx

I’m a relative newbie, so be kind… I have a problem that sounds like it might be related to the above, but I don’t understand what you said or exactly what the referenced “ticket” is about. If I need to post somewhere else (or whatever), any direction would be appreciated. Also, if it would help to generate a log of some kind, let me know what would be appropriate.
I have 8 Grandstream GXP2000 phones with the side extension modules in a customer’s location. They have 11 inbound routes sent to extensions in FreePBX, and corresponding BLF lamps set in their phone’s “side car” extension module. The “side car” also has 8 BLF lamps set for the other phones, so they can tell who is on the phone. When an incoming call comes in, the BLF lamp for that incoming extension flashes red. Follow Me is set up on each incoming extension so that all 8 phones ring. The BLF lamps flash red for each phone that is ringing, and stays red if another employee is on the phone, unable to answer. That part works great!
The problem is the BLF lamps will occasionally (about 50 to 75% of the time) continue to blink when the call is answered. It continues the fast blink on each phone. Dialing that extension will make the blinking light go back to it’s idle “green” state. If the BLF is for another phone, initiating a call from that phone will also make the BLF go back to the correct state. It almost seems like the phone is not getting the signal that the call has ended.
It appears (initial testing only, done late last night) that if there are only six phones being called, the BLF lamps work correctly. Adding a seventh phone will make the BLF lamps continue to blink on all of the phones, like one or two of the phones are still ringing.
I thought it was a Grandstream firmware issue, and ordered new phones, but to no avail. I ordered the Snom 360 thinking it might solve the problem, but the Grandstream BLF lamps blinked even if one of the seven phones was the Snom. I’m thinking it might be a FreePBX configuration issue, or an Asterisk problem. Again, any help or direction would be appreciated.
Thank you for the great work you have done on FreePBX.

you can type show hints at the Asterisk CLI to see what state Asterisk claims they are in. Then you can do a tcpdump on the nic and look at wireshark (ethereal) to see if Asterisk is signaling the phones to stop blinking or not. The phones use SIP subscriptions to receive the the notifications so the tracing will help to see if the notices are going out properly or not.