So I washed this bit of code through NUA and I'm getting back 900 Internal
Error from the stack, triggering an nua_r_invite followed by an nua_r_state
with the same error. I'm curious as to what I'm doing wrong.
event nua_r_invite status 900 Internal error at nua_stack.c:2578
Code:
/* */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sofia-sip/nua.h>
#include <sofia-sip/sip_header.h>
int main(int argc, char **argv);
void event_callback( nua_event_t event,
int status,
const char *phrase,
nua_t *nua,
nua_magic_t *magic,
nua_handle_t *nh,
nua_hmagic_t *hmagic,
const sip_t *sip,
tagi_t tags[]);
int main(int argc, char **argv)
{
su_root_t *root;
nua_t *nua;
/* Init sofia nua stack */
su_init();
root = su_root_create(NULL);
nua = nua_create( root,
event_callback,
NULL,
NUTAG_URL("sip:0.0.0.0:5060"),
TAG_END());
/* Enter into the Sofia event loop */
su_root_run(root);
/* Tear down NUA stack */
nua_destroy(nua);
su_root_destroy(root);
su_deinit();
/* Done */
return(1);
}
void event_callback( nua_event_t event,
int status,
const char *phrase,
nua_t *nua,
nua_magic_t *magic,
nua_handle_t *nh,
nua_hmagic_t *hmagic,
const sip_t *sip,
tagi_t tags[])
{
nua_handle_t *new_leg_a;
nua_handle_t *new_leg_b;
sip_to_t *to;
sip_from_t *from;
//printf("DEBUG: event %s status %d %s\n", nua_event_name(event), status,
phrase);
switch(event)
{
case nua_i_invite:
//printf("INVITE received invite from phone number %s\n",
sip->sip_from->a_url->url_user);
/* Set up and connect leg A (towards caller) */
to = sip->sip_from;
from = sip->sip_to;
new_leg_a = nua_handle(nua, hmagic, SIPTAG_TO(to), TAG_END());
nua_invite(new_leg_a, SIPTAG_FROM(from), TAG_END());
nua_respond(nh, 503, "Service Unavailable", TAG_END());
/* Set up and connect leg B (towards cisco) */
break;
case nua_i_state:
//printf("state change\n");
break;
default:
//printf("Unkown event occured\n");
break;
}
}
Debug output:
tport_wakeup_pri(0x308020): events IN
tport_recv_event(0x308020)
tport_recv_iovec(0x308020) msg 0x30c0d0 from (udp/127.0.0.1:5060) has 908
bytes, veclen = 1
tport_deliver(0x308020): msg 0x30c0d0 (892 bytes) from udp/
127.0.0.1:5060/sip next=0x0
nta: received INVITE sip:[email protected] <sip%[email protected]> SIP/2.0 (CSeq
1)
nta: INVITE (1) going to a default leg
nta: timer set to 200 ms
nua: nua_stack_process_request: entering
nua: nh_create: entering
nua: nh_create_handle: entering
nua: nua_stack_set_params: entering
soa_clone(static::0x305980, 0x303310, 0x309890) called
soa_set_params(static::0x309f80, ...) called
nta_leg_tcreate(0x30a290)
soa_init_offer_answer(static::0x309f80) called
soa_set_remote_sdp(static::0x309f80, 0x0, 0x80aa14, 360) called
nua(0x309890): adding session usage
tport_tsend(0x308020) tpn = UDP/127.0.0.1:41454
tport_resolve addrinfo = 127.0.0.1:41454
tport_by_addrinfo(0x308020): not found by name UDP/127.0.0.1:41454
tport_vsend returned 333
nta: sent 100 Trying for INVITE (1)
nua(0x309890): event i_invite 100 Trying
nua(0x309890): call state changed: init -> received, received offer
soa_get_remote_sdp(static::0x309f80, [0xb00807ac], [0xb00807a8], [0x0])
called
nua(0x309890): event i_state 100 Trying
nua: nua_application_event: entering
nua: nh_create_handle: entering
nua: nua_invite: entering
nua(0x30b1b0): sent signal r_invite
nua: nua_respond: entering
nua(0x309890): sent signal r_respond
nua: nua_application_event: entering
nua(0x30b1b0): recv signal r_invite
nua: nua_stack_set_params: entering
soa_clone(static::0x305980, 0x303310, 0x30b1b0) called
soa_set_params(static::0x30b600, ...) called
soa_set_params(static::0x30b600, ...) called
nta_leg_tcreate(0x30a240)
nua(0x30b1b0): adding session usage
soa_init_offer_answer(static::0x30b600) called
soa_generate_offer(static::0x30b600, 0) called
nua(0x30b1b0): event r_invite 900 Internal error at nua_stack.c:2578
nua(0x30b1b0): call state changed: init -> init
nua(0x30b1b0): event i_state 900 Internal error at nua_stack.c:2578
nua(0x30b1b0): event i_terminated 900 Internal error at nua_stack.c:2578
nua(0x30b1b0): removing session usage
soa_destroy(static::0x30b600) called
nta_leg_destroy(0x30a240)
nua(0x309890): recv signal r_respond 503 Service Unavailable
nua: nua_stack_set_params: entering
soa_set_params(static::0x309f80, ...) called
nua: nua_invite_server_respond: entering
soa_clear_remote_sdp(static::0x309f80) called
tport_tsend(0x308020) tpn = UDP/127.0.0.1:41454
tport_resolve addrinfo = 127.0.0.1:41454
tport_by_addrinfo(0x308020): not found by name UDP/127.0.0.1:41454
tport_vsend returned 507
nta: sent 503 Service Unavailable for INVITE (1)
nua(0x309890): removing session usage
nua(0x309890): call state changed: received -> terminated
nua(0x309890): event i_state 503 Service Unavailable
nua(0x309890): event i_terminated 503 Service Unavailable
soa_destroy(static::0x309f80) called
nta_leg_destroy(0x30a290)
nua: nua_application_event: entering
nua: nua_application_event: entering
nua: nua_application_event: entering
nua: nua_application_event: entering
nua: nua_application_event: entering
tport_wakeup_pri(0x308020): events IN
tport_recv_event(0x308020)
tport_recv_iovec(0x308020) msg 0x30a290 from (udp/127.0.0.1:5060) has 337
bytes, veclen = 1
tport_deliver(0x308020): msg 0x30a290 (321 bytes) from udp/
127.0.0.1:5060/sip next=0x0
nta: received ACK sip:[email protected] <sip%[email protected]> SIP/2.0 (CSeq 1)
nta: ACK (1) is going to INVITE (1)
nta: timer set next to 4804 ms
nta: timer I fired, terminate 503 response
incoming_reclaim_all(0x0, 0x0, 0xb0080d7c)
nta_incoming_timer: 0/0 resent, 0/0 tout, 1/1 term, 1/1 free
nta: timer not set
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel