initiate outbound phone call from vb.net with tel protocol

727 Views Asked by At

I would expect next code to launch the chrome extension of my 3cx softphone the same way an html link call me would do. But it just opens google chrome default page and no number is dialed on softphone extension.

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Process.Start("tel:+34555555555")
End Sub

Am I missing anything?

1

There are 1 best solutions below

0
On

After some research it seems 3cx needs extra attribute tcxhref on anchor to do the job. In order to launch the dialer with the proper phone number on it I had to publish an ASP MVC page which clicks the anchor on loading.

This is the Html code:

<body onload="autodial()">
    <a id="callme" href="tel:@(Model)" tcxhref="@(Model)" ></a>
    <script>
        function autodial() {
            document.getElementById('callme').click();
            window.close();
            }
    </script>
</body>

This is how the MVC controller looks like:

Public Class Cx3Controller
    Function MakeCall(id As String) As ActionResult
        Return View(viewName:="MakeCall", model:=id)
    End Function
End Class

And this is how to invoke it from winforms:

Shared Sub MakeCall(telnum As String)
    Process.Start("chrome.exe", "https://www.mywebsite.com/cx3/makecall/" & telnum)
End Sub