osip-dev
[Top][All Lists]
Advanced

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

[osip-dev] osip_thread_create error


From: Firman
Subject: [osip-dev] osip_thread_create error
Date: Mon, 4 Feb 2013 17:08:50 +0800 (SGT)

Hi everyone,
Please excuse me for being dumb here. I'm new to SIP and I'm trying to understand SIP and making a simple SIP user agent using oSIP. 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? 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");
}

reply via email to

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