osip-dev
[Top][All Lists]
Advanced

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

Re: [osip-dev] Endless UDP packets sent by eXosip


From: Aymeric Moizard
Subject: Re: [osip-dev] Endless UDP packets sent by eXosip
Date: Thu, 7 Feb 2013 23:17:22 +0100



2013/2/7 Firman <address@hidden>
Hi Aymeric, all

Hi Firman,
 
I followed your advice and started learning eXosip instead of oSip ;-)
The doc is very clear, thanks Aymeric.

Tks a lot for this comment! ;)
 
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? 

Your program is not running after the REGISTER request is sent: you must wait for answers to your REGISTER.

Check this file http://antisip.com/documentation/exosip2/group__howto__initialize.html
and section: "Handle eXosip2 events (eXosip_event_t)"

Add the loop, including the call to "eXosip_automatic_action" which will do many automatic required stuff.

I still don't understand why you said you have udp traffic captured even after reboot... The program won't
send anything if it's not started ... I guess...

Regards,
Aymeric

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;

}


_______________________________________________
osip-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/osip-dev




--
Antisip - http://www.antisip.com

reply via email to

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