Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESC key does not work on Windows #139

Closed
GGGO opened this issue Jun 7, 2016 · 2 comments
Closed

ESC key does not work on Windows #139

GGGO opened this issue Jun 7, 2016 · 2 comments

Comments

@GGGO
Copy link
Contributor

GGGO commented Jun 7, 2016

Hi,

on Windows, I can't use ESC key. So it's impossible to cancel any dialing/refer prompt, and to hangup/reject a call with ESC key.

Here a patch for modules/wincons/wincons.c in input_thread():

 static DWORD WINAPI input_thread(LPVOID arg)
 {
        struct ui_st *st = arg;
@@ -85,23 +95,25 @@

        while (st->run) {

-               char buf[4];
+               INPUT_RECORD buf[4];
                DWORD i, count = 0;

-               ReadConsole(st->hstdin, buf, sizeof(buf), &count, NULL);
+               ReadConsoleInput(st->hstdin, buf, sizeof(buf), &count);

                for (i=0; i<count; i++) {
-                       int ch = buf[i];
-
-                       if (ch == '\r')
-                               ch = '\n';
-
-                       /*
-                        * The keys are read from a thread so we have
-                        * to send them to the RE main event loop via
-                        * a message queue
-                        */
-                       mqueue_push(st->mq, ch, 0);
+                       if (buf[i].EventType == KEY_EVENT) {
+                               if (buf[i].Event.KeyEvent.bKeyDown) {
+                                       int ch = buf[i].Event.KeyEvent.uChar.AsciiChar;
+
+                                       if (ch == '\r')
+                                               ch = '\n';
+
+                                       /*
+                                        * The keys are read from a thread so we have
+                                        * to send them to the RE main event loop via
+                                        * a message queue
+                                        */
+                                       mqueue_push(st->mq, ch, 0);
+                               }
+                       }
                }
        }

In the TODO, I can see "improve gui and multi-UA and multi-call interaction", is someone working on this or got some ideas how to implement it ?

Right now, it's impossible to select or switch from many call.

Thanks.

@alfredh alfredh closed this as completed in 249f349 Jun 8, 2016
@alfredh
Copy link
Collaborator

alfredh commented Jun 8, 2016

thanks @GGGO for the patch, it was commit to master (with minor adjustments).

regarding improving the GUI there are plans to do it, and I think we need input from
community regarding how it should work. For example we should add long-string commands
because the single key command space is "used up" ..

example:

'd'    "dial"                Dial remote uri
's'    "sysinfo"             Print system info
       "load_module"         Load a module

This was referenced Jun 9, 2016
@seven1240
Copy link

I think it's two topics so I created #140 and #141

0-wiz-0 pushed a commit to NetBSD/pkgsrc-wip that referenced this issue Sep 6, 2016
Pkgsrc changes:

 * change the build procedure a bit to accommodate modules
 * use the options framework top optionally build a number of modules
 * install example configuration files

Notes:

 On my NetBSD machine the "oss" and "portaudio" modules do not work
 correctly. This is probably due to the fact that the module
 opens and initializes the device twice (once for reading and once
 for writing) but I was unable to diagnose the exact problem.

 A workaround is to use the jack plugin (or pulseaudio) by enabling
 the "jack.so" module in ~/.baresip/config.  The jack server can
 start automatically:

  echo "/usr/pkg/bin/jackd -T -r -d sun" > ~/.jackdrc
  export JACK_START_SERVER=yes

 The sndiod module currently does not build.

Changelog:

2016-07-22 Alfred E. Heggestad <aeh@db.org>

	* Version 0.4.20

	* GIT URL: https://github.com/alfredh/baresip.git
	* GIT tag: v0.4.20
	* NOTE: Requires libre v0.4.17 or later
	        Requires librem v0.4.7 or later

	* new modules:
	  - pulse      Pulseaudio driver
	  - vp9        VP9 video codec

	* config:
	  - audio_path          Path to audio files
	  - call_local_timeout  Timeout for incoming calls
	  - redial_attempts     Number of redial attempts
	  - redial_delay        Redial delay in seconds

	* baresip-core:
	  - baresip: added a global baresip instance (WIP)
	  - call: add RTP timeout (thanks to Sveriges Radio)
	  - config: added call_local_timeout for incoming call timeout
	  - config: added compile-time configureable CONFIG_PATH
	  - config: added 'audio_path' config variable (thanks Juha Heinanen)
	  - net: made it re-entrant with struct network
	  - ua: added uag_set_exit_handler
	  - ua: fix bug with reg_uri limited to 64-chars
	  - video: vidfilters should not modify decoded image

	* selftest:
	  - add test for network
	  - add test for sending SIP OPTIONS
	  - add test for RTP timeout

	* Modules:

	* avcodec: fix usage of deprecated API

	* avformat: remove support for scaling
		    fix usage of deprecated API

	* cons: relay log-messages to active UDP/TCP connections
		baresip/baresip#144

	* h265: fix usage of deprecated API

	* menu: added support for re-dial on failure
		(thanks to Sveriges Radio)

	* mpa: Bug with reinit of codec structs (thanks Christian Hoene)

	* natpmp: added support for RTCP

	* presence: use correct struct in deref handler

	* pulse: new module for Pulseaudio driver
		 (thanks to Matthias Apitz for testing)

	* vidloop: vidfilters should not modify decoded image

	* vp8: module renamed from vpx.so to vp8.so

	* vp9: new module implementing VP9 video codec

	* wincons: use ReadConsoleInput, thanks to GGGO (fixes #139)
		   baresip/baresip#139

2016-05-20 Alfred E. Heggestad <aeh@db.org>

	* Version 0.4.19

	* GIT URL: https://github.com/alfredh/baresip.git
	* GIT tag: v0.4.19
	* NOTE: Requires libre v0.4.14 or later
	        Requires librem v0.4.7 or later

	* new modules:
	  - mpa        MPA Speech and Audio Codec (thanks Christian Hoene)

	* baresip-core:
	  - audio: remove is_g722 exception
		   use aucodec's rtp clockrate for calculating RTP timestamp
		   plc: make sure sampc is exactly one ptime frame
	  - aucodec: split srate into DSP srate and RTP clockrate
		     (these are different for e.g. G.722 and MDA)
	  - mos: add mos_calculate() (thanks Lorenzo Mangani)
	  - net: use configured dns servers only, if specified
	  - ua: fix potential NULL-pointer crash for uag.cfg

	* selftest:
	  - add test for SIP registration with DNS
	  - add test for SIP registration with authentication
	  - add test for MOS calculations
	  - added a mock DNS Server
	  - added a mock SIP Server

	* Modules:

	* aucodec: add support for NV12 and YUVJ420P pixel formats

	* daala: update to libdaala version 0.0-1564-g79787c7

	* gtk: fix autodetection of libgtk+ 2.0 (thanks Charles Lehner)

	* h265: remove call to x265_cleanup, caused crash on OpenBSD

	* mpa: new module that implements MPA Speech and Audio Codec
	       (this module was contributed by Christian Hoene)

	* opus: added new configuration parameters:
		opus_cbr        {yes,no}   # Constant Bitrate (inverse of VBR)
		opus_inbandfec  {yes,no}   # Enable inband FEC
		opus_dtx        {yes,no}   # Enable DTX

	* presence: improved interoperability, allow white space before
		    xml element closing tags (thanks Juha Heinanen)

	* x11: added borderless window (thanks Doug Blewett)

2016-03-12 Alfred E. Heggestad <aeh@db.org>

	* Version 0.4.18

	* GIT URL: https://github.com/alfredh/baresip.git
	* GIT tag: v0.4.18
	* NOTE: Requires libre v0.4.14 or later
	        Requires librem v0.4.7 or later

	* baresip-core:
	  - call: fix SIP INFO with dtmf-relay (thanks Gary Metalle)
	  - ua: add event UA_EVENT_CALL_CLOSED for ua_hangup()

	* selftest:
	  - add tests for answer a call and hangup

	* Modules:

	* alsa: fix potential crash (thanks Gary Metalle)

	* audiounit: fix compilation for iOS (issue #91)

	* avcodec: fix compilation for FFmpeg 3.0

	* avformat: fix compilation for FFmpeg 3.0

	* gtk: always handle incoming calls (thanks Charles Lehner)

	* h265: fix compilation for FFmpeg 3.0

	* menu: add config 'menu_bell  off/on' to enable Bell alert
		add command 'A' for switch audio device (thanks AlexMarlo)

	* v4l2_codec: add list of encoders (fixes #99)

2016-01-17 Alfred E. Heggestad <aeh@db.org>

	* Version 0.4.17

	* GIT URL: https://github.com/alfredh/baresip.git
	* GIT tag: v0.4.17
	* NOTE: Requires libre v0.4.14 or later
	        Requires librem v0.4.7 or later

	* new modules:
	  - echo        Echo server module
	  - jack        JACK Audio Connection Kit audio-driver

	* baresip-core:
	  - config: keep config object in memory
	  - ua: moved playing of ringtones out of core, to "menu" module
		(let's keep the core nice and slim..)
	  - ui: added ui_password_prompt()

	* selftest:
	  - silence debug/info log by default, only print warnings
	    (use -v to see verbose logging)

	* Modules:

	* alsa: added config option to specify the sample format
		"alsa_sample_format    {s16,float,s24_3le}"
		thanks to Ola Palm for valuable feedback

	* audiounit: fix recording on OSX (thanks Sebastian Reimers)
		     print hardware samplerate in debug mode

	* auloop: add support for 44100 Hz samplerate

	* daala: update to latest libdaala API (thanks Dmitrij D. Czarkoff)

	* echo: new module which implements a simple Echo-server, to
		be used in combination with the aubridge.so module.
		contributed by Sebastian Reimers

	* gtk: fixes to support C89 compiler (thanks Dmitrij D. Czarkoff)

	* jack: new module which implements audio-driver for JACK

	* menu: playing of ringtones moved here, from ua.c

	* sndio: fix crash when device open fails (thanks Dmitrij D. Czarkoff)

2015-12-01 Alfred E. Heggestad <aeh@db.org>

	* Version 0.4.16

	* GIT URL: https://github.com/alfredh/baresip.git
	* GIT commit bed2241da3261e472f09b21958f0cc1324a94f27
	* GIT tag: v0.4.16
	* NOTE: Requires libre v0.4.14 or later

	* new modules:
	  - v4l2_codec  Video4Linux2 video codec (H264 hardware encoding)
	  - vidinfo     Video info overlay module

	* baresip-core:
	  - audio: add audio_set_source() and audio_set_player()
	  - audio: flush tx-buffer for all modes (thanks Thibault Gueslin)
	  - call: add call_is_outgoing()
	  - call: check address-family of incoming SDP offer (thanks Olle)
	  - h264: move H.264 packetization code to core
	  - main: add -u option to append extra global UA parameters
	  - main: pre-load modules after all arguments are parsed
	  - ua: add events UA_EVENT_SHUTDOWN,UA_EXIT
	  - ua: add ua_hold_answer()
	  - ua: add ua_set_media_af()
	  - ua: delay mod-unloading if mods has a ref to struct ua

	* build:
	  - add verbose build with V=1 (thanks Dmitrij D. Czarkoff)
	  - add pkg-config file (thanks William King)
	  - add travis.yml file for Github build-system

	* Modules:

	* alsa: fix memory leaks

	* avcodec: move common H.264 packetization code to core

	* cairo: use pkg-config in makefile

	* daala: update to latest libdaala (thanks Dmitrij D. Czarkoff)

	* gst_video: use H.264 packetization API from core

	* gst_video1: use H.264 packetization API from core

	* gtk: fix segmentation fault on window close

	* mwi: add 500ms delay after closing subscription

	* oss: use pthread for ausrc instead of fd_listen (fixes FreeBSD)

	* presence: use sipevent_sock instance from UA core
		    add 500ms delay after closing subscription

	* v4l2_codec: new module

	* vidinfo: new module

	* zrtp: fix ZRTP over TURN by moving helper to layer 10
		fix ZID verification (thanks Ingo Feinerer)

2015-09-26 Alfred E. Heggestad <aeh@db.org>

	* Version 0.4.15

	* GIT URL: https://github.com/alfredh/baresip.git
	* GIT commit 86262a6fc17e19e2be82eb8a2a05ec0f884d3d38
	* GIT tag: v0.4.15
	* NOTE: Requires libre v0.4.13 or later

	* added selftest binary

	* baresip-core:
	  - audio: fix televent when pt != 101 (reported by AndyJRobinson)
	  - magic: use __func__ for C99 or later
	  - sip: make sip_req_send() public
	  - ua: add UA_EVENT_CALL_DTMF_START/END, thanks Gary Metalle

	* Modules:

	* alsa: added extra logging

	* gtk: add support for libnotify (thanks Charles Lehner)

	* video: fix potential null deref (thanks Tomasz Ostrowski)

	* zrtp: added 36-bytes preamble for TURN-header

2015-08-08 Alfred E. Heggestad <aeh@db.org>

	* Version 0.4.14

	* GIT URL: https://github.com/alfredh/baresip.git
	* GIT commit ebac23b0692de71ee4c3a436f0372013150c937f
	* GIT tag: v0.4.14
	* NOTE: Requires libre v0.4.13 or later

	* new modules:
	  - gtk		GTK+ 2.0 UI (thanks Charles E. Lehner)
	  - gst1	Gstreamer 1.0 audio module
	  - gst_video1	Gstreamer 1.0 video module (thanks Thomas Strobel)
	  - daala	Experimental video-codec using Daala

	* baresip-core:
	  - baresip: added -m argument to pre-load modules
	  - config: add kqueue to sample config (thanks Dmitrij D. Czarkoff)
	  - log: make code C89 compliant (thanks Victor Sergienko)
	  - module: added module_preload()
	  - ua: add CALL_EVENT_TRANSFER_FAILED
	  - ua: skip initial white space from uri (thanks Juha Heinanen)
	  - ua: ua_prev_call()
	  - videnc: move videnc_packet_h to update-handler

	* build:
	  - added optional $(MOD)_CFLAGS for local module CFLAGS
	  - added project file for Visual C++ Express 2010
	  - freebsd: add include path to $(SYSROOT)/local/include
	    (thanks Hellmuth Michaelis)

	* Modules:

	* avcodec: make code C89 compliant (thanks Victor Sergienko)

	* cons: make code C89 compliant (thanks Victor Sergienko)

	* daala: new module

	* dshow: updates for VC2010 (thanks Victor Sergienko)

	* gst1: new module

	* gst_video1: new module

	* gtk: new module

	* menu: fix crash when 0 UAs (thanks Hans Petter Selasky)
		added command 'H' to hold previous call (thanks xanm)

	* wincons: make code C89 compliant (thanks ggcoding)

2015-06-20 Alfred E. Heggestad <aeh@db.org>

	* Version 0.4.13

	* GIT commit 2e3e825ef5532dfde5a8b52de9ebaac51aa20a9c
	* NOTE: Requires libre v0.4.12 or later

	* new modules:
	  - aufile      Audio module for using a WAV-file as audio input
	  - b2bua       Back-to-Back User-Agent (B2BUA) module
	  - codec2      CODEC2 audio codec
	  - gst_video   Gstreamer video codec
	  - h265        H.265 (HEVC) video codec

	* baresip-core:
	  - contact: add support for access-control (thanks Doug Blewett)
	  - ausrc: change base-class to a const pointer
	  - auplay: change base-class to a const pointer
	  - vidsrc: change base-class to a const pointer
	  - vidisp: change base-class to a const pointer
	  - video: smooth sending of video packets

	* Modules:

	* amr: added support for octet-align mode (thanks to Stefan Sayer)

	* aubridge: copy audio-samples if resampler not needed

	* aufile: new module for using a WAV-file as audio source

	* avcapture: only register 1 video source

	* avformat: fix segfault on recent versions of libav

	* b2bua: new experimental module

	* codec2: new module for CODEC2 audio codec

	* dtls_srtp: uppercase fingerprint, interop (thanks Juha Heinanen)
		     alternative SDP protocols for interop

	* dtmfio: unregister event handler on close (thanks Hellmuth Michaelis)

	* gst_video: new module using Gstreamer as a video codec
		     (Thanks to Victor Sergienko and Fadeev Alexander)

	* h265: new module for H.265 video codec

	* httpd: added raw mode (thanks Lorenzo Mangani)

	* menu: create user-agent with a command 'R' (thanks Lorenzo Mangani)

	* opus: add configuration of "opus_bitrate"
		(thanks to Juha Heinanen)

	* speex: add configuration of "speex_mode_nb" and "speex_mode_wb"
		 (thanks to Dmitrij D. Czarkoff and Juha Heinanen)

	* vidloop: add VIDLOOP_INTERNAL_FMT and split encoder/decoder

	* x11: catch Window delete (thanks to Doug Blewett)

	* zrtp: initialize remote_zid (thanks to Ingo Feinerer)

2014-12-24 Alfred E. Heggestad <aeh@db.org>

	* Version 0.4.12

	* GIT commit 67993e35d980375458348b264c4a35a944bb5180
	* NOTE: Requires libre v0.4.11 or later

	* baresip:
	  - account: add regint and pubint
	  - audio: fix checking of sample-rate range
	  - config: remove the "input" block
	  - config: added support for quoted device parameters
	  - config: fix conversion of bandwidth to kbit/s
	  - config: generate more relevant config for FreeBSD and OpenBSD
		    (thanks Dmitrij D. Czarkoff)
	  - reg: add support for extracting GRUU parameter
	  - main: add -p option to set path to audio files
	  - sipreq: make response-handler optional
	  - ua: add support for GRUU (RFC 5627)
	    (many thanks to Juha Heinanen for starting this work and
	     helping out with the testing)
	  - ua: moved presence-status to each struct ua instance
	  - ua: add presence status to each User-Agent instance
	  - ua: use public-GRUU if set, otherwise local cuser
	  - ui: make UI single instance
	  - video: add VIDENC_INTERNAL_FMT (suggested by Victor Sergienko)

	* docs: added sample configuration files

	* account: added pubint for Publishing Interval

	* avcodec: upgrade to recent ffmpeg/libav APIs
		   either FFmpeg or libav can be used

	* celt: deleted module (replaced by opus)

	* cons: update usage of struct ui, added output handler
		added config: cons_listen    0.0.0.0:5555

	* evdev: update usage of struct ui, added output handler
		 added config: evdev_device    /dev/input/event0

	* httpd: added ui output handler

	* menu: added command 'o' for sending OPTION request
		(thanks to Juha Heinanen)

		added command 'D' for accepting incoming calls

	* mwi: subscribe to MWI after Registration succeeded
	       (thanks to Juha Heinanen)

	* opensles: add double-buffering and some tuning
		    (thanks to Francesco Bradascio)

	* opus: added config "opus_bitrate" (thanks to Sebastian Reimers)

	* presence: added support for PUBLISH (thanks to Juha Heinanen)
		    interop fixes and tuning

	* stdio: update usage of struct ui, added output handler

	* uuid: use internal version of generating UUID

	* v4l2: use memory mapped mode only

	* vumeter: dont call tmr_start from non-RE thread

	* wincons: update usage of struct ui, added output handler

	* winwave: fix bug when closing player device
		   (thanks to Tomasz Ostrowski)
		   add support for mapping device name to index

	* zrtp: add support for verify SAS (thanks to Ingo Feinerer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants