Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First step is build <code>pjsip</code> source code for Android (steps for Ubuntu Linux):</p> <ol> <li>Set <code>ANDROID_NDK_ROOT</code> environment variable to your NDK's root folder.</li> <li>Go to pjsip 2.x folder and create <code>pjlib/include/pj/config_site.h</code> including <code>config_site_sample.h</code> (<code>#include &lt;pj/config_site_sample.h&gt;</code>)</li> <li>Run <code>./configure-android</code></li> <li>Run <code>make clean &amp;&amp; make depend &amp;&amp; make</code></li> </ol> <p>After these steps, you will have several static libraries in several folders. I suggest to group them in a same folder (better in your project) by:</p> <pre><code>mkdir &lt;your_project_path&gt;/pjsip_libs find . -name *.a | xargs -I % cp % &lt;your_project_path&gt;/pjsip_libs/ </code></pre> <p>Once you've all libraries, you need to add those libraries into your project's Android.mk file, this is done by including a new module section per library. This module section should be something like:</p> <pre><code>include $(CLEAR_VARS) LOCAL_MODULE := pjsua-arm-unknown-linux-androideabi LOCAL_SRC_FILES := $(MY_PJLIB_PATH)/libpjsua-arm-unknown-linux-androideabi.a include $(PREBUILT_STATIC_LIBRARY) </code></pre> <p>And, in the section you're actually building your JNI project's source code, add all modules to your static library references:</p> <pre><code> LOCAL_STATIC_LIBRARIES := pjsua-arm-unknown-linux-androideabi ... </code></pre> <p>This will include <code>pjsip</code> references into your JNI library. Now, you need to configure a <code>pjsip</code> UA instance.</p> <p>You've a explanation about init and start <code>pjsip</code>'s UA (pjsua) in <code>pjsip/include/pjsua-lib/pjsua.h</code> but main steps to follow are:</p> <ol> <li>Create a UA instance with <code>pjsua_create</code></li> <li>Create a worker thread with <code>pj_thread_create</code></li> <li><p>Set default configuration for UA instance:</p> <p>pjsua_config cfg; pjsua_logging_config log_cfg; pjsua_media_config media_cfg;</p> <p>pj_cli_cfg_default(&amp;app_config.cli_cfg.cfg); pjsua_logging_config_default(&amp;log_cfg); pjsua_media_config_default(&amp;media_cfg);</p></li> <li><p>Init the stack with <code>pjsua_init</code></p></li> <li>Start the stack with <code>pjsua_start</code></li> </ol> <p>From here, you've plenty of configuration options (log, media, transport, etc.)</p> <p>You can find a basic PJSIP tutorial <a href="http://trac.pjsip.org/repos/wiki/PJSIP_Tutorial" rel="nofollow">here</a> and, inside pjsip's source root path, you've a basic (but complete enough for a basic SIP usage) at: <code>pjsip-apps/src/samples/simple_pjsua.c</code></p> <p><strong>Edit:</strong> When building android project in pjsip-apps, you can face a problem because pjsua-app is not generated by default on the general build (more specifically, pjsua: target is not included on all: target at pjsip-apps/build/Makefile). To fix this just go to pjsip-apps/build and run:</p> <p>make pjsua</p> <p>This would create proper object files at: pjsip-apps/build/output/pjsua-arm-unknown-linux-androideabi/ (needed when building android sample).</p> <p>Once you've all corresponding object files, you can run ndk-build again at pjsip-apps/src/pjsua/android</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload