osip-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[osip-dev] Endless UDP packets sent by eXosip


From: Firman
Subject: [osip-dev] Endless UDP packets sent by eXosip
Date: Thu, 7 Feb 2013 18:19:32 +0800 (SGT)

Hi Aymeric, all

I followed your advice and started learning eXosip instead of oSip ;-)
The doc is very clear, thanks Aymeric. I wrote the below program following the tutorial in the module section. I also compiled it and linked it against the c-ares library. Problem is, after the program finishes, it keeps generating UDP traffic (captured by Wireshark). Even after I rebooted my Ubuntu, the traffic still keeps being sent periodically. This must be caused by linking against the c-ares lib, no? Any idea how I can find the process spawned by the program and kill it? 
Thanks in advance.

#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;
  }

  // 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;
  }

  eXosip_set_user_agent(ctx, "Firman Test");

  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, &reg);

  if(rid < 0){
    fprintf(stderr, "Unable to build initial register\n");
    return -1;
  }

  osip_message_set_supported(reg, "100rel");
  osip_message_set_supported(reg, "path");

  i = eXosip_register_send_register(ctx, rid, reg);
  eXosip_unlock(ctx);
  return i;

}


reply via email to

[Prev in Thread] Current Thread [Next in Thread]