PSIP
Check-in [fe2c01b633]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:increase max number of device from 16 to 20 and change ring-method to use pjsua's internal ring instead of external player
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fe2c01b63379dc40445f4ebc8b0f23838aa1704e
User & Date: james 2011-09-23 10:32:33.452
Context
2011-09-23
10:53
restrict selection of ring-file to WAV only check-in: d273baa132 user: james tags: trunk
10:32
increase max number of device from 16 to 20 and change ring-method to use pjsua's internal ring instead of external player check-in: fe2c01b633 user: james tags: trunk
2011-09-22
12:27
im sent and receive prefix now uses different color check-in: 11eb590d43 user: james tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to backend.c.
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	return pid;
}

void apply_audio_preference() {
	audio_settings as;
	get_audio_preference_settings (&as);
	
	pjmedia_aud_dev_info available_audio[MAX_AUDIO_DEVICES * 2];		
	int i, current_input, current_output, count = MAX_AUDIO_DEVICES * 2;
	int chosen_input, chosen_output;

	//get current devices and list all available audio devices	
	pjsua_get_snd_dev (&current_input, &current_output);
	chosen_input = current_input; chosen_output = current_output;	
	
	pjsua_enum_aud_devs (available_audio, &count);	







|
|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	return pid;
}

void apply_audio_preference() {
	audio_settings as;
	get_audio_preference_settings (&as);
	
	pjmedia_aud_dev_info available_audio[MAX_AUDIO_DEVICES];		
	int i, current_input, current_output, count = MAX_AUDIO_DEVICES;
	int chosen_input, chosen_output;

	//get current devices and list all available audio devices	
	pjsua_get_snd_dev (&current_input, &current_output);
	chosen_input = current_input; chosen_output = current_output;	
	
	pjsua_enum_aud_devs (available_audio, &count);	
197
198
199
200
201
202
203
204





205
206
207
208
209
210
211
	if (p) {
		pjsua_call_answer(call_id, SIP_CODE_BUSY_HERE, NULL, NULL); //486 is "busy here"
		g_free (state); g_free (address);
		return;
	}

	//we've got incoming call, sound the ring and prompt user
	GPid pid = exec_ring_command();





	gchararray s = g_strdup_printf("Incoming call from %.*s. Pick up call?", ci.remote_info.slen, ci.remote_info.ptr);
	g_object_set (G_OBJECT (psip_state->confirm_dialog), "text", s, NULL);
	g_free(s);
	
	lock_gdk();
	guint max_timeout = atoi(gtk_entry_get_text(psip_state->call_timeout_field));
	guint timeout_id = g_timeout_add_seconds (max_timeout==0 ? DEFAULT_INCOMING_TIMEOUT : max_timeout, incoming_call_timeout, NULL);







|
>
>
>
>
>







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
	if (p) {
		pjsua_call_answer(call_id, SIP_CODE_BUSY_HERE, NULL, NULL); //486 is "busy here"
		g_free (state); g_free (address);
		return;
	}

	//we've got incoming call, sound the ring and prompt user
	//GPid pid = exec_ring_command(); //disabled - use pjsua's internal player instead
	pjsua_player_id ring_player_id = PJSUA_INVALID_ID;
	pj_str_t fn;
	if (pjsua_player_create ( pj_cstr(&fn, psip_state->ring_filename), 0, &ring_player_id) == PJ_SUCCESS);
		pjsua_conf_connect (pjsua_player_get_conf_port (ring_player_id), 0);
	
	gchararray s = g_strdup_printf("Incoming call from %.*s. Pick up call?", ci.remote_info.slen, ci.remote_info.ptr);
	g_object_set (G_OBJECT (psip_state->confirm_dialog), "text", s, NULL);
	g_free(s);
	
	lock_gdk();
	guint max_timeout = atoi(gtk_entry_get_text(psip_state->call_timeout_field));
	guint timeout_id = g_timeout_add_seconds (max_timeout==0 ? DEFAULT_INCOMING_TIMEOUT : max_timeout, incoming_call_timeout, NULL);
221
222
223
224
225
226
227





228


229
230
231
232
233
234
235
		unlock_gdk();
		pjsua_call_set_user_data (call_id, p);
		pjsua_call_answer(call_id, SIP_CODE_OK, NULL, NULL);
	} else {
		pjsua_call_answer(call_id, SIP_CODE_BUSY_HERE, NULL, NULL);
		g_free (state); g_free (address);
	}





	if (pid) kill (pid, SIGTERM);


}

/* call state change - required to monitor call drops, successful connection */
void backend_on_call_state_change (pjsua_call_id call_id, pjsip_event *e) {
	if (backend_state->terminating) return;

	gchararray address, state;







>
>
>
>
>
|
>
>







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
		unlock_gdk();
		pjsua_call_set_user_data (call_id, p);
		pjsua_call_answer(call_id, SIP_CODE_OK, NULL, NULL);
	} else {
		pjsua_call_answer(call_id, SIP_CODE_BUSY_HERE, NULL, NULL);
		g_free (state); g_free (address);
	}
	
	//terminate the ring, if any
	if (ring_player_id != PJSUA_INVALID_ID) pjsua_player_destroy (ring_player_id); 
/*	if (pid) {
		int status;
		kill (pid, SIGTERM);
		waitpid (pid, &status, 0);
	}*/
}

/* call state change - required to monitor call drops, successful connection */
void backend_on_call_state_change (pjsua_call_id call_id, pjsip_event *e) {
	if (backend_state->terminating) return;

	gchararray address, state;
Changes to config.c.
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
	
	object = cJSON_GetObjectItem(account, "password");
	if (object) gtk_entry_set_text (psip_state->account_password_field, object->valuestring);
	
	object = cJSON_GetObjectItem(settings, "sip-port");
	if (object) gtk_entry_set_text (psip_state->sip_port_field, object->valuestring);	
	
	object = cJSON_GetObjectItem(settings, "ring-command");
	if (object) gtk_entry_set_text (psip_state->ring_command_field, object->valuestring);
	
	object = cJSON_GetObjectItem(settings, "loglevel");
	if (object) gtk_range_set_value (GTK_RANGE(psip_state->loglevel_scaler), object->valuedouble);
	
	object = cJSON_GetObjectItem(settings, "help-command");
	if (object) gtk_entry_set_text (psip_state->help_command_field, object->valuestring);








|
|







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
	
	object = cJSON_GetObjectItem(account, "password");
	if (object) gtk_entry_set_text (psip_state->account_password_field, object->valuestring);
	
	object = cJSON_GetObjectItem(settings, "sip-port");
	if (object) gtk_entry_set_text (psip_state->sip_port_field, object->valuestring);	
	
//	object = cJSON_GetObjectItem(settings, "ring-command");
//	if (object) gtk_entry_set_text (psip_state->ring_command_field, object->valuestring);
	
	object = cJSON_GetObjectItem(settings, "loglevel");
	if (object) gtk_range_set_value (GTK_RANGE(psip_state->loglevel_scaler), object->valuedouble);
	
	object = cJSON_GetObjectItem(settings, "help-command");
	if (object) gtk_entry_set_text (psip_state->help_command_field, object->valuestring);

119
120
121
122
123
124
125



126
127
128
129
130
131
132
	if (object) gtk_toggle_button_set_active (psip_state->auto_register_field, object->valueint);

	object = cJSON_GetObjectItem(settings, "audio-in");
	if (object) gtk_button_set_label (GTK_BUTTON(psip_state->audio_inputs[0]), object->valuestring);

	object = cJSON_GetObjectItem(settings, "audio-out");
	if (object) gtk_button_set_label (GTK_BUTTON(psip_state->audio_outputs[0]), object->valuestring);



	
	//read buddies
	clear_default_buddies();
	cJSON *buddies = cJSON_GetObjectItem (root, "buddies");
	if (!buddies) goto bail_out;
	
	int i, no_of_buddies = cJSON_GetArraySize (buddies);







>
>
>







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
	if (object) gtk_toggle_button_set_active (psip_state->auto_register_field, object->valueint);

	object = cJSON_GetObjectItem(settings, "audio-in");
	if (object) gtk_button_set_label (GTK_BUTTON(psip_state->audio_inputs[0]), object->valuestring);

	object = cJSON_GetObjectItem(settings, "audio-out");
	if (object) gtk_button_set_label (GTK_BUTTON(psip_state->audio_outputs[0]), object->valuestring);

	object = cJSON_GetObjectItem(settings, "ring-wav-file");
	if (object) gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (psip_state->ring_wav_file_button), object->valuestring);
	
	//read buddies
	clear_default_buddies();
	cJSON *buddies = cJSON_GetObjectItem (root, "buddies");
	if (!buddies) goto bail_out;
	
	int i, no_of_buddies = cJSON_GetArraySize (buddies);
167
168
169
170
171
172
173
174
175
176
177
178
179

180
181
182
183
184
185
186
	cJSON_AddStringToObject (account, "registrar", gtk_entry_get_text(psip_state->account_registrar_field));
	cJSON_AddStringToObject (account, "realm", gtk_entry_get_text(psip_state->account_realm_field));
	cJSON_AddStringToObject (account, "user", gtk_entry_get_text(psip_state->account_user_field));
	cJSON_AddStringToObject (account, "password", gtk_entry_get_text(psip_state->account_password_field));
	
	//save settings
	cJSON_AddStringToObject (settings, "sip-port", gtk_entry_get_text(psip_state->sip_port_field));		
	cJSON_AddStringToObject (settings, "ring-command", gtk_entry_get_text(psip_state->ring_command_field));
	cJSON_AddNumberToObject (settings, "loglevel", gtk_range_get_value(GTK_RANGE(psip_state->loglevel_scaler)));
	cJSON_AddStringToObject (settings, "help-command", gtk_entry_get_text(psip_state->help_command_field));
	cJSON_AddStringToObject (settings, "call-timeout", gtk_entry_get_text(psip_state->call_timeout_field));
	cJSON_AddNumberToObject (settings, "minimise-tray", gtk_toggle_button_get_active(psip_state->minimise_tray_field));
	cJSON_AddNumberToObject (settings, "auto-register", gtk_toggle_button_get_active(psip_state->auto_register_field));


	//audio settings
	audio_settings as;
	get_audio_preference_settings (&as);
	if (as.input) cJSON_AddStringToObject (settings, "audio-in", as.input);
	if (as.output) cJSON_AddStringToObject (settings, "audio-out", as.output);	








|





>







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
	cJSON_AddStringToObject (account, "registrar", gtk_entry_get_text(psip_state->account_registrar_field));
	cJSON_AddStringToObject (account, "realm", gtk_entry_get_text(psip_state->account_realm_field));
	cJSON_AddStringToObject (account, "user", gtk_entry_get_text(psip_state->account_user_field));
	cJSON_AddStringToObject (account, "password", gtk_entry_get_text(psip_state->account_password_field));
	
	//save settings
	cJSON_AddStringToObject (settings, "sip-port", gtk_entry_get_text(psip_state->sip_port_field));		
//	cJSON_AddStringToObject (settings, "ring-command", gtk_entry_get_text(psip_state->ring_command_field));
	cJSON_AddNumberToObject (settings, "loglevel", gtk_range_get_value(GTK_RANGE(psip_state->loglevel_scaler)));
	cJSON_AddStringToObject (settings, "help-command", gtk_entry_get_text(psip_state->help_command_field));
	cJSON_AddStringToObject (settings, "call-timeout", gtk_entry_get_text(psip_state->call_timeout_field));
	cJSON_AddNumberToObject (settings, "minimise-tray", gtk_toggle_button_get_active(psip_state->minimise_tray_field));
	cJSON_AddNumberToObject (settings, "auto-register", gtk_toggle_button_get_active(psip_state->auto_register_field));
	cJSON_AddStringToObject (settings, "ring-wav-file", gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (psip_state->ring_wav_file_button)));

	//audio settings
	audio_settings as;
	get_audio_preference_settings (&as);
	if (as.input) cJSON_AddStringToObject (settings, "audio-in", as.input);
	if (as.output) cJSON_AddStringToObject (settings, "audio-out", as.output);	

Changes to psip.c.
493
494
495
496
497
498
499

500
501
502
503
504
505
506
507
	gtk_entry_set_text (psip_state->ring_command_field, s); g_free(s);	
	s = g_strstrip (g_strdup (gtk_entry_get_text(psip_state->sip_port_field)));
	gtk_entry_set_text (psip_state->sip_port_field, s); g_free(s);	
	s = g_strstrip (g_strdup (gtk_entry_get_text(psip_state->help_command_field)));
	gtk_entry_set_text (psip_state->help_command_field, s); g_free(s);	
	s = g_strstrip (g_strdup (gtk_entry_get_text(psip_state->call_timeout_field)));
	gtk_entry_set_text (psip_state->call_timeout_field, s); g_free(s);	

	
	//process changes
	backend_reconfigure();	
}

/*==== callback: refresh presence ===*/
void on_refresh_presence_clicked (GtkToolButton *b, gpointer p) {
	buddylist_refresh_presence();







>
|







493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
	gtk_entry_set_text (psip_state->ring_command_field, s); g_free(s);	
	s = g_strstrip (g_strdup (gtk_entry_get_text(psip_state->sip_port_field)));
	gtk_entry_set_text (psip_state->sip_port_field, s); g_free(s);	
	s = g_strstrip (g_strdup (gtk_entry_get_text(psip_state->help_command_field)));
	gtk_entry_set_text (psip_state->help_command_field, s); g_free(s);	
	s = g_strstrip (g_strdup (gtk_entry_get_text(psip_state->call_timeout_field)));
	gtk_entry_set_text (psip_state->call_timeout_field, s); g_free(s);	
	psip_state->ring_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (psip_state->ring_wav_file_button));
		
	//process changes
	backend_reconfigure();	
}

/*==== callback: refresh presence ===*/
void on_refresh_presence_clicked (GtkToolButton *b, gpointer p) {
	buddylist_refresh_presence();
911
912
913
914
915
916
917

918
919
920
921
922
923
924
    psip_state->sip_port_field = GTK_ENTRY (gtk_builder_get_object( builder, "sip_port" ));
    psip_state->loglevel_scaler = GTK_WIDGET (gtk_builder_get_object( builder, "loglevel_scaler" ));    
    psip_state->ring_command_field = GTK_ENTRY (gtk_builder_get_object( builder, "ring_command" ));    
    psip_state->help_command_field = GTK_ENTRY (gtk_builder_get_object( builder, "help_command" ));    
    psip_state->call_timeout_field = GTK_ENTRY (gtk_builder_get_object( builder, "call_timeout" ));    
    psip_state->minimise_tray_field = GTK_TOGGLE_BUTTON (gtk_builder_get_object( builder, "minimise_tray" ));
    psip_state->auto_register_field = GTK_TOGGLE_BUTTON (gtk_builder_get_object( builder, "auto_register" ));


    psip_state->call_window = GTK_WINDOW (gtk_builder_get_object( builder, "call_window" ));
    psip_state->call_list = GTK_LIST_STORE (gtk_builder_get_object( builder, "call_list" ));
    psip_state->call_listview = GTK_TREE_VIEW (gtk_builder_get_object( builder, "call_listview" ));
    psip_state->local_mic_volume_scaler = GTK_WIDGET (gtk_builder_get_object( builder, "local_mic_volume_scaler" ));    
    psip_state->remote_speaker_volume_scaler = GTK_WIDGET (gtk_builder_get_object( builder, "remote_speaker_volume_scaler" ));
    gtk_range_set_value (GTK_RANGE (psip_state->local_mic_volume_scaler), 1.0);







>







912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
    psip_state->sip_port_field = GTK_ENTRY (gtk_builder_get_object( builder, "sip_port" ));
    psip_state->loglevel_scaler = GTK_WIDGET (gtk_builder_get_object( builder, "loglevel_scaler" ));    
    psip_state->ring_command_field = GTK_ENTRY (gtk_builder_get_object( builder, "ring_command" ));    
    psip_state->help_command_field = GTK_ENTRY (gtk_builder_get_object( builder, "help_command" ));    
    psip_state->call_timeout_field = GTK_ENTRY (gtk_builder_get_object( builder, "call_timeout" ));    
    psip_state->minimise_tray_field = GTK_TOGGLE_BUTTON (gtk_builder_get_object( builder, "minimise_tray" ));
    psip_state->auto_register_field = GTK_TOGGLE_BUTTON (gtk_builder_get_object( builder, "auto_register" ));
    psip_state->ring_wav_file_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object( builder, "ring_wav_file" ));

    psip_state->call_window = GTK_WINDOW (gtk_builder_get_object( builder, "call_window" ));
    psip_state->call_list = GTK_LIST_STORE (gtk_builder_get_object( builder, "call_list" ));
    psip_state->call_listview = GTK_TREE_VIEW (gtk_builder_get_object( builder, "call_listview" ));
    psip_state->local_mic_volume_scaler = GTK_WIDGET (gtk_builder_get_object( builder, "local_mic_volume_scaler" ));    
    psip_state->remote_speaker_volume_scaler = GTK_WIDGET (gtk_builder_get_object( builder, "remote_speaker_volume_scaler" ));
    gtk_range_set_value (GTK_RANGE (psip_state->local_mic_volume_scaler), 1.0);
Changes to psip.glade.
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
                <property name="tooltip_text" translatable="yes">Sets the audio devices used for input and output.
Takes effect immediately after this window is closed.</property>
                <property name="border_width">5</property>
                <property name="orientation">vertical</property>
                <child>
                  <object class="GtkTable" id="table4">
                    <property name="visible">True</property>
                    <property name="n_rows">17</property>
                    <property name="n_columns">2</property>
                    <child>
                      <object class="GtkLabel" id="label13">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">Output</property>
                      </object>
                      <packing>







|







876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
                <property name="tooltip_text" translatable="yes">Sets the audio devices used for input and output.
Takes effect immediately after this window is closed.</property>
                <property name="border_width">5</property>
                <property name="orientation">vertical</property>
                <child>
                  <object class="GtkTable" id="table4">
                    <property name="visible">True</property>
                    <property name="n_rows">21</property>
                    <property name="n_columns">2</property>
                    <child>
                      <object class="GtkLabel" id="label13">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">Output</property>
                      </object>
                      <packing>
1374
1375
1376
1377
1378
1379
1380
































































































































1381
1382
1383
1384
1385
1386
1387
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="right_attach">2</property>
                        <property name="top_attach">16</property>
                        <property name="bottom_attach">17</property>
                      </packing>
                    </child>
































































































































                  </object>
                  <packing>
                    <property name="position">0</property>
                  </packing>
                </child>
              </object>
              <packing>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="right_attach">2</property>
                        <property name="top_attach">16</property>
                        <property name="bottom_attach">17</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkRadioButton" id="audio_input16">
                        <property name="label" translatable="yes">radiobutton</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">False</property>
                        <property name="active">True</property>
                        <property name="draw_indicator">True</property>
                        <property name="group">audio_input0</property>
                      </object>
                      <packing>
                        <property name="top_attach">17</property>
                        <property name="bottom_attach">18</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkRadioButton" id="audio_input17">
                        <property name="label" translatable="yes">radiobutton</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">False</property>
                        <property name="active">True</property>
                        <property name="draw_indicator">True</property>
                        <property name="group">audio_input0</property>
                      </object>
                      <packing>
                        <property name="top_attach">18</property>
                        <property name="bottom_attach">19</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkRadioButton" id="audio_input18">
                        <property name="label" translatable="yes">radiobutton</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">False</property>
                        <property name="active">True</property>
                        <property name="draw_indicator">True</property>
                        <property name="group">audio_input0</property>
                      </object>
                      <packing>
                        <property name="top_attach">19</property>
                        <property name="bottom_attach">20</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkRadioButton" id="audio_input19">
                        <property name="label" translatable="yes">radiobutton</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">False</property>
                        <property name="active">True</property>
                        <property name="draw_indicator">True</property>
                        <property name="group">audio_input0</property>
                      </object>
                      <packing>
                        <property name="top_attach">20</property>
                        <property name="bottom_attach">21</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkRadioButton" id="audio_output16">
                        <property name="label" translatable="yes">radiobutton</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">False</property>
                        <property name="active">True</property>
                        <property name="draw_indicator">True</property>
                        <property name="group">audio_output0</property>
                      </object>
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="right_attach">2</property>
                        <property name="top_attach">17</property>
                        <property name="bottom_attach">18</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkRadioButton" id="audio_output17">
                        <property name="label" translatable="yes">radiobutton</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">False</property>
                        <property name="active">True</property>
                        <property name="draw_indicator">True</property>
                        <property name="group">audio_output0</property>
                      </object>
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="right_attach">2</property>
                        <property name="top_attach">18</property>
                        <property name="bottom_attach">19</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkRadioButton" id="audio_output18">
                        <property name="label" translatable="yes">radiobutton</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">False</property>
                        <property name="active">True</property>
                        <property name="draw_indicator">True</property>
                        <property name="group">audio_output0</property>
                      </object>
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="right_attach">2</property>
                        <property name="top_attach">19</property>
                        <property name="bottom_attach">20</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkRadioButton" id="audio_output19">
                        <property name="label" translatable="yes">radiobutton</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">False</property>
                        <property name="active">True</property>
                        <property name="draw_indicator">True</property>
                        <property name="group">audio_output0</property>
                      </object>
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="right_attach">2</property>
                        <property name="top_attach">20</property>
                        <property name="bottom_attach">21</property>
                      </packing>
                    </child>
                  </object>
                  <packing>
                    <property name="position">0</property>
                  </packing>
                </child>
              </object>
              <packing>
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
                <property name="position">1</property>
                <property name="tab_fill">False</property>
              </packing>
            </child>
            <child>
              <object class="GtkTable" id="table5">
                <property name="visible">True</property>
                <property name="n_rows">7</property>
                <property name="n_columns">2</property>
                <property name="column_spacing">5</property>
                <property name="row_spacing">5</property>
                <child>
                  <object class="GtkLabel" id="label15">
                    <property name="visible">True</property>
                    <property name="tooltip_text" translatable="yes">Set console logging level.







|







1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
                <property name="position">1</property>
                <property name="tab_fill">False</property>
              </packing>
            </child>
            <child>
              <object class="GtkTable" id="table5">
                <property name="visible">True</property>
                <property name="n_rows">8</property>
                <property name="n_columns">2</property>
                <property name="column_spacing">5</property>
                <property name="row_spacing">5</property>
                <child>
                  <object class="GtkLabel" id="label15">
                    <property name="visible">True</property>
                    <property name="tooltip_text" translatable="yes">Set console logging level.
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
                    <property name="bottom_attach">2</property>
                    <property name="x_options">GTK_FILL</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkLabel" id="label16">
                    <property name="visible">True</property>
                    <property name="tooltip_text" translatable="yes">Enter the command to execute the a call is received.
Example: aplay -Dplug:dmix /usr/share/sounds/2barks.au</property>
                    <property name="xalign">0</property>
                    <property name="label" translatable="yes">Command to execute on ring</property>
                  </object>
                  <packing>
                    <property name="top_attach">2</property>
                    <property name="bottom_attach">3</property>
                    <property name="x_options">GTK_FILL</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkEntry" id="ring_command">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="tooltip_text" translatable="yes">Enter the command to execute the a call is received.
Example: aplay -Dplug:dmix /usr/share/sounds/2barks.au</property>
                    <property name="invisible_char">&#x25CF;</property>
                  </object>
                  <packing>
                    <property name="left_attach">1</property>
                    <property name="right_attach">2</property>
                    <property name="top_attach">2</property>
                    <property name="bottom_attach">3</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkHScale" id="loglevel_scaler">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>







<









<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1549
1550
1551
1552
1553
1554
1555

1556
1557
1558
1559
1560
1561
1562
1563
1564
















1565
1566
1567
1568
1569
1570
1571
                    <property name="bottom_attach">2</property>
                    <property name="x_options">GTK_FILL</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkLabel" id="label16">

                    <property name="tooltip_text" translatable="yes">Enter the command to execute the a call is received.
Example: aplay -Dplug:dmix /usr/share/sounds/2barks.au</property>
                    <property name="xalign">0</property>
                    <property name="label" translatable="yes">Command to execute on ring</property>
                  </object>
                  <packing>
                    <property name="top_attach">2</property>
                    <property name="bottom_attach">3</property>
                    <property name="x_options">GTK_FILL</property>
















                    <property name="y_options">GTK_FILL</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkHScale" id="loglevel_scaler">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
                </child>
                <child>
                  <object class="GtkLabel" id="label18">
                    <property name="visible">True</property>
                    <property name="tooltip_text" translatable="yes">Enter the command for Help button.
Example: defaultbrowser http://www.smokey01.com/help/psip-help.html</property>
                    <property name="xalign">0</property>
                    <property name="label" translatable="yes">Command to execute on help
</property>
                  </object>
                  <packing>
                    <property name="top_attach">3</property>
                    <property name="bottom_attach">4</property>
                    <property name="x_options">GTK_FILL</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>







|
<







1614
1615
1616
1617
1618
1619
1620
1621

1622
1623
1624
1625
1626
1627
1628
                </child>
                <child>
                  <object class="GtkLabel" id="label18">
                    <property name="visible">True</property>
                    <property name="tooltip_text" translatable="yes">Enter the command for Help button.
Example: defaultbrowser http://www.smokey01.com/help/psip-help.html</property>
                    <property name="xalign">0</property>
                    <property name="label" translatable="yes">Command to execute on help</property>

                  </object>
                  <packing>
                    <property name="top_attach">3</property>
                    <property name="bottom_attach">4</property>
                    <property name="x_options">GTK_FILL</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
                  </packing>
                </child>
                <child>
                  <object class="GtkLabel" id="label21">
                    <property name="visible">True</property>
                    <property name="tooltip_text" translatable="yes">Number of seconds to wait before an incoming call is automatically dropped.</property>
                    <property name="xalign">0</property>
                    <property name="xpad">2</property>
                    <property name="label" translatable="yes">Incoming call timeout</property>
                  </object>
                  <packing>
                    <property name="top_attach">4</property>
                    <property name="bottom_attach">5</property>
                    <property name="x_options">GTK_FILL</property>
                    <property name="y_options">GTK_FILL</property>







<







1644
1645
1646
1647
1648
1649
1650

1651
1652
1653
1654
1655
1656
1657
                  </packing>
                </child>
                <child>
                  <object class="GtkLabel" id="label21">
                    <property name="visible">True</property>
                    <property name="tooltip_text" translatable="yes">Number of seconds to wait before an incoming call is automatically dropped.</property>
                    <property name="xalign">0</property>

                    <property name="label" translatable="yes">Incoming call timeout</property>
                  </object>
                  <packing>
                    <property name="top_attach">4</property>
                    <property name="bottom_attach">5</property>
                    <property name="x_options">GTK_FILL</property>
                    <property name="y_options">GTK_FILL</property>
1619
1620
1621
1622
1623
1624
1625













































1626
1627
1628
1629
1630
1631
1632
                    <property name="left_attach">1</property>
                    <property name="right_attach">2</property>
                    <property name="top_attach">6</property>
                    <property name="bottom_attach">7</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>
                </child>













































              </object>
              <packing>
                <property name="position">2</property>
              </packing>
            </child>
            <child type="tab">
              <object class="GtkLabel" id="label6">







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
                    <property name="left_attach">1</property>
                    <property name="right_attach">2</property>
                    <property name="top_attach">6</property>
                    <property name="bottom_attach">7</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkEntry" id="ring_command">
                    <property name="can_focus">True</property>
                    <property name="tooltip_text" translatable="yes">Enter the command to execute the a call is received.
Example: aplay -Dplug:dmix /usr/share/sounds/2barks.au</property>
                    <property name="invisible_char">&#x25CF;</property>
                  </object>
                  <packing>
                    <property name="left_attach">1</property>
                    <property name="right_attach">2</property>
                    <property name="top_attach">2</property>
                    <property name="bottom_attach">3</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkLabel" id="label23">
                    <property name="visible">True</property>
                    <property name="tooltip_text" translatable="yes">WAV file to be played on ring. 
16-bit, mono WAV file only.</property>
                    <property name="xalign">0</property>
                    <property name="label" translatable="yes">WAV to play on ring</property>
                  </object>
                  <packing>
                    <property name="top_attach">7</property>
                    <property name="bottom_attach">8</property>
                    <property name="x_options">GTK_FILL</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkFileChooserButton" id="ring_wav_file">
                    <property name="visible">True</property>
                    <property name="tooltip_text" translatable="yes">WAV file to be played on ring. 
16-bit, mono WAV file only.</property>
                    <property name="title" translatable="yes">Select ringer WAV file </property>
                  </object>
                  <packing>
                    <property name="left_attach">1</property>
                    <property name="right_attach">2</property>
                    <property name="top_attach">7</property>
                    <property name="bottom_attach">8</property>
                    <property name="y_options">GTK_FILL</property>
                  </packing>
                </child>
              </object>
              <packing>
                <property name="position">2</property>
              </packing>
            </child>
            <child type="tab">
              <object class="GtkLabel" id="label6">
Changes to psip.h.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <gtk/gtk.h>

#define CONFIG_FILE "psip.conf"
#define DEFAULT_HELP_COMMAND "defaultbrowser http://www.smokey01.com/help/psip-help.html"
#define DEFAULT_RING_COMMAND "aplay -Dplug:dmix /usr/share/sounds/2barks.au"
#define	DEFAULT_INCOMING_TIMEOUT	15		/* in seconds */

#define MAX_AUDIO_DEVICES 	16
#define INVALID_CALL_ID 	(-1)
#define GTK_END_OF_LIST		(-1) /*gtk code*/

//buddylist columns - must sync with glade file
#define BUDDY_NICK			0
#define BUDDY_ADDRESS		1
#define BUDDY_STATUS		2
#define BUDDY_STATUS_TEXT	3
#define BUDDY_ICON			4







|

|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <gtk/gtk.h>

#define CONFIG_FILE "psip.conf"
#define DEFAULT_HELP_COMMAND "defaultbrowser http://www.smokey01.com/help/psip-help.html"
#define DEFAULT_RING_COMMAND "aplay -Dplug:dmix /usr/share/sounds/2barks.au"
#define	DEFAULT_INCOMING_TIMEOUT	15		/* in seconds */

#define MAX_AUDIO_DEVICES 	20	 /* make sure this is in sync with psip.glade */
#define INVALID_CALL_ID 	(-1)
#define GTK_END_OF_LIST		(-1) /* gtk code */

//buddylist columns - must sync with glade file
#define BUDDY_NICK			0
#define BUDDY_ADDRESS		1
#define BUDDY_STATUS		2
#define BUDDY_STATUS_TEXT	3
#define BUDDY_ICON			4
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
	GtkTreeView *buddylistview, *call_listview;
	
	GtkEntry *addbuddy_nickname_field, *addbuddy_address_field;
	GtkEntry *account_sip_url_field, *account_registrar_field, *account_realm_field, 
			 *account_user_field, *account_password_field, *ring_command_field,
			 *sip_port_field, *help_command_field, *call_timeout_field;
	GtkToggleButton *minimise_tray_field, *auto_register_field;

	GtkEntry *adhoc_call_field;
	
	GtkWidget *audio_inputs[MAX_AUDIO_DEVICES], *audio_outputs[MAX_AUDIO_DEVICES];
	GHashTable *active_ims, *active_calls; /* hash tables for multiple IMs and calls */
	
	gboolean is_playing, is_recording;
	gchararray recording_filename, playing_filename;
};

typedef struct _im_data {
	gint buddy_id;
	gchararray address;
	GtkWindow *w;
	GtkWidget *msg, *history;







>






|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
	GtkTreeView *buddylistview, *call_listview;
	
	GtkEntry *addbuddy_nickname_field, *addbuddy_address_field;
	GtkEntry *account_sip_url_field, *account_registrar_field, *account_realm_field, 
			 *account_user_field, *account_password_field, *ring_command_field,
			 *sip_port_field, *help_command_field, *call_timeout_field;
	GtkToggleButton *minimise_tray_field, *auto_register_field;
	GtkFileChooserButton *ring_wav_file_button;
	GtkEntry *adhoc_call_field;
	
	GtkWidget *audio_inputs[MAX_AUDIO_DEVICES], *audio_outputs[MAX_AUDIO_DEVICES];
	GHashTable *active_ims, *active_calls; /* hash tables for multiple IMs and calls */
	
	gboolean is_playing, is_recording;
	gchararray recording_filename, playing_filename, ring_filename;
};

typedef struct _im_data {
	gint buddy_id;
	gchararray address;
	GtkWindow *w;
	GtkWidget *msg, *history;