提交 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.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using System.Xml;
using FreeSWITCH.Native;
......@@ -45,8 +45,8 @@ namespace FSClient {
new Field(Field.FIELD_TYPE.String, "Server","server","realm","",""),
new Field(Field.FIELD_TYPE.String,"Username", "username","username","",""),
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 Number","caller_id_number","cid-num","",""),
new Field(Field.FIELD_TYPE.String, "Caller ID Name","caller_id_name","","",""),
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 Sending to Voicemail","sip_send_voicemail_url","","",""),
new Field(Field.FIELD_TYPE.Bool,"Register","register","register","true",""),
......@@ -196,12 +196,25 @@ namespace FSClient {
PropertyChanged += Account_PropertyChanged;
state = "NOREG";
}
private static Regex sip_regex;
public void CreateCall(String number) {
if (!enabled)
return;
String sec_media = secure_media ? "{sip_secure_media=true}" : "";
PortAudio.Call(sec_media + "sofia/gateway/" + gateway_id + "/" + number);
String var_str = "origination_caller_id_name='" + caller_id_name + "',origination_caller_id_number='" + caller_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() {
if (!String.IsNullOrEmpty(old_gateway_id))
......
......@@ -79,6 +79,8 @@ namespace FSClient {
IncomingBalloons = Properties.Settings.Default.IncomingBalloons;
IncomingTopMost = Properties.Settings.Default.FrontOnIncoming;
ClearDTMFS = Properties.Settings.Default.ClearDTMFS;
UPNPNAT = Properties.Settings.Default.UPNPNAT;
DirectSipDial = Properties.Settings.Default.DirectSipDial;
UseNumberOnlyInput = Properties.Settings.Default.UseNumberOnlyInput;
CheckForUpdates = Properties.Settings.Default.CheckForUpdates;
......@@ -369,6 +371,8 @@ namespace FSClient {
Properties.Settings.Default.CheckForUpdates = CheckForUpdates;
Properties.Settings.Default.FrontOnIncoming = IncomingTopMost;
Properties.Settings.Default.ClearDTMFS = ClearDTMFS;
Properties.Settings.Default.UPNPNAT = UPNPNAT;
Properties.Settings.Default.DirectSipDial = DirectSipDial;
Properties.Settings.Default.UseNumberOnlyInput = UseNumberOnlyInput;
Properties.Settings.Default.RecordingPath = recordings_folder;
Properties.Settings.Default.Sofia = new SettingsSofia(sofia);
......@@ -526,6 +530,8 @@ namespace FSClient {
private bool _UseNumberOnlyInput;
public Utils.ObjectEventHandler<bool> UseNumberOnlyInputChanged;
public Utils.ObjectEventHandler<bool> ClearDTMFSChanged = null;
public bool ClearDTMFS {
get { return _ClearDTMFS; }
set {
......@@ -541,7 +547,28 @@ namespace FSClient {
}
}
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 {
get { return _SpeakerphoneActive; }
......@@ -752,12 +779,12 @@ namespace FSClient {
private bool is_inited;
private bool fs_inited;
private static IDisposable event_bind;
private void fs_core_init() {
fs_inited = true;
String err = "";
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);
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);
......
<Window x:Class="FSClient.Options"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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>
<Style x:Key="OptionHeaderStyle" TargetType="{x:Type TextBlock}">
<Setter Property="FontWeight" Value="Bold"/>
......@@ -18,7 +18,7 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="90" />
<RowDefinition Height="130" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid Grid.ColumnSpan="2">
......@@ -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="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="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>
<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" />
......
......@@ -38,7 +38,9 @@ namespace FSClient {
chkClearDTMFS.IsChecked = broker.ClearDTMFS;
chkUseNumbers.IsChecked = broker.UseNumberOnlyInput;
chkUpdatesOnStart.IsChecked = broker.CheckForUpdates != "Never";
txtRecordingPath.Text = broker.recordings_folder;
chkNAT.IsChecked = broker.UPNPNAT;
txtRecordingPath.Text = broker.recordings_folder;
chkDirectSip.IsChecked = broker.DirectSipDial;
comboHeadsetDevice.SelectedItem = broker.ActiveHeadset();
if (comboHeadsetDevice.SelectedIndex == -1)
......@@ -57,7 +59,9 @@ namespace FSClient {
broker.SetRingDev(outdev == null ? "" : outdev.name);
broker.IncomingBalloons = chkIncomingBalloons.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.recordings_folder = txtRecordingPath.Text;
broker.CheckForUpdates = chkUpdatesOnStart.IsChecked == true ? "OnStart" : "Never";
......
......@@ -11,8 +11,8 @@ using System.Windows;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mitch Capper")]
[assembly: AssemblyProduct("FSClient")]
[assembly: AssemblyCopyright("Copyright © MitchCapper 2011")]
[assembly: AssemblyProduct("FSClient")]
[assembly: AssemblyCopyright("Copyright © MitchCapper 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......@@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.2")]
[assembly: AssemblyFileVersion("1.0.1.2")]
[assembly: AssemblyVersion("1.0.1.3")]
[assembly: AssemblyFileVersion("1.0.1.3")]
//------------------------------------------------------------------------------
// <auto-generated>
// 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
// the code is regenerated.
......@@ -245,5 +245,29 @@ namespace FSClient.Properties {
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 @@
<Setting Name="UpdateURL" Type="System.String" Scope="User">
<Value Profile="(Default)">https://fsclient.fluky.biz/version</Value>
</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>
</SettingsFile>
\ No newline at end of file
......@@ -49,6 +49,12 @@
<setting name="UpdateURL" serializeAs="String">
<value>https://fsclient.fluky.biz/version</value>
</setting>
<setting name="UPNPNAT" serializeAs="String">
<value>False</value>
</setting>
<setting name="DirectSipDial" serializeAs="String">
<value>False</value>
</setting>
</FSClient.Properties.Settings>
</userSettings>
</configuration>
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论