Project

General

Profile

XMPP Status (Presence configuration) on the phone etc

Jonathan Hunter
Added almost 5 years ago

HI Guys,

Just trying to implement tigase-server with Jitsi, and all works well, apart from on the phone status, when client is actually in a call.

Id like to control this server side, so the clients in each domain/group know the status of each user.

I notice the vhost-presence-forward-jid parameter, however not clear on what to point it to, if I want to store all presence information on the server itself.

Any pointers would be great please!

The next step would be presence of Cisco hard phones!

Many thanks

Jon


Replies (13)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam almost 5 years ago

Just trying to implement tigase-server with Jitsi, and all works well, apart from on the phone status, when client is actually in a call.

Id like to control this server side, so the clients in each domain/group know the status of each user.

Do I understand this correctly. Do you want to change user's presence by the server not by user's client when the user is on call? A few more questions to this:

  1. Why? Why not letting the client to change the user's status? I am not asking because I am curious but motivations behind this may help me find the best approach.

  2. Assuming we want the server to set user's "on-call" status, how do we (how the server) knows that the user is on call or ended the call?

I notice the vhost-presence-forward-jid parameter, however not clear on what to point it to, if I want to store all presence information on the server itself.

Again, why? You know all users' presences are stored on the server anyway within user's session object. Forwarding presence to some address makes sense if you, for example want to display user's presence on a website or want to integrate XMPP with some external system to which you want to submit user's status.

Any pointers would be great please!

The most optimal way to do it, would be to intercept some packet from a client which indicates that the call has started and then write a plugin which intercepts the packet and changes user's presence status, saves a copy of previous presence and generates a new presence. Then we need another packet from a client which indicates that the user is no longer on call and this second packet should be also intercepted by the same plugin and again revert user's presence to the original one.

Added by Jonathan Hunter almost 5 years ago

Hi Artur,

Thanks for getting back to me.

This all leads to us running an XMPP server for IM, and an Asterisk/Kamailio SIP configuration for Voice.

After speaking with the Jitsi guys, they say I can either change the XMPP status on the server or they implement it in the client and the status is pushed from there.

This is mainly in terms of on the phone status being automatically distributed amongst clients.

I just want all users in the same domain to know the status of one another at all times.

Does that make my requirement any clearer?

Many thanks

Jon

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam almost 5 years ago

Jonathan Hunter wrote:

Hi Artur,

Thanks for getting back to me.

This all leads to us running an XMPP server for IM, and an Asterisk/Kamailio SIP configuration for Voice.

After speaking with the Jitsi guys, they say I can either change the XMPP status on the server or they implement it in the client and the status is pushed from there.

This is mainly in terms of on the phone status being automatically distributed amongst clients.

I just want all users in the same domain to know the status of one another at all times.

Does that make my requirement any clearer?

It definitely makes it more weird ;-) Assuming I understand you correctly.

Normally in IM (or XMPP) user status, whatever it is, is distributed to all user's contacts only, not to all users in the same domain. Are you sure you want to do that? Do you really want to distribute user's "on the phone" status to all users in the same domain? This generates quite a few problems you have to overcome:

  1. If you have 100k online users in the same domain, the user's status change would generate 100k presence notifications to all users. This might be a huge traffic to handle.

  2. Another question is whether all other users on the same domain (who are not in my contact list) are really interested in my "on the phone" status. Maybe they do not want to receive my status? After all they are not my friends as they are not in my contact list.

  3. Another problem is that the user's status would never reach all other users who are not in contact list (roster) because the server automatically blocks presence packets from users who are not in the roster.

Maybe you really want to distribute user's "on the phone" status to all contacts from the roster? If this is the case, than it is much better to change the status in the client if possible. However, maybe for some use cases (Cisco hard phones) it is not possible? Than you could write a custom logic on the server, but as I said before, the server must have some way of knowing that the users is on the phone. Once we get past this details and you tell me how the server can know of user being on the phone we can suggest the best place to put the custom code.

Added by Jonathan Hunter almost 5 years ago

Hi Artur,

Sorry just to be clear, the server will be a multi-tenanted/Virtual domain environment, so there will be say 1000-2000 users in a domain, however I do take your point about scale and would want to distribute presence to contacts only to start with.

I am scoping out requirements for presence in general for different phones (Cisco etc), however my primary objective is to get our soft-client working, which is JITSI based.

And I was under the impression you can set XMPP status, and tell the server to distribute to all contacts?

Can Phone events which are XMPP packets with a child element phone-event be sent and understood by Tigase server?

I would just want events do not disturb, and on the phone be sent to the contacts list.

Any help would be great.

Thanks

Jon

Added by Wojciech Kapcia TigaseTeam almost 5 years ago

Jonathan Hunter wrote:

And I was under the impression you can set XMPP status, and tell the server to distribute to all contacts?

Well, that's the gist of XMPP.

Can Phone events which are XMPP packets with a child element phone-event be sent and understood by Tigase server?

I would just want events do not disturb, and on the phone be sent to the contacts list.

One question comes to mind - will the software running on the phone be xmpp based and will log as a user for which status should be set (i.e. you have IM running on computer for user1@domain, and this user has SIP phone on the desk - will this phone be logged in as same user1@domain)? Or those will be separate entities with separate accounts merely communicating status of the phone and it's user in the stanza itself?

For the first option changing presence by the phone should be easy (however - it will be only one resource, but you could adjust it's priority, etc). Alternatively you could use XEP-0163: Personal Eventing Protocol with Xep-0108: User Activity which should better fit the scenario.

Added by Jonathan Hunter almost 5 years ago

Hi,

In terms of the clients, there will be a soft-client with a SIP account, and an XMPP account, however there will also be SIP hardphones that we need to make their presence known too.

Seems like the phone presence is the best approach.

I will also review the XEP-0163 document, thanks for that.

Thanks

Jon

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam almost 5 years ago

Jonathan Hunter wrote:

Hi Artur,

Sorry just to be clear, the server will be a multi-tenanted/Virtual domain environment, so there will be say 1000-2000 users in a domain, however I do take your point about scale and would want to distribute presence to contacts only to start with.

Good idea, let's start with this and once we get this sorted we can move to non-standard stuff.

I am scoping out requirements for presence in general for different phones (Cisco etc), however my primary objective is to get our soft-client working, which is JITSI based.

And I was under the impression you can set XMPP status, and tell the server to distribute to all contacts?

You are under a correct impression. This is exactly how it works.

Can Phone events which are XMPP packets with a child element phone-event be sent and understood by Tigase server?

I would just want events do not disturb, and on the phone be sent to the contacts list.

If these events are just presence packets with some extra payload (a child element - phone-event) than it would just work out of the box. Tigase does not need to understand it. It will forward presence with the whole content to all contacts.

If, however, you want Tigase to understand the phone-event and do something special about it, then it is possible through a custom plugin.

My suggestion to start is, just try to send a presence with DND status from a client to the server and see what happens. It should be distributed to all contacts.

Added by Jonathan Hunter almost 5 years ago

Hi Artur,

Thanks for the help so far, really enjoying tigase and its capabilities.

I have tested setting manual presence status, and all work well, as does DND , so they are all good.

Im now looking at presence being triggered when the client is on the phone, which I think as you mention I need to look at a custom plugin.

I am working with kamailio, so is it sensible for me to add it as an XMPP component to my tigase-server, so it can share presence data from SIP clients?

What would be your recommended approach for integrating SIP and XMPP on Tigase?

Also any pointers on custom plugins work be great.

Thanks again and sorry for all the questions!

Jon

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam almost 5 years ago

Im now looking at presence being triggered when the client is on the phone, which I think as you mention I need to look at a custom plugin.

I am working with kamailio, so is it sensible for me to add it as an XMPP component to my tigase-server, so it can share presence data from SIP clients?

There is still something I do not understand. For the user to set his presence he must be an XMPP user. SIP and XMPP are separate networks, so you cannot just

set a presence for SIP user in XMPP system.

What would be your recommended approach for integrating SIP and XMPP on Tigase?

Also any pointers on custom plugins work be great.

Plugins are actually for processing XMPP packets in the Tigase XMPP Server. Plugin execution is triggered by a packet (message, presence, IQ, or something more specific such as IQ roster, IQ vcard, etc...).

So to use plugins Kamailio would need to connect to Tigase via XMPP, login as a user and then it could send custom packets to Tigase which would be processed by plugins.

However, I suspect I know what you are trying to do. A user is connected via XMPP to Tigase and he is also connected via SIP to Kamailio. When the user answers the call you would like to show this on his XMPP status? Is that correct?

If this is the case, I can see 2 (maybe 3 solutions):

  1. Admin ad-hoc command can be executed on the Tigase XMPP Server and it can change status of a user. Ad-hoc commands can be executed via XMPP from an admin account or via REST API. So the Kamailio would need to connect to Tigase via XMPP as admin (preferable for performance reasons) and then it can execute ad-hoc command to manipulate users' presence status (or anything you wish for that matter). Kamailio could also connect via REST API and do the same, but this is much slower.

  2. What we did once with Yate team (another SIP/internet telephony server) is, the Yate connected to Tigase as an external component and over this external component it created additional user's sessions. Then it could change user's presence for this session they way it liked. More over, it was also exposing custom capabilities for this session so other people knew they could call the user over SIP.

Please let me know if I am right with my assumption and which option you prefer. I will provide you with more details.

I hope this helps.

Added by Jonathan Hunter almost 5 years ago

Hi Artur,

You are correct with your assumptions.

I like the idea of Case 1, Kamailio sending adhoc commands, if you could let me know a little more on that it would be great.

Many thanks

Jon

Added by Jonathan Hunter almost 5 years ago

Hi Artur,

Also I am looking to implement CUSAX on my server.

Therefore can I add a 'tel' entry to the tig_pairs table, so that I can link a SIP account with an XMPP one?

If so is there a stored procedure for this or can I insert directly into dB?

Thanks

Jon

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam almost 5 years ago

I like the idea of Case 1, Kamailio sending adhoc commands, if you could let me know a little more on that it would be great.

The most optimal way is to connect Kamalio to Tigase via XMPP. However, I imagine this might require substantial work to add XMPP support on the Kamalio side. Therefore, I suggest you start with REST API. All the admin ad-hoc commands in the Tigase XMPP Server can be executed either via REST API or XMPP. REST API is simpler/easier to call but less optimal for a high volume calls. But I think, it is a good idea to start with REST API as kind of a proof of concept and then once everything is confirmed to work, you can switch communication protocol between Kamalio and Tigase to XMPP.

Dokumentation for the Tigase REST API is on the wiki page of the HTTP API project

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam almost 5 years ago

Therefore can I add a 'tel' entry to the tig_pairs table, so that I can link a SIP account with an XMPP one?

If so is there a stored procedure for this or can I insert directly into dB?

There is no stored procedure for adding entries to tig_pairs table, you can insert data directly.

    (1-13/13)