Created
November 2, 2014 07:53
-
-
Save hiroeorz/4feb11e7a6b5cbd3f41f to your computer and use it in GitHub Desktop.
PJSUA API - High Level Softphone API 日本語訳 ref: http://qiita.com/hiroeorz@github/items/348668b461b661f51acc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pjsua-lib/pjsua.h> | |
#define THIS_FILE __FILE__ | |
static pj_status_t app_init(void) | |
{ | |
pjsua_config ua_cfg; | |
pjsua_logging_config log_cfg; | |
pjsua_media_config media_cfg; | |
pj_status_t status; | |
// Must create pjsua before anything else! | |
status = pjsua_create(); | |
if (status != PJ_SUCCESS) { | |
pjsua_perror(THIS_FILE, "Error initializing pjsua", status); | |
return status; | |
} | |
// Initialize configs with default settings. | |
pjsua_config_default(&ua_cfg); | |
pjsua_logging_config_default(&log_cfg); | |
pjsua_media_config_default(&media_cfg); | |
// At the very least, application would want to override | |
// the call callbacks in pjsua_config: | |
ua_cfg.cb.on_incoming_call = ... | |
ua_cfg.cb.on_call_state = .. | |
... | |
// Customize other settings (or initialize them from application specific | |
// configuration file): | |
... | |
// Initialize pjsua | |
status = pjsua_init(&ua_cfg, &log_cfg, &media_cfg); | |
if (status != PJ_SUCCESS) { | |
pjsua_perror(THIS_FILE, "Error initializing pjsua", status); | |
return status; | |
} | |
. | |
... | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static pj_status_t app_run(void) | |
{ | |
pj_status_t status; | |
// Start pjsua | |
status = pjsua_start(); | |
if (status != PJ_SUCCESS) { | |
pjsua_destroy(); | |
pjsua_perror(THIS_FILE, "Error starting pjsua", status); | |
return status; | |
} | |
// Run application loop | |
while (1) { | |
char choice[10]; | |
printf("Select menu: "); | |
fgets(choice, sizeof(choice), stdin); | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment