diff options
author | Alfred E. Heggestad <aeh@db.org> | 2016-01-03 19:22:15 +0100 |
---|---|---|
committer | Alfred E. Heggestad <aeh@db.org> | 2016-01-03 19:22:15 +0100 |
commit | 3d55e9a0550365c19ad3370f146bcc6e656fd9da (patch) | |
tree | 11024c5a2044ab223f172f60aa601981d5fc91a1 /modules | |
parent | c6d7b657441b2025a9a70da42951e7ca53328474 (diff) | |
parent | a6455ae9826a65c1b409025a699c1399572d6011 (diff) |
Merge branch 'master' into jack
Diffstat (limited to 'modules')
-rw-r--r-- | modules/aufile/aufile.c | 2 | ||||
-rw-r--r-- | modules/avformat/avformat.c | 1 | ||||
-rw-r--r-- | modules/cairo/cairo.c | 1 | ||||
-rw-r--r-- | modules/contact/contact.c | 2 | ||||
-rw-r--r-- | modules/echo/echo.c | 157 | ||||
-rw-r--r-- | modules/echo/module.mk | 9 | ||||
-rw-r--r-- | modules/fakevideo/fakevideo.c | 1 | ||||
-rw-r--r-- | modules/gst1/gst.c | 7 | ||||
-rw-r--r-- | modules/gst_video/encode.c | 2 | ||||
-rw-r--r-- | modules/gtk/gtk_mod.c | 6 | ||||
-rw-r--r-- | modules/mwi/mwi.c | 2 | ||||
-rw-r--r-- | modules/rst/audio.c | 2 | ||||
-rw-r--r-- | modules/rst/video.c | 2 | ||||
-rw-r--r-- | modules/snapshot/png_vf.c | 1 | ||||
-rw-r--r-- | modules/v4l/v4l.c | 1 | ||||
-rw-r--r-- | modules/v4l2/v4l2.c | 1 | ||||
-rw-r--r-- | modules/vidloop/vidloop.c | 1 | ||||
-rw-r--r-- | modules/x11grab/x11grab.c | 1 |
18 files changed, 183 insertions, 16 deletions
diff --git a/modules/aufile/aufile.c b/modules/aufile/aufile.c index 0fc9faa..9422b7a 100644 --- a/modules/aufile/aufile.c +++ b/modules/aufile/aufile.c @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Creytiv.com */ - +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <pthread.h> #include <re.h> diff --git a/modules/avformat/avformat.c b/modules/avformat/avformat.c index 8424707..cabb103 100644 --- a/modules/avformat/avformat.c +++ b/modules/avformat/avformat.c @@ -3,6 +3,7 @@ * * Copyright (C) 2010 - 2015 Creytiv.com */ +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <unistd.h> #include <string.h> diff --git a/modules/cairo/cairo.c b/modules/cairo/cairo.c index 7ca83b1..438e654 100644 --- a/modules/cairo/cairo.c +++ b/modules/cairo/cairo.c @@ -3,6 +3,7 @@ * * Copyright (C) 2010 Creytiv.com */ +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <unistd.h> #include <pthread.h> diff --git a/modules/contact/contact.c b/modules/contact/contact.c index 18bd9c0..ef10bc8 100644 --- a/modules/contact/contact.c +++ b/modules/contact/contact.c @@ -159,7 +159,7 @@ static int write_template(const char *file) "\"%s\" <sip:%s@%s>;presence=p2p\n" "\n" "# Access rules\n" - "\"Catch All\" <sip:*@*>;access=block\n" + "#\"Catch All\" <sip:*@*>;access=block\n" "\"Good Friend\" <sip:good@friend.com>;access=allow\n" "\n" , diff --git a/modules/echo/echo.c b/modules/echo/echo.c new file mode 100644 index 0000000..3fac5ba --- /dev/null +++ b/modules/echo/echo.c @@ -0,0 +1,157 @@ +/** + * @file echo.c Echo module + */ +#include <re.h> +#include <baresip.h> + +/** + * + * Multi Call Echo module + * + * REQUIRES: aubridge + * NOTE: This module is experimental. + * + */ + +struct session { + struct le le; + struct call *call_in; +}; + + +static struct list sessionl; + + +static void destructor(void *arg) +{ + struct session *sess = arg; + + debug("echo: session destroyed (in=%p)\n", + sess->call_in); + + list_unlink(&sess->le); + mem_deref(sess->call_in); +} + + +static void call_event_handler(struct call *call, enum call_event ev, + const char *str, void *arg) +{ + struct session *sess = arg; + + switch (ev) { + + case CALL_EVENT_CLOSED: + debug("echo: CALL_CLOSED: %s\n", str); + mem_deref(sess); + break; + + default: + break; + } +} + + +static void call_dtmf_handler(struct call *call, char key, void *arg) +{ + (void)arg; + + debug("echo: relaying DTMF event: key = '%c'\n", key ? key : '.'); + + call_send_digit(call, key); +} + + +static int new_session(struct call *call) +{ + struct session *sess; + char a[64]; + int err = 0; + + sess = mem_zalloc(sizeof(*sess), destructor); + if (!sess) + return ENOMEM; + + sess->call_in = call; + + re_snprintf(a, sizeof(a), "A-%x", sess); + + audio_set_devicename(call_audio(sess->call_in), a, a); + + call_set_handlers(sess->call_in, call_event_handler, + call_dtmf_handler, sess); + + list_append(&sessionl, &sess->le, sess); + ua_answer(uag_current(), NULL); + + if (err) + mem_deref(sess); + + return err; +} + + +static void ua_event_handler(struct ua *ua, enum ua_event ev, + struct call *call, const char *prm, void *arg) +{ + int err; + (void)prm; + (void)arg; + + switch (ev) { + + case UA_EVENT_CALL_INCOMING: + debug("echo: CALL_INCOMING: peer=%s --> local=%s\n", + call_peeruri(call), + call_localuri(call)); + + err = new_session(call); + if (err) { + ua_hangup(ua, call, 500, "Server Error"); + } + break; + + default: + break; + } +} + + +static int module_init(void) +{ + int err; + + list_init(&sessionl); + + err = uag_event_register(ua_event_handler, 0); + if (err) + return err; + + debug("echo: module loaded\n"); + + return 0; +} + + +static int module_close(void) +{ + debug("echo: module closing..\n"); + + if (!list_isempty(&sessionl)) { + + info("echo: flushing %u sessions\n", list_count(&sessionl)); + list_flush(&sessionl); + } + + uag_event_unregister(ua_event_handler); + + return 0; +} + + +const struct mod_export DECL_EXPORTS(echo) = { + "echo", + "application", + module_init, + module_close +}; diff --git a/modules/echo/module.mk b/modules/echo/module.mk new file mode 100644 index 0000000..0c7ee6f --- /dev/null +++ b/modules/echo/module.mk @@ -0,0 +1,9 @@ +# +# module.mk +# +# + +MOD := echo +$(MOD)_SRCS += echo.c + +include mk/mod.mk diff --git a/modules/fakevideo/fakevideo.c b/modules/fakevideo/fakevideo.c index 2c85372..c750814 100644 --- a/modules/fakevideo/fakevideo.c +++ b/modules/fakevideo/fakevideo.c @@ -3,6 +3,7 @@ * * Copyright (C) 2010 Creytiv.com */ +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <unistd.h> #include <pthread.h> diff --git a/modules/gst1/gst.c b/modules/gst1/gst.c index bae477d..8ecd85f 100644 --- a/modules/gst1/gst.c +++ b/modules/gst1/gst.c @@ -158,9 +158,6 @@ static void format_check(struct ausrc_st *st, GstStructure *s) gst_structure_get_int(s, "width", &width); gst_structure_get_boolean(s, "signed", &sign); - re_printf(" format: rate=%d, channels=%d, width=%d, sign=%d\n", - rate, channels, width, sign); - if ((int)st->prm.srate != rate) { warning("gst: expected %u Hz (got %u Hz)\n", st->prm.srate, rate); @@ -236,11 +233,7 @@ static void handoff_handler(GstFakeSink *fakesink, GstBuffer *buffer, { struct ausrc_st *st = user_data; GstCaps *caps; - - re_printf(" handoff handler\n"); - (void)fakesink; - (void)pad; caps = gst_pad_get_current_caps(pad); diff --git a/modules/gst_video/encode.c b/modules/gst_video/encode.c index 948b98a..8abe017 100644 --- a/modules/gst_video/encode.c +++ b/modules/gst_video/encode.c @@ -4,7 +4,7 @@ * Copyright (C) 2010 - 2013 Creytiv.com * Copyright (C) 2014 Fadeev Alexander */ - +#define _DEFAULT_SOURCE 1 #define __USE_POSIX199309 #define _BSD_SOURCE 1 #include <stdlib.h> diff --git a/modules/gtk/gtk_mod.c b/modules/gtk/gtk_mod.c index 67f40cb..83000d6 100644 --- a/modules/gtk/gtk_mod.c +++ b/modules/gtk/gtk_mod.c @@ -308,6 +308,9 @@ static void notify_incoming_call(struct gtk_mod *mod, const char *msg = call_peeruri(call); GtkWidget *call_menu; GtkWidget *menu_item; +#if defined(USE_LIBNOTIFY) + NotifyNotification *notification; +#endif #if GLIB_CHECK_VERSION(2,40,0) char id[64]; @@ -337,8 +340,7 @@ static void notify_incoming_call(struct gtk_mod *mod, /* If glib does not have GNotification, use libnotify instead. */ if (!notify_is_initted()) return; - NotifyNotification* notification = notify_notification_new(title, - msg, "baresip"); + notification = notify_notification_new(title, msg, "baresip"); notify_notification_set_urgency(notification, NOTIFY_URGENCY_CRITICAL); notify_notification_show(notification, NULL); g_object_unref(notification); diff --git a/modules/mwi/mwi.c b/modules/mwi/mwi.c index e2c9a1d..2b94131 100644 --- a/modules/mwi/mwi.c +++ b/modules/mwi/mwi.c @@ -150,8 +150,6 @@ static void ua_event_handler(struct ua *ua, (void)prm; (void)arg; - info("mwi: got event %d (%s)\n", ev, uag_event_str(ev)); - if (ev == UA_EVENT_REGISTER_OK) { if (!mwi_find(ua)) diff --git a/modules/rst/audio.c b/modules/rst/audio.c index f6dd4e8..8dc5175 100644 --- a/modules/rst/audio.c +++ b/modules/rst/audio.c @@ -3,7 +3,7 @@ * * Copyright (C) 2011 Creytiv.com */ - +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <pthread.h> #include <fcntl.h> diff --git a/modules/rst/video.c b/modules/rst/video.c index 139c9f7..b252504 100644 --- a/modules/rst/video.c +++ b/modules/rst/video.c @@ -3,7 +3,7 @@ * * Copyright (C) 2011 Creytiv.com */ - +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <pthread.h> #include <string.h> diff --git a/modules/snapshot/png_vf.c b/modules/snapshot/png_vf.c index d7f1f8a..6c5c18a 100644 --- a/modules/snapshot/png_vf.c +++ b/modules/snapshot/png_vf.c @@ -4,6 +4,7 @@ * Author: Doug Blewett * Review: Alfred E. Heggestad */ +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <string.h> #include <time.h> diff --git a/modules/v4l/v4l.c b/modules/v4l/v4l.c index e6842b1..46d4ca7 100644 --- a/modules/v4l/v4l.c +++ b/modules/v4l/v4l.c @@ -3,6 +3,7 @@ * * Copyright (C) 2010 Creytiv.com */ +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <unistd.h> #include <stdlib.h> diff --git a/modules/v4l2/v4l2.c b/modules/v4l2/v4l2.c index 0dbad00..b450a9e 100644 --- a/modules/v4l2/v4l2.c +++ b/modules/v4l2/v4l2.c @@ -3,6 +3,7 @@ * * Copyright (C) 2010 Creytiv.com */ +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <unistd.h> #include <stdlib.h> diff --git a/modules/vidloop/vidloop.c b/modules/vidloop/vidloop.c index ff38281..9d05618 100644 --- a/modules/vidloop/vidloop.c +++ b/modules/vidloop/vidloop.c @@ -3,6 +3,7 @@ * * Copyright (C) 2010 Creytiv.com */ +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <string.h> #include <time.h> diff --git a/modules/x11grab/x11grab.c b/modules/x11grab/x11grab.c index 1ab88ed..ecbcba5 100644 --- a/modules/x11grab/x11grab.c +++ b/modules/x11grab/x11grab.c @@ -3,6 +3,7 @@ * * Copyright (C) 2010 Creytiv.com */ +#define _DEFAULT_SOURCE 1 #define _BSD_SOURCE 1 #include <unistd.h> #ifndef SOLARIS |