blob: 46dcd937f142ab3d86db6164f1da2f3fce967a33 [file] [log] [blame]
Riza Sulistyo0c5d8f72013-04-19 06:05:06 +00001/* $Id$ */
2/*
3 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __PJSUA_APP_H__
21#define __PJSUA_APP_H__
22
23/**
24 * Interface for user application to use pjsua with CLI/menu based UI.
25 */
26
27#include "pjsua_common.h"
28
29PJ_BEGIN_DECL
30
31/**
32 * This structure contains the configuration of application.
33 */
34typedef struct app_cfg_t
35{
36 /**
37 * The number of runtime arguments passed to the application.
38 */
39 int argc;
40
41 /**
42 * The array of arguments string passed to the application.
43 */
44 char **argv;
45
46 /**
47 * Tell app that CLI (and pjsua) is (re)started.
48 * msg will contain start error message such as “Telnet to X:Y”,
49 * “failed to start pjsua lib”, “port busy”..
50 */
51 void (*on_started)(pj_status_t status, const char* title);
52
53 /**
54 * Tell app that library request to stopped/restart.
55 * GUI app needs to use a timer mechanism to wait before invoking the
56 * cleanup procedure.
57 */
58 pj_bool_t (*on_stopped)(pj_bool_t restart, int argc, char** argv);
59
60 /**
61 * This will enable application to supply customize configuration other than
62 * the basic configuration provided by pjsua.
63 */
64 void (*on_config_init)(pjsua_app_config *cfg);
65} app_cfg_t;
66
67/**
68 * This will initiate the pjsua and the user interface (CLI/menu UI) based on
69 * the provided configuration.
70 */
71PJ_DECL(pj_status_t) app_init(const app_cfg_t *app_cfg);
72
73/**
74 * This will run the CLI/menu based UI.
75 * wait_telnet_cli is used for CLI based UI. It will tell the library to block
76 * or wait until user invoke the "shutdown"/"restart" command. GUI based app
77 * should define this param as PJ_FALSE.
78 */
79PJ_DECL(pj_status_t) app_run(pj_bool_t wait_telnet_cli);
80
81/**
82 * This will destroy/cleanup the application library.
83 */
84PJ_DECL(pj_status_t) app_destroy();
85
86PJ_END_DECL
87
88#endif /* __PJSUA_APP_H__ */