[Osip] osip for a gateway

Iban Lopetegi Zinkunegi lopetaz at hotmail.com
Mon Feb 15 17:30:37 CET 2010


Hi all,

I am trying to program a SIP gateway for a mobile network. The mobile network signaling is done, i mean i have two variables to access that give me the necessary information to know whether i am connected, ringing,... etc.

Now, I am trying to handle SIP requests and although i have a rudimentary program it keeps giving me segmentation faults. The program is organized as below:

//some variables
osip_message_t *dest;


//Main program ( program listens SIP messages)
while (1){

if recvlen=recvfrom(socket,buffer,...){
         if(osip_message_init(&dest)!=0)die("osip_message_t error");
         osip_message_parse(dest,buffer);

         if ((REQUEST=INVITE)&&(INVITE==ACCEPTED)){// this is a pseudo code, it is only to check that no other invite is received with the same call-id etc.
                 pthread_create(new_session,$attributes,new_session_thread,(void)*dest) // bear in mind that the received packet is passed to the thread
 
                  osip_message_free(dest);// ?? is that right
         }
      
}

/*at the thread*/
new_session_thread(void * dest)
{
       osip_message_clone(dest_aux,dest);
       /*if message progresses, i generate a reponse */
              send_trying();                                            ???? socket number is sock the same as used in the main program, is that right
              send _200ok();
              start rtp packets {
                     new_thread send rtp packets
                     new_thread receive rtp packets);      
              }
              send_bye()

} 

}

Any help is well appreciated.

Thanks

Lopetaz
 		 	   		  
_________________________________________________________________
Ibex 35, comparadores de hipotecas, Euribor, foros de bolsa. ¡Nuevo MSN Dinero!
http://dinero.es.msn.com/


More information about the Osip mailing list