summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-12-16 16:53:56 +0100
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-12-16 16:53:56 +0100
commitc36b42303285fb629145f92a7668a97397e69af0 (patch)
treebf393219bca1c1e3a8f748ef92149ca978003546
parent3e68bd83525b5fc295e39223d50a497e5da44b83 (diff)
event: new file for generic event handling
-rw-r--r--src/event.c40
-rw-r--r--src/srcs.mk1
-rw-r--r--src/ua.c31
3 files changed, 41 insertions, 31 deletions
diff --git a/src/event.c b/src/event.c
new file mode 100644
index 0000000..77b5676
--- /dev/null
+++ b/src/event.c
@@ -0,0 +1,40 @@
+/**
+ * @file src/event.c Baresip event handling
+ *
+ * Copyright (C) 2017 Creytiv.com
+ */
+
+#include <re.h>
+#include <baresip.h>
+#include "core.h"
+
+
+/**
+ * Get the name of the User-Agent event
+ *
+ * @param ev User-Agent event
+ *
+ * @return Name of the event
+ */
+const char *uag_event_str(enum ua_event ev)
+{
+ switch (ev) {
+
+ case UA_EVENT_REGISTERING: return "REGISTERING";
+ case UA_EVENT_REGISTER_OK: return "REGISTER_OK";
+ case UA_EVENT_REGISTER_FAIL: return "REGISTER_FAIL";
+ case UA_EVENT_UNREGISTERING: return "UNREGISTERING";
+ case UA_EVENT_SHUTDOWN: return "SHUTDOWN";
+ case UA_EVENT_EXIT: return "EXIT";
+ case UA_EVENT_CALL_INCOMING: return "CALL_INCOMING";
+ case UA_EVENT_CALL_RINGING: return "CALL_RINGING";
+ case UA_EVENT_CALL_PROGRESS: return "CALL_PROGRESS";
+ case UA_EVENT_CALL_ESTABLISHED: return "CALL_ESTABLISHED";
+ case UA_EVENT_CALL_CLOSED: return "CALL_CLOSED";
+ case UA_EVENT_CALL_TRANSFER_FAILED: return "TRANSFER_FAILED";
+ case UA_EVENT_CALL_DTMF_START: return "CALL_DTMF_START";
+ case UA_EVENT_CALL_DTMF_END: return "CALL_DTMF_END";
+ case UA_EVENT_CALL_RTCP: return "CALL_RTCP";
+ default: return "?";
+ }
+}
diff --git a/src/srcs.mk b/src/srcs.mk
index 686ca7c..a35e0d8 100644
--- a/src/srcs.mk
+++ b/src/srcs.mk
@@ -17,6 +17,7 @@ SRCS += cmd.c
SRCS += conf.c
SRCS += config.c
SRCS += contact.c
+SRCS += event.c
SRCS += log.c
SRCS += menc.c
SRCS += message.c
diff --git a/src/ua.c b/src/ua.c
index b736bf3..0467e35 100644
--- a/src/ua.c
+++ b/src/ua.c
@@ -1633,37 +1633,6 @@ struct tls *uag_tls(void)
/**
- * Get the name of the User-Agent event
- *
- * @param ev User-Agent event
- *
- * @return Name of the event
- */
-const char *uag_event_str(enum ua_event ev)
-{
- switch (ev) {
-
- case UA_EVENT_REGISTERING: return "REGISTERING";
- case UA_EVENT_REGISTER_OK: return "REGISTER_OK";
- case UA_EVENT_REGISTER_FAIL: return "REGISTER_FAIL";
- case UA_EVENT_UNREGISTERING: return "UNREGISTERING";
- case UA_EVENT_SHUTDOWN: return "SHUTDOWN";
- case UA_EVENT_EXIT: return "EXIT";
- case UA_EVENT_CALL_INCOMING: return "CALL_INCOMING";
- case UA_EVENT_CALL_RINGING: return "CALL_RINGING";
- case UA_EVENT_CALL_PROGRESS: return "CALL_PROGRESS";
- case UA_EVENT_CALL_ESTABLISHED: return "CALL_ESTABLISHED";
- case UA_EVENT_CALL_CLOSED: return "CALL_CLOSED";
- case UA_EVENT_CALL_TRANSFER_FAILED: return "TRANSFER_FAILED";
- case UA_EVENT_CALL_DTMF_START: return "CALL_DTMF_START";
- case UA_EVENT_CALL_DTMF_END: return "CALL_DTMF_END";
- case UA_EVENT_CALL_RTCP: return "CALL_RTCP";
- default: return "?";
- }
-}
-
-
-/**
* Find the correct UA from the contact user
*
* @param cuser Contact username