|
From: | Firman |
Subject: | [osip-dev] Execution gets stuck at eXosip_event_wait |
Date: | Tue, 12 Feb 2013 16:02:25 +0800 (SGT) |
Hi Aymeric, I followed your advice to run eXosip_event_wait in a loop but it seems that the execution stops right at that line of the code which calls eXosip_event_wait. Any advise as to what causes it? Thanks in advace. #include <sys/socket.h> #include <netinet/in.h> #include <eXosip2/eXosip.h> int registerClient(eXosip_t*); int main(){ // Initialize the osip trace (compile this code with -DENABLE_TRACE) eXosip_t *ctx; int i; int port = 5060; //TRACE_INITIALIZE(6, NULL); // Initialize eXosip (and osip) stack ctx = eXosip_malloc(); if(ctx == NULL){ return -1; } i = eXosip_init(ctx); if(i !=
0){ return -1; } eXosip_set_user_agent(ctx, "Firman"); // Open a UDP socket for signalling i = eXosip_listen_addr(ctx, IPPROTO_UDP, NULL, port, AF_INET, 0); if(i!=0){ eXosip_quit(ctx); fprintf (stderr, "could not initialize transport layer\n"); return -1; }
registerClient(ctx); } int registerClient(eXosip_t *ctx){ fprintf(stdout, "Register client\n"); // Initialize a registration osip_message_t *reg = NULL; int rid; int i; eXosip_lock(ctx); rid = eXosip_register_build_initial_register(ctx,
"sip:address@hidden", "sip.antisip.com", NULL, 1800, ®); osip_message_set_supported(reg, "100rel"); osip_message_set_supported(reg, "path"); i = eXosip_register_send_register(ctx, rid, reg); eXosip_unlock(ctx); eXosip_event_t *evt; while(true){ fprintf(stderr, "Start\n");
fprintf(stderr, "%d\n", rid); evt = eXosip_event_wait(ctx, 0, 50); eXosip_lock(ctx); eXosip_automatic_action(ctx); eXosip_unlock(ctx); fprintf(stderr, "Check event\n"); if(evt == NULL){ fprintf(stderr, "NULL\n"); continue;
} if(evt->type == EXOSIP_REGISTRATION_SUCCESS){ fprintf(stderr, "Success\n"); break; }else if(evt->type == EXOSIP_REGISTRATION_FAILURE){ fprintf(stderr, "Failure\n"); break; } fprintf(stderr, "%d\n", evt->type); } fprintf(stderr, "Out of the loop"); return i; } |
[Prev in Thread] | Current Thread | [Next in Thread] |