diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-12-05 04:30:04 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-12-05 04:30:04 +0000 |
commit | 0867865e82fcdd71fc78c90ca9c1c833ef5882d6 (patch) | |
tree | 02dc460ddee900db82be6d8bfe72cdb2548ee0e0 /pjsip-apps | |
parent | 40abf25871619b6bd4adae021c2421a4291d32e9 (diff) |
Reverted accidental checkin of pjsua_app.c and sample_debug.c
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1620 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps')
-rw-r--r-- | pjsip-apps/src/pjsua/pjsua_app.c | 49 | ||||
-rw-r--r-- | pjsip-apps/src/samples/debug.c | 113 |
2 files changed, 7 insertions, 155 deletions
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c index 5071a053..fe92fa2d 100644 --- a/pjsip-apps/src/pjsua/pjsua_app.c +++ b/pjsip-apps/src/pjsua/pjsua_app.c @@ -91,8 +91,6 @@ static struct app_config static pjsua_call_id current_call = PJSUA_INVALID_ID; static pj_str_t uri_arg; -static pjsua_transport_id tls_id; - #ifdef STEREO_DEMO static void stereo_demo(); #endif @@ -569,8 +567,8 @@ static pj_status_t parse_args(int argc, char *argv[], case OPT_NO_UDP: /* no-udp */ if (cfg->no_tcp) { - //PJ_LOG(1,(THIS_FILE,"Error: cannot disable both TCP and UDP")); - //return PJ_EINVAL; + PJ_LOG(1,(THIS_FILE,"Error: can not disable both TCP and UDP")); + return PJ_EINVAL; } cfg->no_udp = PJ_TRUE; @@ -582,8 +580,8 @@ static pj_status_t parse_args(int argc, char *argv[], case OPT_NO_TCP: /* no-tcp */ if (cfg->no_udp) { - //PJ_LOG(1,(THIS_FILE,"Error: cannot disable both TCP and UDP")); - //return PJ_EINVAL; + PJ_LOG(1,(THIS_FILE,"Error: can not disable both TCP and UDP")); + return PJ_EINVAL; } cfg->no_tcp = PJ_TRUE; @@ -2218,15 +2216,12 @@ static void send_request(char *cstr_method, const pj_str_t *dst_uri) pjsip_method_init_np(&method, &str_method); status = pjsua_acc_create_request(current_acc, &method, dst_uri, &tdata); - if (status == PJ_SUCCESS) { - status = pjsip_endpt_send_request(endpt, tdata, -1, NULL, NULL); - } + status = pjsip_endpt_send_request(endpt, tdata, -1, NULL, NULL); if (status != PJ_SUCCESS) { - pjsua_perror(THIS_FILE, "Unable to create/send request", status); + pjsua_perror(THIS_FILE, "Unable to send request", status); return; } - } @@ -3429,34 +3424,6 @@ pj_status_t app_init(int argc, char *argv[]) } } - /* Add IPv6 UDP */ -#if 0 && defined(PJ_HAS_IPV6) && PJ_HAS_IPV6 - if (1) { - pjsua_acc_id aid; - - status = pjsua_transport_create(PJSIP_TRANSPORT_UDP6, - &app_config.udp_cfg, - &transport_id); - if (status != PJ_SUCCESS) - goto on_error; - - /* Add local account */ - pjsua_acc_add_local(transport_id, PJ_TRUE, &aid); - //pjsua_acc_set_transport(aid, transport_id); - pjsua_acc_set_online_status(current_acc, PJ_TRUE); - - if (app_config.udp_cfg.port == 0) { - pjsua_transport_info ti; - pj_sockaddr_in *a; - - pjsua_transport_get_info(transport_id, &ti); - a = (pj_sockaddr_in*)&ti.local_addr; - - tcp_cfg.port = pj_ntohs(a->sin_port); - } - } -#endif /* PJ_HAS_IPV6 */ - /* Add TCP transport unless it's disabled */ if (!app_config.no_tcp) { status = pjsua_transport_create(PJSIP_TRANSPORT_TCP, @@ -3487,8 +3454,6 @@ pj_status_t app_init(int argc, char *argv[]) if (status != PJ_SUCCESS) goto on_error; - tls_id = transport_id; - /* Add local account */ pjsua_acc_add_local(transport_id, PJ_FALSE, &acc_id); pjsua_acc_set_online_status(acc_id, PJ_TRUE); @@ -3591,8 +3556,6 @@ pj_status_t app_destroy(void) app_config.pool = NULL; } - pjsua_transport_close(tls_id, 0); - status = pjsua_destroy(); pj_bzero(&app_config, sizeof(app_config)); diff --git a/pjsip-apps/src/samples/debug.c b/pjsip-apps/src/samples/debug.c index aa7be0fd..77933ea4 100644 --- a/pjsip-apps/src/samples/debug.c +++ b/pjsip-apps/src/samples/debug.c @@ -27,116 +27,5 @@ * E.g.: * #include "playfile.c" */ -//#include "aectest.c" -//#include "strerror.c" +#include "aectest.c" -#include <pjlib.h> -#include <pjlib-util.h> - -#define THIS_FILE "test.c" - -void check_error(const char *func, pj_status_t status) -{ - if (status != PJ_SUCCESS) { - char errmsg[PJ_ERR_MSG_SIZE]; - pj_strerror(status, errmsg, sizeof(errmsg)); - PJ_LOG(1,(THIS_FILE, "%s error: %s", func, errmsg)); - exit(1); - } -} - -#define DO(func) status = func; check_error(#func, status); - -int main() -{ - pj_sock_t sock; - pj_sockaddr_in addr; - pj_str_t stun_srv = pj_str("stun.fwdnet.net"); - pj_caching_pool cp; - pj_status_t status; - - DO( pj_init() ); - - pj_caching_pool_init(&cp, NULL, 0); - - DO( pjlib_util_init() ); - DO( pj_sock_socket(pj_AF_INET(), pj_SOCK_DGRAM(), 0, &sock) ); - DO( pj_sock_bind_in(sock, 0, 0) ); - - DO( pjstun_get_mapped_addr(&cp.factory, 1, &sock, - &stun_srv, 3478, - &stun_srv, 3478, - &addr) ); - - PJ_LOG(3,(THIS_FILE, "Mapped address is %s:%d", - pj_inet_ntoa(addr.sin_addr), - (int)pj_ntohs(addr.sin_port))); - - DO( pj_sock_close(sock) ); - pj_caching_pool_destroy(&cp); - pj_shutdown(); - - return 0; -} - - -#if 0 -#include <pjlib.h> - -static void on_accept_complete(pj_ioqueue_key_t *key, - pj_ioqueue_op_key_t *op_key, - pj_sock_t sock, - pj_status_t status) -{ -} - -static void on_read_complete(pj_ioqueue_key_t *key, - pj_ioqueue_op_key_t *op_key, - pj_ssize_t bytes_read) -{ -} - - -int main() -{ - pj_status_t status; - pj_caching_pool cp; - pj_pool_t *pool; - pj_sock_t sock, new_sock; - pj_ioqueue_t *ioqueue; - pj_ioqueue_op_key_t op_key; - pj_ioqueue_callback cb; - pj_ioqueue_key_t *key; - - status = pj_init(); - PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1); - - pj_caching_pool_init(&cp, NULL, 0); - pool = pj_pool_create(&cp.factory, "app", 1000, 1000, NULL); - - status = pj_sock_socket(pj_AF_INET(), pj_SOCK_STREAM(), 0, &sock); - PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1); - - status = pj_sock_bind_in(sock, 0, 80); - if (status != PJ_SUCCESS) - return 1; - - status = pj_ioqueue_create(pool, PJ_IOQUEUE_MAX_HANDLES, &ioqueue); - PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1); - - status = pj_sock_listen(sock, 5); - PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1); - - pj_bzero(&cb, sizeof(cb)); - cb.on_accept_complete = &on_accept_complete; - cb.on_read_complete = &on_read_complete; - - status = pj_ioqueue_register_sock(pool, ioqueue, sock, NULL, &cb, &key); - PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1); - - pj_ioqueue_op_key_init(&op_key, sizeof(op_key)); - status = pj_ioqueue_accept(key, &op_key, &new_sock, NULL, NULL, NULL); - PJ_ASSERT_RETURN(status==PJ_EPENDING, 1); -} - -#endif |