summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-03-22 14:47:38 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-03-22 16:32:48 +0100
commit10e22bd6f4ebc93e9467fec98a27585a34fcb5d8 (patch)
treeabd3ed98d836d5e5de974379047de3f4ef855ac6
parent90881b6a5a908f8c1b9745ca7b4eea299d8cacdc (diff)
call: Introduce a structure for representing a call
Right now a call has two legs, the initial one and the remote. In general this will allow a SIP to SIP, SIP to MNCC and MNCC to MNCC structure in the future.
-rw-r--r--src/Makefile.am3
-rw-r--r--src/call.c24
-rw-r--r--src/call.h45
-rw-r--r--src/main.c2
4 files changed, 73 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 4052dea..0c04d50 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,9 +3,10 @@ bin_PROGRAMS = osmo-sip-connector
AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(SOFIASIP_CFLAGS)
noinst_HEADERS = \
- evpoll.h vty.h mncc_protocol.h app.h mncc.h sip.h
+ evpoll.h vty.h mncc_protocol.h app.h mncc.h sip.h call.h
osmo_sip_connector_SOURCES = \
+ call.c \
sip.c \
mncc.c \
evpoll.c \
diff --git a/src/call.c b/src/call.c
new file mode 100644
index 0000000..464530f
--- /dev/null
+++ b/src/call.c
@@ -0,0 +1,24 @@
+/*
+ * (C) 2016 by Holger Hans Peter Freyther
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "call.h"
+
+
+LLIST_HEAD(g_call_list);
diff --git a/src/call.h b/src/call.h
new file mode 100644
index 0000000..4e8e662
--- /dev/null
+++ b/src/call.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#include <osmocom/core/linuxlist.h>
+
+struct sip_agent;
+struct mncc_connection;
+
+struct call_leg;
+
+/**
+ * One instance of a call with two legs. The initial
+ * field will always be used by the entity that has
+ * launched the call.
+ */
+struct call {
+ struct llist_head entry;
+
+ struct call_leg *initial;
+ struct call_leg *remote;
+};
+
+enum {
+ CALL_TYPE_NONE,
+ CALL_TYPE_SIP,
+ CALL_TYPE_MNCC,
+};
+
+struct call_leg {
+ int type;
+};
+
+struct sip_call_leg {
+ struct call_leg base;
+
+ struct sip_agent *agent;
+};
+
+struct mncc_call_leg {
+ struct call_leg base;
+
+ struct mncc_connection *conn;
+};
+
+extern struct llist_head g_call_list;
+void calls_init(void);
diff --git a/src/main.c b/src/main.c
index d62e652..3e5e08a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,6 +25,7 @@
#include "logging.h"
#include "mncc.h"
#include "app.h"
+#include "call.h"
#include <osmocom/core/application.h>
#include <osmocom/core/utils.h>
@@ -147,6 +148,7 @@ int main(int argc, char **argv)
exit(1);
}
+ calls_init();
/* marry sofia-sip to glib and glib to libosmocore */
loop = g_main_loop_new(NULL, FALSE);