summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/include/osmocom/bb/mobile/mnccms.h
blob: 929bc8c16e054a465eb7c4a0f9fb80574a51da05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef _MNCCMS_H
#define _MNCCMS_H

#include <osmocom/core/linuxlist.h>

#define DTMF_ST_IDLE		0	/* no DTMF active */
#define DTMF_ST_START		1	/* DTMF started, waiting for resp. */
#define DTMF_ST_MARK		2	/* wait tone duration */
#define DTMF_ST_STOP		3	/* DTMF stopped, waiting for resp. */
#define DTMF_ST_SPACE		4	/* wait space between tones */

#define RINGER_MARK		0, 500000
#define RINGER_SPACE		0, 250000

#define CALL_ST_IDLE		0	/* no state */
#define CALL_ST_MO_INIT		1	/* call initiated, no response yet */
#define CALL_ST_MO_PROC		2	/* call proceeding */
#define CALL_ST_MO_ALERT	3	/* call alerting */
#define CALL_ST_MT_RING		4	/* call ringing */
#define CALL_ST_MT_KNOCK	5	/* call knocking */
#define CALL_ST_ACTIVE		6	/* call connected and active */
#define CALL_ST_HOLD		7	/* call connected, but on hold */
#define CALL_ST_DISC_RX		8	/* call disconnected (disc received) */
#define CALL_ST_DISC_TX		9	/* call disconnected (disc sent)  */

struct gsm_call {
	struct llist_head	entry;

	struct osmocom_ms	*ms;

	uint32_t		callref;

	uint8_t			call_state;

	char			number[33]; /* remote number */

	struct osmo_timer_list	dtmf_timer;
	uint8_t			dtmf_state;
	uint8_t			dtmf_index;
	char			dtmf[32]; /* dtmf sequence */

	struct osmo_timer_list	ringer_timer;
	uint8_t			ringer_state;
};

int mncc_recv_dummy(struct osmocom_ms *ms, int msg_type, void *arg);
int mncc_recv_socket(struct osmocom_ms *ms, int msg_type, void *arg);
int mncc_recv_mobile(struct osmocom_ms *ms, int msg_type, void *arg);
int mnccms_init(struct osmocom_ms *ms);
void mnccms_exit(struct osmocom_ms *ms);
int mncc_call(struct osmocom_ms *ms, char *number);
int mncc_hangup(struct osmocom_ms *ms, int index);
int mncc_answer(struct osmocom_ms *ms, int index);
int mncc_hold(struct osmocom_ms *ms, int index);
int mncc_retrieve(struct osmocom_ms *ms, int index);
int mncc_dtmf(struct osmocom_ms *ms, int index, char *dtmf);
int mncc_list(struct osmocom_ms *ms);

#endif /* _MNCCMS_H */