[SR-Users] Reading presence state

Gertjan Wolzak g.wolzak at kazlow.nl
Fri Jul 19 11:04:50 CEST 2019

Hello Henning, 

No, I need the presence functionality, just wanted to see if I could use the presence status to route calls, i.e. a user is in a call, someone else calls that user, I check the presence state and route the call to voicemail of reception. 
If that is possible I do not have to change the settings on a phone to disable or enable callwaiting. 

I was thinking that if I could route based on the presence state I do not have to use dialog_profile method. 

I have got it working as required. 

Thank you for your time. 



From: "Henning Westerholt" <hw at skalatan.de> 
To: "sr-users" <sr-users at lists.kamailio.org>, "Gertjan Wolzak" <g.wolzak at kazlow.nl> 
Sent: Friday, July 19, 2019 10:43:39 AM 
Subject: Re: [SR-Users] Reading presence state 

Hello Gertjan, 

if you just want to monitor the dialog count of a user internally in your cfg, you don't need to use the presence modules. This can be done only with the dialog module with the functionality you already mentioned: dialog profiles. This will be also more acurate then querying the database table etc.. 


Am 15.07.19 um 09:28 schrieb Gertjan Wolzak: 

Hello Henning, 

Thank you for your time. 

Think I have not been able to explain my challenge, or I am so far off, I need to start at zero. 

I would want to only request the value of the in memory content, cause when I a call is finished, the records in the presentity table stay valid till they expire and the action to remove the expired records has been executed. 

So to my best knowledge that would mean that even if the dialog has been ended, the record could exist for x amount of time depending on the min_expires and the clean_period parameters of the presence module. 

For now I have solved my routing requirement by using the dialog funtions set_dlg_profile and get_profile_size. So I am able to limit calls to an extension that has an active call, but still allow outgoing calls from that extension. 

I guess I have to look into doing something with the publish messages, get the information in those before the handle_publish action, retrieve the information and put it in a database table. But I think then the dialog option is the same, so just keep using that. 

Am I correct in saying that monitoring (realtime) if an extension is in a dialog can be checked by querying the presentity table, but that wont work to check if an extension is not in a call due to the expires value an dthe clean_period 
parameters. With extension I mean user.. 

Thank you. 


From: "Henning Westerholt" [ mailto:hw at skalatan.de | 
<hw at skalatan.de> ] 
To: "sr-users" [ mailto:sr-users at lists.kamailio.org | 
<sr-users at lists.kamailio.org> ] 
Cc: "Gertjan Wolzak" [ mailto:g.wolzak at kazlow.nl | 
<g.wolzak at kazlow.nl> ] 
Sent: Friday, July 12, 2019 10:17:20 PM 
Subject: RE: Reading presence state 

Hello Gertjan, 

so you want to not only query the database, but also the in-memory content of the presence module? 

The PV $subs does not work for you? Another idea – have you looked to the parameter subs_db_mode? From the docs: 

“1 - Write-Through scheme. Subscriptions are updated synchronously in database and in memory(used for read operations). Use this scheme if speed is not top priority, but it's important that no subscriptions will be lost during crash or reboot or if you have an external application that reads the state of the subscriptions from database and they need to be updated synchronously.” 




Henning Westerholt - [ https://skalatan.de/blog/ | https://skalatan.de/blog/ ] 

Kamailio services - [ https://skalatan.de/services | https://skalatan.de/services ] 

From: sr-users [ mailto:sr-users-bounces at lists.kamailio.org | 
<sr-users-bounces at lists.kamailio.org> ] On Behalf Of Gertjan Wolzak 
Sent: Monday, July 8, 2019 2:23 PM 
To: sr-users [ mailto:sr-users at lists.kamailio.org | 
<sr-users at lists.kamailio.org> ] 
Subject: [SR-Users] Reading presence state 

Hello Kamailions, 

I have been able to get the presence configured, subscribers see the status of their subscriptions, this is working fine, for internal, incoming external and external calls. This was solved by enabling use_pubruri_avps in the pua_dialoginfo module. 

Now I want to be able to route calls based on the presence state. 

Using the presentity table could be used by doing a query based on the userpart of the ruri, which works fine when the call is still active, but it can take a while for the record to be removed from the presentity table, as that is dependend on the expires value. So when a query is made after a call is finished, a record would still be present in the presentity table till clean_period timer has hit again and the expires value is expired. 

So I should get the status from memory, but I have not been able to find the information on how to do that. 

Can someone enlighten me on where to find that information? 



Kamailio (SER) - Users Mailing List [ mailto:sr-users at lists.kamailio.org | sr-users at lists.kamailio.org ] [ https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users | https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users ] 

Henning Westerholt - [ https://skalatan.de/blog/ | https://skalatan.de/blog/ ] Kamailio services - [ https://skalatan.de/services | https://skalatan.de/services ] 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190719/89e96137/attachment.html>

More information about the sr-users mailing list