Hi.

I'm new to the list and to the Sofia SIP stack. I'm trying to get started using the NUA API and have made a very simple test application based on the code on http://sofia-sip.sourceforge.net/refdocs/nua/.

The test application have a simple callback function printing out messages for some indications and responses. The main function tries to establish a connection by sending an INVITE request, using the nua_invite()-function. I keep getting a "900 Internal NUA Error" as answer to outgoing INVITE and I can't understand why.

The creation of the NUA stack seems to succeed. I guess I'm doing some "beginners mistake", but I can't find it. Can someone help me?

I'm running a siproxd-server locally to test against.

Here is the relevant code snippets:

oper_data_t *place_call(char const *name, char const *url)
{
  oper_data_t *op;
  sip_to_t *to;

  /* create operation context information */
  op = su_zalloc(appl->home, (sizeof *op));
  if(!op)
    return NULL;

  /* destination address */
  to = sip_to_create(NULL, (url_string_t*)url);
  if(!to)
    return NULL;
  to->a_display = name;

  /* create operation handle */
  op->handle = nua_handle(appl->nua, op, SIPTAG_TO(to), TAG_END());

  if(op->handle == NULL)
  {
    printf("cannot create operation handle\n");
    return NULL;
  }

  nua_invite(op->handle,
             /* other tags as needed ... */
             TAG_END());

  return op;
}


int main(int argc, char **argv)
{
  su_init();
  su_home_init(appl->home);
  appl->root = su_root_create(appl);
  if(appl->root == NULL)
  {
    printf("couldn't initialize root object");
    exit(EXIT_FAILURE);
  }

  /* create NUA stack */
  appl->nua = nua_create(appl->root,
                         callback_app,
                         appl,
                         NUTAG_URL("sip: 127.0.0.1:5060"),
                         /* tags as necessary ... */
                         TAG_NULL());
  if(appl->nua == NULL)
  {
    printf("couldn't create NUA stack");
    exit(EXIT_SUCCESS);
  }

  /* set necessary parameters */
  nua_set_params(appl->nua,
                 TAG_NULL());

  //su_root_step(appl->root, 10);
  place_call("Alice", "sip: 127.0.0.1:5062");

  while(1)
  {
    /* main loop */
    su_root_step(appl->root, 10);
  }

  /* destroy NUA stack */
  /*nua_destroy(appl->nua);
  su_root_destroy(appl->root);
  appl->root = NULL;
  su_home_deinit(appl->home);
  su_deinit();*/
  return 0;
}


/Pontus
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to