| Both sides previous revision Previous revision Next revision | Previous revision |
| tech-notes:scripts:dial-peer-config [2019/03/05 15:17] – [Batch file] gerardorourke | tech-notes:scripts:dial-peer-config [2019/03/05 16:51] (current) – [Batch file] gerardorourke |
|---|
| REM START OF MAIN SCRIPT | REM START OF MAIN SCRIPT |
| REM *************************************************** | REM *************************************************** |
| | |
| set runningconfig=MyRouterConfigFile.txt | set runningconfig=MyRouterConfigFile.txt |
| echo . | echo . |
| |
| REM Print Header | REM Print Header |
| echo "dial-peer","description","translation-profile","preference","destination-pattern","session protocol","session target","voice-class codec","voice-class h323","dtmf-relay","fax","vad","direct-inward-dial","incoming","service" > %outputfile% | echo "Filename","dial-peer","description","translation-profile incoming","direct-inward-dial","incoming called-num","destination-pattern","service","preference","session protocol","session target","voice-class codec","voice-class h323","dtmf-relay","fax","vad" > %outputfile% |
| | |
| |
| REM For Loop for each Dial-peer and create a temp file for just that dial-peer | REM For Loop for each Dial-peer and create a temp file for just that dial-peer |
| SET service=. | SET service=. |
| |
| FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "dial-peer"`) DO (SET dial-peer=%%F) | FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "dial-peer voice"`) DO (SET dial-peer=%%F) |
| FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "description"`) DO (SET description=%%F) | FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "description"`) DO (SET description=%%F) |
| FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "translation-profile"`) DO (SET translation-profile="%%F") | FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "translation-profile incoming"`) DO (SET translation-profile="%%F") |
| REM echo my translation profile is: translation-profile | |
| FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "preference"`) DO (SET preference=%%F) | FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "preference"`) DO (SET preference=%%F) |
| FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "destination-pattern"`) DO (SET destination-pattern=%%F) | FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "destination-pattern"`) DO (SET destination-pattern=%%F) |
| FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "vad"`) DO (SET vad=%%F) | FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "vad"`) DO (SET vad=%%F) |
| FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "direct-inward-dial"`) DO (SET direct-inward-dial=%%F) | FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "direct-inward-dial"`) DO (SET direct-inward-dial=%%F) |
| FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "incoming"`) DO (SET incoming=%%F) | FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "incoming called-number"`) DO (SET incoming=%%F) |
| FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "service"`) DO (SET service=%%F) | FOR /F "tokens=* USEBACKQ" %%F IN (`type %tempfile% ^| find "service"`) DO (SET service=%%F) |
| |
| echo "%dial-peer%","%description%","%translation-profile%","%preference%","%destination-pattern%","%session-protocol%","%session-target%","%voice-class-codec%","%voice-class-h323%","%dtmf-relay%","%fax%","%vad%","%direct-inward-dial%","%incoming%","%service%" >> %outputfile% | echo "%runningconfig%","%dial-peer%","%description%","%translation-profile%","%direct-inward-dial%","%incoming%","%destination-pattern%","%service%","%preference%","%session-protocol%","%session-target%","%voice-class-codec%","%voice-class-h323%","%dtmf-relay%","%fax%","%vad%" >> %outputfile% |
| exit /b | exit /b |
| </code> | </file> |
| |