1 /* $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_app_common.h" 28 29 PJ_BEGIN_DECL 30 31 /** 32 * This structure contains the configuration of application. 33 */ 34 typedef struct pjsua_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 void (*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 } pjsua_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 */ 71 pj_status_t pjsua_app_init(const pjsua_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 */ 79 pj_status_t pjsua_app_run(pj_bool_t wait_telnet_cli); 80 81 /** 82 * This will destroy/cleanup the application library. 83 */ 84 pj_status_t pjsua_app_destroy(void); 85 86 PJ_END_DECL 87 88 #endif /* __PJSUA_APP_H__ */ 89