<configuration name="xml_curl.conf" description="cURL XML Gateway">
<bindings>
<binding name="example">
+ <!-- Allow to bind on a particular IP for requests sent -->
+ <!--<param name="bind-local" value="$${local_ip_v4}" />-->
<!-- The url to a gateway cgi that can generate xml similar to
what's in this file only on-the-fly (leave it commented if you dont
need it) -->
char *url;
char *bindings;
char *cred;
+ char *bind_local;
int disable100continue;
int use_get_style;
uint32_t enable_cacert_check;
switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, binding->cookie_file);
}
+ if (binding->bind_local) {
+ curl_easy_setopt(curl_handle, CURLOPT_INTERFACE, binding->bind_local);
+ }
+
switch_curl_easy_perform(curl_handle);
switch_curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
switch_curl_easy_cleanup(curl_handle);
for (binding_tag = switch_xml_child(bindings_tag, "binding"); binding_tag; binding_tag = binding_tag->next) {
char *bname = (char *) switch_xml_attr_soft(binding_tag, "name");
char *url = NULL;
+ char *bind_local = NULL;
char *bind_cred = NULL;
char *bind_mask = NULL;
char *method = NULL;
need_vars_map = 1;
}
- if (vars_map && val)
+ if (vars_map && val) {
if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't add %s to params hash!\n", val);
}
+ }
+ } else if (!strcasecmp(var, "bind-local")) {
+ bind_local = val;
}
}
binding->url = strdup(url);
switch_assert(binding->url);
+ if (bind_local != NULL) {
+ binding->bind_local = strdup(bind_local);
+ }
if (method != NULL) {
binding->method = strdup(method);
} else {