InnovateAsterisk / Browser-Phone

A fully featured browser based WebRTC SIP phone for Asterisk
https://www.innovateasterisk.com
GNU Affero General Public License v3.0
489 stars 240 forks source link

Install BrowserPhone with FreePBX #139

Open acoolov opened 3 years ago

acoolov commented 3 years ago

Hi, is it possible to install this soft phone on top of freepbx and use it with freepbx existing user accounts and extensions?

Is there a guide on how to install it on top of freepbx?

Thank you.

HSMM commented 3 years ago

Hi, is it possible to install this soft phone on top of freepbx and use it with freepbx existing user accounts and extensions?

Is there a guide on how to install it on top of freepbx?

Thank you.

It works for me with FreePBX. Try this instruction https://voxlink.ru/kb/asterisk-configuration/nastroika-webrtc-ispolzuya-jssip/ Instructions in Russian

acoolov commented 3 years ago

Awesome, I'll check them out. I speak russian too. I have also tried following this guide to install in on top of VitalPBX but once I install it and try to access the link, it says access denied. I am missing something but don't know what exactly. https://www.vitalpbx.org/blog/webrtc-audio-and-video-calls-with-vitalpbx/ Would someone be able to help?

acoolov commented 3 years ago

@HSMM I'm trying to register the pre-installed demo version of this browser phone at https://www.innovateasterisk.com/phone/ to a FreePBX instance that is hosted in the cloud.

I enabled all the options needed in the FreePBX per the instructions you provided except I didn't install the Stun server. In the browser phone I enter the FQDN of the PBX, 8089 and /we for web socket and the extension credentials, but it says registration failed. Am I missing something?

I tried registering the same demo app to a VitalPBX it worked, and I didn't have to install Stun server.

Let me know if I am missing something.

Also, I am using FreePBX 15. Some of the menu items are different in there, than what is in your instructions.

InnovateAsterisk commented 3 years ago

STUN will not play a part until you get to call setup (its only used as part of the INVITE).

Do you have the Console output?

acoolov commented 3 years ago

@InnovateAsterisk Hi Conrad, thanks for replying and thank you so much for developing such a simple yet functional app. Couple questions for you. Do you think this app can be further developed to be able to provide to our customers as a service? If so, we are willing to contribute in developing it. We would be happy to share the improvements done from our side.

  1. I see there is a video of you coding the app line by line, but is there a video on just how to install the already configured app step by step? I don't know if I need to build it line by line like this if I could just install the one you already build. I'm new to this, so maybe I am missing something. Where is a guide on how to install it?
  2. Can this app be installed on top of FreePBX or VitalPBX distro and synced with the existing extensions/users, so that once you go to the app link, you are prompted with a simple log in screen with just a username (ext number) and a password. So that as soon as the user enters their ext numner and password, they're logged into this softphone app that you build. Is this feature possible to develop? Would it be easy or hard to do?
  3. Also, which file should be modified to tweak the design of the app?

I hope this message finds you well!

InnovateAsterisk commented 3 years ago

Yes, this app can be provided to your customers as a service so long as that conforms to the LGPL-3.0 License. https://github.com/InnovateAsterisk/Browser-Phone/blob/master/LICENSE

I do this work because I believe this app (will) provides functionality that doesn't currently exists, and so I enjoy being in a pioneering development space. The business model is to direct interest to my YouTube channel and ultimately generate revenues from advertisers/subscriptions etc.

I'm very happy to hear input from the community, and do my best to integrate feature requests, but must also add that, it's important for me to keep the app on what I believe is the correct track, in keeping with what the app objectives are. The two main features that will be developed in the coming months are; full XMPP support, and Group Video Calling / Chat.

This project isn't really an "install" app, you just clone the GitHub project, and it's good to go. (It's not a node.js module either). All the library files are provided via CDN, and you are able to make the changes (if you want) to the actual html/JS/CSS files. The server setup side does, however, require some knowledge, but should work with existing installations like Asterisk / FreePBX / VitalPBX, even OpenSIPS.

Technically you don't even need to install this app "on top" of anything, you could just use the hosted version: https://www.innovateasterisk.com/phone/ and when asked, just enter the details of your own server (even a local url like mycompany.local), this is the magic of WebSockets.

That being said, If you want to deploy this app as part of your server software, you just host the "phone" (https://github.com/InnovateAsterisk/Browser-Phone/tree/master/Phone) folder, and it will just work (as you can see by the /phone/ in the url www.innovateasterisk.com/phone/)

Provisioning... now this is an interesting topic. This app has been deliberately left as open as possible to provisioning, so that you can perform you own login etc. The provided index.html could easily be changed to index.php, and have the necessary login prompts etc, and upon completing the login successfully, initialise the phone with the necessary SIP details, and other settings (there are many). I don't get involved in this development, however this can be done by almost any developer. It wouldn't be difficult, but would require knowledge on how your own customer database would work - something that I would rather stay away from.

There are a few design files that you can manipulate to make it look as you like, the phone.css will be the most important, but also look at files like wp_1.png, and default.png.

acoolov commented 3 years ago

Thanks Conrad.

We'll try to install it on our server and see how it works. Happy to provide feedback and give back to be beneficial for others.

One of our concerns is that, when registering to a VitalPBX extension, in VitalPBX extension settings you have to specify the transport protocol either UDP or WSS. When udp is selected this phone obviously does not work. When wss selected it works and you can make calls. However, our desk phone stops working on the same extension. Is it possible to use the same extension with both a desk phone and this web phone so that when a call is received it will ring on both phones? Because if not, I'm afraid it is going to be much less useful. Maybe there is a way to use them together on the same extension that we don't know of. Let us know what you think. It would be very important that both phones work of of the same extension in production.

Which file needs to be modified in order to tweak some minor design aspects?

I haven't been able to register this phone to FreePBX still. If you have any experience with FreePBX, do you know what settings need to be changed in order for this phone to register and make calls?

Also, do you think it is possible to customize the very first log in fields so that only username and password and server address appear on the screen. And all the rest of the settings would be set according to our default? So that our clients can just simply log into their extension without having to see all the advanced settings.

InnovateAsterisk commented 3 years ago

One of our concerns is that, when registering to a VitalPBX extension, in VitalPBX extension settings you have to specify the transport protocol either UDP or WSS. When udp is selected this phone obviously does not work. When wss selected it works and you can make calls. However, our desk phone stops working on the same extension. Is it possible to use the same extension with both a desk phone and this web phone so that when a call is received it will ring on both phones? Because if not, I'm afraid it is going to be much less useful. Maybe there is a way to use them together on the same extension that we don't know of. Let us know what you think. It would be very important that both phones work of of the same extension in production.

I'm not sure how VitalPBX works, but Asterisk does not have such transport limitation. An extension should be able to use both UDP and WSS, it fact it should also be able to use TCP. I'm already getting a bit rusty on chan_sip, so if this is a limitation of the old SIP engine, try PJSIP. If this is a UI limitation, you would need to contact VitalPBX about that.

Which file needs to be modified in order to tweak some minor design aspects?

phone.css

I haven't been able to register this phone to FreePBX still. If you have any experience with FreePBX, do you know what settings need to be changed in order for this phone to register and make calls?

Again, I'm not familiar with FreePBX... would really be nice of someone from the community could help out here.

Also, do you think it is possible to customize the very first log in fields so that only username and password and server address appear on the screen. And all the rest of the settings would be set according to our default? So that our clients can just simply log into their extension without having to see all the advanced settings.

Yes, the settings can be provisioned, but this would be for your own development. I can however show you that some data can be set by default or at least hard coded, that a new user would only need to enter their sip username and password.

An Example:

Open up the index.html You will find the following script block:

        <script type="text/javascript">
            var web_hook_on_transportError = function(t, ua){
                // console.warn("web_hook_on_transportError",t, ua);
            }
            var web_hook_on_register = function(ua){
                // console.warn("web_hook_on_register", ua);
            }
            var web_hook_on_registrationFailed = function(e){
                // console.warn("web_hook_on_registrationFailed", e);
            }
            var web_hook_on_unregistered = function(){
                // console.warn("web_hook_on_unregistered");
            }
            var web_hook_on_invite = function(session){
                // console.warn("web_hook_on_invite", session);
            }
            var web_hook_on_message = function(message){
                // console.warn("web_hook_on_message", message);
            }
            var web_hook_on_modify = function(action, session){
                // console.warn("web_hook_on_modify", action, session);
            }
            var web_hook_on_dtmf = function(item, session){
                // console.warn("web_hook_on_dtmf", item, session);
            }
            var web_hook_on_terminate = function(session){
                // console.warn("web_hook_on_terminate", session);
            }
        </script>

I will assume you are not using any of these web hooks, so take them all out, so it look like this:

        <script type="text/javascript">

        </script>

Now start adding your own custom settings:

        <script type="text/javascript">
        window.localStorage.setItem("wssServer", "myservername.local");
        window.localStorage.setItem("WebSocketPort", "4431");
        window.localStorage.setItem("ServerPath", "/ws");
        </script>

With these settings, they now only need to enter their own settings, like extension number, username and password.

acoolov commented 3 years ago

Thanks so much Conrad, we will try that.

acoolov commented 3 years ago

Conrad,

I have consulted both FreePBX and VitalPBX forums. Both of them are saying there is no way to have an IP desk phone and a webrtc phone work on the same extension. And as i tested both, it is true. As soon as i set media encryption to TDLS-SRTP i stop receiving calls on my IP phone, because to uses UDP for transport. Even if i set transport to auto, with dtla enabled the IP phone does not receive calls. With dtls disabled on the extension, the webrtc phone stops working.

Do you think there is a way to solve this? Are you sure you have tried testing both IP phone and browser phone on the same extension?

InnovateAsterisk commented 3 years ago

What IP Phone are you using? I am able to use the same Websocket extension on my Yealink T48S, no problem.

I used the following config. I can use User1 in the browser phone and the Yealink, no problems.

Try capture the error log or something. At what point does it actually fail?

[global]
max_forwards=70
user_agent=Raspberry Pi BPX
default_realm=raspberrypi.local
keep_alive_interval=300

; == Transports

[udp_transport]
type=transport
protocol=udp
bind=0.0.0.0
tos=af42
cos=3

[wss_transport]
type=transport
protocol=wss
bind=0.0.0.0

; == ACL

[acl] ; Opperates on all pjsip traffic (can also be in acl.conf)
type=acl
deny=0.0.0.0/0.0.0.0
permit=10.0.0.0/255.0.0.0
permit=172.16.0.0/255.240.0.0
permit=192.168.0.0/255.255.0.0
permit=127.0.0.1/255.255.255.255

; == Templates

[single_aor](!)
max_contacts=1
qualify_frequency=120
remove_existing=yes

[userpass_auth](!)
auth_type=userpass

[basic_endpoint](!)
moh_suggest=default
context=from-extensions
inband_progress=no
rtp_timeout=120
message_context=textmessages
allow_subscribe=yes
subscribe_context=subscriptions
direct_media=no
dtmf_mode=rfc4733
device_state_busy_at=1
disallow=all

[phone_endpoint](!)
allow=ulaw,alaw,g722,gsm,vp9,vp8,h264

[webrtc_endpoint](!)
transport=wss_transport
allow=opus,ulaw,vp9,vp8,h264
webrtc=yes
dtls_auto_generate_cert=yes

; == Users

[User1](basic_endpoint,webrtc_endpoint)
type=endpoint
callerid="One Hundred" <100>
auth=User1
aors=User1
[User1](single_aor)
type=aor
mailboxes=User1@default
[User1](userpass_auth)
type=auth
username=User1
password=1234

[User2](basic_endpoint,webrtc_endpoint)
type=endpoint
callerid="Two Hundred" <200>
auth=User2
aors=User2
[User2](single_aor)
type=aor
[User2](userpass_auth)
type=auth
username=User2
password=1234

[User3](basic_endpoint,phone_endpoint)
type=endpoint
callerid="Three Hundred" <300>
auth=User3
aors=User3
[User3](single_aor)
type=aor
[User3](userpass_auth)
type=auth
username=User3
password=1234
InnovateAsterisk commented 3 years ago

IMG_3244 IMG_3248

acoolov commented 3 years ago

I'm using Yealink phones as well. I think i need to figure out how i can authenticate on user not directly onto the extension itself. Because right now i am authenticating both the phone and the browser phone to the extension directly. Somehow i need to figure out how i can enable a user for that extension and enable webrtc for that user. And leave the extension on udp. It fails on transport, when you try to call it just hangs up.

InnovateAsterisk commented 3 years ago

Ah, it could just be that the contacts are limited to 1

max_contacts=1

By increasing this value, your are able to register multiple devices under the same endpoint.

Then by calling the extension, they should all ring. From what I remember… there could be some other things to do in the dial plan.

acoolov commented 3 years ago

No, i confirmed about that too. Max contacts is just a setting to allow more registrations. My problem is not registration, both endpoints register fine, but when i enable DTLS-SRTP for the extension, the UDP transport protocol stops working for the Yealink phone. It won't receive calls any more but it is registered. Same thing as soon as i disable dtls the Yealink starts to work and webrtc stops receiving calls, but remains registered. It's the transport protocol that they are using is completely different from one another.

The guys from VitalPBX said you can never have webrtc and udp endpoints on the same extension. They implement it this way, in VitalPBX you create an extension (200 for example) and register your IP phone with a regular pjsip device profile which is on udp. Then to register webrtc you have to create another device profile and select webrtc for it. Then that device profile is going to have an extension at the end of the regular ext number such as 200_1. You can't register webrtc to the regular udp ext 200.

They're saying you should never authenticate a webrtc phone to an extension directly. Also they said it needs to be authenticated to the user associated with that extension.

You've also said that you've authenticated your webrtc to user1. In FreePBX there is a user created for each extension, but I'm not sure how i can authenticate a webrtc to that user and not the extension. Both PBXs do not work together with the IP phone. Only one or the other.

acoolov commented 3 years ago

Conrad, i think we're misunderstanding each other in regards to the way you're setting up your Yealink phone. Are you using UDP transport on the Yealink or are you also using tls encryption on it?

Is it possible to register the Yealink phone using the same dtls protocol so that they both use the same transport protocol? I think that could be a solution here.

InnovateAsterisk commented 3 years ago

I use UDP in the settings of the Yealink.

I understand that Yealink support DTLS, it’s in the advanced section of the account tab, and they call it ‘Encryption SRTP’.

I’m away for a few days, but when I’m back I’ll try of the scenario you are describing.

acoolov commented 3 years ago

Oh ok. I will try to register Yealink over dtls too. Hopefully it works. Then it doesn't need any duplicate or ghost extensions created. Here is what the guys from FreePBX told me. UCP phone is the FreePBX webrtc phone.

"there is a ghost pjsip endpoint created under the hood for the UCP phone registration. If the primary extension is 101, the webrtc phone registers to 99101, and dialplan is used to route calls to and from each as if they are both primary"

This is how freepbx handles webrtc so it looks like both ip phone and webrtc phone are on the same extension.

acoolov commented 3 years ago

Conrad,

Is it possible at all to add capability to this soft phone to be able to register to the pjsip extension over tcp/udp like a normal softphone mobile app? Or is it something that would require a lot of coding to add a feature like that?

spereg53 commented 2 years ago

i have freepbx 15 and used minihtps on port 8089,copied all files from innovateasterisk/phone to /var/lib/asterisk/static-http,with default certificate,SIP(chan_sip) is registering, but when try to call to another extension,asterisk cli: "WARNING[11121][C-0000000e]: chan_sip.c:10933 process_sdp: Can't provide secure audio requested in SDP offer",can you help met ,thanks in advance

spereg53 commented 2 years ago

can not register with pjsip on freepbx 15 with bowser-phone,with can_sip the register is ok,but i can not call....can you helpme???,thanks

InnovateAsterisk commented 2 years ago

"WARNING[11121][C-0000000e]: chan_sip.c:10933 process_sdp: Can't provide secure audio requested in SDP offer"

It seem like the DTLS is not enabled on the endpoint.