Hi Everybody,

I try to register to the Asterisk server using exosip2, this is my code :
*TRACE_INITIALIZE (6, stdout);
  if (eXosip_init ()) {
      printf("eXosip_init failed\n");
      exit (1);
  }

  i = eXosip_listen_addr (IPPROTO_UDP,"192.168.14.35", port, AF_INET, 0);
  if (i!=0) {
    eXosip_quit();
    printf("could not initialize transport layer\n");
      exit (1);
  }
    osip_message_t *reg = NULL;
  int id;
  int j;

  eXosip_lock ();
  id = eXosip_register_build_initial_register
("sip:3...@192.168.14.35<sip%3a3...@192.168.14.35>",
"sip:192.168.14.36", "sip:3...@192.168.15.35:5060", 1800, &reg);
  if (id < 0)
    {
      eXosip_unlock ();
      return -1;
}

j = eXosip_register_send_register (id, reg);
   printf("%d\n",j);
  eXosip_unlock ();

  return j;
*
Unfortunately, the Asterisk server send to me this message :

SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.14.35:5060
;branch=z9hG4bK1366493399;received=192.168.14.35;rport=5060
From: <sip:3...@192.168.14.35 <sip%3a3...@192.168.14.35>>;tag=1127882803
To: <sip:3...@192.168.14.35 <sip%3a3...@192.168.14.35>>
Call-ID: 796455...@192.168.14.35
CSeq: 1 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:3...@192.168.14.36 <sip%3a3...@192.168.14.36>>
Content-Length: 0

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.14.35:5060
;branch=z9hG4bK1366493399;received=192.168.14.35;rport=5060
From: <sip:3...@192.168.14.35 <sip%3a3...@192.168.14.35>>;tag=1127882803
To: <sip:3...@192.168.14.35 <sip%3a3...@192.168.14.35>>;tag=as0f0ad599
Call-ID: 796455...@192.168.14.35
CSeq: 1 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="1929e732"
Content-Length: 0

What is wrong in my code ?
Big thanks for your help.
-- 
IDRISS GHODHBANE
-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to