InnovateAsterisk / Browser-Phone

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

adding phone number into window application text box when answering a call #390

Open edimondi opened 1 year ago

edimondi commented 1 year ago

hi there, i have a question if its possible to insert the phone number into windows app textbox when answering the phone call, is there a way to do it? Thanks

InnovateAsterisk commented 1 year ago

Typically the way to read any external text into an application text field, you would add a parameter into the .exe so that you can read this and populate the text field. Something like: “C:/my app.exe 123”. This is typically how this is done.

The problem here is that you want the web page to be able to imitate a call to an executable on your pc… this sounds a lot like virus ;), and probably something that chrome etc are trying to vigorously stop. That being said… there are ways to load browsers in an unsafe way, and maybe it’s possible to just call the url as a file url, with the path to the exe and the number as a parameter… I’m not sure… it may work.

vieridipaola commented 1 year ago

Maybe a "safer" implementation would to make an ajax call to a custom web service within the on_invite web hook where one could pass the client info as well as the phone number. The Windows program would then have to poll the same custom webservice to retrieve the number based on host information.

If Asterisk is the voip server then maybe you can also try connecting the Windows program to listen for AMI events, filter them and get the phone number there instead.

InnovateAsterisk commented 1 year ago

Nice idea. In fact what you would do is host a small web socket service. I think .net May have something out the box. Just make sure your windows app hosts it as 127.0.0.1:XXXX where XXXX is above 1024. Then from the browser connect to the web service as a websocket connection, and parse it json messages based off the built in events.