Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
path: |
third_party/pjsip
third_party/deps
key: pjsip-universal-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/build-pjsip.sh', 'third_party/pjsip/config_site.h') }}
key: pjsip-universal-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/build-pjsip.sh', 'third_party/pjsip/config_site.h', 'scripts/pjsip-patches/**') }}

- name: Build PJSIP, OpenSSL and Opus (arm64 + x86_64, universal)
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
path: |
third_party/pjsip
third_party/deps
key: pjsip-universal-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/build-pjsip.sh', 'third_party/pjsip/config_site.h') }}
key: pjsip-universal-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/build-pjsip.sh', 'third_party/pjsip/config_site.h', 'scripts/pjsip-patches/**') }}

- name: Build PJSIP, OpenSSL and Opus (arm64 + x86_64, universal)
run: |
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
![macOS 14+](https://img.shields.io/badge/macOS-14%2B-lightgrey)
![Universal: Apple Silicon and Intel](https://img.shields.io/badge/arch-universal-lightgrey)
![PJSIP 2.17](https://img.shields.io/badge/PJSIP-2.17-green)
![Release 26.3.0](https://img.shields.io/badge/release-26.3.0-brightgreen)
![Release 26.3.1](https://img.shields.io/badge/release-26.3.1-brightgreen)

A MicroSIP-style SIP softphone for macOS on Apple Silicon and Intel. Native Swift and
SwiftUI interface, [PJSIP](https://github.com/pjsip/pjproject) 2.17 engine,
Expand All @@ -19,7 +19,7 @@ presence, quick keys, global hotkeys, English and Russian interface.

Guide: https://hsmm.github.io/MacroSIP/wiki/

Status: `26.3.0` released 2026-11-05. What comes next: [docs/ROADMAP.md](docs/ROADMAP.md).
Status: `26.3.1` released 2026-11-09. What comes next: [docs/ROADMAP.md](docs/ROADMAP.md).

## Screenshots

Expand Down Expand Up @@ -93,6 +93,7 @@ Messages: the conversation list, and a conversation open:

- Several SIP accounts registered at once; UDP, TCP and TLS with certificate verification; SRTP; STUN and ICE; outgoing-only accounts; each account switched on or off in the account pop-up; search and a status summary when there are many. Passwords are kept in the Keychain.
- An account on a server addressed by a private IP address (10.x, 172.16-31.x, 192.168.x, 100.64-127.x, on the LAN or over a VPN) does not use STUN, so the first REGISTER carries the Mac's own address.
- IPv6 next to IPv4: SIP over UDP, TCP and TLS and the audio over IPv6, for a server given by an IPv6 address or by a host name with IPv6 (AAAA) records. Per account, IP protocol Auto (an IP address picks its own protocol, a host name follows the order macOS returns and tries the other protocol when the server does not answer), IPv4 only or IPv6 only. Over IPv6 there is no STUN; ICE works over IPv6 too.
- After a network drop, an IP change or sleep the accounts register again at once, with backoff while the network is down; a running call survives an IP change. The status bar and the call window show "No network" and "Reconnecting…".
- Network pane: RTP port range, rport, DNS SRV with a custom nameserver.
- Codecs: Opus (with FEC and DTX), G.722, G.711 and, off until you turn them on, G.722.1, GSM, iLBC and Speex.
Expand Down Expand Up @@ -220,7 +221,7 @@ scripts/selftest-call.sh # end-to-end call against a local pjsua: RTP both wa

The details are in [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md#releasing).

1. Tag `26.3.0` (release candidates: `26.3.0-rc.1`) and push the tag; the app takes its version from the tag. For a final release also bump `Product.fallbackVersion`.
1. Tag `26.3.1` (release candidates: `26.3.1-rc.1`) and push the tag; the app takes its version from the tag. For a final release also bump `Product.fallbackVersion`.
2. `.github/workflows/release.yml` builds the DMG, creates the GitHub Release and adds it to the
update feed (`appcast.xml` on the `gh-pages` branch, signed with the Actions secret
`SPARKLE_PRIVATE_KEY`; ADR 0013). Tag each release on a new commit, a final release after its
Expand Down
7 changes: 4 additions & 3 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
![macOS 14+](https://img.shields.io/badge/macOS-14%2B-lightgrey)
![Universal: Apple Silicon and Intel](https://img.shields.io/badge/arch-universal-lightgrey)
![PJSIP 2.17](https://img.shields.io/badge/PJSIP-2.17-green)
![Release 26.3.0](https://img.shields.io/badge/release-26.3.0-brightgreen)
![Release 26.3.1](https://img.shields.io/badge/release-26.3.1-brightgreen)

SIP-софтфон для macOS на Apple Silicon и Intel в духе MicroSIP. Нативный интерфейс на
Swift и SwiftUI, движок [PJSIP](https://github.com/pjsip/pjproject) 2.17, без
Expand All @@ -19,7 +19,7 @@ Electron и Qt. Одно небольшое окно, значок в строк

Руководство: https://hsmm.github.io/MacroSIP/wiki/ru/index.html

Статус: выпущена версия `26.3.0` (5 ноября 2026). Что дальше: [docs/ROADMAP.md](docs/ROADMAP.md).
Статус: выпущена версия `26.3.1` (9 ноября 2026). Что дальше: [docs/ROADMAP.md](docs/ROADMAP.md).

## Скриншоты

Expand Down Expand Up @@ -93,6 +93,7 @@ Electron и Qt. Одно небольшое окно, значок в строк

- Несколько SIP-аккаунтов с одновременной регистрацией; UDP, TCP и TLS с проверкой сертификата; SRTP; STUN и ICE; аккаунты «только исходящие»; каждый аккаунт включается и выключается в меню аккаунтов; поиск и сводка состояния, когда аккаунтов много. Пароли хранятся в связке ключей.
- Аккаунт на сервере с частным IP-адресом (10.x, 172.16–31.x, 192.168.x, 100.64–127.x, в локальной сети или через VPN) не использует STUN: первый REGISTER несёт собственный адрес Mac.
- IPv6 наряду с IPv4: SIP по UDP, TCP и TLS и звук по IPv6 для сервера, заданного IPv6-адресом или именем хоста с IPv6-записями (AAAA). У каждого аккаунта протокол IP: «Авто» (IP-адрес сам задаёт протокол, для имени хоста — порядок, который выдаёт macOS, а если сервер не отвечает, другой протокол), «Только IPv4» или «Только IPv6». По IPv6 нет STUN; ICE работает и по IPv6.
- После обрыва сети, смены IP или сна аккаунты сразу регистрируются заново, пока сети нет, попытки повторяются с нарастающей паузой; идущий разговор переживает смену IP. В строке состояния и в окне звонка видны «Нет сети» и «Переподключение…».
- Раздел «Сеть»: диапазон портов RTP, rport, DNS SRV с собственным сервером имён.
- Кодеки: Opus (с FEC и DTX), G.722, G.711 и, выключенные до включения вами, G.722.1, GSM, iLBC и Speex.
Expand Down Expand Up @@ -222,7 +223,7 @@ scripts/selftest-call.sh # сквозной звонок на локальн

Подробности в [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md#releasing).

1. Поставить тег `26.3.0` (кандидаты: `26.3.0-rc.1`) и отправить его; версию приложение берёт из тега. Для финального релиза также обновить `Product.fallbackVersion`.
1. Поставить тег `26.3.1` (кандидаты: `26.3.1-rc.1`) и отправить его; версию приложение берёт из тега. Для финального релиза также обновить `Product.fallbackVersion`.
2. `.github/workflows/release.yml` собирает DMG, создаёт GitHub Release и добавляет его в ленту
обновлений (`appcast.xml` в ветке `gh-pages`, подпись секретом Actions `SPARKLE_PRIVATE_KEY`;
ADR 0013). Каждый релиз ставится на новый коммит, финальный после кандидата тоже.
Expand Down
44 changes: 43 additions & 1 deletion Sources/CPJSUA/include/CPJSUA.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ pj_status_t cpjsua_transport_create2(pjsip_transport_type_e type,
pjsua_transport_id *out_id);

/** TLS listener (also used for outgoing TLS connections of accounts bound to it).
* `type` is PJSIP_TRANSPORT_TLS or PJSIP_TRANSPORT_TLS6.
* verify_server != 0: the server certificate must chain to a CA in `ca_file` (PEM) and
* match the destination host name (PJSIP sets SNI and checks CN/SAN per connection).
* verify_client is always off; no client certificate is presented. */
pj_status_t cpjsua_tls_transport_create(unsigned port,
pj_status_t cpjsua_tls_transport_create(pjsip_transport_type_e type,
unsigned port,
const char *address,
int verify_server,
const char *ca_file,
Expand Down Expand Up @@ -322,6 +324,15 @@ int cpjsua_has_resolver(void);
/** Local RTP port of the call's first audio stream, 0 if none (tests, diagnostics). */
int cpjsua_call_local_rtp_port(pjsua_call_id call_id);

/** Local RTP address of the call's first audio stream as published in SDP ("::1",
* "192.0.2.10", no brackets, no port) into `buf`; returns its length, 0 if none. */
int cpjsua_call_local_rtp_addr(pjsua_call_id call_id, char *buf, unsigned len);

/** ICE of the call's first audio stream: 1 when ICE is in use and its negotiation completed (session
* running), with the addresses of component 1's nominated pair in `local` and `remote` (no
* brackets, no port); 0 otherwise. */
int cpjsua_call_ice_pair(pjsua_call_id call_id, char *local, char *remote, unsigned len);

/* ----------------------------------------------------- packet source --- */

/** Where a received message came from (rdata->pkt_info, rdata->tp_info). */
Expand Down Expand Up @@ -463,6 +474,37 @@ pj_status_t cpjsua_handle_ip_change(int restart_listener, unsigned restart_delay
* calls). Accounts with a registration session are always re-registered by pjsua. */
void cpjsua_acc_prepare_ip_change(pjsua_acc_id acc_id, int register_it);

/* ------------------------------------------------- moving an account between IP families --- */

/** Slots in pjsua's transport table (pjsua_var.tpdata, a fixed array of 8 in pjsua_internal.h,
* not a configurable macro): the engine creates at most this many transports. */
unsigned cpjsua_transport_slots(void);

/** 1 when the registrar holds a binding of the account as PJSIP knows it: a registration session
* exists and its last REGISTER was answered 2xx (pjsua destroys the session after a failure and
* after a successful un-REGISTER). */
int cpjsua_acc_has_binding(pjsua_acc_id acc_id);

/** 1 while the account has a registration session (pjsua_acc_modify drops it for some changes). */
int cpjsua_acc_has_regc(pjsua_acc_id acc_id);

/** 1 while the account's registration session has a REGISTER (or un-REGISTER) transaction in flight. */
int cpjsua_acc_reg_busy(pjsua_acc_id acc_id);

/** pjsua_acc_modify never copies allow_sdp_nat_rewrite (only pjsua_acc_add does): set it on the
* live account config. */
void cpjsua_acc_set_sdp_nat_rewrite(pjsua_acc_id acc_id, int on);

/** After a move to another transport (the registration session is gone): end the MWI subscription,
* whose dialog keeps the old transport selector; pjsua subscribes again once the account has
* registered (regc_cb). No-op while the account still has a registration session. */
void cpjsua_acc_end_mwi_after_move(pjsua_acc_id acc_id);

/** Presence subscription of a buddy anew: the current one (its dialog keeps the transport selector
* of the account at subscribe time) is detached and unsubscribed, and a new one is created with the
* account's current selector. No-op for a buddy without an active subscription. */
pj_status_t cpjsua_buddy_resubscribe(pjsua_buddy_id buddy_id);

/** Re-INVITE a confirmed call after a network change: new media transport, Contact and
* Via (cpjsua_ip_change_reinvite_flags), local hold kept. */
pj_status_t cpjsua_call_reinvite_ip_change(pjsua_call_id call_id);
Expand Down
158 changes: 156 additions & 2 deletions Sources/CPJSUA/shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ pj_status_t cpjsua_transport_create2(pjsip_transport_type_e type,
return status;
}

pj_status_t cpjsua_tls_transport_create(unsigned port,
pj_status_t cpjsua_tls_transport_create(pjsip_transport_type_e type,
unsigned port,
const char *address,
int verify_server,
const char *ca_file,
Expand All @@ -136,6 +137,8 @@ pj_status_t cpjsua_tls_transport_create(unsigned port,
pjsua_transport_id tid = PJSUA_INVALID_ID;
pj_status_t status;

if (type != PJSIP_TRANSPORT_TLS && type != PJSIP_TRANSPORT_TLS6)
return PJ_EINVAL;
pjsua_transport_config_default(&cfg);
cfg.port = port;
if (address && *address) {
Expand All @@ -147,7 +150,7 @@ pj_status_t cpjsua_tls_transport_create(unsigned port,
cfg.tls_setting.require_client_cert = PJ_FALSE;
if (ca_file && *ca_file)
cfg.tls_setting.ca_list_file = cpjsua_str(ca_file);
status = pjsua_transport_create(PJSIP_TRANSPORT_TLS, &cfg, &tid);
status = pjsua_transport_create(type, &cfg, &tid);
if (out_id)
*out_id = tid;
return status;
Expand Down Expand Up @@ -1137,6 +1140,56 @@ int cpjsua_call_local_rtp_port(pjsua_call_id call_id)
return pj_sockaddr_get_port(&tpinfo.sock_info.rtp_addr_name);
}

int cpjsua_call_ice_pair(pjsua_call_id call_id, char *local, char *remote, unsigned len)
{
pjsua_call_info ci;
pjmedia_transport_info tpinfo;
pjmedia_ice_transport_info *ice;
int aud;

if (!local || !remote || len == 0)
return 0;
local[0] = remote[0] = '\0';
if (pjsua_call_get_info(call_id, &ci) != PJ_SUCCESS)
return 0;
aud = first_audio_index(&ci);
if (aud < 0)
return 0;
pjmedia_transport_info_init(&tpinfo);
if (pjsua_call_get_med_transport_info(call_id, (unsigned)aud, &tpinfo) != PJ_SUCCESS)
return 0;
ice = (pjmedia_ice_transport_info *)
pjmedia_transport_info_get_spc_info(&tpinfo, PJMEDIA_TRANSPORT_TYPE_ICE);
if (!ice || !ice->active || ice->sess_state != PJ_ICE_STRANS_STATE_RUNNING)
return 0;
pj_sockaddr_print(&ice->comp[0].lcand_addr, local, len, 0);
pj_sockaddr_print(&ice->comp[0].rcand_addr, remote, len, 0);
return 1;
}

int cpjsua_call_local_rtp_addr(pjsua_call_id call_id, char *buf, unsigned len)
{
pjsua_call_info ci;
pjmedia_transport_info tpinfo;
int aud;

if (!buf || len == 0)
return 0;
buf[0] = '\0';
if (pjsua_call_get_info(call_id, &ci) != PJ_SUCCESS)
return 0;
aud = first_audio_index(&ci);
if (aud < 0)
return 0;
pjmedia_transport_info_init(&tpinfo);
if (pjsua_call_get_med_transport_info(call_id, (unsigned)aud, &tpinfo) != PJ_SUCCESS)
return 0;
if (!pj_sockaddr_has_addr(&tpinfo.sock_info.rtp_addr_name))
return 0;
pj_sockaddr_print(&tpinfo.sock_info.rtp_addr_name, buf, len, 0);
return (int)pj_ansi_strlen(buf);
}

/* ====================================================== packet source === */

pj_status_t cpjsua_rdata_source(const pjsip_rx_data *rdata, cpjsua_pkt_source *out)
Expand Down Expand Up @@ -1609,6 +1662,107 @@ void cpjsua_acc_prepare_ip_change(pjsua_acc_id acc_id, int register_it)
PJSUA_UNLOCK();
}

unsigned cpjsua_transport_slots(void)
{
return (unsigned)PJ_ARRAY_SIZE(pjsua_var.tpdata);
}

int cpjsua_acc_has_binding(pjsua_acc_id acc_id)
{
int bound = 0;
if (acc_id < 0 || acc_id >= (int)PJ_ARRAY_SIZE(pjsua_var.acc))
return 0;
PJSUA_LOCK();
if (pjsua_var.acc[acc_id].valid && pjsua_var.acc[acc_id].regc &&
pjsua_var.acc[acc_id].reg_last_code / 100 == 2)
{
bound = 1;
}
PJSUA_UNLOCK();
return bound;
}

int cpjsua_acc_has_regc(pjsua_acc_id acc_id)
{
int has;
if (acc_id < 0 || acc_id >= (int)PJ_ARRAY_SIZE(pjsua_var.acc))
return 0;
PJSUA_LOCK();
has = pjsua_var.acc[acc_id].valid && pjsua_var.acc[acc_id].regc != NULL;
PJSUA_UNLOCK();
return has;
}

int cpjsua_acc_reg_busy(pjsua_acc_id acc_id)
{
pjsip_regc_info info;
int busy = 0;
if (acc_id < 0 || acc_id >= (int)PJ_ARRAY_SIZE(pjsua_var.acc))
return 0;
PJSUA_LOCK();
if (pjsua_var.acc[acc_id].valid && pjsua_var.acc[acc_id].regc &&
pjsip_regc_get_info(pjsua_var.acc[acc_id].regc, &info) == PJ_SUCCESS)
{
busy = info.is_busy ? 1 : 0;
}
PJSUA_UNLOCK();
return busy;
}

void cpjsua_acc_set_sdp_nat_rewrite(pjsua_acc_id acc_id, int on)
{
if (acc_id < 0 || acc_id >= (int)PJ_ARRAY_SIZE(pjsua_var.acc))
return;
PJSUA_LOCK();
if (pjsua_var.acc[acc_id].valid)
pjsua_var.acc[acc_id].cfg.allow_sdp_nat_rewrite = on ? PJ_TRUE : PJ_FALSE;
PJSUA_UNLOCK();
}

void cpjsua_acc_end_mwi_after_move(pjsua_acc_id acc_id)
{
if (acc_id < 0 || acc_id >= (int)PJ_ARRAY_SIZE(pjsua_var.acc))
return;
PJSUA_LOCK();
/* pjsua_start_mwi() unsubscribes and detaches the subscription when the account has no
* registration session (pjsua_pres.c); regc_cb starts a new one after the next REGISTER. */
if (pjsua_var.acc[acc_id].valid && pjsua_var.acc[acc_id].regc == NULL && pjsua_var.acc[acc_id].mwi_sub)
pjsua_start_mwi(acc_id, PJ_FALSE);
PJSUA_UNLOCK();
}

pj_status_t cpjsua_buddy_resubscribe(pjsua_buddy_id buddy_id)
{
pjsua_buddy *buddy;
pjsip_evsub *sub;
pjsip_dialog *dlg;
pjsip_tx_data *tdata;

if (!pjsua_buddy_is_valid(buddy_id))
return PJ_EINVAL;
PJSUA_LOCK();
buddy = &pjsua_var.buddy[buddy_id];
sub = buddy->sub;
dlg = buddy->dlg;
if (!sub || !dlg || !buddy->monitor) {
PJSUA_UNLOCK();
return PJ_SUCCESS;
}
pjsip_dlg_inc_lock(dlg);
/* Detached: pjsua's callbacks ignore a subscription without the buddy as mod data. */
buddy->sub = NULL;
buddy->dlg = NULL;
pjsip_evsub_set_mod_data(sub, pjsua_var.mod.id, NULL);
if (pjsip_evsub_get_state(sub) != PJSIP_EVSUB_STATE_TERMINATED &&
pjsip_pres_initiate(sub, 0, &tdata) == PJ_SUCCESS)
{
pjsip_pres_send_request(sub, tdata);
}
pjsip_dlg_dec_lock(dlg);
PJSUA_UNLOCK();
return pjsua_buddy_update_pres(buddy_id);
}

pj_status_t cpjsua_call_reinvite_ip_change(pjsua_call_id call_id)
{
pjsua_call_info ci;
Expand Down
13 changes: 13 additions & 0 deletions Sources/MacroSIPApp/Model/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,19 @@ enum L {
static var accountVerifyCertificateHelp: String {
loc("account.field.verifyCertificate.help", "Turn off only for a server with a self-signed certificate.")
}
static var accountIPProtocol: String { loc("account.field.ipProtocol", "IP protocol") }
static var accountIPProtocolHelp: String {
loc("account.field.ipProtocol.help", "Auto picks IPv4 or IPv6 from the server address.")
}
static var ipProtocolAuto: String { loc("account.ipProtocol.auto", "Auto") }
static var ipProtocolIPv4: String { loc("account.ipProtocol.ipv4", "IPv4 only") }
static var ipProtocolIPv6: String { loc("account.ipProtocol.ipv6", "IPv6 only") }
static var accountErrorIPv6Server: String {
loc("account.error.ipv6Server", "The server's address is an IPv6 address. Choose Auto or IPv6 only.")
}
static var accountErrorIPv4Server: String {
loc("account.error.ipv4Server", "The server's address is an IPv4 address. Choose Auto or IPv4 only.")
}

// MARK: messages (SIP MESSAGE, screen 14)
static var messagesNew: String { loc("messages.new", "New Message") }
Expand Down
Loading
Loading