Hi all,
this is my first post here, I have a very newbie usage question and I
don't know if this is the right place wether to ask, so please tell me
if this is the case.
I'm writing a little application in my sandbox to understand the basic
mechanisms of sofia-sip, here it is the code:
---------------------------8<---------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <sofia-sip/nua.h>
/* 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[])
{
static unsigned int count = 1;
printf ("arrived request number %d\n"
"I have received an event %s status %d %s\n",
count++, nua_event_name(event), status, phrase);
/* how to print a message? */
}
/**
* Creates a communication handle, sends an INVITE request and destroys it.
*/
int send_invite (nua_t *nua, const char* callee)
{
nua_handle_t *handle;
/* create an handle */
handle = nua_handle(nua, NULL,
SIPTAG_TO_STR(callee),
TAG_END());
if (!handle) {
fprintf(stderr, "Failed to instantiate an handle for the invite\n");
return -1;
}
fprintf(stderr, "Sending the invite...\n");
nua_invite(handle,
TAG_END());
nua_handle_destroy(handle);
return 0;
}
int main (int argc, char *argv[])
{
su_root_t *root;
nua_t *nua;
if (argc <= 1) {
fprintf(stderr, "Missing the destination target");
exit(1);
}
const char* callee = argv[1];
/* Initialize Sofia-SIP library and create event loop */
su_init ();
root = su_root_create (NULL);
nua = nua_create(root, /* Event loop */
event_callback, /* Callback for processing events */
NULL, /* Additional data to pass to callback */
NUTAG_URL("sip:localhost:5060"),
TAG_END()); /* Last tag should always finish the sequence
*/
/* send an invite to a remote sip client */
send_invite (nua, callee);
/* Run event loop */
su_root_run (root);
/* Destroy allocated resources */
nua_destroy (nua);
su_root_destroy (root);
su_deinit ();
exit(0);
}
---------------------------8<---------------------------------------
It simply takes the first command line arguments and send an invite to
that address.
The problem is that although I can see:
[EMAIL PROTECTED] ~/s/S/C/libsofia> sip-inviter sip:10.xx.x.204:5060
Sending the invite...
I don't see any SIP messages (using wireshark), also when I set a
bogus calle such as:
[EMAIL PROTECTED] ~/s/S/C/libsofia> sip-inviter sip:foo:5060
Sending the invite...
I got the same result and no complain from sofia-sip, as I would
expect if it can't resolve the address.
What am I missing?
Many thanks in advance, best regards.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel