Fwd: Where Could I find PJSUA API

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

 



Please little help.
 Like I said I succeeded to compile the code source downloaded from svn. I
got all the lib but I did not figure out how use it to test the code source
above

If it possible may you tell me how generate a library for java program( I
couldn't compile the swig configuration)

Thank you

---------- Forwarded message ----------
From: Jaafar Hamza <hamzaesprit@xxxxxxxxx>
Date: 2014-01-28
Subject: Fwd: Where Could I find PJSUA API
To: pjsip at lists.pjsip.org



Please cloud you help. I needed for a demonstration in my job.
I try to build(only build the project) this sample :

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#include <pjsua-lib/pjsua.h>

#define THIS_FILE "APP"

#define SIP_DOMAIN "example.com"
#define SIP_USER "alice"
#define SIP_PASSWD "secret"

/* Callback called by the library upon receiving incoming call */
 static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
pjsip_rx_data *rdata)
 {
  pjsua_call_info ci;

  PJ_UNUSED_ARG(acc_id);
  PJ_UNUSED_ARG(rdata);

  pjsua_call_get_info(call_id, &ci);

  PJ_LOG(3,(THIS_FILE, "Incoming call from %.*s!!",
 (int)ci.remote_info.slen,
  ci.remote_info.ptr));
  /* Automatically answer incoming calls with 200/OK */
  pjsua_call_answer(call_id, 200, NULL, NULL);
 }
/* Callback called by the library when call's state has changed */
 static void on_call_state(pjsua_call_id call_id, pjsip_event *e)
 {
  pjsua_call_info ci;

  PJ_UNUSED_ARG(e);

  pjsua_call_get_info(call_id, &ci);
  PJ_LOG(3,(THIS_FILE, "Call %d state=%.*s", call_id,
  (int)ci.state_text.slen,
  ci.state_text.ptr));
 }

 /* Callback called by the library when call's media state has changed */
 static void on_call_media_state(pjsua_call_id call_id)
 {
  pjsua_call_info ci;

  pjsua_call_get_info(call_id, &ci);

  if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE) {
  // When media is active, connect call to sound device.
  pjsua_conf_connect(ci.conf_slot, 0);
  pjsua_conf_connect(0, ci.conf_slot);
  }
 }

 /* Display error and exit application */
 static void error_exit(const char *title, pj_status_t status)
 {
  pjsua_perror(THIS_FILE, title, status);
  pjsua_destroy();
  exit(1);
 }
 /*
  * main()
  *
  * argv[1] may contain URL to call.
  */
 int main(int argc, char *argv[])
 {
  pjsua_acc_id acc_id;
  pj_status_t status;

  /* Create pjsua first! */
  status = pjsua_create();
  if (status != PJ_SUCCESS) error_exit("Error in pjsua_create()", status);

  /* If argument is specified, it's got to be a valid SIP URL */
  if (argc > 1) {
  status = pjsua_verify_url(argv[1]);
  if (status != PJ_SUCCESS) error_exit("Invalid URL in argv", status);
  }

  /* Init pjsua */
  {
  pjsua_config cfg;
  pjsua_logging_config log_cfg;

  pjsua_config_default(&cfg);
  cfg.cb.on_incoming_call = &on_incoming_call;
  cfg.cb.on_call_media_state = &on_call_media_state;
  cfg.cb.on_call_state = &on_call_state;

  pjsua_logging_config_default(&log_cfg);
  log_cfg.console_level = 4;

  status = pjsua_init(&cfg, &log_cfg, NULL);
  if (status != PJ_SUCCESS) error_exit("Error in pjsua_init()", status);
  }

  /* Add UDP transport. */
  {
  pjsua_transport_config cfg;

  pjsua_transport_config_default(&cfg);
  cfg.port = 5060;
  status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &cfg, NULL);
  if (status != PJ_SUCCESS) error_exit("Error creating transport", status);
  }

  /* Initialization is done, now start pjsua */
  status = pjsua_start();
  if (status != PJ_SUCCESS) error_exit("Error starting pjsua", status);

  /* Register to SIP server by creating SIP account. */
  {
  pjsua_acc_config cfg;

  pjsua_acc_config_default(&cfg);
  cfg.id = pj_str("sip:" SIP_USER "@" SIP_DOMAIN);
  cfg.reg_uri = pj_str("sip:" SIP_DOMAIN);
  cfg.cred_count = 1;
  cfg.cred_info[0].realm = pj_str(SIP_DOMAIN);
  cfg.cred_info[0].scheme = pj_str("digest");
  cfg.cred_info[0].username = pj_str(SIP_USER);
  cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
  cfg.cred_info[0].data = pj_str(SIP_PASSWD);

  status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id);
  if (status != PJ_SUCCESS) error_exit("Error adding account", status);
  }

  /* If URL is specified, make call to the URL. */
  if (argc > 1) {
  pj_str_t uri = pj_str(argv[1]);
  status = pjsua_call_make_call(acc_id, &uri, 0, NULL, NULL, NULL);
  if (status != PJ_SUCCESS) error_exit("Error making call", status);
  }

  /* Wait until user press "q" to quit. */
  for (;;) {
  char option[10];

  puts("Press 'h' to hangup all calls, 'q' to quit");
  if (fgets(option, sizeof(option), stdin) == NULL) {
  puts("EOF while reading stdin, will quit now..");
  break;
  }

  if (option[0] == 'q')
  break;

  if (option[0] == 'h')
  pjsua_call_hangup_all();
  }

  /* Destroy pjsua */
  pjsua_destroy();

  return 0;
 }

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

*by I get these errors:*














































*-------------- Clean: Debug in PJSip (compiler: GNU GCC
Compiler)---------------Cleaned "PJSip - Debug"-------------- Build: Debug
in PJSip (compiler: GNU GCC Compiler)--------------- mingw32-gcc.exe -Wall
-g -DPJ_WIN32=1 -I"C:\Program Files\Microsoft DirectX SDK (June
2010)\Include" -I"C:\Program Files\Microsoft SDKs\Windows\v7.1\Include"
-I"C:\Program Files\Microsoft Platform SDK\Include"
-I"C:\pjproject-2.1.0-with Generate .lib VC2012\pjlib\include"
-I"C:\pjproject-2.1.0-with Generate .lib VC2012\pjlib-util\include"
-I"C:\pjproject-2.1.0-with Generate .lib VC2012\pjmedia\include"
-I"C:\pjproject-2.1.0-with Generate .lib VC2012\pjnath\include"
-I"C:\pjproject-2.1.0-with Generate .lib VC2012\pjsip\include" -c
C:\Users\5635acer\Documents\WorkSpaceCodeBlocks\PJSip\main.c -o
obj\Debug\main.o mingw32-g++.exe -L"C:\Program Files\Microsoft Platform
SDK\Lib" -L"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib" -L"C:\Program
Files\Microsoft DirectX SDK (June 2010)\Lib\x86" -L"C:\pjproject-2.1.0-with
Generate .lib VC2012\pjlib\lib" -L"C:\pjproject-2.1.0-with Generate .lib
VC2012\pjlib-util\lib" -L"C:\pjproject-2.1.0-with Generate .lib
VC2012\pjmedia\lib" -L"C:\pjproject-2.1.0-with Generate .lib
VC2012\pjnath\lib" -L"C:\pjproject-2.1.0-with Generate .lib
VC2012\pjsip\lib" -o bin\Debug\PJSip.exe obj\Debug\main.o
obj\Debug\main.o: In function
`on_incoming_call':C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:17:
undefined reference to
`pjsua_call_get_info'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:19:
undefined reference to `pj_log_get_level'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:21: undefined
reference to
`pj_log_3'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:23:
undefined reference to `pjsua_call_answer' obj\Debug\main.o: In function
`on_call_state':C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:32:
undefined reference to
`pjsua_call_get_info'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:33:
undefined reference to `pj_log_get_level'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:35: undefined
reference to `pj_log_3'obj\Debug\main.o: In function
`on_call_media_state':C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:43:
undefined reference to `pjsua_call_get_info'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:47: undefined
reference to
`pjsua_conf_connect'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:48:
undefined reference to `pjsua_conf_connect' obj\Debug\main.o: In function
`error_exit':C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:55:
undefined reference to
`pjsua_perror'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:56:
undefined reference to `pjsua_destroy' obj\Debug\main.o: In function
`main':C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:70:
undefined reference to
`pjsua_create'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:75:
undefined reference to `pjsua_verify_url'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:84: undefined
reference to
`pjsua_config_default'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:89:
undefined reference to `pjsua_logging_config_default'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:92: undefined
reference to
`pjsua_init'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:100:
undefined reference to `pjsua_transport_config_default'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:102: undefined
reference to
`pjsua_transport_create'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:107:
undefined reference to `pjsua_start'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:114: undefined
reference to
`pjsua_acc_config_default'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:115:
undefined reference to `pj_str'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:116: undefined
reference to
`pj_str'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:118:
undefined reference to
`pj_str'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:119:
undefined reference to `pj_str'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:120: undefined
reference to
`pj_str'obj\Debug\main.o:C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:122:
more undefined references to `pj_str' follow obj\Debug\main.o: In function
`main':C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:124:
undefined reference to
`pjsua_acc_add'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:130:
undefined reference to `pj_str'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:131: undefined
reference to
`pjsua_call_make_call'C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:149:
undefined reference to `pjsua_call_hangup_all'
C:/Users/5635acer/Documents/WorkSpaceCodeBlocks/PJSip/main.c:153: undefined
reference to `pjsua_destroy'*



PS:
I put all necessaries .h file in include folder of codeBolocks(IDE)
same thing for .lib files generated by VC 2012 in Lib folder.

After getting these errors, I tried to compile this sample in VC 2012 but I
got same errors:
  undefined reference ....


---------- Forwarded message ----------
From: Jaafar Hamza <hamzaesprit@xxxxxxxxx>
Date: 2014-01-28
Subject: Where Could I find PJSUA API
To: pjsip at lists.pjsip.org


Hello
First, I would like thanks you for this great job.
 My problem is that I succeeded in generation of all Pj's lib from source
code only
this PJSUA API I couldn't find its. I use VC 2012 and PJ source code
Latest  version 2.1 Released on 2013-03-05.
Please could you help me to resolve this problem

Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140202/f775c9d9/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux