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.
zecke/wip/sip-invite-cancel
Holger Hans Peter Freyther 7 years ago
parent 90881b6a5a
commit 10e22bd6f4
  1. 3
      src/Makefile.am
  2. 24
      src/call.c
  3. 45
      src/call.h
  4. 2
      src/main.c

@ -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 \

@ -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);

@ -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);

@ -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);

Loading…
Cancel
Save