Skip to content

Commit 5f9d65b

Browse files
authored
Add comprehensive GitHub Copilot instructions for PJSIP development workflow (#4558)
1 parent 9c904ec commit 5f9d65b

File tree

1 file changed

+154
-0
lines changed

1 file changed

+154
-0
lines changed

.github/copilot-instructions.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# PJSIP/PJPROJECT
2+
3+
PJSIP is a free and open source multimedia communication library written in C with high level API in C, C++, Java, C#, and Python languages. It implements standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE. It combines signaling protocol (SIP) with rich multimedia framework and NAT traversal functionality into high level API that is portable and suitable for almost any type of systems ranging from desktops, embedded systems, to mobile handsets.
4+
5+
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
6+
7+
## Working Effectively
8+
9+
- Bootstrap, build, and test the repository:
10+
- `./configure` - takes ~7 seconds to configure build system
11+
- `make dep` - generate dependencies, takes ~13 seconds
12+
- `make -j3` - build everything with parallel jobs, takes ~65 seconds. NEVER CANCEL. Set timeout to 120+ seconds.
13+
- Run individual component tests:
14+
- `make pjlib-test` - core library tests, takes 5+ minutes. NEVER CANCEL. Set timeout to 600+ seconds.
15+
- `make pjlib-util-test` - utility library tests, takes ~3 minutes. NEVER CANCEL. Set timeout to 360+ seconds.
16+
- `make pjnath-test` - NAT traversal tests, takes 3+ minutes. NEVER CANCEL. Set timeout to 360+ seconds.
17+
- `make pjmedia-test` - media framework tests, takes 5+ minutes. NEVER CANCEL. Set timeout to 600+ seconds.
18+
- `make pjsip-test` - SIP stack tests, takes 5+ minutes. NEVER CANCEL. Set timeout to 600+ seconds.
19+
- `make pjsua-test` - high-level API tests (Python-based), takes 5+ minutes. NEVER CANCEL. Set timeout to 600+ seconds.
20+
- Get target architecture name:
21+
- `make infotarget` - returns target name (e.g., x86_64-pc-linux-gnu)
22+
- Run main PJSUA application:
23+
- `./pjsip-apps/bin/pjsua-x86_64-pc-linux-gnu --help` - show all options
24+
- `./pjsip-apps/bin/pjsua-x86_64-pc-linux-gnu --null-audio --no-cli-console` - basic test run
25+
- Note: pjsua binary name depends on the target architecture name
26+
27+
## Coding Style
28+
29+
- Follow the official PJSIP coding style guidelines: https://docs.pjsip.org/en/latest/get-started/coding-style.html
30+
- The coding style covers naming conventions, indentation, formatting, and other code organization principles
31+
- Consistent style is essential for maintainability across the large PJSIP codebase
32+
33+
## Validation
34+
35+
- ALWAYS run through at least one complete validation scenario after making changes.
36+
- Test PJSUA basic functionality: run PJSUA with null audio device and verify it starts without errors.
37+
- For quick validation: `cd tests/pjsua && python3 run.py mod_run.py scripts-run/100_simple.py` (takes ~2 seconds).
38+
- ALWAYS run appropriate test suites for the component you're modifying before completing your work.
39+
- SSL tests will fail with timeouts in sandboxed environments - this is expected and normal.
40+
41+
### Manual Validation Scenarios
42+
43+
After making changes, validate functionality by:
44+
1. **Basic SIP functionality**: Run `echo "Cp\nq" | ./pjsip-apps/bin/pjsua-x86_64-pc-linux-gnu --null-audio --no-cli-console` and verify codec list includes speex, G.711, etc.
45+
2. **Configuration check**: Run `./pjlib/bin/pjlib-test-x86_64-pc-linux-gnu --config --list | grep PJ_SSL` to verify SSL support is enabled
46+
3. **Quick component test**: Run one of the shorter unit tests like `make pjlib-util-test` which completes in ~3 minutes
47+
48+
## Common Tasks
49+
50+
The following are outputs from frequently run commands. Reference them instead of viewing, searching, or running bash commands to save time.
51+
52+
### Repository Structure
53+
54+
```
55+
/home/runner/work/pjproject/pjproject/
56+
├── pjlib/ # Portable library (core)
57+
├── pjlib-util/ # Utility library
58+
├── pjnath/ # NAT traversal library
59+
├── pjmedia/ # Media framework
60+
├── pjsip/ # SIP stack
61+
├── pjsip-apps/ # Applications and samples
62+
│ ├── bin/ # Built executables
63+
│ └── src/ # Source for applications
64+
├── third_party/ # Third-party dependencies
65+
├── tests/ # Test frameworks
66+
│ ├── pjsua/ # Python-based PJSUA tests
67+
│ └── automated/ # Other automated tests
68+
├── build/ # Build system files
69+
├── .github/ # GitHub workflows and configs
70+
├── configure # Main configure script (calls aconfigure)
71+
├── aconfigure # Real autotools configure script
72+
├── Makefile # Main makefile
73+
└── build.mak.in # Build configuration template
74+
```
75+
76+
### Main Applications Built
77+
78+
After running `make`:
79+
- `pjsip-apps/bin/pjsua-x86_64-pc-linux-gnu` - Main SIP user agent application
80+
- `pjsip-apps/bin/pjsystest-x86_64-pc-linux-gnu` - Audio system test application
81+
- `pjsip-apps/bin/samples/x86_64-pc-linux-gnu/` - Various sample applications
82+
83+
### Test Executables Built
84+
85+
- `pjlib/bin/pjlib-test-x86_64-pc-linux-gnu` - Core library tests
86+
- `pjlib-util/bin/pjlib-util-test-x86_64-pc-linux-gnu` - Utility tests
87+
- `pjnath/bin/pjnath-test-x86_64-pc-linux-gnu` - NAT traversal tests
88+
- `pjmedia/bin/pjmedia-test-x86_64-pc-linux-gnu` - Media framework tests
89+
- `pjsip/bin/pjsip-test-x86_64-pc-linux-gnu` - SIP stack tests
90+
- `pjsip/bin/pjsua2-test-x86_64-pc-linux-gnu` - High-level C++ API tests
91+
92+
### Key Configuration Options
93+
94+
The configure script supports many options. Key ones:
95+
- `--disable-ssl` - Disable SSL/TLS support
96+
- `--with-gnutls=/usr/` - Use GnuTLS instead of OpenSSL
97+
- `--enable-shared` - Build shared libraries
98+
- `CFLAGS="-g -fPIC"` - Add debug symbols and position-independent code
99+
100+
### Testing Framework
101+
102+
- Python-based test framework in `tests/pjsua/`
103+
- Use `cd tests/pjsua && python3 run.py MODULE CONFIG` for individual tests
104+
- Example: `cd tests/pjsua && python3 run.py mod_run.py scripts-run/100_simple.py`
105+
- Use `cd tests/pjsua && python3 runall.py` for complete test suite
106+
- Test modules include: mod_run, mod_call, mod_pres, mod_sendto, mod_media_playrec
107+
108+
### Build System Details
109+
110+
- Uses autotools (configure/make) build system
111+
- Main build controlled by top-level Makefile
112+
- Each component has its own build/ subdirectory with component-specific Makefiles
113+
- Parallel builds supported with `make -j<N>`
114+
- Dependencies generated with `make dep`
115+
116+
### Key Environment Variables
117+
118+
- `TARGET_NAME` - Target architecture (set by configure)
119+
- `CI_ARGS` - Additional arguments for CI testing
120+
- `CI_MODE` - CI mode flag
121+
- `CI_RUNNER` - CI runner command wrapper
122+
123+
### SSL/TLS Support
124+
125+
- Default build includes OpenSSL support
126+
- SSL implementation ID: 1=OpenSSL, 2=GnuTLS
127+
- Check SSL support: `./pjlib/bin/pjlib-test-x86_64-pc-linux-gnu --config --list | grep SSL`
128+
- SSL tests may timeout in sandboxed environments (this is normal)
129+
130+
### Media Codecs
131+
132+
Built-in codecs include:
133+
- G.711 (PCMU/PCMA)
134+
- G.722
135+
- G.722.1
136+
- GSM
137+
- iLBC
138+
- L16 (linear PCM)
139+
- Speex
140+
141+
### Important Paths for Development
142+
143+
- `pjlib/include/pj/config_site.h` - Main configuration overrides
144+
- `user.mak` - User-specific build customizations
145+
- `build.mak` - Generated build configuration
146+
- `pjsip-apps/src/pjsua/` - Main PJSUA application source
147+
- `pjsip-apps/src/samples/` - Sample application sources
148+
149+
### CI Integration
150+
151+
- GitHub Actions workflows in `.github/workflows/`
152+
- Primary CI runs on Linux, Mac, and Windows
153+
- Uses `cirunner` tool for test execution with timeouts
154+
- Builds test multiple configurations (SSL/no-SSL, video codecs, etc.)

0 commit comments

Comments
 (0)