Browse code

rtpengine : add node fallback if node out of port

When rtpengine answers with error-reason 'Ran out of ports' adopt the same behavor that when node answers 'Parallel session limit reached'

dvillaume authored on 03/02/2021 09:19:46 • GitHub committed on 03/02/2021 09:19:46
Showing 1 changed files
... ...
@@ -294,6 +294,9 @@ static pv_spec_t *media_duration_pvar = NULL;
294 294
 #define RTPENGINE_SESS_LIMIT_MSG "Parallel session limit reached"
295 295
 #define RTPENGINE_SESS_LIMIT_MSG_LEN (sizeof(RTPENGINE_SESS_LIMIT_MSG)-1)
296 296
 
297
+#define RTPENGINE_SESS_OUT_OF_PORTS_MSG "Ran out of ports"
298
+#define RTPENGINE_SESS_OUT_OF_PORTS_MSG_LEN (sizeof(RTPENGINE_SESS_OUT_OF_PORTS_MSG)-1)
299
+
297 300
 char* force_send_ip_str="";
298 301
 int force_send_ip_af = AF_UNSPEC;
299 302
 
... ...
@@ -2632,6 +2635,13 @@ select_node:
2632 2635
 				LM_WARN("proxy %.*s: %.*s", node->rn_url.len, node->rn_url.s , error.len, error.s);
2633 2636
 				goto select_node;
2634 2637
 			}
2638
+			if ((RTPENGINE_SESS_OUT_OF_PORTS_MSG_LEN == error.len) &&
2639
+				(strncmp(error.s, RTPENGINE_SESS_OUT_OF_PORTS_MSG, RTPENGINE_SESS_OUT_OF_PORTS_MSG_LEN) == 0))
2640
+			{
2641
+				LM_WARN("proxy %.*s: %.*s", node->rn_url.len, node->rn_url.s , error.len, error.s);
2642
+				goto select_node;
2643
+			}
2644
+
2635 2645
 			LM_ERR("proxy replied with error: %.*s\n", error.len, error.s);
2636 2646
 		}
2637 2647
 		goto error;