summaryrefslogtreecommitdiffstats
path: root/src/router/call.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/router/call.h')
-rw-r--r--src/router/call.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/router/call.h b/src/router/call.h
new file mode 100644
index 0000000..12b62c5
--- /dev/null
+++ b/src/router/call.h
@@ -0,0 +1,84 @@
+
+#include "../libtimer/timer.h"
+#include "../libosmocc/endpoint.h"
+#include "../libosmocc/helper.h"
+#include "../libsample/sample.h"
+#include "../libjitter/jitter.h"
+#include "../libwave/wave.h"
+#include "../libdtmf/dtmf_decode.h"
+
+
+enum call_state {
+ CALL_STATE_IDLE = 0,
+ CALL_STATE_SETUP,
+ CALL_STATE_OVERLAP,
+ CALL_STATE_PROCEEDING,
+ CALL_STATE_ALERTING,
+ CALL_STATE_CONNECT,
+ CALL_STATE_DISC_FROM_ORIG,
+ CALL_STATE_DISC_FROM_TERM,
+};
+
+#include "routing.h"
+
+/* relation to upper layer */
+typedef struct call_relation {
+ struct call_relation *next;
+ int num; /* number counter for debugging */
+ struct call *call; /* points to the call */
+ uint32_t cc_callref; /* callref for each releation */
+ const char *sdp; /* received SDP? */
+ int tones_recv; /* are inband tones available? */
+ jitter_t orig_dejitter; /* jitter buffer for call recording (originating source) */
+ jitter_t term_dejitter; /* jitter buffer for call recording (terminating source) */
+
+ char interface[256]; /* interface */
+ char id[256]; /* caller ID / dialing*/
+ enum call_state state; /* state for status display */
+
+ int rtp_proxy;
+ osmo_cc_session_t *cc_session;
+ int codec_negotiated;
+ osmo_cc_session_codec_t *codec;
+
+ wave_play_t play; /* play a wave file */
+ int play_loop; /* set to play loop */
+ char play_filename[256];/* stored for reopen on loop */
+ double play_deviation; /* stored for reopen on loop */
+ wave_rec_t rec; /* record a wave file */
+ dtmf_dec_t dtmf_dec; /* dtmf decoder */
+ int dtmf_dec_enable;/* feed decoder with data */
+} call_relation_t;
+
+/* call instance */
+typedef struct call {
+ struct call *next;
+ int num; /* number counter for debugging */
+
+ /* call */
+ enum call_state state; /* current state of call */
+ osmo_cc_msg_t *setup_msg; /* stored setup message for later IE forwarding */
+ char dialing_number[256]; /* accumulated dial string (setup + info) */
+ char dialing_keypad[256]; /* accumulated keypad string (setup + info) */
+ int forking; /* set, if call is forked (started with 2 or more calls) */
+ uint8_t collect_cause; /* cause from forking calls */
+ call_relation_t *relation_list; /* list of all upper layer relations */
+ /* NOTE: the first relation is always the originator */
+ int tones_sent; /* did we announce inband tones? */
+ int sdp_forwarded; /* if set, we cannot do RTP-Proxy anymore */
+
+ /* routing */
+ routing_t routing;
+
+ /* audio */
+ double tx_gain; /* gain of what is received from originator */
+ double rx_gain; /* gain of what is transmitted to the originator */
+} call_t;
+
+extern call_t *call_list;
+
+int call_init(osmo_cc_endpoint_t *ep, const char *_routing_script, const char *_routing_shell);
+void call_exit(void);
+int call_handle(void);
+void cc_message(osmo_cc_endpoint_t *ep, uint32_t callref, osmo_cc_msg_t *msg);
+