Hi Folks,
I need to implement a sip registar and presence server into an
existing application...
My first step down this road was to attempt to build as simple a
registar server as possible in order to aid understand sofia-sip and
sip in general.
I have come up with the following code, which seems to let me
register, but I bet invalid status from callback messages... I am not
sure what this means or where I should be going to find a clue to the
solution.
Can anyone assist?
Any other comments on how I am using NTA are apprecated, but please
keep in mind this is toss away code and is not meant to be complete.
:)
The output I am getting is:
Got Root
Got Agent
Got Default Leg
Incoming Request
Register: REGISTER
nta_leg(0x804c430): invalid status -1208623345 from callback
/*
* siptest.c
*
* Created on: 1/09/2008
* Author: whelans
*/
#include siptest.h
#include sofia-sip/nta.h
#include sofia-sip/su.h
#include sofia-sip/sip_status.h
int process_nta_request(nta_agent_magic_t *context, nta_agent_t
*agent, nta_incoming_t *irq, sip_t *sip);
su_root_t *reg_root;
nta_agent_t *reg_agent;
nta_leg_t *default_leg;
su_root_magic_t *app;
int main(int argc, char **argv)
{
reg_root = su_root_create(app);
if (reg_root)
{
printf(Got Root\n);
reg_agent = nta_agent_create(reg_root, (url_string_t*) argv[1],
NULL, NULL, TAG_END());
if (reg_agent)
{
printf(Got Agent\n);
default_leg = nta_leg_tcreate(reg_agent, process_nta_request,
app, NTATAG_NO_DIALOG(1),
TAG_END());
printf(Got Default Leg\n);
su_root_run(reg_root);
nta_agent_destroy(reg_agent);
}
su_root_destroy(reg_root);
}
return 0;
}
int process_nta_request(nta_agent_magic_t *context, nta_agent_t
*agent, nta_incoming_t *irq, sip_t *sip)
{
printf(Incoming Request\n);
sip_contact_t *m;
switch( sip-sip_request-rq_method)
{
casesip_method_register: printf(Register: %s\n,
sip-sip_request-rq_method_name ); break;
default: printf(Default: %s\n,
sip-sip_request-rq_method_name );
}
nta_incoming_treply(irq, SIP_200_OK, TAG_END());
return SIP_200_OK;
}
-
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=100url=/
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel