#! /bin/bash
hostname="10.0.4.249"
DB_USER="admin"
DB_PASSWD="Pulse@123"
DB_NAME="master"

{
mysql --host=$hostname --user=$DB_USER --password=$DB_PASSWD $DB_NAME << EOF
select folder_encrypt from company;
EOF
}|while read folder_encrypt
do

cd /etc/asterisk/dialplan/"$folder_encrypt"/

echo folder ="$folder_encrypt"

for file in *; do
  if [ -f "$file" ]; then
    sed '/exten => h,n,Set(CURLOPT(ssl_verifypeer)=0)/a exten => h,n,Set(CURLOPT(httptimeout)=2.0)' "$file" > TempFile && mv TempFile "$file"
exten => h,n,Set(CURLOPT(httptimeout)=2.0)
exten => h,n,Set(CURLOPT(httptimeout)=2.0)
exten => h,n,Set(CURLOPT(httptimeout)=2.0)
exten => h,n,Set(CURLOPT(httptimeout)=2.0)
    echo "$file"
  fi
done


done

