void proxy_init_all(void) { pj_status_t status; global.port = 5060; global.record_route = 0; pj_log_set_level(5); status = init_stack(); if (status != PJ_SUCCESS) { app_perror("Error initializing stack", status); return; } status = init_proxy(); if (status != PJ_SUCCESS) { app_perror("Error initializing proxy", status); return; } status = init_stateful_proxy(); if (status != PJ_SUCCESS) { app_perror("Error initializing stateful proxy", status); return; } return; }
/* * main() */ int main(int argc, char *argv[]) { pj_status_t status; global.port = 5060; global.record_route = 0; pj_log_set_level(4); status = init_options(argc, argv); if (status != PJ_SUCCESS) return 1; status = init_stack(); if (status != PJ_SUCCESS) { app_perror("Error initializing stack", status); return 1; } status = init_proxy(); if (status != PJ_SUCCESS) { app_perror("Error initializing proxy", status); return 1; } status = init_stateful_proxy(); if (status != PJ_SUCCESS) { app_perror("Error initializing stateful proxy", status); return 1; } #if PJ_HAS_THREADS status = pj_thread_create(global.pool, "sproxy", &worker_thread, NULL, 0, 0, &global.thread); if (status != PJ_SUCCESS) { app_perror("Error creating thread", status); return 1; } while (!global.quit_flag) { char line[10]; puts("\n" "Menu:\n" " q quit\n" " d dump status\n" " dd dump detailed status\n" ""); if (fgets(line, sizeof(line), stdin) == NULL) { puts("EOF while reading stdin, will quit now.."); global.quit_flag = PJ_TRUE; break; } if (line[0] == 'q') { global.quit_flag = PJ_TRUE; } else if (line[0] == 'd') { pj_bool_t detail = (line[1] == 'd'); pjsip_endpt_dump(global.endpt, detail); pjsip_tsx_layer_dump(detail); } } pj_thread_join(global.thread); #else puts("\nPress Ctrl-C to quit\n"); for (;;) { pj_time_val delay = {0, 0}; pjsip_endpt_handle_events(global.endpt, &delay); } #endif destroy_stack(); return 0; }