mirror of
https://github.com/D-Modem/gui.git
synced 2026-11-28 14:19:58 -08:00
Anonymous SIP: dial a SIP address with no account (Linux, Windows, macOS)
A "No account (anonymous)" switch in the line settings starts dmodemd with SIP_LOGIN=anonymous: nothing registered, sip:user@host (or user@host) dialled as it is from "Anonymous", for the Modem page's data calls and the Phone page's voice calls; the account's fields are hidden (Linux, macOS) or greyed (Windows) and kept. The number fields say they take a SIP address too. Needs D-Modem with the anonymous user agent (D-Modem/D-Modem#112). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSJKSd2kxxKFZAiaXQ
This commit is contained in:
19 files changed
+119
-25
No files matched your search
@@ -18,6 +18,10 @@ typedef struct Config {
|
||||
/* "sip", "usb", "alsa", or "device" (a modem that already runs) */
|
||||
char *line;
|
||||
char *sip_user, *sip_password, *sip_server;
|
||||
/* SIP with no account (dmodemd's SIP_LOGIN=anonymous): nothing
|
||||
registered, SIP addresses (sip:user@host, user@host) dialled as
|
||||
they are, from "Anonymous" */
|
||||
gboolean sip_anonymous;
|
||||
gboolean listen, t38, v152, v150;
|
||||
char *srtp; /* "", "no" or "require" */
|
||||
char *country; /* dmodemd -c's, "" for its default */
|
||||
@@ -93,6 +97,8 @@ void config_save(const Config *c);
|
||||
void config_free(Config *c);
|
||||
/* "SIP: alice@sip.example.com" and the like */
|
||||
char *config_summary(const Config *c);
|
||||
/* the SIP line has what dmodemd needs: an account, or none (anonymous) */
|
||||
gboolean config_sip_ready(const Config *c);
|
||||
/* the line settings dialog */
|
||||
void prefs_show(App *a);
|
||||
|
||||
|
||||
+43
-2
@@ -44,6 +44,7 @@ void config_load(Config *c)
|
||||
c->sip_user = get_s(k, "sip-user", "");
|
||||
c->sip_password = get_s(k, "sip-password", "");
|
||||
c->sip_server = get_s(k, "sip-server", "");
|
||||
c->sip_anonymous = get_b(k, "sip-anonymous", FALSE);
|
||||
c->listen = get_b(k, "listen", FALSE);
|
||||
c->t38 = get_b(k, "t38", TRUE);
|
||||
c->v152 = get_b(k, "v152", TRUE);
|
||||
@@ -102,6 +103,7 @@ void config_save(const Config *c)
|
||||
g_key_file_set_string(k, "line", "sip-user", c->sip_user);
|
||||
g_key_file_set_string(k, "line", "sip-password", c->sip_password);
|
||||
g_key_file_set_string(k, "line", "sip-server", c->sip_server);
|
||||
g_key_file_set_boolean(k, "line", "sip-anonymous", c->sip_anonymous);
|
||||
g_key_file_set_boolean(k, "line", "listen", c->listen);
|
||||
g_key_file_set_boolean(k, "line", "t38", c->t38);
|
||||
g_key_file_set_boolean(k, "line", "v152", c->v152);
|
||||
@@ -171,12 +173,20 @@ char *config_summary(const Config *c)
|
||||
return g_strdup_printf("Softmodem codec %s", c->alsa);
|
||||
if (!g_strcmp0(c->line, "device"))
|
||||
return g_strdup_printf("The modem at %s", c->device);
|
||||
if (c->sip_anonymous)
|
||||
return g_strdup_printf("SIP: anonymous, no account%s",
|
||||
c->listen ? ", taking calls" : "");
|
||||
if (!*c->sip_user || !*c->sip_server)
|
||||
return g_strdup("SIP account not set up");
|
||||
return g_strdup_printf("SIP: %s@%s%s", c->sip_user, c->sip_server,
|
||||
c->listen ? ", taking calls" : "");
|
||||
}
|
||||
|
||||
gboolean config_sip_ready(const Config *c)
|
||||
{
|
||||
return c->sip_anonymous || (*c->sip_user && *c->sip_server);
|
||||
}
|
||||
|
||||
/*
|
||||
* the dialog
|
||||
*/
|
||||
@@ -198,7 +208,7 @@ typedef struct Prefs {
|
||||
AdwEntryRow *user, *server, *country, *usb, *alsa, *device, *dmodemd,
|
||||
*init;
|
||||
AdwPasswordEntryRow *password;
|
||||
AdwSwitchRow *listen, *t38, *v152, *v150;
|
||||
AdwSwitchRow *anonymous, *listen, *t38, *v152, *v150;
|
||||
AdwSpinRow *debug;
|
||||
AdwPreferencesGroup *sip, *usb_g, *alsa_g, *device_g;
|
||||
} Prefs;
|
||||
@@ -221,6 +231,26 @@ static void show_groups(Prefs *p)
|
||||
!g_strcmp0(l, "device"));
|
||||
}
|
||||
|
||||
/* the account's rows: hidden when there is none (anonymous) */
|
||||
static void show_account(Prefs *p)
|
||||
{
|
||||
gboolean anon = adw_switch_row_get_active(p->anonymous);
|
||||
gtk_widget_set_visible(GTK_WIDGET(p->user), !anon);
|
||||
gtk_widget_set_visible(GTK_WIDGET(p->password), !anon);
|
||||
gtk_widget_set_visible(GTK_WIDGET(p->server), !anon);
|
||||
adw_action_row_set_subtitle(ADW_ACTION_ROW(p->listen), anon ?
|
||||
"Calls that come straight to this computer's address ring "
|
||||
"the modem" :
|
||||
"Register, so calls to the account ring the modem");
|
||||
}
|
||||
|
||||
static void anonymous_changed(GObject *o, GParamSpec *ps, gpointer data)
|
||||
{
|
||||
(void)o;
|
||||
(void)ps;
|
||||
show_account(data);
|
||||
}
|
||||
|
||||
static void line_changed(GObject *o, GParamSpec *ps, gpointer data)
|
||||
{
|
||||
(void)o;
|
||||
@@ -290,6 +320,7 @@ static void closed(AdwDialog *d, gpointer data)
|
||||
c->sip_user = text_of(p->user);
|
||||
c->sip_password = g_strdup(gtk_editable_get_text(GTK_EDITABLE(p->password)));
|
||||
c->sip_server = text_of(p->server);
|
||||
c->sip_anonymous = adw_switch_row_get_active(p->anonymous);
|
||||
c->listen = adw_switch_row_get_active(p->listen);
|
||||
c->t38 = adw_switch_row_get_active(p->t38);
|
||||
c->v152 = adw_switch_row_get_active(p->v152);
|
||||
@@ -325,7 +356,14 @@ void prefs_show(App *a)
|
||||
p->country = entry(g, "Country (dmodemd -c, empty for the USA)",
|
||||
c->country);
|
||||
|
||||
p->sip = group(page, "SIP account", "Calls go to sip:<number>@server.");
|
||||
p->sip = group(page, "SIP account", "Calls go to sip:<number>@server; "
|
||||
"a SIP address (sip:user@host, or user@host) is "
|
||||
"dialled as it is, and the account's password only "
|
||||
"goes to its own server.");
|
||||
p->anonymous = toggle(p->sip, "No account (anonymous)", "Dial SIP "
|
||||
"addresses straight, from \"Anonymous\": "
|
||||
"nothing registered, no numbers",
|
||||
c->sip_anonymous);
|
||||
p->user = entry(p->sip, "User name", c->sip_user);
|
||||
GtkWidget *pw = adw_password_entry_row_new();
|
||||
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(pw), "Password");
|
||||
@@ -364,6 +402,9 @@ void prefs_show(App *a)
|
||||
p->debug = ADW_SPIN_ROW(dbg);
|
||||
|
||||
show_groups(p);
|
||||
show_account(p);
|
||||
g_signal_connect(p->anonymous, "notify::active",
|
||||
G_CALLBACK(anonymous_changed), p);
|
||||
g_signal_connect(p->line, "notify::selected", G_CALLBACK(line_changed),
|
||||
p);
|
||||
adw_preferences_dialog_add(ADW_PREFERENCES_DIALOG(d), page);
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ static void activate(GApplication *g, gpointer data)
|
||||
gtk_window_present(a->window);
|
||||
/* a modem that runs already, or one this app starts */
|
||||
if (!g_strcmp0(a->cfg.line, "device") ||
|
||||
(!g_strcmp0(a->cfg.line, "sip") && *a->cfg.sip_user))
|
||||
(!g_strcmp0(a->cfg.line, "sip") && config_sip_ready(&a->cfg)))
|
||||
modem_start(a);
|
||||
(void)g;
|
||||
}
|
||||
|
||||
+5
-4
@@ -297,8 +297,7 @@ void modem_start(App *a)
|
||||
"set its path in the line settings");
|
||||
return;
|
||||
}
|
||||
if (!g_strcmp0(c->line, "sip") &&
|
||||
(!*c->sip_user || !*c->sip_server)) {
|
||||
if (!g_strcmp0(c->line, "sip") && !config_sip_ready(c)) {
|
||||
window_toast(a, "Set up the SIP account first");
|
||||
prefs_show(a);
|
||||
g_free(exe);
|
||||
@@ -332,8 +331,10 @@ void modem_start(App *a)
|
||||
GSubprocessLauncher *l = g_subprocess_launcher_new(
|
||||
G_SUBPROCESS_FLAGS_STDOUT_PIPE | G_SUBPROCESS_FLAGS_STDERR_PIPE);
|
||||
if (!g_strcmp0(c->line, "sip")) {
|
||||
char *login = g_strdup_printf("%s:%s@%s", c->sip_user,
|
||||
c->sip_password, c->sip_server);
|
||||
/* (no account: dmodemd's anonymous user agent) */
|
||||
char *login = c->sip_anonymous ? g_strdup("anonymous") :
|
||||
g_strdup_printf("%s:%s@%s", c->sip_user,
|
||||
c->sip_password, c->sip_server);
|
||||
g_subprocess_launcher_setenv(l, "SIP_LOGIN", login, TRUE);
|
||||
g_free(login);
|
||||
}
|
||||
|
||||
+2
-2
@@ -585,7 +585,7 @@ static void call(GtkWidget *w, gpointer data)
|
||||
(void)w;
|
||||
const char *n = gtk_editable_get_text(GTK_EDITABLE(a->voice->number));
|
||||
if (!*n) {
|
||||
window_toast(a, "Enter a number to call");
|
||||
window_toast(a, "Enter a number or SIP address to call");
|
||||
return;
|
||||
}
|
||||
stop_sound(a);
|
||||
@@ -828,7 +828,7 @@ GtkWidget *voice_page_new(App *a)
|
||||
|
||||
v->number = adw_entry_row_new();
|
||||
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(v->number),
|
||||
"Number to call");
|
||||
"Number or SIP address (sip:user@host)");
|
||||
v->call_btn = button("Call", G_CALLBACK(call), a);
|
||||
gtk_widget_add_css_class(v->call_btn, "suggested-action");
|
||||
adw_entry_row_add_suffix(ADW_ENTRY_ROW(v->number), v->call_btn);
|
||||
|
||||
+2
-2
@@ -160,7 +160,7 @@ static void dial(GtkWidget *w, gpointer data)
|
||||
(void)w;
|
||||
const char *n = gtk_editable_get_text(GTK_EDITABLE(a->number));
|
||||
if (!*n) {
|
||||
window_toast(a, "Enter a number to dial");
|
||||
window_toast(a, "Enter a number or SIP address to dial");
|
||||
return;
|
||||
}
|
||||
char *cmd = g_strdup_printf("ATD%s", n);
|
||||
@@ -234,7 +234,7 @@ static GtkWidget *modem_page(App *a)
|
||||
adw_preferences_group_set_title(ADW_PREFERENCES_GROUP(call), "Call");
|
||||
a->number = adw_entry_row_new();
|
||||
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(a->number),
|
||||
"Number to dial");
|
||||
"Number or SIP address (sip:user@host)");
|
||||
gtk_editable_set_text(GTK_EDITABLE(a->number), "");
|
||||
a->dial_btn = gtk_button_new_with_label("Dial");
|
||||
gtk_widget_set_valign(a->dial_btn, GTK_ALIGN_CENTER);
|
||||
|
||||
@@ -108,7 +108,7 @@ struct ModemPage: View {
|
||||
}
|
||||
Section("Call") {
|
||||
HStack {
|
||||
TextField("Number", text: $number)
|
||||
TextField("Number", text: $number, prompt: Text("number or sip:user@host"))
|
||||
.onSubmit { if modem.isIdle { modem.dial(number) } }
|
||||
Button("Dial") { modem.dial(number) }
|
||||
.disabled(!modem.isIdle)
|
||||
|
||||
@@ -24,6 +24,9 @@ struct LineConfig {
|
||||
var sipUser = ""
|
||||
var sipPassword = ""
|
||||
var sipServer = ""
|
||||
/// SIP with no account (dmodemd's SIP_LOGIN=anonymous): nothing registered, SIP addresses
|
||||
/// (sip:user@host, user@host) dialled as they are, from "Anonymous"
|
||||
var sipAnonymous = false
|
||||
var listen = false
|
||||
var t38 = true
|
||||
var v152 = true
|
||||
@@ -44,6 +47,7 @@ struct LineConfig {
|
||||
c.line = LineKind(rawValue: d.string(forKey: "line") ?? "") ?? .sip
|
||||
c.sipUser = d.string(forKey: "sipUser") ?? ""
|
||||
c.sipServer = d.string(forKey: "sipServer") ?? ""
|
||||
c.sipAnonymous = d.bool(forKey: "sipAnonymous")
|
||||
c.listen = d.bool(forKey: "listen")
|
||||
c.t38 = d.object(forKey: "t38") as? Bool ?? true
|
||||
c.v152 = d.object(forKey: "v152") as? Bool ?? true
|
||||
@@ -64,6 +68,7 @@ struct LineConfig {
|
||||
d.set(line.rawValue, forKey: "line")
|
||||
d.set(sipUser, forKey: "sipUser")
|
||||
d.set(sipServer, forKey: "sipServer")
|
||||
d.set(sipAnonymous, forKey: "sipAnonymous")
|
||||
d.set(listen, forKey: "listen")
|
||||
d.set(t38, forKey: "t38")
|
||||
d.set(v152, forKey: "v152")
|
||||
@@ -83,13 +88,14 @@ struct LineConfig {
|
||||
case .usb: return "USB modem (\(usb))"
|
||||
case .device: return "The modem at \(device)"
|
||||
case .sip:
|
||||
if sipAnonymous { return "SIP: anonymous, no account" + (listen ? ", taking calls" : "") }
|
||||
if sipUser.isEmpty || sipServer.isEmpty { return "SIP account not set up" }
|
||||
return "SIP: \(sipUser)@\(sipServer)" + (listen ? ", taking calls" : "")
|
||||
}
|
||||
}
|
||||
|
||||
var isSetUp: Bool {
|
||||
line != .sip || (!sipUser.isEmpty && !sipServer.isEmpty)
|
||||
line != .sip || sipAnonymous || (!sipUser.isEmpty && !sipServer.isEmpty)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,17 @@ struct LineSettingsView: View {
|
||||
switch c.line {
|
||||
case .sip:
|
||||
Section("SIP account") {
|
||||
TextField("User", text: $c.sipUser)
|
||||
SecureField("Password", text: $c.sipPassword)
|
||||
TextField("Server", text: $c.sipServer, prompt: Text("sip.example.net"))
|
||||
Toggle("No account (anonymous)", isOn: $c.sipAnonymous)
|
||||
if !c.sipAnonymous {
|
||||
TextField("User", text: $c.sipUser)
|
||||
SecureField("Password", text: $c.sipPassword)
|
||||
TextField("Server", text: $c.sipServer, prompt: Text("sip.example.net"))
|
||||
}
|
||||
Toggle("Take incoming calls", isOn: $c.listen)
|
||||
Text(c.sipAnonymous
|
||||
? "Calls go straight to a SIP address (sip:user@host, or user@host), from “Anonymous”: nothing is registered, and numbers can’t be dialled."
|
||||
: "A SIP address (sip:user@host) is dialled as it is too; the password only goes to the account’s own server.")
|
||||
.font(.caption).foregroundStyle(.secondary)
|
||||
}
|
||||
Section("Calls") {
|
||||
Toggle("Fax over T.38", isOn: $c.t38)
|
||||
|
||||
@@ -466,7 +466,8 @@ final class Modem: ObservableObject {
|
||||
}
|
||||
var env = ProcessInfo.processInfo.environment
|
||||
if c.line == .sip {
|
||||
env["SIP_LOGIN"] = "\(c.sipUser):\(c.sipPassword)@\(c.sipServer)"
|
||||
// (no account: dmodemd's anonymous user agent)
|
||||
env["SIP_LOGIN"] = c.sipAnonymous ? "anonymous" : "\(c.sipUser):\(c.sipPassword)@\(c.sipServer)"
|
||||
}
|
||||
if !c.t38 { env["SIP_T38"] = "no" }
|
||||
if !c.v152 { env["SIP_V152"] = "no" }
|
||||
|
||||
@@ -592,7 +592,7 @@ struct PhonePage: View {
|
||||
Section {
|
||||
LabeledContent("Phone", value: status)
|
||||
HStack {
|
||||
TextField("Number to call", text: $number)
|
||||
TextField("Number to call", text: $number, prompt: Text("number or sip:user@host"))
|
||||
.onSubmit { if modem.isIdle { modem.voiceDial(number) } }
|
||||
Button("Call") { modem.voiceDial(number) }
|
||||
.disabled(!modem.isIdle)
|
||||
|
||||
@@ -36,6 +36,7 @@ BEGIN
|
||||
AUTORADIOBUTTON "Start &dmodemd on this computer (Windows 7 or later)", IDC_L_DMODEMD, 8, 8, 284, 10, WS_GROUP | WS_TABSTOP
|
||||
LTEXT "SIP &user:", -1, 20, 24, 60, 8
|
||||
EDITTEXT IDC_L_USER, 84, 22, 120, 12, ES_AUTOHSCROLL
|
||||
AUTOCHECKBOX "&No account", IDC_L_ANONYMOUS, 210, 23, 82, 10, WS_TABSTOP
|
||||
LTEXT "&Password:", -1, 20, 40, 60, 8
|
||||
EDITTEXT IDC_L_PASSWORD, 84, 38, 120, 12, ES_AUTOHSCROLL | ES_PASSWORD
|
||||
LTEXT "Ser&ver:", -1, 20, 56, 60, 8
|
||||
|
||||
@@ -47,6 +47,10 @@ enum LineKind { LINE_DMODEMD = 0, LINE_TCP, LINE_COM };
|
||||
struct Config {
|
||||
int line; /* LineKind */
|
||||
char sip_user[128], sip_password[128], sip_server[256];
|
||||
/* SIP with no account (dmodemd's SIP_LOGIN=anonymous): nothing
|
||||
registered, SIP addresses (sip:user@host, user@host) dialled as
|
||||
they are, from "Anonymous" */
|
||||
int sip_anonymous;
|
||||
int listen, t38, v152, v150;
|
||||
char country[64];
|
||||
char usb[64]; /* --usb, "" for a SIP line */
|
||||
@@ -66,6 +70,8 @@ void config_load(Config *c);
|
||||
void config_save(const Config *c);
|
||||
/* "SIP: alice@sip.example.com" and the like, into out */
|
||||
void config_summary(const Config *c, char *out, int n);
|
||||
/* the SIP line has what dmodemd needs: an account, or none (anonymous) */
|
||||
bool config_sip_ready(const Config *c);
|
||||
/* the Line Settings dialog: true if changed */
|
||||
bool line_dialog(HWND owner, Config *c);
|
||||
|
||||
|
||||
+21
-1
@@ -82,6 +82,7 @@ void config_load(Config *c)
|
||||
get(ini, "sip-user", "", c->sip_user, sizeof(c->sip_user));
|
||||
get(ini, "sip-password", "", c->sip_password, sizeof(c->sip_password));
|
||||
get(ini, "sip-server", "", c->sip_server, sizeof(c->sip_server));
|
||||
c->sip_anonymous = get_i(ini, "sip-anonymous", 0);
|
||||
c->listen = get_i(ini, "listen", 0);
|
||||
c->t38 = get_i(ini, "t38", 1);
|
||||
c->v152 = get_i(ini, "v152", 1);
|
||||
@@ -110,6 +111,7 @@ void config_save(const Config *c)
|
||||
put(ini, "sip-user", c->sip_user);
|
||||
put(ini, "sip-password", c->sip_password);
|
||||
put(ini, "sip-server", c->sip_server);
|
||||
put_i(ini, "sip-anonymous", c->sip_anonymous);
|
||||
put_i(ini, "listen", c->listen);
|
||||
put_i(ini, "t38", c->t38);
|
||||
put_i(ini, "v152", c->v152);
|
||||
@@ -144,6 +146,9 @@ void config_summary(const Config *c, char *out, int n)
|
||||
default:
|
||||
if (c->usb[0])
|
||||
_snprintf(out, n, "dmodemd: USB modem (%s)", c->usb);
|
||||
else if (c->sip_anonymous)
|
||||
_snprintf(out, n, "dmodemd: SIP, anonymous (no account)%s",
|
||||
c->listen ? ", taking calls" : "");
|
||||
else if (!c->sip_user[0] || !c->sip_server[0])
|
||||
_snprintf(out, n, "dmodemd: SIP account not set up");
|
||||
else
|
||||
@@ -154,6 +159,11 @@ void config_summary(const Config *c, char *out, int n)
|
||||
out[n - 1] = '\0';
|
||||
}
|
||||
|
||||
bool config_sip_ready(const Config *c)
|
||||
{
|
||||
return c->sip_anonymous || (c->sip_user[0] && c->sip_server[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
* the dialog
|
||||
*/
|
||||
@@ -165,13 +175,20 @@ static void enable(HWND d)
|
||||
bool here = IsDlgButtonChecked(d, IDC_L_DMODEMD) == BST_CHECKED;
|
||||
bool tcp = IsDlgButtonChecked(d, IDC_L_TCP) == BST_CHECKED;
|
||||
bool com = IsDlgButtonChecked(d, IDC_L_COM) == BST_CHECKED;
|
||||
bool anon = IsDlgButtonChecked(d, IDC_L_ANONYMOUS) == BST_CHECKED;
|
||||
static const int account_ids[] = {
|
||||
IDC_L_USER, IDC_L_PASSWORD, IDC_L_SERVER, 0
|
||||
};
|
||||
static const int dmodemd_ids[] = {
|
||||
IDC_L_USER, IDC_L_PASSWORD, IDC_L_SERVER, IDC_L_LISTEN,
|
||||
IDC_L_ANONYMOUS, IDC_L_LISTEN,
|
||||
IDC_L_T38, IDC_L_V152, IDC_L_V150, IDC_L_COUNTRY, IDC_L_USB,
|
||||
IDC_L_PATH, IDC_L_BROWSE, 0
|
||||
};
|
||||
for (int i = 0; dmodemd_ids[i]; i++)
|
||||
EnableWindow(GetDlgItem(d, dmodemd_ids[i]), here);
|
||||
/* (no account: anonymous, its fields kept but not used) */
|
||||
for (int i = 0; account_ids[i]; i++)
|
||||
EnableWindow(GetDlgItem(d, account_ids[i]), here && !anon);
|
||||
EnableWindow(GetDlgItem(d, IDC_L_ADDRESS), tcp);
|
||||
EnableWindow(GetDlgItem(d, IDC_L_PORT), com);
|
||||
}
|
||||
@@ -214,6 +231,7 @@ static BOOL CALLBACK line_proc(HWND d, UINT m, WPARAM wp, LPARAM lp)
|
||||
SetDlgItemText(d, IDC_L_USER, c->sip_user);
|
||||
SetDlgItemText(d, IDC_L_PASSWORD, c->sip_password);
|
||||
SetDlgItemText(d, IDC_L_SERVER, c->sip_server);
|
||||
check(d, IDC_L_ANONYMOUS, c->sip_anonymous);
|
||||
check(d, IDC_L_LISTEN, c->listen);
|
||||
check(d, IDC_L_T38, c->t38);
|
||||
check(d, IDC_L_V152, c->v152);
|
||||
@@ -239,6 +257,7 @@ static BOOL CALLBACK line_proc(HWND d, UINT m, WPARAM wp, LPARAM lp)
|
||||
case IDC_L_DMODEMD:
|
||||
case IDC_L_TCP:
|
||||
case IDC_L_COM:
|
||||
case IDC_L_ANONYMOUS:
|
||||
enable(d);
|
||||
return TRUE;
|
||||
case IDC_L_BROWSE:
|
||||
@@ -252,6 +271,7 @@ static BOOL CALLBACK line_proc(HWND d, UINT m, WPARAM wp, LPARAM lp)
|
||||
sizeof(c->sip_password));
|
||||
GetDlgItemText(d, IDC_L_SERVER, c->sip_server,
|
||||
sizeof(c->sip_server));
|
||||
c->sip_anonymous = checked(d, IDC_L_ANONYMOUS);
|
||||
c->listen = checked(d, IDC_L_LISTEN);
|
||||
c->t38 = checked(d, IDC_L_T38);
|
||||
c->v152 = checked(d, IDC_L_V152);
|
||||
|
||||
@@ -227,7 +227,7 @@ static char *environment(const char *const *add)
|
||||
static bool start_dmodemd()
|
||||
{
|
||||
Config &c = app.cfg;
|
||||
if (!c.usb[0] && (!c.sip_user[0] || !c.sip_server[0])) {
|
||||
if (!c.usb[0] && !config_sip_ready(&c)) {
|
||||
app_message("Set up the SIP account first (Modem, Line Settings)");
|
||||
return false;
|
||||
}
|
||||
@@ -255,8 +255,12 @@ static bool start_dmodemd()
|
||||
cmd[sizeof(cmd) - 1] = '\0';
|
||||
|
||||
char login[600];
|
||||
_snprintf(login, sizeof(login), "SIP_LOGIN=%s:%s@%s", c.sip_user,
|
||||
c.sip_password, c.sip_server);
|
||||
/* (no account: dmodemd's anonymous user agent) */
|
||||
if (c.sip_anonymous)
|
||||
_snprintf(login, sizeof(login), "SIP_LOGIN=anonymous");
|
||||
else
|
||||
_snprintf(login, sizeof(login), "SIP_LOGIN=%s:%s@%s",
|
||||
c.sip_user, c.sip_password, c.sip_server);
|
||||
login[sizeof(login) - 1] = '\0';
|
||||
const char *add[6];
|
||||
int k = 0;
|
||||
|
||||
@@ -377,7 +377,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmd, int show)
|
||||
ShowWindow(w, show);
|
||||
UpdateWindow(w);
|
||||
/* a modem that is set up starts at once */
|
||||
if (app.cfg.line != LINE_DMODEMD || app.cfg.sip_user[0] ||
|
||||
if (app.cfg.line != LINE_DMODEMD || config_sip_ready(&app.cfg) ||
|
||||
app.cfg.usb[0])
|
||||
link_start();
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ static void modem_command(HWND page, int id, int code)
|
||||
char n[128], cmd[140];
|
||||
GetDlgItemText(page, IDC_NUMBER, n, sizeof(n));
|
||||
if (!n[0]) {
|
||||
app_message("Enter a number to dial");
|
||||
app_message("Enter a number or SIP address (sip:user@host) to dial");
|
||||
return;
|
||||
}
|
||||
_snprintf(cmd, sizeof(cmd), "ATD%s", n);
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
#define IDC_L_ADDRESS 915
|
||||
#define IDC_L_PORT 916
|
||||
#define IDC_L_INIT 917
|
||||
#define IDC_L_ANONYMOUS 918
|
||||
|
||||
/* the Change Setting dialog */
|
||||
#define IDD_SETTING 950
|
||||
|
||||
@@ -713,7 +713,7 @@ static void voice_command(HWND p, int id, int code)
|
||||
char n[128];
|
||||
GetDlgItemText(p, IDC_V_NUMBER, n, sizeof(n));
|
||||
if (!n[0]) {
|
||||
app_message("Enter a number to call");
|
||||
app_message("Enter a number or SIP address (sip:user@host) to call");
|
||||
return;
|
||||
}
|
||||
stop_sound();
|
||||
|
||||
Reference in new issue
Block a user