Hi all,

after a long and happy experience with sofia, I've just noticed that I'm not able to properly answer INVITE requests with NTA. In fact, when the tranport is UDP, the 200 response is sent back only once, even if no ACK is received. I'm sure it's my fault; I've attached a short program to reproduce the issue. Can anyone please tell me what's wrong with it?

--
Ciao
Enrico


#include <sofia-sip/su.h>
#include <sofia-sip/url.h>
#include <sofia-sip/msg.h>
#include <sofia-sip/sip.h>
#include <sofia-sip/sip_tag.h>
#include <sofia-sip/sip_status.h>
#include <sofia-sip/nta.h>


#ifndef ME
#define ME "sip:[EMAIL PROTECTED]"
#endif

#ifndef YOU
#define YOU "sip:[EMAIL PROTECTED]"
#endif

int
request_handler(nta_leg_magic_t *lmagic, nta_leg_t *leg,
                nta_incoming_t *irq, sip_t const *sip)
{
  msg_t *res;

  printf("New Request\n");
  res = nta_incoming_create_response(irq, SIP_200_OK);
  nta_incoming_complete_response(irq, res, SIP_200_OK, TAG_END());
  nta_incoming_mreply(irq, res);

  return 0;
}

int
response_handler(nta_outgoing_magic_t *magic, nta_outgoing_t *outgoing,
                 sip_t const *sip)
{
  printf("New Response\n");

  return 0;
}

int
main(int argc, char *argv[])
{
  su_home_t *home = su_home_new(sizeof(su_home_t));
  su_root_t *root = su_root_create(NULL);
  nta_agent_t *agent;
  nta_leg_t *defleg, *outleg;
  msg_t *req;

  agent = nta_agent_create(root, URL_STRING_MAKE(ME ";transport=udp"),
                           NULL, NULL, TAG_END());

  defleg = nta_leg_tcreate(agent, request_handler, NULL,
                           NTATAG_NO_DIALOG(1), TAG_END());

  outleg = nta_leg_tcreate(agent, request_handler, NULL,
SIPTAG_FROM_STR(ME), SIPTAG_TO_STR(YOU), TAG_END());

  req = nta_msg_create(agent, 0);

  nta_msg_request_complete(req, outleg, sip_method_invite, NULL,
                           URL_STRING_MAKE(YOU));

  fgetc(stdin);

  nta_outgoing_mcreate(agent, response_handler, NULL,
                       URL_STRING_MAKE(YOU), req, TAG_END());

  su_root_run(root);

  return 0;
}

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to