I am trying to create a script for Asterisk. We use a lot of channspy. Sometimes the channspy stays opened and didn't hangup even if the softphone is hangup (I don't understand why).So I thought of creating a script to take the number of channels opened started with the SIP/[extension]-channel and this grep export it to a TXT file this file will have 3 columns and extract just the first column with awk ' {print $1} 'but here is where I stuck because each row has 1 channel and if I want to hangup this channel I have to do asterisk -rx 'soft hangup SIP/[exntesion]-channel'Can someone help me with this to get each row as a variable and loop the script till the last row.so the command will be something likeasterisk -rx 'soft hangup $variable'
Script to hang up Asterisk channels
shell script;awk;asterisk
Also you can use system with awk:awk ' command = asterisk -rx '\''soft hangup  $1 '\'' { system(command); }' channels_filejust for testing:awk ' command = asterisk -rx '\''soft hangup  $1 '\'' { print command; }' channels_file