Module: kamailio
Branch: master
Commit: ceffd956e3b7a8070ffb6cf6c1a05b0f86f34ac8
URL:
https://github.com/kamailio/kamailio/commit/ceffd956e3b7a8070ffb6cf6c1a05b0…
Author: Lucian Balaceanu <lucian.balaceanu(a)1and1.ro>
Committer: Lucian Balaceanu <lucian.balaceanu(a)1and1.ro>
Date: 2015-06-16T16:28:53+03:00
rtpengine: interpret session limit message
- upon receiving a "Parallel session limit reached"message from rtpengine
Kamailio's rtpengine module should try the next media relay available (or
none if none is available) without marking the media relay as unavailable;
---
Modified: modules/rtpengine/rtpengine.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ceffd956e3b7a8070ffb6cf6c1a05b0…
Patch:
https://github.com/kamailio/kamailio/commit/ceffd956e3b7a8070ffb6cf6c1a05b0…
---
diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c
index 6f03d30..0c4e807 100644
--- a/modules/rtpengine/rtpengine.c
+++ b/modules/rtpengine/rtpengine.c
@@ -255,6 +255,8 @@ static int_str setid_avp;
static str write_sdp_pvar_str = {NULL, 0};
static pv_spec_t* write_sdp_pvar = NULL;
+#define RTPENGINE_SESS_LIMIT_MSG "Parallel session limit reached"
+#define RTPENGINE_SESS_LIMIT_MSG_LEN (sizeof(RTPENGINE_SESS_LIMIT_MSG)-1)
char* force_send_ip_str="";
int force_send_ip_af = AF_UNSPEC;
@@ -1882,6 +1884,7 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf,
struct sip_
active_rtpp_set = default_rtpp_set;
queried_nodes = 0;
+select_node:
do {
if (++queried_nodes > queried_nodes_limit) {
LM_ERR("queried nodes limit reached\n");
@@ -1909,11 +1912,19 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t
*bencbuf, struct sip_
goto error;
}
if (!bencode_dictionary_get_strcmp(resp, "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
+ 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 {
+ if ((RTPENGINE_SESS_LIMIT_MSG_LEN == error.len) &&
+ (strncmp(error.s, RTPENGINE_SESS_LIMIT_MSG, RTPENGINE_SESS_LIMIT_MSG_LEN) == 0))
+ {
+ LM_WARN("proxy %.*s: %.*s", node->rn_url.len, node->rn_url.s ,
error.len, error.s);
+ goto select_node;
+ }
LM_ERR("proxy replied with error: %.*s\n", error.len, error.s);
- goto error;
+ }
+ goto error;
}
if (body_out)