Skip to content

Commit

Permalink
dispatcher: option to set add socket as string in the dst xavp
Browse files Browse the repository at this point in the history
- bit 2 has to be set for xavp_dst_mode modparam

(cherry picked from commit 8507efe)
  • Loading branch information
miconda committed Jan 8, 2020
1 parent 08353d6 commit 16e41ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/modules/dispatcher/dispatch.c
Expand Up @@ -1925,6 +1925,17 @@ int ds_add_xavp_record(ds_set_t *dsidx, int pos, int set, int alg,
LM_ERR("failed to add destination sock xavp field\n");
return -1;
}
if((ds_xavp_dst_mode & DS_XAVP_DST_ADD_SOCKSTR)
&& (dsidx->dlist[pos].attrs.socket.len > 0)) {
memset(&nxval, 0, sizeof(sr_xval_t));
nxval.type = SR_XTYPE_STR;
nxval.v.s = dsidx->dlist[pos].attrs.socket;
if(xavp_add_value(&ds_xavp_dst_socket, &nxval, &nxavp)==NULL) {
xavp_destroy_list(&nxavp);
LM_ERR("failed to add destination attrs xavp field\n");
return -1;
}
}
}

if(alg == DS_ALG_CALLLOAD) {
Expand Down
2 changes: 2 additions & 0 deletions src/modules/dispatcher/dispatch.h
Expand Up @@ -66,6 +66,7 @@
#define DS_USE_NEXT 1

#define DS_XAVP_DST_SKIP_ATTRS 1
#define DS_XAVP_DST_ADD_SOCKSTR (1<<1)

#define DS_XAVP_CTX_SKIP_CNT 1

Expand Down Expand Up @@ -94,6 +95,7 @@ extern str ds_xavp_dst_grp;
extern str ds_xavp_dst_dstid;
extern str ds_xavp_dst_attrs;
extern str ds_xavp_dst_sock;
extern str ds_xavp_dst_socket;

extern str ds_xavp_ctx_cnt;

Expand Down
1 change: 1 addition & 0 deletions src/modules/dispatcher/dispatcher.c
Expand Up @@ -85,6 +85,7 @@ str ds_xavp_dst_grp = str_init("grp");
str ds_xavp_dst_dstid = str_init("dstid");
str ds_xavp_dst_attrs = str_init("attrs");
str ds_xavp_dst_sock = str_init("sock");
str ds_xavp_dst_socket = str_init("socket");

str ds_xavp_ctx_cnt = str_init("cnt");

Expand Down

0 comments on commit 16e41ff

Please sign in to comment.