osip-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [osip-dev] osip_thread_create error


From: Aymeric Moizard
Subject: Re: [osip-dev] osip_thread_create error
Date: Mon, 4 Feb 2013 11:20:39 +0100

Hi

2013/2/4 Firman <address@hidden>
Hi everyone,
Please excuse me for being dumb here.

No trouble!
 
I'm new to SIP and I'm trying to understand SIP and making a simple SIP user agent using oSIP.

If you are starting with sip, you may want to choose an easier sip library: osip is very low level
and eXosip2 might be much easier for you to implement a User-Agent. (Note that eXosip2 is
GPL (or commercial) and osip2 is LGPL)

 
So the following is what I have come up with, but when I compiled it, the compiler complained: osip_thread_create was not declared in this scope. Any advice as to what I have done wrong?

Most probably, this means that you can't acces the API and declaration of osip_thread_create
because
1/ you are using the old osip version 3.X
2/ 3.x version requires that you compile YOUR application, with -DOSIP_MT

If you update to latest 4.0.0 version which is higly advised if you are starting a new project,
the code you are using should work and you won't need to use any mandatory #define
directive.
 
Keep me informed
Regards
Aymeric

Any pointer would be appreciated. Thanks a lot.

#include <sys/time.h>
#include <pthread.h>
#include <osip2/osip.h>
#include <osip2/osip_mt.h>

void SetCallbacks(osip_t*);
int cb_SendMsg(osip_transaction_t*, osip_message_t*, char*, int, int);
void cb_RcvICTRes(int, osip_transaction_t *, osip_message_t*);
void cb_RcvNICTRes(int, osip_transaction_t *, osip_message_t*);
void cb_RcvISTReq(int, osip_transaction_t*, osip_message_t*);
void cb_ISTTranKill(int, osip_transaction_t*);
void* TransportFun(void *arg);

int main(int argc, char* argv[]){

  int i;
  osip_t *osip;
  i = osip_init(&osip);
  if(i != 0){
    printf("Fail initializing osip");
    return -1;
  }
  SetCallbacks(osip);
}

void SetCallbacks(osip_t *osip){
  osip_set_cb_send_message(osip, cb_SendMsg);
  osip_set_message_callback(osip, OSIP_ICT_STATUS_1XX_RECEIVED, cb_RcvICTRes);
  osip_set_message_callback(osip, OSIP_NICT_STATUS_1XX_RECEIVED, cb_RcvNICTRes);
  osip_set_message_callback(osip, OSIP_IST_INVITE_RECEIVED, cb_RcvISTReq);
  osip_set_kill_transaction_callback(osip, OSIP_IST_KILL_TRANSACTION, cb_ISTTranKill);
  osip_thread_create(0, TransportFun, osip);
}

int cb_SendMsg(osip_transaction_t *tr, osip_message_t *sip, char*, int port, int out_socket){
  printf("cb_SendMsg gets called");
}

void cb_RcvICTRes(int, osip_transaction_t *, osip_message_t*){
  printf("cb_RcvICTRes gets called");
}

void cb_RcvNICTRes(int, osip_transaction_t *, osip_message_t*){
  printf("cb_RcvNICTRes gets called");
}

void cb_RcvISTReq(int, osip_transaction_t*, osip_message_t*){
  printf("cb_RcvISTReq gets called");
}

void cb_ISTTranKill(int, osip_transaction_t*){
  printf("cb_ISTTranKill gets called");
}

void* TransportFun(void* arg){
  printf("TransportFun gets called");
}

_______________________________________________
osip-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/osip-dev




--
Antisip - http://www.antisip.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]