diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c index b62d4c86de8..6ded0120853 100644 --- a/src/modules/dispatcher/dispatch.c +++ b/src/modules/dispatcher/dispatch.c @@ -324,6 +324,9 @@ int ds_set_attrs(ds_dest_t *dest, str *vattrs) } else if(pit->name.len == 9 && strncasecmp(pit->name.s, "ping_from", 9) == 0) { dest->attrs.ping_from = pit->body; + } else if(pit->name.len == 7 + && strncasecmp(pit->name.s, "obproxy", 7) == 0) { + dest->attrs.obproxy = pit->body; } } if(params_list) @@ -3295,6 +3298,7 @@ void ds_ping_set(ds_set_t *node) uac_req_t uac_r; int i, j; str ping_from; + str obproxy; if(!node) return; @@ -3342,10 +3346,20 @@ void ds_ping_set(ds_set_t *node) LM_DBG("Default ping_from: %.*s\n", ping_from.len, ping_from.s); } + if(node->dlist[j].attrs.obproxy.s != NULL + && node->dlist[j].attrs.obproxy.len > 0) { + obproxy = node->dlist[j].attrs.obproxy; + LM_DBG("outbound proxy: %.*s\n", obproxy.len, obproxy.s); + } + else { + obproxy = ds_outbound_proxy; + LM_DBG("Default outbound proxy: %.*s\n", ds_outbound_proxy.len, ds_outbound_proxy.s); + } + gettimeofday(&node->dlist[j].latency_stats.start, NULL); if(tmb.t_request(&uac_r, &node->dlist[j].uri, &node->dlist[j].uri, - &ping_from, &ds_outbound_proxy) + &ping_from, &obproxy) < 0) { LM_ERR("unable to ping [%.*s]\n", node->dlist[j].uri.len, node->dlist[j].uri.s); diff --git a/src/modules/dispatcher/dispatch.h b/src/modules/dispatcher/dispatch.h index e067d304786..6c167a9551c 100644 --- a/src/modules/dispatcher/dispatch.h +++ b/src/modules/dispatcher/dispatch.h @@ -188,6 +188,7 @@ typedef struct _ds_attrs { int rweight; int congestion_control; str ping_from; + str obproxy; } ds_attrs_t; typedef struct _ds_latency_stats { diff --git a/src/modules/dispatcher/dispatcher.c b/src/modules/dispatcher/dispatcher.c index 06e96da61a3..6ac01bbd2ac 100644 --- a/src/modules/dispatcher/dispatcher.c +++ b/src/modules/dispatcher/dispatcher.c @@ -1573,7 +1573,7 @@ int ds_rpc_print_set(ds_set_t *node, rpc_t *rpc, void *ctx, void *rpc_handle) rpc->fault(ctx, 500, "Internal error creating dest struct"); return -1; } - if(rpc->struct_add(wh, "SSdddSS", + if(rpc->struct_add(wh, "SSdddSSS", "BODY", &(node->dlist[j].attrs.body), "DUID", (node->dlist[j].attrs.duid.s) ? &(node->dlist[j].attrs.duid) : &data, @@ -1583,7 +1583,9 @@ int ds_rpc_print_set(ds_set_t *node, rpc_t *rpc, void *ctx, void *rpc_handle) "SOCKET", (node->dlist[j].attrs.socket.s) ? &(node->dlist[j].attrs.socket) : &data, "SOCKNAME", (node->dlist[j].attrs.sockname.s) - ? &(node->dlist[j].attrs.sockname) : &data) + ? &(node->dlist[j].attrs.sockname) : &data, + "OBPROXY", (node->dlist[j].attrs.obproxy.s) + ? &(node->dlist[j].attrs.obproxy) : &data) < 0) { rpc->fault(ctx, 500, "Internal error creating attrs struct"); return -1; diff --git a/src/modules/dispatcher/doc/dispatcher.xml b/src/modules/dispatcher/doc/dispatcher.xml index 8502aec0a3a..b64151dd44e 100644 --- a/src/modules/dispatcher/doc/dispatcher.xml +++ b/src/modules/dispatcher/doc/dispatcher.xml @@ -59,6 +59,11 @@ Chavanton jchavanton@gmail.com + + Federico + Cabiddu + federico.cabiddu@gmail.com + 2004 @@ -84,6 +89,10 @@ 2017, 2018 Julien chavanton, Flowroute + + 2020 + Federico Cabiddu, Libon + diff --git a/src/modules/dispatcher/doc/dispatcher_admin.xml b/src/modules/dispatcher/doc/dispatcher_admin.xml index ae8102b3555..30cd6a5ec1a 100644 --- a/src/modules/dispatcher/doc/dispatcher_admin.xml +++ b/src/modules/dispatcher/doc/dispatcher_admin.xml @@ -1316,6 +1316,7 @@ DEST: { RWEIGHT: 50 SOCKET: SOCKNAME: + OBPROXY: } LATENCY: { AVG: 20.104000 @@ -2055,6 +2056,10 @@ DEST: { 'ping_from' - used to set the From URI in OPTIONS keepalives. It overwrites the general ds_ping_from parameter. + + 'obproxy' - SIP URI of outbound proxy to be used when sending pings. + It overwrites the general ds_outbound_proxy parameter. +