Here is a sample script addressing this function...
----------------------------------------------------------------
# This sample will show how to enable/disable circuilts in protocol selection. # Using Demo_Analog.env # The circuilts 1, 3, 5 of slot 1 will be disabled
package require tclreadyapi
set OUTFILE "_PtlSelection_SetConfig_Circuits.txt" ::aba::WriteToFile $OUTFILE "\n*********************************************\n"
::aba::ApiApplication app ::aba::ApiProtocolSelection ptl
set chan [app Enter localhost] if { ![regexp {sock\d+} $chan] } { ::aba::WriteToFile $OUTFILE [app GetLastError] exit } ::aba::WriteToFile $OUTFILE "Abacus Entered Successfully\n"
set envFile "Demo_Analog.env" set loadret [app Load $envFile] if { ![string equal -nocase $loadret "OK"] } { ::aba::WriteToFile $OUTFILE [app GetLastError] ::aba::WriteToFile $OUTFILE "Fail to load the environment: \"$envFile\".\n" exit } ::aba::WriteToFile $OUTFILE "Load the environment file sucessfully.\n" ::aba::sleep 10
set ptlXml {<protocol-selection> <card> <slot-card-spec type="EANALOG" slot="1"> <physical>Analog</physical> <signaling>Regular</signaling> <side>Subscriber</side> <law>u-law</law> </slot-card-spec> <slot-card-spec type="EANALOG" slot="2"> <physical>Analog</physical> <side>Exchange</side> <law>u-law</law> </slot-card-spec> </card> <channels> <slot-channel-spec type="EANALOG" slot="1"> <protocol>Loop start</protocol> </slot-channel-spec> <slot-channel-spec type="EANALOG" slot="2"> <protocol>Loop start</protocol> </slot-channel-spec> </channels> <voip/> <icg/> <sut> <slot-sut-spec type="EANALOG" slot="1"> <profile>Default Analog</profile> </slot-sut-spec> <slot-sut-spec type="EANALOG" slot="2"> <profile>Default Analog</profile> </slot-sut-spec> </sut> <circuits> <slot-circuit-spec slot="1"> <circuit num="1" enabled="false"/> <circuit num="2" enabled="true"/> <circuit num="3" enabled="false"/> <circuit num="4" enabled="true"/> <circuit num="5" enabled="false"/> <circuit num="6" enabled="true"/> <circuit num="7" enabled="true"/> <circuit num="8" enabled="true"/> <circuit num="9" enabled="true"/> <circuit num="10" enabled="true"/> <circuit num="11" enabled="true"/> <circuit num="12" enabled="true"/> <circuit num="13" enabled="true"/> <circuit num="14" enabled="true"/> </slot-circuit-spec> <slot-circuit-spec slot="2"> <circuit num="1" enabled="true"/> <circuit num="2" enabled="true"/> <circuit num="3" enabled="true"/> <circuit num="4" enabled="true"/> <circuit num="5" enabled="true"/> <circuit num="6" enabled="true"/> <circuit num="7" enabled="true"/> <circuit num="8" enabled="true"/> <circuit num="9" enabled="true"/> <circuit num="10" enabled="true"/> <circuit num="11" enabled="true"/> <circuit num="12" enabled="true"/> <circuit num="13" enabled="true"/> <circuit num="14" enabled="true"/> </slot-circuit-spec> </circuits> <analog> <slot-analog-spec hdw-type="ECG3" slot="1"> <gain-ad>0</gain-ad> <gain-da>0</gain-da> <country>Not Defined</country> <impedance>600 Ohm</impedance> </slot-analog-spec> <slot-analog-spec hdw-type="XCG3" slot="2"> <gain-ad>0</gain-ad> <gain-da>0</gain-da> <impedance>600 Ohm</impedance> </slot-analog-spec> </analog> </protocol-selection>}
if { [ptl SetCurrentConfig $ptlXml] != 1 } then { ::aba::WriteToFile $OUTFILE [ptl GetLastError] ::aba::WriteToFile $OUTFILE "Fail to set the configuration of protocol selection." } else { ::aba::WriteToFile $OUTFILE "Set the configuration of protocol selection successfully.\n" }
set ret [ptl GetCurrentConfig] if {[string length $ret] == 0} { ::aba::WriteToFile $OUTFILE "[ptl GetLastError]" ::aba::WriteToFile $OUTFILE "Fail to get the configuration of protocol selection." exit } ::aba::WriteToFile $OUTFILE "Current configuration of protocol selection:" ::aba::WriteToFile $OUTFILE "$ret"
::aba::WriteToFile $OUTFILE "Abacus instance exited.\n"
::aba::WriteToFile $OUTFILE "SCRIPT DONE" exit
---------------------------------------------------------------------