Hello,
I have noticed that user records were not being correctly saved in the location 
table.
I have tried to fix this will the attached code.
This would fix reginfo_handle_notify() to store the user-record in the right 
format.

This fixes part of the problem, I'm still trying to fix the incorrect uri in 
the PUBLISH message generated by this module.
Regards,
Gnaneshwar Gatla | InTouch Health | Software Developer
6330 Hollister Ave. Goleta CA, 93117 | P: 805.562.8686 ext: 199

From: Gnaneshwar Gatla
Sent: Tuesday, May 08, 2012 4:58 PM
To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users 
Mailing List
Cc: Carsten Bock (cars...@ng-voice.com)
Subject: Bug: Pua_reginfo

Hello all,
There seems to be an deadlock between registrar and pua_reginfo module whenever 
a SIP client refreshes its registration.

1.       The pua_reginfo does not publish Event:reg when a sip client registers 
for the first time.

2.       The pua_reginfo module does not use ul.lock_udomain() to lock the ul 
table to get the record.

3.       The pua_reginfo does not release the record that it accessed from 
ul.get_urecord()
Since the record is not released, when the client re-registers, the registrar 
module is unable to query for the userlocation and sends a 200 OK response with 
0 bindings.
Which leads to no contact header in the response message and eventually 
deletion of the record in the location table(expires).

I have tried to fix this using lock_udomain, release_urecord and 
unlock_udomain, but failed to rectify the error.

The deadlock happens in modules_k/usrloc/udomain.c (db_load_urecord()).
if (ul_dbf.query(_c, keys, 0, vals, columns, (use_domain)?2:1, 13, order,
                                &res) < 0)


My Question:

1.       is pua_reginfo supposed to delete record from location database and 
send the same data to a presence server?

a.       If above is true, then should the registrar module insert a new record 
in the location table?

b.      If above is false, the registrar module should be able to 
refresh/update the record in the location table.

This error is also impacts pua_usrloc module too as it cannot access the record 
and sends creates an incorrect uri.


Help:
I'm new and learning how Kamailio works, is there a clean way that pua_reginfo 
module gets the record?

Gnaneshwar Gatla | InTouch Health | Software Developer
6330 Hollister Ave. Goleta CA, 93117 | P: 805.562.8686 ext: 199
149,165d148
<                       /* received Attribute */
<                               memset(buf, 0, sizeof(buf));
<                       buf_len = snprintf(buf, sizeof(buf), "%.*s", 
ptr->received.len, ptr->received.s);
<                       xmlNewProp(contact_node, BAD_CAST "received", BAD_CAST 
buf);
<                       
<                       memset(buf, 0, sizeof(buf));
<                         buf_len = snprintf(buf, sizeof(buf), "%.*s", 
ptr->path.len, ptr->path.s);
<                         xmlNewProp(contact_node, BAD_CAST "path", BAD_CAST 
buf);
< 
<                       memset(buf, 0, sizeof(buf));
<                         buf_len = snprintf(buf, sizeof(buf), "%.*s", 
ptr->user_agent.len, ptr->user_agent.s);
<                         xmlNewProp(contact_node, BAD_CAST "user_agent", 
BAD_CAST buf);
<                       
<                       /* CSeq Attribute */
<                         memset(buf, 0, sizeof(buf));
<                         buf_len = snprintf(buf, sizeof(buf), "%d", ptr->cseq);
<                         xmlNewProp(contact_node, BAD_CAST "cseq", BAD_CAST 
buf);
107,108c107,108
<               || (ul.get_ucontact(*ul_record, &contact_uri, &callid, &no_str, 
cseq+1, &ul_contact) != 0)) {
<               if (ul.insert_ucontact(*ul_record, &contact_uri, &ci, 
&ul_contact) < 0) {
---
>               || (ul.get_ucontact(*ul_record, &aor, &callid, &no_str, cseq+1, 
> &ul_contact) != 0)) {
>               if (ul.insert_ucontact(*ul_record, &aor, &ci, &ul_contact) < 0) 
> {
203,205d202
<       str received = {0,0};
<       str path = {0,0};
<       str user_agent = {0, 0};
215c212
<       
---
> 
253c250
<               ul.lock_udomain(domain, &aor);
---
>               ul.lock_udomain(domain, &parsed_aor.user);
255c252
<               result = ul.get_urecord(domain, &aor, &ul_record);
---
>               result = ul.get_urecord(domain, &parsed_aor.user, &ul_record);
257c254
<                       ul.unlock_udomain(domain, &aor);
---
>                       ul.unlock_udomain(domain, &parsed_aor.user);
277c274
<                               if (ul.delete_urecord(domain, &aor, ul_record) 
< 0) {
---
>                               if (ul.delete_urecord(domain, &parsed_aor.user, 
> ul_record) < 0) {
297,314d293
<                               
<                               received.s = xmlGetAttrContentByName(contacts, 
"received");
<                               if (received.s == NULL) {
<                                         LM_DBG("No received for this 
contact!\n");
<                                 }
<                               received.len - strlen(received.s);
< 
<                               path.s = xmlGetAttrContentByName(contacts, 
"path");     
<                               if (received.s == NULL) {
<                                         LM_DBG("No path for this contact!\n");
<                                 }
<                               path.len = strlen(path.s);
< 
<                               user_agent.s = 
xmlGetAttrContentByName(contacts, "user_agent");
<                               if (received.s == NULL) {
<                                         LM_DBG("No user_agent for this 
contact!\n");
<                                 }
<                               user_agent.len = strlen(user_agent.s);
373c352
<               ul.unlock_udomain(domain, &aor);
---
>               ul.unlock_udomain(domain, &parsed_aor.user);
386c365
<       
---
> 
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to