Extending Asterisk presence support

I am interested in extending/changing the queue presence support to include general asterisk user presence.

By doing this I would like an “on idle, ring-all / follow-me” setup.

Currently, we have a mysql table of extensions and alternate numbers. Through a simple web interface or quick-key on the sip phone, users can select to have their calls also ring on another number. This can be anything from a mobile to sip extension etc.

What I would like, is to have a function (very similar to the queue presence) that will execute a customisable asterisk manager command. This will alow the use of extended functionality which we have already customized in asterisk.

Is this in the scope of Asterisk-IM?

-Rob

Yes that sounds like a good idea.

We could have some events that are triggered on presence changes and send Asterisk commands. I’ve recently played a bit with groovy for similar extension points in another project. Maybe it would be an option to allow the admin to define some groovy script snippets that are evaluated on these events.

What do you think?

By keeping the events customizable, it opens it up to a variatey of applications, not just the follow-me/ring-all mentioned before.

Anything from as simple as setting a value in asterisks internal database, to sending an sms, using it for agent single-sign-on…

The Groovy hooks might be better to implement in the user-status plugin? (assuming thats still being developed/mantained)

This will allow the presence info to be used for practically anything in the enterprise and won’t be limited to asterisk.

Indeed this could be used for a lot more things…

Could you please, elaborate your request ?

Do you mean Openfire server should centralize information such as “this extension is now forwarded to that number” ?

If positive, we have to keep in mind that in SIP setups, call forwarding is mostly done by phones themselves which means, as long as you don’t call a phone, you can’t know if its calls are redirected or not. SIP standards provide OPTIONS method to query for forwarding status but I can’t think of way to integrate this with a presence server as long as phone themselves are not presence aware. Anyway, it could be possible to have an Openfire server replying “I can’t answer” for non presence enabled phones.

For Follow Me feature, situation is different as this feature is done by Asterisk.

Most asterisk installations I’ve been in contact with all rely on hard sip phones ranging from Aastra to Grandstream and even some Cisco. None of which are effective in managing presence. Sure you can customize a programmable button to do it for you, but it requires user intervention, and as I’m sure you can imagine is fairly useless if you don’t remember to use it. This is the beuty of asterisk-im. As the user becomes idle at their PC, it is then safe to assume they have wondered from their desk and its time to start hunting for them.

It’s probably not the best way to do it, but currently we use something like this:

exten => XXXX,n,Dial(    SIP/${EXTEN}    ${DB(presence/${EXTEN})}    ,${DIALOPTIONS});
//Spacing only there to make it easier to read//

The value of DB(presence/$) is currently set manually via a simple web interface.

It can either be a valid dial string, so something like “&SIP/4000” or “&ZAP/g1/0832818712” or it can be an emtpy string for no follow-me.

Asterisk-IM already ties a jabber login to a SIP extension and can currently tweak your queue presence. What I am after is simply extending that same functionality to instead of only tweaking queue presence, also executing customizable manager commands. In our case, we need something simple like a manager command to add or remove a asterisk-DB entry so that we can do something like:

exten => XXXX,n,ExecIf($[${DB(presence/idle/${EXTEN})}=1]|Dial|SIP/${EXTEN}&${FOLLOWME},${DIALOPTIONS});
exten => XXXX,n,ExecIf($[${DB(presence/idle/${EXTEN})}=0]|Dial|SIP/${EXTEN},${DIALOPTIONS});

From another angle, if the whole lot can be managed by the end user from spark plugin, that would be a dream.

So I guess an was to look at it would be that asterisk-im/jabber maintains the presence, but every time it changes, it updates the asterisk dialplan accordingly.

-R

Message was edited by: rhartzenberg

Correct some layout/mark-up issues.

It seems this would only require us to set a dialplan variable update a db key in Asterisk if presence changes.

That’s indeed exactly what we already have in place for Queues, so the effort would be reasonable.

=Stefan

So, the point is to have user’s hardphone and IM client behaving as presence providers and let different presence consumers as Asterisk, using this presence data to forward calls accordingly :

“this guy didn’t reply to that call, he must out somewhere” “this PC is idle, let’s forward new incoming calls to someone else”.

Is this correct ?

If positive, I’m wondering which tool would give users the control they’re very likely to look after.

What I mean is how do you edit and maintain such presence rules ?

Asterisk-IM basically says when you are on the phone, then your Jabber presence should indicate that (“away” with status “on the phone”) because you are unlikely to handle IM and phone calls at the same time.

The other idea is that presence is not specific to a communication channel. If you leave the office you are “away” on your desktop and you won’t be able reply to IM messages and won’t answer calls from a call queue, same if you set your presence to “do not disturb”.