diff --git a/index.js b/index.js index f6c01a1..78e09ce 100644 --- a/index.js +++ b/index.js @@ -8,6 +8,7 @@ const main = async () => { ); try { + var forwards = {}; const commands = [ 'asterisk -x "database show CF"', 'asterisk -x "database show CFB"', @@ -19,7 +20,6 @@ const main = async () => { console.error(`Error executing command "${command}": ${error}`); continue; } - console.log(`Output for command "${command}":\n${stdout}`); const lines = stdout.split('\n'); for (const line of lines) { @@ -28,10 +28,12 @@ const main = async () => { const type = match[1]; const extension = match[2]; const target = match[3]; - console.log(`Parsed - Type: ${type}, Extension: ${extension}, Target: ${target}`); + + forwards[`${type}/${extension}`] = target; } } } + console.log("Call forwards:", forwards); } catch (err) { console.error(`Unexpected error: ${err}`); }