3CX_CFD/721_dynWeiterleitung_mitExtension_an/setStateAndFWDestination.comp
stefanpflug 34ab7a7176 Init
Überführung von github
2025-03-31 08:42:12 +02:00

43 lines
9.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<File>
<Version>2.1</Version>
<Variables>
<ArrayOfVariable xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Variable>
<Name>strDestNo</Name>
<ShowScopeProperty>true</ShowScopeProperty>
<DebuggerVisible>true</DebuggerVisible>
<HelpText />
</Variable>
<Variable>
<Name>strExtensionNo</Name>
<ShowScopeProperty>true</ShowScopeProperty>
<DebuggerVisible>true</DebuggerVisible>
<HelpText />
</Variable>
</ArrayOfVariable>
</Variables>
<Flows>
<MainFlow>
<ns0:MainFlow Description="Callflow execution path." DebugModeActive="False" x:Name="setStateAndFWDestination" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ns0="clr-namespace:TCX.CFD.Classes.Components;Assembly=3CX Call Flow Designer, Version=20.2.84.0, Culture=neutral, PublicKeyToken=7cb95a1a133e706e">
<ns0:ExecuteCSharpCodeComponent ReturnsValue="True" Code="var ext = PhoneSystem.Root.GetDNByNumber(strExtNr) as Extension;&#xD;&#xA;var profile=ext.FwdProfiles.Where( x =&gt; x.Name == &quot;Custom 2&quot;).First(); // 'Available', 'Away', 'Out of office', 'Custom 1', 'Custom 2', maybe parameter?&#xD;&#xA;&#xD;&#xA;var NewStatus=-1;&#xD;&#xA;if( profile != null ) {&#xD;&#xA; // DestinationStruct need 3 parameter&#xD;&#xA; // 1 DestinationType: 'None', 'VoiceMail', 'Extension', 'Queue', 'RingGroup', 'IVR', 'External', 'Fax', 'Boomerang' (external number),&#xD;&#xA; // 'Deflect', 'VoiceMailOfDestination', 'Callback' (reserved), 'RoutePoint' &#xD;&#xA; // 2 internal DN, maybe select by parameter - OR - &#xD;&#xA; // 3 external number as string, maybe select by parameter&#xD;&#xA;&#xD;&#xA; // DestinationType anhand der Zielnummer (strDestNr) bestimmen&#xD;&#xA; bool isInternal = false;&#xD;&#xA; bool isExtension = false;&#xD;&#xA; bool isRG = false;&#xD;&#xA; bool isIVR = false;&#xD;&#xA; bool isQUEUE = false;&#xD;&#xA; &#xD;&#xA; // check if strDestNr is a internal extension&#xD;&#xA; var extension = PhoneSystem.Root.GetDNByNumber(strDestNr) as Extension;&#xD;&#xA; if( extension != null ) {&#xD;&#xA; isInternal = true;&#xD;&#xA; isExtension = true;&#xD;&#xA; }&#xD;&#xA; &#xD;&#xA; // check if strDestNr is a ringgroup&#xD;&#xA; var allRGs = PhoneSystem.Root.GetRingGroups();&#xD;&#xA; foreach (var rg in allRGs)&#xD;&#xA; {&#xD;&#xA; if (rg.Number == strDestNr) &#xD;&#xA; {&#xD;&#xA; isInternal = true;&#xD;&#xA; isRG = true;&#xD;&#xA; break;&#xD;&#xA; }&#xD;&#xA; }&#xD;&#xA; &#xD;&#xA; // check if strDestNr is a IVR/receptionist&#xD;&#xA; var allIVRs = PhoneSystem.Root.GetIVRs();&#xD;&#xA; foreach (var ivr in allIVRs)&#xD;&#xA; {&#xD;&#xA; if (ivr.Number == strDestNr) &#xD;&#xA; {&#xD;&#xA; isInternal = true;&#xD;&#xA; isIVR = true;&#xD;&#xA; break;&#xD;&#xA; }&#xD;&#xA; }&#xD;&#xA; &#xD;&#xA; // check if strDestNr is a Queue&#xD;&#xA; var allQUEUQs = PhoneSystem.Root.GetQueues();&#xD;&#xA; foreach (var queue in allQUEUQs)&#xD;&#xA; {&#xD;&#xA; if (queue.Number == strDestNr) &#xD;&#xA; {&#xD;&#xA; isInternal = true;&#xD;&#xA; isQUEUE = true;&#xD;&#xA; break;&#xD;&#xA; }&#xD;&#xA; }&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA; // define the DestinationStruct depending on the type of the destination target....&#xD;&#xA; &#xD;&#xA; var dest = new DestinationStruct();&#xD;&#xA; if (strExtNr.Equals(strDestNr)) {&#xD;&#xA; // set state to available if destination number is the number of the extension&#xD;&#xA; NewStatus = 0;&#xD;&#xA; }&#xD;&#xA; else {&#xD;&#xA; if( isInternal) {&#xD;&#xA; if( isExtension ) { &#xD;&#xA; dest.To=DestinationType.Extension; &#xD;&#xA; dest.Internal=PhoneSystem.Root.GetDNByNumber(strDestNr); // needed if internal destination &#xD;&#xA; }&#xD;&#xA; else if( isRG ) { &#xD;&#xA;&#xD;&#xA; dest.To=DestinationType.RingGroup; &#xD;&#xA; dest.Internal=PhoneSystem.Root.GetDNByNumber(strDestNr); // needed if internal destination &#xD;&#xA; }&#xD;&#xA; else if( isIVR ) { &#xD;&#xA;&#xD;&#xA; dest.To=DestinationType.IVR; &#xD;&#xA; dest.Internal=PhoneSystem.Root.GetDNByNumber(strDestNr); // needed if internal destination &#xD;&#xA; }&#xD;&#xA; else if( isQUEUE ) { &#xD;&#xA;&#xD;&#xA; dest.To=DestinationType.Queue; &#xD;&#xA; dest.Internal=PhoneSystem.Root.GetDNByNumber(strDestNr); // needed if internal destination &#xD;&#xA; }&#xD;&#xA; }&#xD;&#xA; else {&#xD;&#xA;&#xD;&#xA; dest.To=DestinationType.External; &#xD;&#xA; dest.External=strDestNr; // needed if external destination&#xD;&#xA; &#xD;&#xA; }&#xD;&#xA; &#xD;&#xA;&#xD;&#xA; NewStatus = 4;&#xD;&#xA; }&#xD;&#xA;&#xD;&#xA; &#xD;&#xA; if( NewStatus &gt;0)&#xD;&#xA; {&#xD;&#xA; // Depending on the type of status (present or absent), the forwarding must be entered in other target fields&#xD;&#xA; if( profile.TypeOfRouting == RoutingType.Available) {&#xD;&#xA; var route=profile.AvailableRoute; // maybe select by parameter?&#xD;&#xA; route.NoAnswer.AllCalls = dest;&#xD;&#xA; route.NoAnswer.Internal = dest;&#xD;&#xA; route.Busy.AllCalls = route.NotRegistered.AllCalls = dest;&#xD;&#xA; route.Busy.Internal = route.NotRegistered.Internal = dest;&#xD;&#xA; }&#xD;&#xA; if( profile.TypeOfRouting == RoutingType.Away) {&#xD;&#xA; var route=profile.AwayRoute;&#xD;&#xA; var external = profile.AwayRoute.External;&#xD;&#xA; route.Internal.AllHours = dest; // maybe select by parameter?&#xD;&#xA; route.Internal.OutOfOfficeHours = dest;&#xD;&#xA; route.External.AllHours = dest;&#xD;&#xA; route.External.OutOfOfficeHours = dest;&#xD;&#xA; }&#xD;&#xA; ext.Save();&#xD;&#xA; }&#xD;&#xA; &#xD;&#xA;}&#xD;&#xA;return( NewStatus);" ParameterList="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;ArrayOfScriptParameter xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;&lt;ScriptParameter&gt;&lt;Name&gt;strExtNr&lt;/Name&gt;&lt;Value&gt;callflow$.strExtensionNo&lt;/Value&gt;&lt;Type&gt;String&lt;/Type&gt;&lt;/ScriptParameter&gt;&lt;ScriptParameter&gt;&lt;Name&gt;strDestNr&lt;/Name&gt;&lt;Value&gt;callflow$.strDestNo&lt;/Value&gt;&lt;Type&gt;String&lt;/Type&gt;&lt;/ScriptParameter&gt;&lt;/ArrayOfScriptParameter&gt;" MethodName="SetExtDNDDest" Tag="" DebugModeActive="False" x:Name="SetExtDNDDest" />
<ns0:ConditionalComponent Tag="" DebugModeActive="False" x:Name="CreateCondition1">
<ns0:ConditionalComponentBranch Condition="EQUAL(SetExtDNDDest.ReturnValue,0)" Description="Execution path when the specified condition is met." Tag="" DebugModeActive="False" x:Name="conditionalComponentBranch1">
<ns0:TcxSetExtensionStatusComponent Status="Available" Tag="" DebugModeActive="False" Extension="callflow$.strExtensionNo" x:Name="SetAvailable" />
<ns0:PromptPlaybackComponent Tag="" AcceptDtmfInput="True" DebugModeActive="False" PromptList="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;ArrayOfPrompt xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;&lt;Prompt xsi:type=&quot;AudioFilePrompt&quot;&gt;&lt;AudioFileName&gt;Weiterleitung wurde entfernt.wav&lt;/AudioFileName&gt;&lt;/Prompt&gt;&lt;/ArrayOfPrompt&gt;" x:Name="Weiterleitung_entfernt" />
</ns0:ConditionalComponentBranch>
<ns0:ConditionalComponentBranch Condition="EQUAL(SetExtDNDDest.ReturnValue,4)" Description="Execution path when the specified condition is met." Tag="" DebugModeActive="False" x:Name="conditionalComponentBranch2">
<ns0:TcxSetExtensionStatusComponent Status="BusinessTrip" Tag="" DebugModeActive="False" Extension="callflow$.strExtensionNo" x:Name="SetExtCustom2" />
<ns0:PromptPlaybackComponent Tag="" AcceptDtmfInput="True" DebugModeActive="False" PromptList="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;ArrayOfPrompt xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;&lt;Prompt xsi:type=&quot;AudioFilePrompt&quot;&gt;&lt;AudioFileName&gt;IhreAnrufeWerdenAufDieFolgendeNummerWeitergeleitet-vicki.wav&lt;/AudioFileName&gt;&lt;/Prompt&gt;&lt;Prompt xsi:type=&quot;NumberPrompt&quot;&gt;&lt;Format&gt;OneByOne&lt;/Format&gt;&lt;Number&gt;callflow$.strDestNo&lt;/Number&gt;&lt;/Prompt&gt;&lt;/ArrayOfPrompt&gt;" x:Name="PlayDigits" />
</ns0:ConditionalComponentBranch>
</ns0:ConditionalComponent>
</ns0:MainFlow>
</MainFlow>
<ErrorHandlerFlow>
<ns0:ErrorHandlerFlow Description="Execution path when an error ocurrs." DebugModeActive="False" x:Name="setStateAndFWDestination" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ns0="clr-namespace:TCX.CFD.Classes.Components;Assembly=3CX Call Flow Designer, Version=20.2.84.0, Culture=neutral, PublicKeyToken=7cb95a1a133e706e" />
</ErrorHandlerFlow>
<DisconnectHandlerFlow>
<ns0:DisconnectHandlerFlow Description="Execution path since the call gets disconnected." DebugModeActive="False" x:Name="setStateAndFWDestination" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ns0="clr-namespace:TCX.CFD.Classes.Components;Assembly=3CX Call Flow Designer, Version=20.2.84.0, Culture=neutral, PublicKeyToken=7cb95a1a133e706e" />
</DisconnectHandlerFlow>
</Flows>
</File>