From ea4a5e7f67d144cb86e16d1ef8aaf4dd2843734a Mon Sep 17 00:00:00 2001 From: emak Date: Fri, 22 Jul 2022 18:47:31 -0400 Subject: [PATCH] Check to make sure accountcode has some value (#6440) The accountcode variable is used in a dialstring later on and if it comes back nil for any reason, then the following error is thrown: 2022-07-22 16:19:11.524674 [ERR] mod_lua.cpp:202 /usr/share/freeswitch/scripts/app/follow_me/index.lua:396: attempt to concatenate global 'accountcode' (a nil value) stack traceback: /usr/share/freeswitch/scripts/app/follow_me/index.lua:396: in main chunk /usr/share/freeswitch/scripts/app.lua:48: in main chunk This completely breaks follow-me. This code sets the accountcode variable to the domain name if it comes back nil during script execution, thus protecting the script from failing with an empty accountcode value in the db or query. --- app/scripts/resources/scripts/app/follow_me/index.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/scripts/resources/scripts/app/follow_me/index.lua b/app/scripts/resources/scripts/app/follow_me/index.lua index 6a76b7dda4..918fc26a9b 100644 --- a/app/scripts/resources/scripts/app/follow_me/index.lua +++ b/app/scripts/resources/scripts/app/follow_me/index.lua @@ -285,7 +285,11 @@ --set the values external = "true"; row['user_exists'] = "false"; - row['accountcode'] = accountcode; + if (accountcode ~= nil) then + row['accountcode'] = accountcode; + else + row['accountcode'] = domain_name; + end --add the row to the destinations array destinations[x] = row; end