Browse code

uac: fixing REGISTER to use custom socket after 401/407

- After receiving 401/407 uac does not use configured custom socket,
second register send from first available address.

Dennis Yurasov authored on 25/10/2021 10:34:14
Showing 1 changed files
... ...
@@ -1011,6 +1011,20 @@ void uac_reg_tm_callback( struct cell *t, int type, struct tmcb_params *ps)
1011 1011
 		uac_r.cb  = uac_reg_tm_callback;
1012 1012
 		/* Callback parameter */
1013 1013
 		uac_r.cbp = (void*)uuid;
1014
+
1015
+		if(ri->socket.s != NULL && ri->socket.len > 0) {
1016
+                        /* custom socket */
1017
+                        LM_DBG("using custom socket %.*s to send request\n",
1018
+                                ri->socket.len, ri->socket.s);
1019
+                        uac_r.ssock = &ri->socket;
1020
+                } else {
1021
+                        /* default socket */
1022
+                        if(uac_default_socket.s != NULL && uac_default_socket.len > 0) {
1023
+                                LM_DBG("using configured default_socket to send request\n");
1024
+                                uac_r.ssock = &uac_default_socket;
1025
+                        }
1026
+                }
1027
+
1014 1028
 		ret = uac_tmb.t_request_within(&uac_r);
1015 1029
 
1016 1030
 		if(ret<0) {