|
@@ -99,8 +99,9 @@ int lookup_to_dset(struct sip_msg* _m, udomain_t* _d, str* _uri)
|
|
|
*/
|
|
|
int xavp_rcd_helper(ucontact_t* ptr)
|
|
|
{
|
|
|
- sr_xavp_t *xavp=NULL;
|
|
|
+ sr_xavp_t **xavp=NULL;
|
|
|
sr_xavp_t *list=NULL;
|
|
|
+ sr_xavp_t *new_xavp=NULL;
|
|
|
str xname_ruid = {"ruid", 4};
|
|
|
str xname_received = { "received", 8};
|
|
|
str xname_contact = { "contact", 7};
|
|
@@ -111,29 +112,32 @@ int xavp_rcd_helper(ucontact_t* ptr)
|
|
|
if(reg_xavp_rcd.s==NULL || reg_xavp_rcd.len<=0) return 0;
|
|
|
|
|
|
list = xavp_get(®_xavp_rcd, NULL);
|
|
|
- xavp = list;
|
|
|
+ xavp = list ? &list->val.v.xavp : &new_xavp;
|
|
|
memset(&xval, 0, sizeof(sr_xval_t));
|
|
|
xval.type = SR_XTYPE_STR;
|
|
|
xval.v.s = ptr->ruid;
|
|
|
- xavp_add_value(&xname_ruid, &xval, &xavp);
|
|
|
+ xavp_add_value(&xname_ruid, &xval, xavp);
|
|
|
|
|
|
if(ptr->received.len > 0) {
|
|
|
memset(&xval, 0, sizeof(sr_xval_t));
|
|
|
xval.type = SR_XTYPE_STR;
|
|
|
xval.v.s = ptr->received;
|
|
|
- xavp_add_value(&xname_received, &xval, &xavp);
|
|
|
+ xavp_add_value(&xname_received, &xval, xavp);
|
|
|
}
|
|
|
|
|
|
memset(&xval, 0, sizeof(sr_xval_t));
|
|
|
xval.type = SR_XTYPE_STR;
|
|
|
xval.v.s = ptr->c;
|
|
|
- xavp_add_value(&xname_contact, &xval, &xavp);
|
|
|
+ xavp_add_value(&xname_contact, &xval, xavp);
|
|
|
|
|
|
if(list==NULL) {
|
|
|
/* no reg_xavp_rcd xavp in root list - add it */
|
|
|
xval.type = SR_XTYPE_XAVP;
|
|
|
- xval.v.xavp = xavp;
|
|
|
- xavp_add_value(®_xavp_rcd, &xval, NULL);
|
|
|
+ xval.v.xavp = *xavp;
|
|
|
+ if(xavp_add_value(®_xavp_rcd, &xval, NULL)==NULL) {
|
|
|
+ LM_ERR("cannot add ruid xavp to root list\n");
|
|
|
+ xavp_destroy_list(xavp);
|
|
|
+ }
|
|
|
}
|
|
|
return 0;
|
|
|
}
|