Commit 0bd114d3 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Assign sip: uri to Linphone to auto start app when user click on sip link

parent a53e7536
...@@ -162,6 +162,10 @@ namespace Linphone ...@@ -162,6 +162,10 @@ namespace Linphone
void UpdateCall(LinphoneCall^ call, LinphoneCallParams^ params); void UpdateCall(LinphoneCall^ call, LinphoneCallParams^ params);
LinphoneCallParams^ CreateDefaultCallParameters(); LinphoneCallParams^ CreateDefaultCallParameters();
/// <summary>
/// This is a temporary workaround since the call to this method crash if it returns a IVector&lt;LinphoneCallLog^&gt;^.
/// Returns a IList&lt;Object&gt; where each object is a LinphoneCallLog.
/// </summary>
Windows::Foundation::Collections::IVector<Platform::Object^>^ GetCallLogs(); Windows::Foundation::Collections::IVector<Platform::Object^>^ GetCallLogs();
void ClearCallLogs(); void ClearCallLogs();
void RemoveCallLog(LinphoneCallLog^ log); void RemoveCallLog(LinphoneCallLog^ log);
......
No preview for this file type
...@@ -264,6 +264,9 @@ namespace Linphone ...@@ -264,6 +264,9 @@ namespace Linphone
RootFrame = new PhoneApplicationFrame(); RootFrame = new PhoneApplicationFrame();
RootFrame.Navigated += CompleteInitializePhoneApplication; RootFrame.Navigated += CompleteInitializePhoneApplication;
// Assign custom URI mapper
RootFrame.UriMapper = new AssociationUriMapper();
// Handle navigation failures // Handle navigation failures
RootFrame.NavigationFailed += RootFrame_NavigationFailed; RootFrame.NavigationFailed += RootFrame_NavigationFailed;
......
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
</Compile> </Compile>
<Compile Include="LocalizedStrings.cs" /> <Compile Include="LocalizedStrings.cs" />
<Compile Include="Model\AlphaKeyGroup.cs" /> <Compile Include="Model\AlphaKeyGroup.cs" />
<Compile Include="Model\AssociationUriMapper.cs" />
<Compile Include="Model\CallControllerListener.cs" /> <Compile Include="Model\CallControllerListener.cs" />
<Compile Include="Model\CallLogs.cs" /> <Compile Include="Model\CallLogs.cs" />
<Compile Include="Model\ContactManager.cs" /> <Compile Include="Model\ContactManager.cs" />
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Navigation;
namespace Linphone.Model
{
/// <summary>
/// Class used to allow the app to be automatically launched when user click on a sip: link.
/// </summary>
class AssociationUriMapper : UriMapperBase
{
public override Uri MapUri(Uri uri)
{
string tempUri = HttpUtility.UrlDecode(uri.ToString());
if (tempUri.StartsWith("/Protocol?encodedLaunchUri="))
{
tempUri = tempUri.Replace("/Protocol?encodedLaunchUri=", "");
if (tempUri.Contains("sip:"))
{
return new Uri("/Views/Dialer.xaml?sip=" + tempUri, UriKind.RelativeOrAbsolute);
}
}
return uri;
}
}
}
...@@ -388,7 +388,6 @@ namespace Linphone.Model ...@@ -388,7 +388,6 @@ namespace Linphone.Model
{ {
Debug.WriteLine("[LinphoneManager] Call rejected"); Debug.WriteLine("[LinphoneManager] Call rejected");
vcall.NotifyCallEnded();
LinphoneCore.TerminateCall(call); LinphoneCore.TerminateCall(call);
}); });
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
</Tokens> </Tokens>
<Extensions> <Extensions>
<Extension ExtensionName="LockScreen_Notification_IconCount" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" /> <Extension ExtensionName="LockScreen_Notification_IconCount" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" />
<Protocol Name="sip" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
</Extensions> </Extensions>
<ActivatableClasses> <ActivatableClasses>
<InProcessServer> <InProcessServer>
......
...@@ -51,7 +51,6 @@ namespace Linphone ...@@ -51,7 +51,6 @@ namespace Linphone
{ {
String sipAddressToCall = NavigationContext.QueryString["sip"]; String sipAddressToCall = NavigationContext.QueryString["sip"];
addressBox.Text = sipAddressToCall; addressBox.Text = sipAddressToCall;
NewOutgoingCall(sipAddressToCall);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment