interfax / interfax-dotnet Goto Github PK
View Code? Open in Web Editor NEWFax send and receive in .NET with the InterFAX REST API
Home Page: https://www.interfax.net/en/dev/dotnet
License: MIT License
Fax send and receive in .NET with the InterFAX REST API
Home Page: https://www.interfax.net/en/dev/dotnet
License: MIT License
InboundFax.MessageId is a string, but all other operations against an InboundFax require fax identification by integer.
Working with the API while processing the inbound queue requires integer parsing to complete the cycle of Inbound.GetList, GetFaxImageStream, MarkAsRead.
The README suggests it has, but the code seems to suggest it's only available as interfax.Outbound.SendFax
.
Any time a FaxClient is created in our application, it overwrites the default serialization settings in Json.Net. Investigating the code, there is this code block in the constructor that should be removed/reworked:
JsonConvert.DefaultSettings = () => { var settings = new JsonSerializerSettings(); settings.Converters.Add(new StringEnumConverter { CamelCaseText = true }); return settings; };
This is generally considered a bad practice for any libraries as it interferes with app behavior.
I am trying to use this SDK within my Azure Functions project. Everything works great when I test on my machine. However, when I deploy my project to Azure (production), I get a runtime error saying that the 'SupportedMediaTypes.json' file is not deployed in the 'bin' folder. Instead, Visual Studio places this file inside the parent '\wwwroot' folder.
I do not know how to instruct VS to place this file in the '\wwwroot\bin' folder where the 'InterFAX.Api.dll' assembly is located and where this assembly is looking for it. Also, why is this file even necessary? It would be nice if the SDK just supported these types by default, unless overridden by the presence of this file. Alternatively, if I could setup the mappings in code, rather than via this file.
Please help - this is crucial I resolve this issue. Many thanks in advance!
Hi Team,
I see typo fileDocument => faxDocument in "Send fax" section.
Outbound.GetCompleted does not include ids when making web request.
In issue #23 it mentions that it uses an embedded version of this file in the assembly but in the code in Documents.cs it also look like if there is not a file on disk it tries to write it out to disk.
`var assembly = Assembly.GetAssembly(typeof(Documents));
var assemblyPath = Path.GetDirectoryName(assembly.Location);
var typesFile = Path.Combine(assemblyPath, "SupportedMediaTypes.json");
if (!File.Exists(typesFile))
{
// unpack the types file to the assembly path
using (var resource = assembly.GetManifestResourceStream("InterFAX.Api.SupportedMediaTypes.json"))
{
using (var file = new FileStream(typesFile, FileMode.Create, FileAccess.Write))
{
resource.CopyTo(file);
}
}
}`
This is a problem I am encountering because it is trying to write the file into the same folder as that the assembly is located in, which if often protected from writing and which with a Store applications it cannot do.
Would it be possible to have a property that is set to define where to write this file and any other files it needs? I have seen other products that define something like "ReferencePath" so that we can define where this is written or I believe this location will work properly for most desktop scenarios, Store and non-Store, although I am not sure about web.
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
This is common practice on Github:
Since the library 1.05 is built on .NET 4.5.2, it requires an additional line of code to be invoked prior to any API calls to force use of TLS 1.2:
C# ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
VB ServicePointManager.SecurityProtocol = DirectCast(3072,System.Net.SecurityProtocolType)
Here is some useful information regarding TLS1.2 and .NET:
https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls
For 2008 R2, registry settings to enable support.
https://support.microsoft.com/en-us/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-a-default-secure-protocols-in
https://support.microsoft.com/en-us/help/3154518/support-for-tls-system-default-versions-included-in-the-net-framework
https://docs.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings
There are a few options I foresee:
Potential problems with each one:
Option 1: Added complexity put upon the end user/developer
Option 2: You've now hardcoded something which will eventually become a problem.
Option 3: Limit usage by potential users/developers that use older .NET versions.
I'd like to add some instructions to the Contributing section on how to exactly run the tests. This will be useful to anyone trying to add bug fixes.
Please consider supporting FaxClient.Documents.BuildFaxDocument(byte[], ...) in addition to filename and uri building options. We have a need to send from a byte[] directly without the option to be able to write to disk first (which would be unwanted overhead even if we could). Many thanks!
Currently we are using hard coded fax and document IDs in some places in the integration tests. As a result the tests fail when a different user tries to edit the code and run the tests, as they do not have access to the same resources.
We should fix this, one way to do this is to "find" a fax ID first based on the whole list of faxes.
We are using below code to connect. But we are not sure where to add proxy settings. Can you please help ?
public void Initialise(HttpMessageHandler messageHandler = null, HttpClient httpClient =
null)
{
var username = _faxConfiguration.UserName;
var password = _faxConfiguration.Password;
if (string.IsNullOrEmpty(username))
throw new ArgumentException($"{username} has not been set.");
if (string.IsNullOrEmpty(password))
throw new ArgumentException($"{password} has not been set.");
Account = new Account(this);
Inbound = new Inbound(this);
Outbound = new Outbound(this);
Documents = new Documents(this);
HttpClient = messageHandler == null ? new HttpClient() : new HttpClient(messageHandler);
HttpClient = httpClient ?? HttpClient;
HttpClient.BaseAddress = new Uri($"https://rest.interfax.net/");
HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpClient.DefaultRequestHeaders.Add("Authorization",
new List<string> { $"Basic {Utils.Base64Encode($"{username}:{password}")}" });
JsonConvert.DefaultSettings = () =>
{
var settings = new JsonSerializerSettings();
settings.Converters.Add(new StringEnumConverter { CamelCaseText = true });
return settings;
};
}
The project is referred to as interfax-csharp
but the url is interfax-dotnet
If the Interfax account is configured to remove images after retrieval, then the inbound faxes will have an image status of DONT_EXIST. The ImageStatus enum does not define this value, so deserialization fails.
My project complains when building with the InterFAX.Api assembly. Below is the error:
"Referenced assembly 'InterFAX.Api, Version=3.0.1.0, Culture=neutral, PublicKeyToken=null' does not have a strong name."
Can you please resolve this and post an updated version to Nuget? Many thanks.
I've installed .NET for Mac via: https://www.microsoft.com/net/core#macos
I am using VS Code with Nuget installed, and when I install the file and run dotnet restore
I get the following error.
Errors in /Users/cbetta/code/playground/hwapp/hwapp.csproj
Package InterFAX.Api 1.0.4 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package InterFAX.Api 1.0.4 supports: net452 (.NETFramew
ork,Version=v4.5.2)
Package Microsoft.AspNet.WebApi.Client 5.2.3 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.AspNet.WebApi.Clien
t 5.2.3 supports:
- net45 (.NETFramework,Version=v4.5)
- portable-net45+netcore45+wp8+wp81+wpa81 (.NETPortable,Version=v0.0,Profile=wp8+netcore45+net45+wp81+wpa81)
One or more packages are incompatible with .NETCoreApp,Version=v1.1.
Any clues?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.