I have a problem with this following code :

#include <stdio.h>
#include <stdlib.h>
#include <sofia-sip/nua.h>
#include <sofia-sip/soa.h>

// GLOBAL VARIABLES
        //SIP
su_root_t * root;
nua_t * nua;
soa_session_t * soa;

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("I have received an event %s status %d: %s\n",  
nua_event_name (event), status , phrase );

    switch(event) {
        case nua_i_invite:
                if (nh ==NULL) nh = nua_handle(nua,magic, TAG_END());
                 nua_respond(nh,200,"OK", TAG_END());
        break;;

        case nua_i_bye:
                if (nh ==NULL) nh = nua_handle(nua, magic, TAG_END());
                nua_respond(nh, 200, "OK", TAG_END() );
                nua_handle_destroy(nh);
        break;;

        default:;
        };
};

void main( ) {
  su_init();
  root = su_root_create(NULL);
  nua = nua_create(root,event_callback , NULL,
                  NUTAG_URL("sip:0.0.0.0:5060"), TAG_END());

  nua_set_params(nua, NUTAG_ENABLEINVITE(1),
                                NUTAG_AUTOALERT(1), TAG_END());
  su_root_run(root);
};

With this code , I hope that every incomming INVITE message become a  
SIP connection.
My console has this result.

I have received an event nua_i_invite status 180: Ringing
I have received an event nua_i_state status 180: Ringing
I have received an event nua_r_set_params status 200: OK
I have received an event nua_i_error status 500: No session set by user
I have received an event nua_i_state status 500: No session set by user
I have received an event nua_i_terminated status 500: No session set  
by user.

In despite of errors and terminated status, the good packets are send  
on the network at the right place. But unfortunately  the connection  
isn't etablished.

So It 's normal that when the code receive a BYE request, it respond  
by "481 : Call Does Not Exist" status.

What error(s) I have done ?

Thank you in advance,

Fabien




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to