All,

I'm new to sofia. I'm sending a SUBSCRIBE out and receiving a 401. 
However, I'm not getting any events stating that the subscribe failed.

Any help pointing me in the right direction would be greatly appreciated.

Thanks
Tory

The app is based off the API documenation examples:

int
main (int argc, char *argv[])
{
  su_root_t *root;
  nua_t *nua;

  /* Initialize Sofia-SIP library and create event loop */

  su_init ();
  root = su_root_create (NULL);
 
  /* Create a user agent instance. Caller and callee should bind to 
different
   * address to avoid conflicts. The stack will call the 'event_callback()'
   * callback when events such as succesful registration to network,
   * an incoming call, etc, occur.
   */
  nua = nua_create(root, /* Event loop */
                   event_callback, /* Callback for processing events */
                   NULL, /* Additional data to pass to callback */
                   NUTAG_URL("sip:0.0.0.0:5072;transport=TCP"),
                   SIPTAG_FROM_STR("sip:test1@" HOST ";transport=TCP"),
                   /* Address to bind to */
                   TAG_END()); /* Last tag should always finish the 
sequence */

  send_message (nua);
 
  /* Run event loop */
  su_root_run (root);

  /* Destroy allocated resources */
  nua_destroy (nua);
  su_root_destroy (root);
  su_deinit ();

  return 0;
}

/* This callback will be called by SIP stack to
 * process incoming events
 */
void event_callback(nua_event_t   event,
                    int           status,
                    char const   *phrase,
                    nua_t        *nua,
                    nua_magic_t  *magic,
                    nua_handle_t *nh,
                    nua_hmagic_t *hmagic,
                    sip_t const  *sip,
                    tagi_t        tags[])
{
  printf ("Hello world!\n"
          "I have received an event %s status %d %s\n",
          nua_event_name (event), status, phrase);
}

/* Create a communication handle, send MESSAGE with it and destroy it */
void send_message (nua_t *nua)
{
  nua_handle_t *handle;

  handle = nua_handle(nua, NULL,
          SIPTAG_TO_STR("sip:test2@" HOST ";transport=TCP"),
          SIPTAG_ACCEPT_STR("application/pidf+xml"),
          NUTAG_AUTH("Digest:\"gimble.corp.jabber.com\":test1:test"),
          TAG_END());

  nua_subscribe(handle,
          SIPTAG_CONTENT_TYPE_STR("text/plain"),
          SIPTAG_PAYLOAD_STR("Hello callee!!!"),
          SIPTAG_EVENT_STR("presence"),
          TAG_END());

  nua_handle_destroy (handle);
}



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to