|
@@ -50,6 +50,7 @@ struct contact {
|
|
str path;
|
|
str path;
|
|
struct socket_info* sock;
|
|
struct socket_info* sock;
|
|
str instance;
|
|
str instance;
|
|
|
|
+ str ruid;
|
|
unsigned int flags;
|
|
unsigned int flags;
|
|
unsigned short q_flag;
|
|
unsigned short q_flag;
|
|
struct contact *next;
|
|
struct contact *next;
|
|
@@ -92,9 +93,11 @@ static str sock_name = {"sock", 4};
|
|
static str instance_name = {"instance", 8};
|
|
static str instance_name = {"instance", 8};
|
|
static str flags_name = {"flags", 5};
|
|
static str flags_name = {"flags", 5};
|
|
static str q_flag_name = {"q_flag", 6};
|
|
static str q_flag_name = {"q_flag", 6};
|
|
|
|
+static str ruid_name = {"ruid", 4};
|
|
|
|
|
|
void add_contacts_avp(str *uri, str *dst_uri, str *path, str *sock_str,
|
|
void add_contacts_avp(str *uri, str *dst_uri, str *path, str *sock_str,
|
|
- unsigned int flags, unsigned int q_flag, str *instance)
|
|
|
|
|
|
+ unsigned int flags, unsigned int q_flag, str *instance,
|
|
|
|
+ str *ruid)
|
|
{
|
|
{
|
|
sr_xavp_t *record;
|
|
sr_xavp_t *record;
|
|
sr_xval_t val;
|
|
sr_xval_t val;
|
|
@@ -136,6 +139,12 @@ void add_contacts_avp(str *uri, str *dst_uri, str *path, str *sock_str,
|
|
xavp_add_value(&instance_name, &val, &record);
|
|
xavp_add_value(&instance_name, &val, &record);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (ruid->len > 0) {
|
|
|
|
+ val.type = SR_XTYPE_STR;
|
|
|
|
+ val.v.s = *ruid;
|
|
|
|
+ xavp_add_value(&ruid_name, &val, &record);
|
|
|
|
+ }
|
|
|
|
+
|
|
val.type = SR_XTYPE_XAVP;
|
|
val.type = SR_XTYPE_XAVP;
|
|
val.v.xavp = record;
|
|
val.v.xavp = record;
|
|
xavp_add_value(&contacts_avp, &val, NULL);
|
|
xavp_add_value(&contacts_avp, &val, NULL);
|
|
@@ -192,6 +201,7 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
|
|
contacts->path = msg->path_vec;
|
|
contacts->path = msg->path_vec;
|
|
contacts->q = get_ruri_q();
|
|
contacts->q = get_ruri_q();
|
|
contacts->instance = msg->instance;
|
|
contacts->instance = msg->instance;
|
|
|
|
+ contacts->ruid = msg->ruid;
|
|
first_idx = 0;
|
|
first_idx = 0;
|
|
} else {
|
|
} else {
|
|
/* Insert first branch to first contact */
|
|
/* Insert first branch to first contact */
|
|
@@ -207,6 +217,8 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
|
|
contacts->q = branch->q;
|
|
contacts->q = branch->q;
|
|
contacts->instance.s = branch->instance;
|
|
contacts->instance.s = branch->instance;
|
|
contacts->instance.len = branch->instance_len;
|
|
contacts->instance.len = branch->instance_len;
|
|
|
|
+ contacts->ruid.s = branch->ruid;
|
|
|
|
+ contacts->ruid.len = branch->ruid_len;
|
|
first_idx = 1;
|
|
first_idx = 1;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -233,6 +245,8 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
|
|
next->q = branch->q;
|
|
next->q = branch->q;
|
|
next->instance.s = branch->instance;
|
|
next->instance.s = branch->instance;
|
|
next->instance.len = branch->instance_len;
|
|
next->instance.len = branch->instance_len;
|
|
|
|
+ next->ruid.s = branch->ruid;
|
|
|
|
+ next->ruid.len = branch->ruid_len;
|
|
next->next = (struct contact *)0;
|
|
next->next = (struct contact *)0;
|
|
|
|
|
|
prev = (struct contact *)0;
|
|
prev = (struct contact *)0;
|
|
@@ -283,7 +297,7 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
|
|
|
|
|
|
add_contacts_avp(&(curr->uri), &(curr->dst_uri), &(curr->path),
|
|
add_contacts_avp(&(curr->uri), &(curr->dst_uri), &(curr->path),
|
|
&sock_str, curr->flags, curr->q_flag,
|
|
&sock_str, curr->flags, curr->q_flag,
|
|
- &(curr->instance));
|
|
|
|
|
|
+ &(curr->instance), &(curr->ruid));
|
|
|
|
|
|
curr = curr->next;
|
|
curr = curr->next;
|
|
}
|
|
}
|
|
@@ -298,7 +312,7 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
|
|
}
|
|
}
|
|
|
|
|
|
void add_contact_flows_avp(str *uri, str *dst_uri, str *path, str *sock_str,
|
|
void add_contact_flows_avp(str *uri, str *dst_uri, str *path, str *sock_str,
|
|
- unsigned int flags, str *instance)
|
|
|
|
|
|
+ unsigned int flags, str *instance, str *ruid)
|
|
{
|
|
{
|
|
sr_xavp_t *record;
|
|
sr_xavp_t *record;
|
|
sr_xval_t val;
|
|
sr_xval_t val;
|
|
@@ -332,6 +346,12 @@ void add_contact_flows_avp(str *uri, str *dst_uri, str *path, str *sock_str,
|
|
xavp_add_value(&instance_name, &val, &record);
|
|
xavp_add_value(&instance_name, &val, &record);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (ruid->len > 0) {
|
|
|
|
+ val.type = SR_XTYPE_STR;
|
|
|
|
+ val.v.s = *ruid;
|
|
|
|
+ xavp_add_value(&ruid_name, &val, &record);
|
|
|
|
+ }
|
|
|
|
+
|
|
val.type = SR_XTYPE_INT;
|
|
val.type = SR_XTYPE_INT;
|
|
val.v.i = flags;
|
|
val.v.i = flags;
|
|
xavp_add_value(&flags_name, &val, &record);
|
|
xavp_add_value(&flags_name, &val, &record);
|
|
@@ -354,7 +374,7 @@ void add_contact_flows_avp(str *uri, str *dst_uri, str *path, str *sock_str,
|
|
* there was nothing to do. Returns -1 in case of an error. */
|
|
* there was nothing to do. Returns -1 in case of an error. */
|
|
int t_next_contacts(struct sip_msg* msg, char* key, char* value)
|
|
int t_next_contacts(struct sip_msg* msg, char* key, char* value)
|
|
{
|
|
{
|
|
- str uri, dst_uri, path, instance, host, sock_str;
|
|
|
|
|
|
+ str uri, dst_uri, path, instance, host, sock_str, ruid;
|
|
struct socket_info *sock;
|
|
struct socket_info *sock;
|
|
unsigned int flags, q_flag;
|
|
unsigned int flags, q_flag;
|
|
sr_xavp_t *xavp_list, *xavp, *prev_xavp, *vavp;
|
|
sr_xavp_t *xavp_list, *xavp, *prev_xavp, *vavp;
|
|
@@ -443,6 +463,9 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
|
|
il->next = (struct instance_list *)0;
|
|
il->next = (struct instance_list *)0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ vavp = xavp_get(&ruid_name, xavp->val.v.xavp);
|
|
|
|
+ ruid = vavp->val.v.s;
|
|
|
|
+
|
|
/* Rewrite Request-URI */
|
|
/* Rewrite Request-URI */
|
|
rewrite_uri(msg, &uri);
|
|
rewrite_uri(msg, &uri);
|
|
|
|
|
|
@@ -462,6 +485,8 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
|
|
|
|
|
|
setbflagsval(0, flags);
|
|
setbflagsval(0, flags);
|
|
|
|
|
|
|
|
+ set_ruid(msg, &ruid);
|
|
|
|
+
|
|
/* Check if there was only one contact at this priority */
|
|
/* Check if there was only one contact at this priority */
|
|
if (q_flag) {
|
|
if (q_flag) {
|
|
xavp_rm(xavp, NULL);
|
|
xavp_rm(xavp, NULL);
|
|
@@ -535,7 +560,7 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
|
|
}
|
|
}
|
|
if (ilp) {
|
|
if (ilp) {
|
|
add_contact_flows_avp(&uri, &dst_uri, &path, &sock_str,
|
|
add_contact_flows_avp(&uri, &dst_uri, &path, &sock_str,
|
|
- flags, &instance);
|
|
|
|
|
|
+ flags, &instance, &ruid);
|
|
goto check_q_flag;
|
|
goto check_q_flag;
|
|
}
|
|
}
|
|
if (!q_flag) {
|
|
if (!q_flag) {
|
|
@@ -560,8 +585,11 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (append_branch(msg, &uri, &dst_uri, &path, 0, flags, sock, 0, 0)
|
|
|
|
- != 1) {
|
|
|
|
|
|
+ vavp = xavp_get(&ruid_name, xavp->val.v.xavp);
|
|
|
|
+ ruid = vavp->val.v.s;
|
|
|
|
+
|
|
|
|
+ if (append_branch(msg, &uri, &dst_uri, &path, 0, flags, sock, 0, 0,
|
|
|
|
+ &ruid) != 1) {
|
|
LM_ERR("appending branch failed\n");
|
|
LM_ERR("appending branch failed\n");
|
|
free_instance_list(il);
|
|
free_instance_list(il);
|
|
xavp_destroy_list(&xavp_list);
|
|
xavp_destroy_list(&xavp_list);
|
|
@@ -596,7 +624,7 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
|
|
* there was nothing to do. Returns -1 in case of an error. */
|
|
* there was nothing to do. Returns -1 in case of an error. */
|
|
int t_next_contact_flows(struct sip_msg* msg, char* key, char* value)
|
|
int t_next_contact_flows(struct sip_msg* msg, char* key, char* value)
|
|
{
|
|
{
|
|
- str uri, dst_uri, path, instance, host;
|
|
|
|
|
|
+ str uri, dst_uri, path, instance, host, ruid;
|
|
struct socket_info *sock;
|
|
struct socket_info *sock;
|
|
unsigned int flags;
|
|
unsigned int flags;
|
|
sr_xavp_t *xavp_list, *xavp, *next_xavp, *vavp;
|
|
sr_xavp_t *xavp_list, *xavp, *next_xavp, *vavp;
|
|
@@ -683,6 +711,9 @@ int t_next_contact_flows(struct sip_msg* msg, char* key, char* value)
|
|
il->next = (struct instance_list *)0;
|
|
il->next = (struct instance_list *)0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ vavp = xavp_get(&ruid_name, xavp->val.v.xavp);
|
|
|
|
+ ruid = vavp->val.v.s;
|
|
|
|
+
|
|
/* Rewrite Request-URI */
|
|
/* Rewrite Request-URI */
|
|
rewrite_uri(msg, &uri);
|
|
rewrite_uri(msg, &uri);
|
|
|
|
|
|
@@ -700,6 +731,8 @@ int t_next_contact_flows(struct sip_msg* msg, char* key, char* value)
|
|
|
|
|
|
set_force_socket(msg, sock);
|
|
set_force_socket(msg, sock);
|
|
|
|
|
|
|
|
+ set_ruid(msg, &ruid);
|
|
|
|
+
|
|
setbflagsval(0, flags);
|
|
setbflagsval(0, flags);
|
|
|
|
|
|
/* Append branches until out of branches. */
|
|
/* Append branches until out of branches. */
|
|
@@ -793,8 +826,11 @@ int t_next_contact_flows(struct sip_msg* msg, char* key, char* value)
|
|
vavp = xavp_get(&flags_name, xavp->val.v.xavp);
|
|
vavp = xavp_get(&flags_name, xavp->val.v.xavp);
|
|
flags = vavp->val.v.i;
|
|
flags = vavp->val.v.i;
|
|
|
|
|
|
- if (append_branch(msg, &uri, &dst_uri, &path, 0, flags, sock, 0, 0)
|
|
|
|
- != 1) {
|
|
|
|
|
|
+ vavp = xavp_get(&ruid_name, xavp->val.v.xavp);
|
|
|
|
+ ruid = vavp->val.v.s;
|
|
|
|
+
|
|
|
|
+ if (append_branch(msg, &uri, &dst_uri, &path, 0, flags, sock, 0, 0,
|
|
|
|
+ &ruid) != 1) {
|
|
LM_ERR("appending branch failed\n");
|
|
LM_ERR("appending branch failed\n");
|
|
free_instance_list(il);
|
|
free_instance_list(il);
|
|
xavp_destroy_list(&xavp_list);
|
|
xavp_destroy_list(&xavp_list);
|