### Starting the Library Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/using/endpoint.rst Illustrates how to start the PJSUA2 library after initialization using `libStart()`. This step finalizes the initialization phase, including STUN resolution and sound device setup. ```APIDOC ## Starting the library Now we're ready to start the library. We need to start the library to finalize the initialization phase, e.g. to complete the initial STUN address resolution, initialize/start the sound device, etc. To start the library, call :cpp:func:`pj::Endpoint::libStart()` method: .. code-block:: c++ try { ep->libStart(); } catch(Error& err) { cout << "Startup error: " << err.info() << endl; } ``` -------------------------------- ### Quick Start CMake Build Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/cmake/build_instructions.rst Basic commands to configure, build, and install PJSIP using CMake. ```shell cd pjproject cmake -S . -B build cmake --build build -j ``` -------------------------------- ### Initialize PJSUA2, Register Account, and Quit (Java) Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/hello_world.rst This Java snippet mirrors the C++ and Python examples, illustrating PJSUA2 library setup, SIP transport configuration, account registration, and proper library termination within a Java environment. ```java import org.pjsip.pjsua2.*; // Subclass to extend the Account and get notifications etc. class MyAccount extends Account { @Override public void onRegState(OnRegStateParam prm) { System.out.println("*** On registration state: " + prm.getCode() + prm.getReason()); } } public class test { static { System.loadLibrary("pjsua2"); System.out.println("Library loaded"); } public static void main(String argv[]) { try { // Create endpoint Endpoint ep = new Endpoint(); ep.libCreate(); // Initialize endpoint EpConfig epConfig = new EpConfig(); ep.libInit( epConfig ); // Create SIP transport. Error handling sample is shown TransportConfig sipTpConfig = new TransportConfig(); sipTpConfig.setPort(5060); ep.transportCreate(pjsip_transport_type_e.PJSIP_TRANSPORT_UDP, sipTpConfig); // Start the library ep.libStart(); AccountConfig acfg = new AccountConfig(); acfg.setIdUri("sip:test@sip.pjsip.org"); acfg.getRegConfig().setRegistrarUri("sip:sip.pjsip.org"); AuthCredInfo cred = new AuthCredInfo("digest", "*", "test", 0, "secret"); acfg.getSipConfig().getAuthCreds().add( cred ); // Create the account MyAccount acc = new MyAccount(); acc.create(acfg); // Here we don't have anything else to do.. ``` -------------------------------- ### Install PJSIP Libraries Source: https://github.com/pjsip/pjproject_docs/wiki/Getting-Started-Autoconf Run 'make install' to install the header and library files to the target directory. The installation directory can be specified using the --prefix=DIR option during the configure step. ```bash $ make install ``` -------------------------------- ### Installing to Custom Prefix Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/cmake/build_instructions.rst Install PJSIP to a custom directory using CMAKE_INSTALL_PREFIX, then build and install. ```shell cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/opt/pjsip cmake --build build -j cmake --install build ``` -------------------------------- ### Site-Specific Configuration Example Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/cmake/build_instructions.rst Example content for the pjlib/include/pj/config_site.h file, used for application-level settings not covered by CMake options. ```c /* pjlib/include/pj/config_site.h */ #define PJSUA_MAX_CALLS 32 #define PJ_GRP_LOCK_DEBUG 1 /* troubleshooting */ #define PJSIP_MAX_PKT_LEN 8000 ``` -------------------------------- ### Start Docker Service Source: https://github.com/pjsip/pjproject_docs/blob/master/README.md Starts the Docker service using systemd. ```bash sudo service docker start ``` -------------------------------- ### Start Docker Socket Source: https://github.com/pjsip/pjproject_docs/blob/master/README.md Starts the Docker socket using systemctl. ```bash sudo systemctl start docker.socket ``` -------------------------------- ### Example Configure Output with Video Support Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/posix/build_instructions.rst This is an example output from the configure script when video support is enabled. It shows the detection of SDL, ffmpeg, OpenH264, and libyuv. Note the use of alternative prefixes for SDL and ffmpeg, and the fallback to pkgconfig.py for ffmpeg package detection on systems like Mac where pkg-config might not be readily available. ```text ... Using SDL prefix... /Users/pjsip/Desktop/opt checking SDL availability..... 2.0.1 Using ffmpeg prefix... /Users/pjsip/Desktop/opt checking for pkg-config... no checking for python... python pkgconfig.py checking ffmpeg packages... libavformat libavcodec libswscale libavutil checking for v4l2_open in -lv4l2... no checking OpenH264 availability... ok checking for I420Scale in -lyuv... yes ... ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/pjsip/pjproject_docs/blob/master/README.md Navigate to the build/html directory and start a Python HTTP server to view the generated documentation locally. ```bash cd docs/build/html python -m http.server ``` -------------------------------- ### Include PJSIP Default Configuration Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/guidelines-development.rst Include the default configuration sample in your custom config_site.h file to start with recommended settings. This is useful for initial setup before optimization. ```c #include ``` -------------------------------- ### PJSIP Executable Size Example Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/perf_footprint/footprint.rst This example shows the typical file size breakdown of a default PJSIP release build on Windows. ```text pjsua_vc6.exe: file size=749,672 bytes 241664 .data 102400 .rdata 24576 .reloc 536576 .text (all numbers in decimal, bytes) ``` -------------------------------- ### Start Docker Container Source: https://github.com/pjsip/pjproject_docs/blob/master/README.md Starts a stopped Docker container named 'pjproject-docs'. ```bash docker start pjproject-docs ``` -------------------------------- ### Install PJSIP with CMake Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/cmake/build_instructions.rst Installs headers, libraries, and CMake package configuration files after building with CMake. ```shell cmake --install build --prefix /usr/local ``` -------------------------------- ### Build and install OpenCore AMR libraries Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/audio/opencore-amr.rst Compiles and installs the OpenCore AMR libraries after configuration. ```shell make && make install ``` -------------------------------- ### Install Pjproject with Custom Prefix Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/cmake/build_instructions.rst Installs the built Pjproject components to a specified custom prefix path. ```shell cmake --install build --prefix /some/path ``` -------------------------------- ### Start Camera Preview in PJSIP Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/using/media_video.rst Initiates a camera preview using the pj::VideoPreview class. It configures the video device format and starts the preview on a specified window handle. If the window handle is NULL, a new window is created automatically. ```c++ void StartPreview(int device_id, void* hwnd, int width, int height, int fps) { try { // Set the video capture device format. VidDevManager &mgr = Endpoint::instance().vidDevManager(); MediaFormatVideo format = mgr.getDevInfo(device_id).fmt[0]; format.width = width; format.height = height; format.fpsNum = fps; format.fpsDenum = 1; mgr.setFormat(device_id, format, true); // Start the preview on a panel with window handle 'hwnd'. // Note that if hwnd is set to NULL, library will automatically create // a new floating window for the rendering. VideoPreviewOpParam param; param.window.handle.window = (void*) hwnd; VideoPreview preview(device_id); preview.start(param); } catch(Error& err) { } } ``` -------------------------------- ### Schedule Video Preview Start via Timer in PJSIP Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/using/media_video.rst Demonstrates how to schedule the start of a video capture device preview using a PJSUA2 timer to avoid GUI thread blocking. This is a recommended practice for maintaining application responsiveness. ```c++ // Timer type ID enum { T IMER_START_PREVIEW = 1, ... }; // Generic timer parameter struct MyTimerParam { int type; union { struct { int dev_id; void *hwnd; int w, h, fps; } start_preview; ... } data; }; // PJSUA2 Endpoint::onTimer() implementation void Endpoint::onTimer(const OnTimerParam &prm) { MyTimerParam *param = (MyTimerParam*) prm.userData; if (param->type == TIMER_START_PREVIEW) { int dev_id = param->data.start_preview.dev_id; void *hwnd = param->data.start_preview.hwnd; int w = param->data.start_preview.w; int h = param->data.start_preview.h; int fps = param->data.start_preview.fps; StartPreview(device_id, hwnd, w, h, fps); } ... // Finally delete the timer parameter. delete param; } ... MyTimerParam *tp = new MyTimerParam(); tp->type = TIMER_START_PREVIEW; tp->data.start_preview.dev_id = 1; // colorbar virtual device tp->data.start_preview.hwnd = (void*)some_hwnd; tp->data.start_preview.w = 320; tp->data.start_preview.h = 240; tp->data.start_preview.fps = 15; // Schedule the preview start to be executed immediately (zero milisecond delay). Endpoint::instance().utilTimerSchedule(0, tp); ``` -------------------------------- ### Install Pjproject with CMake Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/cmake/build_instructions.rst Installs the built Pjproject components to the default configured prefix. ```shell cmake --install build ``` -------------------------------- ### Handle Push Credentials and Start PJSIP Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/other/ios_push_notifications.rst Format the received push token as a hex string and then start PJSIP on a new thread. ```objc - (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type { /* Format the token as a hex string. */ const char *data = [credentials.token bytes]; self.token = [NSMutableString string]; for (NSUInteger i = 0; i < [credentials.token length]; i++) [self.token appendFormat:@"%%02.2hhx", data[i]]; /* Now start pjsua. */ [NSThread detachNewThreadSelector:@selector(pjsuaStart) toTarget:self withObject:nil]; } ``` -------------------------------- ### Check Tool Installation Source: https://github.com/pjsip/pjproject_docs/blob/master/README.md Verify that Doxygen, Sphinx-build, and Breathe are installed and accessible in the system's PATH by checking their versions. ```bash doxygen -v sphinx-build --version breathe-apidoc --version ``` -------------------------------- ### PJSIP Heap Usage Example Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/perf_footprint/footprint.rst This example demonstrates heap usage statistics from PJSIP with two connected calls using Speex wideband codec and AEC enabled. ```text >>> dd .. Total 908508 of 1046304 (86 %) used! .. ``` -------------------------------- ### PJMEDIA API Example Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/media/ai_connectivity.rst Illustrates direct usage of the underlying C API for PJMEDIA AI port creation, configuration, and connection. ```APIDOC ## PJMEDIA API For applications that are not using PJSUA2, the underlying C API can be used directly. The port needs an ioqueue, a timer heap, and a backend instance. In a pjsua-based app you can reuse the SIP endpoint's ioqueue and timer heap; in a standalone pjmedia app, create your own. .. code-block:: c pjmedia_ai_backend *backend; pjmedia_ai_openai_backend_create(pool, &backend); pjmedia_ai_port_param prm; pjmedia_ai_port_param_default(&prm); prm.ioqueue = pjsip_endpt_get_ioqueue(pjsua_get_pjsip_endpt()); prm.timer_heap = pjsip_endpt_get_timer_heap(pjsua_get_pjsip_endpt()); prm.backend = backend; /* port takes ownership */ prm.cb.on_event = &on_ai_event; prm.user_data = my_ctx; /* Optional: prm.vad_enabled, prm.ptime_msec, prm.ssl_param */ pjmedia_ai_port *ai_port; pjmedia_ai_port_create(pool, &prm, &ai_port); pjmedia_port *port = pjmedia_ai_port_get_port(ai_port); pjmedia_conf_add_port(conf, pool, port, NULL, NULL); pj_str_t url = pj_str("wss://api.openai.com/v1/realtime?model=..."); pj_str_t token = pj_str(api_key); pjmedia_ai_port_connect(ai_port, &url, &token); Destroy the port with :cpp:any:`pjmedia_port_destroy` when done; it disconnects the WebSocket and destroys the backend it owns. ``` -------------------------------- ### DTLS-SRTP Offer SDP Example Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/security/srtp.rst Example SDP for a DTLS-SRTP offer, using UDP/TLS/RTP/SAVP with fingerprint and setup attributes. ```text m=audio 4000 UDP/TLS/RTP/SAVP 0 8 a=fingerprint:sha-1 77:D1:AD:B0:35:F0:9B:04:A0:7B:84:3A:F0:1A:A9:31:9A:3E:F3:4B a=setup:actpass ``` -------------------------------- ### Create `config_site.h` with Customizations Source: https://github.com/pjsip/pjproject_docs/wiki/Getting-Started-Preparation Use this sample to create your `config_site.h` file. Uncomment the desired configuration macros for minimal size or maximum performance, and include the sample configuration. This file is not version controlled and prevents overwrites during source synchronization. ```c // Uncomment to get minimum footprint (suitable for 1-2 concurrent calls only) //#define PJ_CONFIG_MINIMAL_SIZE // Uncomment to get maximum performance //#define PJ_CONFIG_MAXIMUM_SPEED #include ``` -------------------------------- ### View Configure Help Options Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/posix/build_instructions.rst Navigate to the pjproject directory and run the configure script with the --help flag to view all available customization options for the build. ```shell cd pjproject ./configure --help ``` -------------------------------- ### Start PJSUA2 Library Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/using/endpoint.rst Call libStart() to finalize the initialization phase, which includes tasks like STUN resolution and sound device initialization. ```c++ try { ep->libStart(); } catch(Error& err) { cout << "Startup error: " << err.info() << endl; } ``` -------------------------------- ### Build and Install Java SWIG Module Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/building.rst Builds and installs the Java SWIG module for PJSUA2. Assumes SWIG and JDK are installed. ```shell cd pjsip-apps/src/swig/java make make install ``` -------------------------------- ### Basic C Program "Hello World" Source: https://github.com/pjsip/pjproject_docs/wiki/FAQ A minimal C program to start with. Include this in your project before proceeding with PJSIP integration. ```c #include int main() { puts("Hello world!"); return; } ``` -------------------------------- ### Random and GUID Generation Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/api/pjlib/index.rst APIs for generating random numbers and GUIDs. ```APIDOC ## Random API ### Description Provides functions for random number generation. ## Native GUID Generator API ### Description Provides functions for generating native GUIDs. ``` -------------------------------- ### Build and Install Python SWIG Module Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/building.rst Builds and installs the Python SWIG module for PJSUA2. Ensure you are in a virtualenv if applicable, otherwise 'make install' will use the system's site-packages. ```shell cd pjsip-apps/src/swig/python make make install ``` -------------------------------- ### Initialize PJSUA2, Register Account, and Quit (C++) Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/hello_world.rst This C++ snippet demonstrates the fundamental steps of using the PJSUA2 library: initializing the endpoint, creating a SIP transport, configuring and registering an account, and finally shutting down the library. It includes basic error handling for transport creation. ```c++ #include #include using namespace pj; // Subclass to extend the Account and get notifications etc. class MyAccount : public Account { public: virtual void onRegState(OnRegStateParam &prm) { AccountInfo ai = getInfo(); std::cout << (ai.regIsActive? "*** Register:" : "*** Unregister:") << " code=" << prm.code << std::endl; } }; int main() { Endpoint ep; ep.libCreate(); // Initialize endpoint EpConfig ep_cfg; ep.libInit( ep_cfg ); // Create SIP transport. Error handling sample is shown TransportConfig tcfg; tcfg.port = 5060; try { ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg); } catch (Error &err) { std::cout << err.info() << std::endl; return 1; } // Start the library (worker threads etc) ep.libStart(); std::cout << "*** PJSUA2 STARTED ***" << std::endl; // Configure an AccountConfig AccountConfig acfg; acfg.idUri = "sip:test@sip.pjsip.org"; acfg.regConfig.registrarUri = "sip:sip.pjsip.org"; AuthCredInfo cred("digest", "*", "test", 0, "secret"); acfg.sipConfig.authCreds.push_back( cred ); // Create the account MyAccount *acc = new MyAccount; acc->create(acfg); // Here we don't have anything else to do.. pj_thread_sleep(10000); // Delete the account. This will unregister from server delete acc; // This will implicitly shutdown the library return 0; } ``` -------------------------------- ### Sample PJSIP Application (myapp.c) Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/posix/using.rst A basic C program demonstrating PJSIP initialization and destruction. Include necessary PJSIP headers and use pjsua_create() and pjsua_destroy(). ```c #include #include int main() { pj_status_t status; status = pjsua_create(); PJ_LOG(3,("myapp.c", "Hello PJSIP! Bye PJSIP.")); pjsua_destroy(); return 0; } ``` -------------------------------- ### Initialize PJSUA2, Register Account, and Quit (Python3) Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/hello_world.rst This Python3 snippet provides the equivalent functionality to the C++ example, demonstrating PJSUA2 initialization, transport creation, account registration, and library shutdown using Python bindings. ```python import pjsua2 as pj import time # Subclass to extend the Account and get notifications etc. class Account(pj.Account): def onRegState(self, prm): print("***OnRegState: " + prm.reason) # pjsua2 test function def pjsua2_test(): # Create and initialize the library ep_cfg = pj.EpConfig() ep = pj.Endpoint() ep.libCreate() ep.libInit(ep_cfg) # Create SIP transport. Error handling sample is shown sipTpConfig = pj.TransportConfig(); sipTpConfig.port = 5060; ep.transportCreate(pj.PJSIP_TRANSPORT_UDP, sipTpConfig); # Start the library ep.libStart(); acfg = pj.AccountConfig(); acfg.idUri = "sip:test@sip.pjsip.org"; acfg.regConfig.registrarUri = "sip:sip.pjsip.org"; cred = pj.AuthCredInfo("digest", "*", "test", 0, "pwtest"); acfg.sipConfig.authCreds.append( cred ); # Create the account acc = Account(); acc.create(acfg); # Here we don't have anything else to do.. time.sleep(10); # Destroy the library ep.libDestroy() # # main() # if __name__ == "__main__": pjsua2_test() ``` -------------------------------- ### Install SWIG on Debian/Ubuntu Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/building.rst Installs the SWIG package on Debian-based systems using apt-get. ```shell sudo apt-get install swig ``` -------------------------------- ### Create config_site.h for Android Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/android/build_instructions.rst Create this file to activate Android-specific settings and enable video support in PJSIP. ```c #define PJ_CONFIG_ANDROID 1 #include #define PJMEDIA_HAS_VIDEO 1 ``` -------------------------------- ### Initializing and Configuring the Library Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/using/endpoint.rst Explains how to initialize the PJSUA2 library using `libInit()`, which accepts an `EpConfig` object for customizing settings like SIP user agent, media, and logging configurations. ```APIDOC ## Initializing and configuring the library The :cpp:class:`pj::EpConfig` class provides endpoint configuration which allows the customization of the following settings: - :cpp:class:`pj::UAConfig`, to specify core SIP user agent settings. - :cpp:class:`pj::MediaConfig`, to specify various media *global* settings - :cpp:class:`pj::LogConfig`, to customize logging settings. To customize the settings, create instance of ``EpConfig`` class and specify them during the endpoint initialization (will be explained more later), for example: .. code-block:: c++ EpConfig ep_cfg; ep_cfg.logConfig.level = 5; ep_cfg.uaConfig.maxCalls = 4; ep_cfg.mediaConfig.sndClockRate = 16000; Next, you can initialize the library by calling :cpp:func:`pj::Endpoint::libInit()`: .. code-block:: c++ try { EpConfig ep_cfg; // Specify customization of settings in ep_cfg ep->libInit(ep_cfg); } catch(Error& err) { cout << "Initialization error: " << err.info() << endl; } The snippet above initializes the library with the default settings. ``` -------------------------------- ### Install Python Development Package on MinGW/MSYS2 Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/building.rst Installs SWIG, Python, and setuptools on Windows using MinGW/MSYS2. ```shell pacman -S swig python python-setuptools ``` -------------------------------- ### Install Python Development Package on Debian/Ubuntu Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/building.rst Installs the Python 3 development package on Debian-based systems. ```shell sudo apt-get install swig python3-dev ``` -------------------------------- ### Create SIP Account Configuration Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/using/account.rst Configure a SIP account with its URI, registrar, and authentication credentials. This setup is necessary before creating an account instance. ```cpp acc_cfg.idUri = "sip:test1@pjsip.org"; acc_cfg.regConfig.registrarUri = "sip:pjsip.org"; acc_cfg.sipConfig.authCreds.push_back( AuthCredInfo("digest", "*", "test1", 0, "secret1") ); ``` -------------------------------- ### Play WAV file with playfile sample Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/audio-troubleshooting/checks/play_wav.rst Use the playfile sample application to play a WAV file if pjsua fails. This bypasses the conference bridge for simpler testing. ```shell $ ./playfile THEFILE.WAV ``` -------------------------------- ### Test Python SWIG Module Installation Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/building.rst Verifies the installation of the pjsua2 Python module by importing it in the Python interpreter. ```python import pjsua2 ``` -------------------------------- ### Python Example: Deferring Response Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/sip/async_auth.rst A Python example demonstrating how to defer an authentication challenge response using pjsua2. ```APIDOC ## MyAccount.onAuthChallenge ### Description Python implementation of `onAuthChallenge` to defer the authentication response. ### Language Python ### Code Example ```python import pjsua2 as pj class MyAccount(pj.Account): def onAuthChallenge(self, prm): deferred = prm.challenge.defer() # Further asynchronous logic to fetch credentials and call deferred.respond() or deferred.abandon() ``` ``` -------------------------------- ### Build Documentation Locally Source: https://github.com/pjsip/pjproject_docs/blob/master/README.md Cleans previous builds and generates HTML documentation using Sphinx. Navigate to the 'docs' directory before running. ```sh $ cd docs $ make clean html ``` -------------------------------- ### Configure SIP Account and Servers (Kotlin) Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/android/kotlin-sip-client.rst Modify these constants to set up your SIP account, registrar, and proxy server details. Ensure the ACC_ID_URI format is correct for your setup. ```kotlin const val ACC_DOMAIN = "pjsip.org" const val ACC_USER = "101" const val ACC_PASSWD = "--secret--" const val ACC_ID_URI = "Kotlin " const val ACC_REGISTRAR = "sip:sip.pjsip.org;transport=tls" const val ACC_PROXY = "sip:sip.pjsip.org;lr;transport=tls" ``` -------------------------------- ### Install FFMPEG Development Packages on Debian Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/build_int/ffmpeg.rst Install the necessary FFMPEG development libraries on Debian-based systems using apt-get. ```shell sudo apt-get install libavutil-dev libavformat-dev libavcodec-dev libavdevice-dev libswscale-dev ``` -------------------------------- ### PJMEDIA AI Backend Creation and Port Setup Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/media/ai_connectivity.rst Directly use the PJMEDIA C API to create an AI backend and port. This requires an ioqueue, timer heap, and a backend instance. The port takes ownership of the backend. ```c pjmedia_ai_backend *backend; pjmedia_ai_openai_backend_create(pool, &backend); pjmedia_ai_port_param prm; pjmedia_ai_port_param_default(&prm); prm.ioqueue = pjsip_endpt_get_ioqueue(pjsua_get_pjsip_endpt()); prm.timer_heap = pjsip_endpt_get_timer_heap(pjsua_get_pjsip_endpt()); prm.backend = backend; /* port takes ownership */ prm.cb.on_event = &on_ai_event; prm.user_data = my_ctx; /* Optional: prm.vad_enabled, prm.ptime_msec, prm.ssl_param */ pjmedia_ai_port *ai_port; pjmedia_ai_port_create(pool, &prm, &ai_port); pjmedia_port *port = pjmedia_ai_port_get_port(ai_port); pjmedia_conf_add_port(conf, pool, port, NULL, NULL); pj_str_t url = pj_str("wss://api.openai.com/v1/realtime?model=..."); pj_str_t token = pj_str(api_key); pjmedia_ai_port_connect(ai_port, &url, &token); ``` -------------------------------- ### Add New Account Shortcut Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/other/cli_cmd.rst Use the shortcut '+a' to add a new account. ```shell +a ``` -------------------------------- ### Install Video4Linux Development Package Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/api/pjmedia/pjmedia-videodev.rst Install the Video4Linux development package on Debian-based systems to enable V4L support in PJSIP. ```shell sudo apt-get install libv4l-dev ``` -------------------------------- ### Install OpenH264 on Debian/Ubuntu Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/api/pjmedia/pjmedia-codec.rst Use this command to install the OpenH264 development package on Debian-based systems. Ensure you have the necessary permissions. ```shell $ sudo apt-get install libopenh264-dev ``` -------------------------------- ### Run Configure Script with Default Settings Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/posix/build_instructions.rst Navigate to the pjproject directory and run the './configure' script without any options to use default build settings for your host system. This typically builds libraries in release mode with default optimization flags. ```shell cd pjproject ./configure ``` -------------------------------- ### Install TLS development headers on Debian/Ubuntu Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/security/ssl.rst Install the necessary development headers for OpenSSL, GnuTLS, or Mbed TLS using apt-get. ```shell sudo apt-get install libssl-dev # OpenSSL sudo apt-get install libgnutls28-dev # GnuTLS sudo apt-get install libmbedtls-dev # Mbed TLS ``` -------------------------------- ### List CMake Build Options Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/cmake/build_instructions.rst Lists all available configuration options and their current values for an existing build directory. Use with 'less' for easier navigation. ```shell $ cmake -LAH -N build | less ``` -------------------------------- ### Verify OpenCore AMR installation Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/audio/opencore-amr.rst Checks the include directory of the installation path to confirm the presence of OpenCore AMR header files. ```shell $ ls /home/foo/include opencore-amrnb opencore-amrwb vo-amrwbenc ``` -------------------------------- ### Install OpenCore AMR libraries on Debian/Ubuntu Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/specific-guides/audio/opencore-amr.rst Installs the development packages for OpenCore AMR-NB, AMR-WB, and the AMR-WB encoder using apt-get. ```shell $ sudo apt-get install libopencore-amrnb-dev libopencore-amrwb-dev libvo-amrwbenc-dev ``` -------------------------------- ### Install Python SWIG Module within Virtualenv Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/building.rst Installs the Python SWIG module to a virtual environment's site-packages directory. ```shell python setup.py install ``` -------------------------------- ### Check SWIG Version Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/get-started/android/requirements.rst Verify that SWIG is installed and accessible in your system's PATH. This command displays the installed SWIG version. ```shell $ swig -version SWIG Version 4.0.2 Compiled with g++ [x86_64-pc-linux-gnu] Configured options: +pcre Please see http://www.swig.org for reporting bugs and further information ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/pjsip/pjproject_docs/blob/master/README.md Installs all required Python modules for documentation generation using pip. This ensures all necessary packages are available. ```cmd $ pip install -r requirements.txt ``` -------------------------------- ### Creating a Basic Account Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/pjsua2/using/account.rst Create a pj::Account instance with a minimal configuration, setting only the account ID URI. This account provides identity for outgoing requests but does not register to a SIP server. ```cpp AccountConfig acc_cfg; acc_cfg.idUri = "sip:test1@pjsip.org"; // This is also valid // acc_cfg.idUri = "Test "; MyAccount *acc = new MyAccount; try { acc->create(acc_cfg); } catch(Error& err) { cout << "Account creation error: " << err.info() << endl; } ``` -------------------------------- ### Basic Initialization Source: https://github.com/pjsip/pjproject_docs/blob/master/docs/source/api/pjnath/ref.rst Provides documentation for basic initialization functions. ```APIDOC ## Basic Initialization ### Description Provides documentation for basic initialization functions. ### Endpoint /api/generated/pjnath/group/group__PJNATH ### Parameters None specified in source. ### Request Example None specified in source. ### Response None specified in source. ```