blob: bab5502c9ba527d06918abc3570364dc0ebdc9a2 (
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
|
struct string_queue {
struct string_queue *next;
char *string;
};
struct call;
typedef struct routing {
struct call *call;
int routing; /* set, if routing is performed (script runs) */
int envc; /* number of environment variables */
const char *envp[256]; /* environment variables */
int envc_dialing; /* envc index for dialing number */
int envc_keypad; /* envc index for keypad */
pid_t script_pid; /* pid of routing script */
int script_stdin; /* pipe to stdin */
int script_stdout; /* pipe from stdout */
int script_stdout_child; /* child side of pipe */
int script_stderr; /* pipe from stderr */
int script_stderr_child; /* child side of pipe */
struct string_queue *stdin_queue; /* strings to write to script */
char stdout_buffer[1024]; /* line buffer when reading from script */
int stdout_pos; /* number of characters in buffer */
struct string_queue *stdout_queue; /* strings read from script */
char stderr_buffer[1024]; /* line buffer when reading from script */
int stderr_pos; /* number of characters in buffer */
struct string_queue *stderr_queue; /* strings read from script */
} routing_t;
void routing_env_msg(routing_t *routing, osmo_cc_msg_t *msg);
void routing_env_dialing(routing_t *routing, const char *number, const char *keypad);
void routing_env_free(routing_t *routing);
void routing_start(routing_t *routing, const char *script, const char *shell);
void routing_stop(routing_t *routing);
void routing_send(routing_t *routing, const char *string);
int routing_handle(routing_t *routing);
/* callbacks */
void routing_receive_stdout(routing_t *routing, const char *string);
void routing_receive_stderr(routing_t *routing, const char *string);
void routing_close(routing_t *routing);
|