[Решено] Нагенерить файлы (Для автопровижена телефонов)

На самом деле это единственный раздел про unix на этом форуме

Модератор: /dev/random

JTMarsh
Сообщения: 143
ОС: Debian

[Решено] Нагенерить файлы

Сообщение JTMarsh »

Добрый день!

Необходимо нагенерить 200 файликов для автопровижена телефонов.

Есть файлик содержимое которого
mac-адрес; переменная внутренний номер
есть файлик шаблона провижена

Сама задача: взять файлик шаблона, назвать его mac-адрес.cfg и внести в определенные места переменную внутреннего номера и так 200 раз...

В шаблон можно внести в нужные места нужный текст, что бы его заменить.

Подскажите, пожалуйста, как это красиво реализовать...
Последний раз редактировалось JTMarsh 19.04.2021 17:29, всего редактировалось 1 раз.
Спасибо сказали:
Аватара пользователя
bars
Сообщения: 630
ОС: BSD/LINUX

Re: Нагенерить файлы

Сообщение bars »

Вы покажите хоть свои наработки, а мы дальше поправим если что.
Настройка BSD систем
Знание сила, незнание Рабочая сила!
Спасибо сказали:
Аватара пользователя
Bizdelnick
Модератор
Сообщения: 19369
Статус: nulla salus bello
ОС: Debian GNU/Linux

Re: Нагенерить файлы

Сообщение Bizdelnick »

Примерно так:

Код: Выделить всё

#!/bin/sh

IFS=' 	;'

while read MAC TEL; do
	cat > "${MAC}.cfg" <<-EOF
		# это типа шаблон
		# отступы табами, они в файл не попадут
		# допустим, в следующей строчке должно быть "phone=123"
		phone=${TEL}
	EOF
done
Пишите правильно:
в консоли
вку́пе (с чем-либо)
в общем
вообще
в течение (часа)
новичок
нюанс
по умолчанию
приемлемо
проблема
пробовать
трафик
Спасибо сказали:
JTMarsh
Сообщения: 143
ОС: Debian

Re: Нагенерить файлы

Сообщение JTMarsh »

Та наработок еще и нет-то. :ph34r:
Под спойлером текст файла шаблона
переменная %внутренний_номер%
Spoiler
#!version:1.0.0.1
#Phone model: yealink_generic

#Set the password of the user or the administrator, the value format is: user:password or admin:password;
security.user_password = admin:admin





#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.1.enable = 1

#Configure the label displayed on the LCD screen for account 1.
account.1.label = %внутренний_номер%

#Configure the display name of account 1.
account.1.display_name = %внутренний_номер%

#Configure the username and password for register authentication.
account.1.auth_name = %внутренний_номер%
account.1.password = %внутренний_номер%

#Configure the register user name.
account.1.user_name = %внутренний_номер%

#Configure the SIP server address.
account.1.sip_server_host = 10.100.41.254

#Configure the voice mail number of account 1.
voice_mail.number.1 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.1.call_option.call_mode = 0

#Local sip port
account.1.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.1.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.1.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.1.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.1.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.1.codec.1.enable = 1
account.1.codec.1.payload_type = PCMA
account.1.codec.1.priority = 2
account.1.codec.1.rtpmap = 8

account.1.codec.2.enable = 1
account.1.codec.2.payload_type = PCMU
account.1.codec.2.priority = 1
account.1.codec.2.rtpmap = 0

account.1.codec.3.enable = 1
account.1.codec.3.payload_type = G729
account.1.codec.3.priority =3
account.1.codec.3.rtpmap = 18

account.1.codec.4.enable = 1
account.1.codec.4.payload_type = G722
account.1.codec.4.priority = 4
account.1.codec.4.rtpmap = 9

account.1.codec.5.enable = 0
account.1.codec.5.payload_type = G723
account.1.codec.5.priority = 5
account.1.codec.5.rtpmap = 4

account.1.codec.6.enable = 0
account.1.codec.6.payload_type = AACLC
account.1.codec.6.priority = 6
account.1.codec.6.rtpmap = 102

account.1.codec.7.enable = 0
account.1.codec.7.payload_type = iLBC
account.1.codec.7.priority = 7
account.1.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.2.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.2.label =

#Configure the display name of account 1.
account.2.display_name =

#Configure the username and password for register authentication.
account.2.auth_name =
account.2.password =

#Configure the register user name.
account.2.user_name =

#Configure the SIP server address.
account.2.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.2 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.2.call_option.call_mode = 0

#Local sip port
account.2.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.2.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.2.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.2.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.2.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.2.codec.1.enable = 1
account.2.codec.1.payload_type = PCMA
account.2.codec.1.priority = 2
account.2.codec.1.rtpmap = 8

account.2.codec.2.enable = 1
account.2.codec.2.payload_type = PCMU
account.2.codec.2.priority = 1
account.2.codec.2.rtpmap = 0

account.2.codec.3.enable = 1
account.2.codec.3.payload_type = G729
account.2.codec.3.priority =3
account.2.codec.3.rtpmap = 18

account.2.codec.4.enable = 1
account.2.codec.4.payload_type = G722
account.2.codec.4.priority = 4
account.2.codec.4.rtpmap = 9

account.2.codec.5.enable = 0
account.2.codec.5.payload_type = G723
account.2.codec.5.priority = 5
account.2.codec.5.rtpmap = 4

account.2.codec.6.enable = 0
account.2.codec.6.payload_type = AACLC
account.2.codec.6.priority = 6
account.2.codec.6.rtpmap = 102

account.2.codec.7.enable = 0
account.2.codec.7.payload_type = iLBC
account.2.codec.7.priority = 7
account.2.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.3.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.3.label =

#Configure the display name of account 1.
account.3.display_name =

#Configure the username and password for register authentication.
account.3.auth_name =
account.3.password =

#Configure the register user name.
account.3.user_name =

#Configure the SIP server address.
account.3.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.3 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.3.call_option.call_mode = 0

#Local sip port
account.3.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.3.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.3.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.3.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.3.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.3.codec.1.enable = 1
account.3.codec.1.payload_type = PCMA
account.3.codec.1.priority = 2
account.3.codec.1.rtpmap = 8

account.3.codec.2.enable = 1
account.3.codec.2.payload_type = PCMU
account.3.codec.2.priority = 1
account.3.codec.2.rtpmap = 0

account.3.codec.3.enable = 1
account.3.codec.3.payload_type = G729
account.3.codec.3.priority =3
account.3.codec.3.rtpmap = 18

account.3.codec.4.enable = 1
account.3.codec.4.payload_type = G722
account.3.codec.4.priority = 4
account.3.codec.4.rtpmap = 9

account.3.codec.5.enable = 0
account.3.codec.5.payload_type = G723
account.3.codec.5.priority = 5
account.3.codec.5.rtpmap = 4

account.3.codec.6.enable = 0
account.3.codec.6.payload_type = AACLC
account.3.codec.6.priority = 6
account.3.codec.6.rtpmap = 102

account.3.codec.7.enable = 0
account.3.codec.7.payload_type = iLBC
account.3.codec.7.priority = 7
account.3.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.4.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.4.label =

#Configure the display name of account 1.
account.4.display_name =

#Configure the username and password for register authentication.
account.4.auth_name =
account.4.password =

#Configure the register user name.
account.4.user_name =

#Configure the SIP server address.
account.4.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.4 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.4.call_option.call_mode = 0

#Local sip port
account.4.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.4.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.4.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.4.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.4.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.4.codec.1.enable = 1
account.4.codec.1.payload_type = PCMA
account.4.codec.1.priority = 2
account.4.codec.1.rtpmap = 8

account.4.codec.2.enable = 1
account.4.codec.2.payload_type = PCMU
account.4.codec.2.priority = 1
account.4.codec.2.rtpmap = 0

account.4.codec.3.enable = 1
account.4.codec.3.payload_type = G729
account.4.codec.3.priority =3
account.4.codec.3.rtpmap = 18

account.4.codec.4.enable = 1
account.4.codec.4.payload_type = G722
account.4.codec.4.priority = 4
account.4.codec.4.rtpmap = 9

account.4.codec.5.enable = 0
account.4.codec.5.payload_type = G723
account.4.codec.5.priority = 5
account.4.codec.5.rtpmap = 4

account.4.codec.6.enable = 0
account.4.codec.6.payload_type = AACLC
account.4.codec.6.priority = 6
account.4.codec.6.rtpmap = 102

account.4.codec.7.enable = 0
account.4.codec.7.payload_type = iLBC
account.4.codec.7.priority = 7
account.4.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.5.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.5.label =

#Configure the display name of account 1.
account.5.display_name =

#Configure the username and password for register authentication.
account.5.auth_name =
account.5.password =

#Configure the register user name.
account.5.user_name =

#Configure the SIP server address.
account.5.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.5 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.5.call_option.call_mode = 0

#Local sip port
account.5.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.5.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.5.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.5.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.5.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.5.codec.1.enable = 1
account.5.codec.1.payload_type = PCMA
account.5.codec.1.priority = 2
account.5.codec.1.rtpmap = 8

account.5.codec.2.enable = 1
account.5.codec.2.payload_type = PCMU
account.5.codec.2.priority = 1
account.5.codec.2.rtpmap = 0

account.5.codec.3.enable = 1
account.5.codec.3.payload_type = G729
account.5.codec.3.priority =3
account.5.codec.3.rtpmap = 18

account.5.codec.4.enable = 1
account.5.codec.4.payload_type = G722
account.5.codec.4.priority = 4
account.5.codec.4.rtpmap = 9

account.5.codec.5.enable = 0
account.5.codec.5.payload_type = G723
account.5.codec.5.priority = 5
account.5.codec.5.rtpmap = 4

account.5.codec.6.enable = 0
account.5.codec.6.payload_type = AACLC
account.5.codec.6.priority = 6
account.5.codec.6.rtpmap = 102

account.5.codec.7.enable = 0
account.5.codec.7.payload_type = iLBC
account.5.codec.7.priority = 7
account.5.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.6.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.6.label =

#Configure the display name of account 1.
account.6.display_name =

#Configure the username and password for register authentication.
account.6.auth_name =
account.6.password =

#Configure the register user name.
account.6.user_name =

#Configure the SIP server address.
account.6.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.6 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.6.call_option.call_mode = 0

#Local sip port
account.6.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.6.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.6.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.6.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.6.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.6.codec.1.enable = 1
account.6.codec.1.payload_type = PCMA
account.6.codec.1.priority = 2
account.6.codec.1.rtpmap = 8

account.6.codec.2.enable = 1
account.6.codec.2.payload_type = PCMU
account.6.codec.2.priority = 1
account.6.codec.2.rtpmap = 0

account.6.codec.3.enable = 1
account.6.codec.3.payload_type = G729
account.6.codec.3.priority =3
account.6.codec.3.rtpmap = 18

account.6.codec.4.enable = 1
account.6.codec.4.payload_type = G722
account.6.codec.4.priority = 4
account.6.codec.4.rtpmap = 9

account.6.codec.5.enable = 0
account.6.codec.5.payload_type = G723
account.6.codec.5.priority = 5
account.6.codec.5.rtpmap = 4

account.6.codec.6.enable = 0
account.6.codec.6.payload_type = AACLC
account.6.codec.6.priority = 6
account.6.codec.6.rtpmap = 102

account.6.codec.7.enable = 0
account.6.codec.7.payload_type = iLBC
account.6.codec.7.priority = 7
account.6.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.7.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.7.label =

#Configure the display name of account 1.
account.7.display_name =

#Configure the username and password for register authentication.
account.7.auth_name =
account.7.password =

#Configure the register user name.
account.7.user_name =

#Configure the SIP server address.
account.7.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.7 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.7.call_option.call_mode = 0

#Local sip port
account.7.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.7.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.7.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.7.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.7.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.7.codec.1.enable = 1
account.7.codec.1.payload_type = PCMA
account.7.codec.1.priority = 2
account.7.codec.1.rtpmap = 8

account.7.codec.2.enable = 1
account.7.codec.2.payload_type = PCMU
account.7.codec.2.priority = 1
account.7.codec.2.rtpmap = 0

account.7.codec.3.enable = 1
account.7.codec.3.payload_type = G729
account.7.codec.3.priority =3
account.7.codec.3.rtpmap = 18

account.7.codec.4.enable = 1
account.7.codec.4.payload_type = G722
account.7.codec.4.priority = 4
account.7.codec.4.rtpmap = 9

account.7.codec.5.enable = 0
account.7.codec.5.payload_type = G723
account.7.codec.5.priority = 5
account.7.codec.5.rtpmap = 4

account.7.codec.6.enable = 0
account.7.codec.6.payload_type = AACLC
account.7.codec.6.priority = 6
account.7.codec.6.rtpmap = 102

account.7.codec.7.enable = 0
account.7.codec.7.payload_type = iLBC
account.7.codec.7.priority = 7
account.7.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.8.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.8.label =

#Configure the display name of account 1.
account.8.display_name =

#Configure the username and password for register authentication.
account.8.auth_name =
account.8.password =

#Configure the register user name.
account.8.user_name =

#Configure the SIP server address.
account.8.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.8 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.8.call_option.call_mode = 0

#Local sip port
account.8.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.8.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.8.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.8.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.8.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.8.codec.1.enable = 1
account.8.codec.1.payload_type = PCMA
account.8.codec.1.priority = 2
account.8.codec.1.rtpmap = 8

account.8.codec.2.enable = 1
account.8.codec.2.payload_type = PCMU
account.8.codec.2.priority = 1
account.8.codec.2.rtpmap = 0

account.8.codec.3.enable = 1
account.8.codec.3.payload_type = G729
account.8.codec.3.priority =3
account.8.codec.3.rtpmap = 18

account.8.codec.4.enable = 1
account.8.codec.4.payload_type = G722
account.8.codec.4.priority = 4
account.8.codec.4.rtpmap = 9

account.8.codec.5.enable = 0
account.8.codec.5.payload_type = G723
account.8.codec.5.priority = 5
account.8.codec.5.rtpmap = 4

account.8.codec.6.enable = 0
account.8.codec.6.payload_type = AACLC
account.8.codec.6.priority = 6
account.8.codec.6.rtpmap = 102

account.8.codec.7.enable = 0
account.8.codec.7.payload_type = iLBC
account.8.codec.7.priority = 7
account.8.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.9.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.9.label =

#Configure the display name of account 1.
account.9.display_name =

#Configure the username and password for register authentication.
account.9.auth_name =
account.9.password =

#Configure the register user name.
account.9.user_name =

#Configure the SIP server address.
account.9.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.9 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.9.call_option.call_mode = 0

#Local sip port
account.9.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.9.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.9.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.9.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.9.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.9.codec.1.enable = 1
account.9.codec.1.payload_type = PCMA
account.9.codec.1.priority = 2
account.9.codec.1.rtpmap = 8

account.9.codec.2.enable = 1
account.9.codec.2.payload_type = PCMU
account.9.codec.2.priority = 1
account.9.codec.2.rtpmap = 0

account.9.codec.3.enable = 1
account.9.codec.3.payload_type = G729
account.9.codec.3.priority =3
account.9.codec.3.rtpmap = 18

account.9.codec.4.enable = 1
account.9.codec.4.payload_type = G722
account.9.codec.4.priority = 4
account.9.codec.4.rtpmap = 9

account.9.codec.5.enable = 0
account.9.codec.5.payload_type = G723
account.9.codec.5.priority = 5
account.9.codec.5.rtpmap = 4

account.9.codec.6.enable = 0
account.9.codec.6.payload_type = AACLC
account.9.codec.6.priority = 6
account.9.codec.6.rtpmap = 102

account.9.codec.7.enable = 0
account.9.codec.7.payload_type = iLBC
account.9.codec.7.priority = 7
account.9.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.10.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.10.label =

#Configure the display name of account 1.
account.10.display_name =

#Configure the username and password for register authentication.
account.10.auth_name =
account.10.password =

#Configure the register user name.
account.10.user_name =

#Configure the SIP server address.
account.10.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.10 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.10.call_option.call_mode = 0

#Local sip port
account.10.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.10.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.10.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.10.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.10.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.10.codec.1.enable = 1
account.10.codec.1.payload_type = PCMA
account.10.codec.1.priority = 2
account.10.codec.1.rtpmap = 8

account.10.codec.2.enable = 1
account.10.codec.2.payload_type = PCMU
account.10.codec.2.priority = 1
account.10.codec.2.rtpmap = 0

account.10.codec.3.enable = 1
account.10.codec.3.payload_type = G729
account.10.codec.3.priority =3
account.10.codec.3.rtpmap = 18

account.10.codec.4.enable = 1
account.10.codec.4.payload_type = G722
account.10.codec.4.priority = 4
account.10.codec.4.rtpmap = 9

account.10.codec.5.enable = 0
account.10.codec.5.payload_type = G723
account.10.codec.5.priority = 5
account.10.codec.5.rtpmap = 4

account.10.codec.6.enable = 0
account.10.codec.6.payload_type = AACLC
account.10.codec.6.priority = 6
account.10.codec.6.rtpmap = 102

account.10.codec.7.enable = 0
account.10.codec.7.payload_type = iLBC
account.10.codec.7.priority = 7
account.10.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.11.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.11.label =

#Configure the display name of account 1.
account.11.display_name =

#Configure the username and password for register authentication.
account.11.auth_name =
account.11.password =

#Configure the register user name.
account.11.user_name =

#Configure the SIP server address.
account.11.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.11 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.11.call_option.call_mode = 0

#Local sip port
account.11.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.11.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.11.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.11.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.11.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.11.codec.1.enable = 1
account.11.codec.1.payload_type = PCMA
account.11.codec.1.priority = 2
account.11.codec.1.rtpmap = 8

account.11.codec.2.enable = 1
account.11.codec.2.payload_type = PCMU
account.11.codec.2.priority = 1
account.11.codec.2.rtpmap = 0

account.11.codec.3.enable = 1
account.11.codec.3.payload_type = G729
account.11.codec.3.priority =3
account.11.codec.3.rtpmap = 18

account.11.codec.4.enable = 1
account.11.codec.4.payload_type = G722
account.11.codec.4.priority = 4
account.11.codec.4.rtpmap = 9

account.11.codec.5.enable = 0
account.11.codec.5.payload_type = G723
account.11.codec.5.priority = 5
account.11.codec.5.rtpmap = 4

account.11.codec.6.enable = 0
account.11.codec.6.payload_type = AACLC
account.11.codec.6.priority = 6
account.11.codec.6.rtpmap = 102

account.11.codec.7.enable = 0
account.11.codec.7.payload_type = iLBC
account.11.codec.7.priority = 7
account.11.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.12.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.12.label =

#Configure the display name of account 1.
account.12.display_name =

#Configure the username and password for register authentication.
account.12.auth_name =
account.12.password =

#Configure the register user name.
account.12.user_name =

#Configure the SIP server address.
account.12.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.12 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.12.call_option.call_mode = 0

#Local sip port
account.12.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.12.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.12.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.12.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.12.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.12.codec.1.enable = 1
account.12.codec.1.payload_type = PCMA
account.12.codec.1.priority = 2
account.12.codec.1.rtpmap = 8

account.12.codec.2.enable = 1
account.12.codec.2.payload_type = PCMU
account.12.codec.2.priority = 1
account.12.codec.2.rtpmap = 0

account.12.codec.3.enable = 1
account.12.codec.3.payload_type = G729
account.12.codec.3.priority =3
account.12.codec.3.rtpmap = 18

account.12.codec.4.enable = 1
account.12.codec.4.payload_type = G722
account.12.codec.4.priority = 4
account.12.codec.4.rtpmap = 9

account.12.codec.5.enable = 0
account.12.codec.5.payload_type = G723
account.12.codec.5.priority = 5
account.12.codec.5.rtpmap = 4

account.12.codec.6.enable = 0
account.12.codec.6.payload_type = AACLC
account.12.codec.6.priority = 6
account.12.codec.6.rtpmap = 102

account.12.codec.7.enable = 0
account.12.codec.7.payload_type = iLBC
account.12.codec.7.priority = 7
account.12.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.13.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.13.label =

#Configure the display name of account 1.
account.13.display_name =

#Configure the username and password for register authentication.
account.13.auth_name =
account.13.password =

#Configure the register user name.
account.13.user_name =

#Configure the SIP server address.
account.13.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.13 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.13.call_option.call_mode = 0

#Local sip port
account.13.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.13.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.13.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.13.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.13.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.13.codec.1.enable = 1
account.13.codec.1.payload_type = PCMA
account.13.codec.1.priority = 2
account.13.codec.1.rtpmap = 8

account.13.codec.2.enable = 1
account.13.codec.2.payload_type = PCMU
account.13.codec.2.priority = 1
account.13.codec.2.rtpmap = 0

account.13.codec.3.enable = 1
account.13.codec.3.payload_type = G729
account.13.codec.3.priority =3
account.13.codec.3.rtpmap = 18

account.13.codec.4.enable = 1
account.13.codec.4.payload_type = G722
account.13.codec.4.priority = 4
account.13.codec.4.rtpmap = 9

account.13.codec.5.enable = 0
account.13.codec.5.payload_type = G723
account.13.codec.5.priority = 5
account.13.codec.5.rtpmap = 4

account.13.codec.6.enable = 0
account.13.codec.6.payload_type = AACLC
account.13.codec.6.priority = 6
account.13.codec.6.rtpmap = 102

account.13.codec.7.enable = 0
account.13.codec.7.payload_type = iLBC
account.13.codec.7.priority = 7
account.13.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.14.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.14.label =

#Configure the display name of account 1.
account.14.display_name =

#Configure the username and password for register authentication.
account.14.auth_name =
account.14.password =

#Configure the register user name.
account.14.user_name =

#Configure the SIP server address.
account.14.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.14 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.14.call_option.call_mode = 0

#Local sip port
account.14.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.14.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.14.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.14.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.14.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.14.codec.1.enable = 1
account.14.codec.1.payload_type = PCMA
account.14.codec.1.priority = 2
account.14.codec.1.rtpmap = 8

account.14.codec.2.enable = 1
account.14.codec.2.payload_type = PCMU
account.14.codec.2.priority = 1
account.14.codec.2.rtpmap = 0

account.14.codec.3.enable = 1
account.14.codec.3.payload_type = G729
account.14.codec.3.priority =3
account.14.codec.3.rtpmap = 18

account.14.codec.4.enable = 1
account.14.codec.4.payload_type = G722
account.14.codec.4.priority = 4
account.14.codec.4.rtpmap = 9

account.14.codec.5.enable = 0
account.14.codec.5.payload_type = G723
account.14.codec.5.priority = 5
account.14.codec.5.rtpmap = 4

account.14.codec.6.enable = 0
account.14.codec.6.payload_type = AACLC
account.14.codec.6.priority = 6
account.14.codec.6.rtpmap = 102

account.14.codec.7.enable = 0
account.14.codec.7.payload_type = iLBC
account.14.codec.7.priority = 7
account.14.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.15.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.15.label =

#Configure the display name of account 1.
account.15.display_name =

#Configure the username and password for register authentication.
account.15.auth_name =
account.15.password =

#Configure the register user name.
account.15.user_name =

#Configure the SIP server address.
account.15.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.15 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.15.call_option.call_mode = 0

#Local sip port
account.15.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.15.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.15.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.15.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.15.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.15.codec.1.enable = 1
account.15.codec.1.payload_type = PCMA
account.15.codec.1.priority = 2
account.15.codec.1.rtpmap = 8

account.15.codec.2.enable = 1
account.15.codec.2.payload_type = PCMU
account.15.codec.2.priority = 1
account.15.codec.2.rtpmap = 0

account.15.codec.3.enable = 1
account.15.codec.3.payload_type = G729
account.15.codec.3.priority =3
account.15.codec.3.rtpmap = 18

account.15.codec.4.enable = 1
account.15.codec.4.payload_type = G722
account.15.codec.4.priority = 4
account.15.codec.4.rtpmap = 9

account.15.codec.5.enable = 0
account.15.codec.5.payload_type = G723
account.15.codec.5.priority = 5
account.15.codec.5.rtpmap = 4

account.15.codec.6.enable = 0
account.15.codec.6.payload_type = AACLC
account.15.codec.6.priority = 6
account.15.codec.6.rtpmap = 102

account.15.codec.7.enable = 0
account.15.codec.7.payload_type = iLBC
account.15.codec.7.priority = 7
account.15.codec.7.rtpmap = 122


#Enable or disable the account 1; 0-Disabled (default), 1-Enabled;
account.16.enable = 0

#Configure the label displayed on the LCD screen for account 1.
account.16.label =

#Configure the display name of account 1.
account.16.display_name =

#Configure the username and password for register authentication.
account.16.auth_name =
account.16.password =

#Configure the register user name.
account.16.user_name =

#Configure the SIP server address.
account.16.sip_server_host =

#Configure the voice mail number of account 1.
voice_mail.number.16 =

#Configure the call mode; 0-Voice, 1-Video (default);
account.16.call_option.call_mode = 0

#Local sip port
account.16.listen_port = 5060

#Enable or disable the phone to display the local video during call; 0-Disabled, 1-Enabled (default);
account.16.call_option.local_video_enable = 0

#Enable or disable the phone to subscribe the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.16.subscribe_mwi = 0

#Enable or disable the phone to subscribe to the voicemail through the message waiting indicator; 0-Disabled (default), 1-Enabled;
account.16.subscribe_mwi_to_vm = 0

#Read remote number from PAI, then from From
account.16.cid_source = 2

#Audio codecs for account 1 (Y ranges from 1 to 7).
account.16.codec.1.enable = 1
account.16.codec.1.payload_type = PCMA
account.16.codec.1.priority = 2
account.16.codec.1.rtpmap = 8

account.16.codec.2.enable = 1
account.16.codec.2.payload_type = PCMU
account.16.codec.2.priority = 1
account.16.codec.2.rtpmap = 0

account.16.codec.3.enable = 1
account.16.codec.3.payload_type = G729
account.16.codec.3.priority =3
account.16.codec.3.rtpmap = 18

account.16.codec.4.enable = 1
account.16.codec.4.payload_type = G722
account.16.codec.4.priority = 4
account.16.codec.4.rtpmap = 9

account.16.codec.5.enable = 0
account.16.codec.5.payload_type = G723
account.16.codec.5.priority = 5
account.16.codec.5.rtpmap = 4

account.16.codec.6.enable = 0
account.16.codec.6.payload_type = AACLC
account.16.codec.6.priority = 6
account.16.codec.6.rtpmap = 102

account.16.codec.7.enable = 0
account.16.codec.7.payload_type = iLBC
account.16.codec.7.priority = 7
account.16.codec.7.rtpmap = 122
А вот файл привязок
Spoiler
805e0c13b055; 101
805e0c13b056; 102
....
Спасибо сказали:
Аватара пользователя
olecya
Сообщения: 666
ОС: debian, fedora (i3-wm)

Re: Нагенерить файлы

Сообщение olecya »

Код: Выделить всё

#!/bin/bash

while IFS=\; read a b; do
        sed 's/%внутренний_номер%/'"$b/" шаблон.cfg >$a.cfg
done < mac.txt
Спасибо сказали:
JTMarsh
Сообщения: 143
ОС: Debian

Re: Нагенерить файлы

Сообщение JTMarsh »

olecya

Большое спасибо!
Отработало как надо!

---------------

upd. Только вот вылезло другое....
Мак-адреса идут заглавными буквами, а DHCP-запрос строчными...

805E0C13B055.cfg не равно 805e0c13b055.cfg
Как бы его сразу в нижний регистр переводить?
Спасибо сказали:
Аватара пользователя
olecya
Сообщения: 666
ОС: debian, fedora (i3-wm)

Re: Нагенерить файлы

Сообщение olecya »

JTMarsh
olecya писала:
19.04.2021 14:12
шаблон.cfg >$a.cfg

Код: Выделить всё

шаблон.cfg >${a,,}.cfg
Не совсем понятно, в шаблоне у вас адреса в нижнем регистре. Если наоборот то так:

Код: Выделить всё

шаблон.cfg >${a^^}.cfg
Спасибо сказали:
JTMarsh
Сообщения: 143
ОС: Debian

Re: Нагенерить файлы

Сообщение JTMarsh »

olecya
В примере да, но по факту мак-адреса сканятся с коробок с оборудованием, а они там все ПРОПИСНЫЕ.

Вот теперь вроде все.
Спасибо огромное!!!
Последний раз редактировалось JTMarsh 19.04.2021 17:02, всего редактировалось 1 раз.
Спасибо сказали:
Аватара пользователя
olecya
Сообщения: 666
ОС: debian, fedora (i3-wm)

Re: Нагенерить файлы

Сообщение olecya »

JTMarsh
Значит первый вариант
Спасибо сказали:
JTMarsh
Сообщения: 143
ОС: Debian

Re: Нагенерить файлы

Сообщение JTMarsh »

можно отмечать, как решено.
Спасибо сказали:
Kopilov
Сообщения: 870
ОС: [K]Ubuntu, Debian

Re: Нагенерить файлы

Сообщение Kopilov »

JTMarsh, это делается автором (т.е. Вами) через редактирование первого сообщения в теме
Спасибо сказали: