mirror of https://github.com/sipwise/kamailio.git
Change-Id: I0e212ecd99810162c058ed1dfc8055ce7ae3d792changes/30/20830/5
parent
47c08b9682
commit
b7397fde12
@ -0,0 +1,48 @@
|
||||
--- a/src/modules/rtpengine/rtpengine.c
|
||||
+++ b/src/modules/rtpengine/rtpengine.c
|
||||
@@ -2109,6 +2109,7 @@
|
||||
pv_value_t pv_val;
|
||||
char md5[MD5_LEN];
|
||||
char branch_buf[MAX_BRANCH_PARAM_LEN];
|
||||
+ bencode_item_t *result;
|
||||
|
||||
/*** get & init basic stuff needed ***/
|
||||
|
||||
@@ -2132,6 +2133,9 @@
|
||||
}
|
||||
ng_flags.dict = bencode_dictionary(bencbuf);
|
||||
|
||||
+ item = bencode_dictionary_add_list(ng_flags.dict, "supports");
|
||||
+ bencode_list_add_string(item, "load limit");
|
||||
+
|
||||
body.s = NULL;
|
||||
if (op == OP_OFFER || op == OP_ANSWER) {
|
||||
ng_flags.flags = bencode_list(bencbuf);
|
||||
@@ -2282,7 +2286,26 @@
|
||||
goto error;
|
||||
}
|
||||
|
||||
- if (!bencode_dictionary_get_strcmp(resp, "result", "error")) {
|
||||
+ result = bencode_dictionary_get_expect(resp, "result", BENCODE_STRING);
|
||||
+ if (!result) {
|
||||
+ LM_ERR("No 'result' dictionary entry in response from proxy %.*s",
|
||||
+ node->rn_url.len, node->rn_url.s);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ if (!bencode_strcmp(result, "load limit")) {
|
||||
+ item = bencode_dictionary_get_expect(resp, "message", BENCODE_STRING);
|
||||
+ if (!item)
|
||||
+ LM_INFO("proxy %.*s has reached its load limit - trying next one",
|
||||
+ node->rn_url.len, node->rn_url.s);
|
||||
+ else
|
||||
+ LM_INFO("proxy %.*s has reached its load limit (%.*s) - trying next one",
|
||||
+ node->rn_url.len, node->rn_url.s,
|
||||
+ item->iov[1].iov_len, item->iov[1].iov_base);
|
||||
+ goto select_node;
|
||||
+ }
|
||||
+
|
||||
+ if (!bencode_strcmp(result, "error")) {
|
||||
if (!bencode_dictionary_get_str(resp, "error-reason", &error)) {
|
||||
LM_ERR("proxy return error but didn't give an error reason: %.*s\n", ret, cp);
|
||||
} else {
|
||||
Loading…
Reference in new issue