提交 d1c85dda authored 作者: Mitch Capper's avatar Mitch Capper

Fixed Caller ID Sending. Added option for UPNP on startup (as without that and…

Fixed Caller ID Sending.  Added option for UPNP on startup (as without that and SQL FS starts up way faster).  Version bump due to config changes.  Added Direct SIP Dialing.
上级 e08f6f4f
 using System;
using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
using System.Windows; using System.Windows;
using System.Xml; using System.Xml;
using FreeSWITCH.Native; using FreeSWITCH.Native;
...@@ -45,8 +45,8 @@ namespace FSClient { ...@@ -45,8 +45,8 @@ namespace FSClient {
new Field(Field.FIELD_TYPE.String, "Server","server","realm","",""), new Field(Field.FIELD_TYPE.String, "Server","server","realm","",""),
new Field(Field.FIELD_TYPE.String,"Username", "username","username","",""), new Field(Field.FIELD_TYPE.String,"Username", "username","username","",""),
new Field(Field.FIELD_TYPE.Password,"Password", "password","password","",""), new Field(Field.FIELD_TYPE.Password,"Password", "password","password","",""),
new Field(Field.FIELD_TYPE.String, "Caller ID Name","caller_id_name","caller_id_name","",""), new Field(Field.FIELD_TYPE.String, "Caller ID Name","caller_id_name","","",""),
new Field(Field.FIELD_TYPE.String, "Caller ID Number","caller_id_number","cid-num","",""), new Field(Field.FIELD_TYPE.String, "Caller ID Number","caller_id_number","","",""),
new Field(Field.FIELD_TYPE.String, "SIP URL for Checking Voicemail","sip_check_voicemail_url","","",""), new Field(Field.FIELD_TYPE.String, "SIP URL for Checking Voicemail","sip_check_voicemail_url","","",""),
new Field(Field.FIELD_TYPE.String, "SIP URL for Sending to Voicemail","sip_send_voicemail_url","","",""), new Field(Field.FIELD_TYPE.String, "SIP URL for Sending to Voicemail","sip_send_voicemail_url","","",""),
new Field(Field.FIELD_TYPE.Bool,"Register","register","register","true",""), new Field(Field.FIELD_TYPE.Bool,"Register","register","register","true",""),
...@@ -196,12 +196,25 @@ namespace FSClient { ...@@ -196,12 +196,25 @@ namespace FSClient {
PropertyChanged += Account_PropertyChanged; PropertyChanged += Account_PropertyChanged;
state = "NOREG"; state = "NOREG";
} }
private static Regex sip_regex;
public void CreateCall(String number) { public void CreateCall(String number) {
if (!enabled) if (!enabled)
return; return;
String sec_media = secure_media ? "{sip_secure_media=true}" : ""; String var_str = "origination_caller_id_name='" + caller_id_name + "',origination_caller_id_number='" + caller_id_number + "'";
PortAudio.Call(sec_media + "sofia/gateway/" + gateway_id + "/" + number); if (secure_media)
var_str += "sip_secure_media=true";
if (Broker.get_instance().DirectSipDial){
if (sip_regex == null)
sip_regex = new Regex(@"^sip:(.+)$");
Match match = sip_regex.Match(number);
if (match.Success){
string sip_uri = match.Groups[1].Value;
PortAudio.Call("{" + var_str + "}sofia/softphone/" + sip_uri);
return;
}
}
PortAudio.Call("{" + var_str + "}sofia/gateway/" + gateway_id + "/" + number);
} }
private void KillGateway() { private void KillGateway() {
if (!String.IsNullOrEmpty(old_gateway_id)) if (!String.IsNullOrEmpty(old_gateway_id))
......
...@@ -79,6 +79,8 @@ namespace FSClient { ...@@ -79,6 +79,8 @@ namespace FSClient {
IncomingBalloons = Properties.Settings.Default.IncomingBalloons; IncomingBalloons = Properties.Settings.Default.IncomingBalloons;
IncomingTopMost = Properties.Settings.Default.FrontOnIncoming; IncomingTopMost = Properties.Settings.Default.FrontOnIncoming;
ClearDTMFS = Properties.Settings.Default.ClearDTMFS; ClearDTMFS = Properties.Settings.Default.ClearDTMFS;
UPNPNAT = Properties.Settings.Default.UPNPNAT;
DirectSipDial = Properties.Settings.Default.DirectSipDial;
UseNumberOnlyInput = Properties.Settings.Default.UseNumberOnlyInput; UseNumberOnlyInput = Properties.Settings.Default.UseNumberOnlyInput;
CheckForUpdates = Properties.Settings.Default.CheckForUpdates; CheckForUpdates = Properties.Settings.Default.CheckForUpdates;
...@@ -369,6 +371,8 @@ namespace FSClient { ...@@ -369,6 +371,8 @@ namespace FSClient {
Properties.Settings.Default.CheckForUpdates = CheckForUpdates; Properties.Settings.Default.CheckForUpdates = CheckForUpdates;
Properties.Settings.Default.FrontOnIncoming = IncomingTopMost; Properties.Settings.Default.FrontOnIncoming = IncomingTopMost;
Properties.Settings.Default.ClearDTMFS = ClearDTMFS; Properties.Settings.Default.ClearDTMFS = ClearDTMFS;
Properties.Settings.Default.UPNPNAT = UPNPNAT;
Properties.Settings.Default.DirectSipDial = DirectSipDial;
Properties.Settings.Default.UseNumberOnlyInput = UseNumberOnlyInput; Properties.Settings.Default.UseNumberOnlyInput = UseNumberOnlyInput;
Properties.Settings.Default.RecordingPath = recordings_folder; Properties.Settings.Default.RecordingPath = recordings_folder;
Properties.Settings.Default.Sofia = new SettingsSofia(sofia); Properties.Settings.Default.Sofia = new SettingsSofia(sofia);
...@@ -526,6 +530,8 @@ namespace FSClient { ...@@ -526,6 +530,8 @@ namespace FSClient {
private bool _UseNumberOnlyInput; private bool _UseNumberOnlyInput;
public Utils.ObjectEventHandler<bool> UseNumberOnlyInputChanged; public Utils.ObjectEventHandler<bool> UseNumberOnlyInputChanged;
public Utils.ObjectEventHandler<bool> ClearDTMFSChanged = null;
public bool ClearDTMFS { public bool ClearDTMFS {
get { return _ClearDTMFS; } get { return _ClearDTMFS; }
set { set {
...@@ -541,7 +547,28 @@ namespace FSClient { ...@@ -541,7 +547,28 @@ namespace FSClient {
} }
} }
private bool _ClearDTMFS; private bool _ClearDTMFS;
public Utils.ObjectEventHandler<bool> ClearDTMFSChanged = null;
public bool DirectSipDial {
get { return _DirectSipDial; }
set {
if (value == _DirectSipDial)
return;
_DirectSipDial = value;
}
}
private bool _DirectSipDial;
public bool UPNPNAT {
get { return _UPNPNAT; }
set {
if (value == _UPNPNAT)
return;
_UPNPNAT = value;
}
}
private bool _UPNPNAT;
public bool SpeakerphoneActive { public bool SpeakerphoneActive {
get { return _SpeakerphoneActive; } get { return _SpeakerphoneActive; }
...@@ -757,7 +784,7 @@ namespace FSClient { ...@@ -757,7 +784,7 @@ namespace FSClient {
fs_inited = true; fs_inited = true;
String err = ""; String err = "";
freeswitch.switch_core_set_globals(); freeswitch.switch_core_set_globals();
const uint flags = (uint)(switch_core_flag_enum_t.SCF_USE_SQL | switch_core_flag_enum_t.SCF_USE_AUTO_NAT); uint flags = UPNPNAT ? (uint)(switch_core_flag_enum_t.SCF_USE_AUTO_NAT) : 0;
switch_status_t res = freeswitch.switch_core_init(flags, switch_bool_t.SWITCH_FALSE, ref err); switch_status_t res = freeswitch.switch_core_init(flags, switch_bool_t.SWITCH_FALSE, ref err);
search_bind = FreeSWITCH.SwitchXmlSearchBinding.Bind(xml_search, switch_xml_section_enum_t.SWITCH_XML_SECTION_CONFIG); search_bind = FreeSWITCH.SwitchXmlSearchBinding.Bind(xml_search, switch_xml_section_enum_t.SWITCH_XML_SECTION_CONFIG);
event_bind = FreeSWITCH.EventBinding.Bind("FSClient", switch_event_types_t.SWITCH_EVENT_ALL, null, event_handler, true); event_bind = FreeSWITCH.EventBinding.Bind("FSClient", switch_event_types_t.SWITCH_EVENT_ALL, null, event_handler, true);
......
<Window x:Class="FSClient.Options" <Window x:Class="FSClient.Options"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Options" Height="390" Width="550" Loaded="Window_Loaded" Closing="Window_Closing" WindowStyle="ThreeDBorderWindow" ResizeMode="NoResize" Icon="phone.ico"> Title="Options" Height="430" Width="550" Loaded="Window_Loaded" Closing="Window_Closing" WindowStyle="ThreeDBorderWindow" ResizeMode="NoResize" Icon="phone.ico">
<Window.Resources> <Window.Resources>
<Style x:Key="OptionHeaderStyle" TargetType="{x:Type TextBlock}"> <Style x:Key="OptionHeaderStyle" TargetType="{x:Type TextBlock}">
<Setter Property="FontWeight" Value="Bold"/> <Setter Property="FontWeight" Value="Bold"/>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition Height="90" /> <RowDefinition Height="130" />
<RowDefinition Height="30" /> <RowDefinition Height="30" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Grid.ColumnSpan="2"> <Grid Grid.ColumnSpan="2">
...@@ -69,6 +69,8 @@ ...@@ -69,6 +69,8 @@
<CheckBox x:Name="chkClearDTMFS" Content="Clear Key Presses In Call Stats On Disconnect" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" /> <CheckBox x:Name="chkClearDTMFS" Content="Clear Key Presses In Call Stats On Disconnect" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
<CheckBox x:Name="chkUseNumbers" Content="Only Allow Numerical Input While Dialing" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" /> <CheckBox x:Name="chkUseNumbers" Content="Only Allow Numerical Input While Dialing" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
<CheckBox x:Name="chkUpdatesOnStart" Content="Check for Updates on Startup" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" /> <CheckBox x:Name="chkUpdatesOnStart" Content="Check for Updates on Startup" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
<CheckBox x:Name="chkNAT" Content="UPNP NAT Startup Check(slows startup 5-10s)" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
<CheckBox x:Name="chkDirectSip" Content="Direct SIP: Dialing" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
</StackPanel> </StackPanel>
<Button Content="Save" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="101,0,0,0" Name="btnSave" VerticalAlignment="Center" Width="75" Grid.ColumnSpan="2" Click="btnSave_Click" /> <Button Content="Save" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="101,0,0,0" Name="btnSave" VerticalAlignment="Center" Width="75" Grid.ColumnSpan="2" Click="btnSave_Click" />
<Button Content="Cancel" Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="172,0,0,0" Name="btnCancel" VerticalAlignment="Center" Width="75" Click="btnCancel_Click" /> <Button Content="Cancel" Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="172,0,0,0" Name="btnCancel" VerticalAlignment="Center" Width="75" Click="btnCancel_Click" />
......
...@@ -38,7 +38,9 @@ namespace FSClient { ...@@ -38,7 +38,9 @@ namespace FSClient {
chkClearDTMFS.IsChecked = broker.ClearDTMFS; chkClearDTMFS.IsChecked = broker.ClearDTMFS;
chkUseNumbers.IsChecked = broker.UseNumberOnlyInput; chkUseNumbers.IsChecked = broker.UseNumberOnlyInput;
chkUpdatesOnStart.IsChecked = broker.CheckForUpdates != "Never"; chkUpdatesOnStart.IsChecked = broker.CheckForUpdates != "Never";
chkNAT.IsChecked = broker.UPNPNAT;
txtRecordingPath.Text = broker.recordings_folder; txtRecordingPath.Text = broker.recordings_folder;
chkDirectSip.IsChecked = broker.DirectSipDial;
comboHeadsetDevice.SelectedItem = broker.ActiveHeadset(); comboHeadsetDevice.SelectedItem = broker.ActiveHeadset();
if (comboHeadsetDevice.SelectedIndex == -1) if (comboHeadsetDevice.SelectedIndex == -1)
...@@ -58,6 +60,8 @@ namespace FSClient { ...@@ -58,6 +60,8 @@ namespace FSClient {
broker.IncomingBalloons = chkIncomingBalloons.IsChecked == true; broker.IncomingBalloons = chkIncomingBalloons.IsChecked == true;
broker.IncomingTopMost = chkIncomingFront.IsChecked == true; broker.IncomingTopMost = chkIncomingFront.IsChecked == true;
broker.ClearDTMFS = chkClearDTMFS.IsChecked == true; broker.ClearDTMFS = chkClearDTMFS.IsChecked == true;
broker.UPNPNAT = chkNAT.IsChecked == true;
broker.DirectSipDial = chkDirectSip.IsChecked == true;
broker.UseNumberOnlyInput = chkUseNumbers.IsChecked == true; broker.UseNumberOnlyInput = chkUseNumbers.IsChecked == true;
broker.recordings_folder = txtRecordingPath.Text; broker.recordings_folder = txtRecordingPath.Text;
broker.CheckForUpdates = chkUpdatesOnStart.IsChecked == true ? "OnStart" : "Never"; broker.CheckForUpdates = chkUpdatesOnStart.IsChecked == true ? "OnStart" : "Never";
......
...@@ -12,7 +12,7 @@ using System.Windows; ...@@ -12,7 +12,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mitch Capper")] [assembly: AssemblyCompany("Mitch Capper")]
[assembly: AssemblyProduct("FSClient")] [assembly: AssemblyProduct("FSClient")]
[assembly: AssemblyCopyright("Copyright © MitchCapper 2011")] [assembly: AssemblyCopyright("Copyright © MitchCapper 2012")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
...@@ -51,5 +51,5 @@ using System.Windows; ...@@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.2")] [assembly: AssemblyVersion("1.0.1.3")]
[assembly: AssemblyFileVersion("1.0.1.2")] [assembly: AssemblyFileVersion("1.0.1.3")]
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.235 // Runtime Version:4.0.30319.269
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
...@@ -245,5 +245,29 @@ namespace FSClient.Properties { ...@@ -245,5 +245,29 @@ namespace FSClient.Properties {
this["UpdateURL"] = value; this["UpdateURL"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool UPNPNAT {
get {
return ((bool)(this["UPNPNAT"]));
}
set {
this["UPNPNAT"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool DirectSipDial {
get {
return ((bool)(this["DirectSipDial"]));
}
set {
this["DirectSipDial"] = value;
}
}
} }
} }
...@@ -59,5 +59,11 @@ ...@@ -59,5 +59,11 @@
<Setting Name="UpdateURL" Type="System.String" Scope="User"> <Setting Name="UpdateURL" Type="System.String" Scope="User">
<Value Profile="(Default)">https://fsclient.fluky.biz/version</Value> <Value Profile="(Default)">https://fsclient.fluky.biz/version</Value>
</Setting> </Setting>
<Setting Name="UPNPNAT" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="DirectSipDial" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>
\ No newline at end of file
...@@ -49,6 +49,12 @@ ...@@ -49,6 +49,12 @@
<setting name="UpdateURL" serializeAs="String"> <setting name="UpdateURL" serializeAs="String">
<value>https://fsclient.fluky.biz/version</value> <value>https://fsclient.fluky.biz/version</value>
</setting> </setting>
<setting name="UPNPNAT" serializeAs="String">
<value>False</value>
</setting>
<setting name="DirectSipDial" serializeAs="String">
<value>False</value>
</setting>
</FSClient.Properties.Settings> </FSClient.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论