diff --git a/asterisk.c b/asterisk.c
index 3704a9f31d12cc88f20076f9f422b29dc25896da..93eab8a435b16e875061b5062c60dcfcd3260dcf 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -1644,6 +1644,9 @@ static char *cli_prompt(EditLine *el)
 					}
 					break;
 #endif
+				case 's': /* Asterisk system name (from asterisk.conf) */
+					strncat(p, ast_config_AST_SYSTEM_NAME, sizeof(prompt) - strlen(prompt) - 1);
+					break;
 				case 't': /* time */
 					memset(&tm, 0, sizeof(tm));
 					time(&ts);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 0ed91d84ccb029cf0a2dcfcc27331236e8bc93e2..2b51265d8cea91c7aa2571be1a271806f59bd486 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -13260,7 +13260,10 @@ static int reload_config(enum channelreloadreason reason)
 	global_allowsubscribe = FALSE;
 	ast_copy_string(global_useragent, DEFAULT_USERAGENT, sizeof(global_useragent));
 	ast_copy_string(default_notifymime, DEFAULT_NOTIFYMIME, sizeof(default_notifymime));
-	ast_copy_string(global_realm, DEFAULT_REALM, sizeof(global_realm));
+	if (ast_strlen_zero(ast_config_AST_SYSTEM_NAME))
+		ast_copy_string(global_realm, DEFAULT_REALM, sizeof(global_realm));
+	else
+		ast_copy_string(global_realm, ast_config_AST_SYSTEM_NAME, sizeof(global_realm));
 	ast_copy_string(default_callerid, DEFAULT_CALLERID, sizeof(default_callerid));
 	compactheaders = DEFAULT_COMPACTHEADERS;
 	global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT;
diff --git a/configs/manager.conf.sample b/configs/manager.conf.sample
index 1db1ef4cc765c057935a8da7d23266ffdb219042..02f9e41ec01c8c6a89fef822e7e231e572be0b7c 100644
--- a/configs/manager.conf.sample
+++ b/configs/manager.conf.sample
@@ -21,6 +21,7 @@
 ; default is 60 seconds.
 ;
 [general]
+displaysystemname = yes
 enabled = no
 ;webenabled = yes
 port = 5038
diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample
index d44b3c5007fe4bbabbf95c65a79fbdac587ee869..c4cbf0e66234f29e64cf8184ed5f361f834f5513 100644
--- a/configs/sip.conf.sample
+++ b/configs/sip.conf.sample
@@ -32,7 +32,8 @@ allowoverlap=no			; Disable overlap dialing support. (Default is yes)
 ;allowtransfer=no		; Disable all transfers (unless enabled in peers or users)
 				; Default is enabled
 ;realm=mydomain.tld		; Realm for digest authentication
-				; defaults to "asterisk"
+				; defaults to "asterisk". If you set a system name in
+				; asterisk.conf, it defaults to that system name
 				; Realms MUST be globally unique according to RFC 3261
 				; Set this to your host name or domain name
 bindport=5060			; UDP Port to bind to (SIP standard port is 5060)
diff --git a/doc/cliprompt.txt b/doc/cliprompt.txt
index 281d3df5f7fcd0935174755dc8af9bb31c93e322..fbd7dd99fa088a303ddf8c27d9f4f82cc61d9821 100644
--- a/doc/cliprompt.txt
+++ b/doc/cliprompt.txt
@@ -8,6 +8,7 @@ You may include the following variables, that will be replaced by
 the current value by Asterisk:
 
 %d	Date (year-month-date)
+%s	Asterisk system name (from asterisk.conf)
 %h	Full hostname
 %H	Short hostname
 %t	Time
diff --git a/manager.c b/manager.c
index d096c068972d3790cfc4d8ab312b390ca34b3299..0a6b79469076b0cc5591f21f82d49247d3d1dc96 100644
--- a/manager.c
+++ b/manager.c
@@ -158,6 +158,7 @@ static struct mansession {
 	char inbuf[AST_MAX_MANHEADER_LEN];
 	int inlen;
 	int send_events;
+	int displaysystemname;		/*!< Add system name to manager responses and events */
 	/* Queued events that we've not had the ability to send yet */
 	struct eventqent *eventq;
 	/* Timeout for ast_carefulwrite() */
@@ -772,6 +773,14 @@ static int authenticate(struct mansession *s, struct message *m)
 				while (v) {
 					if (!strcasecmp(v->name, "secret")) {
 						password = v->value;
+					} else if (!strcasecmp(v->name, "displaysystemname")) {
+						if (ast_true(v->value)) {
+							if (ast_strlen_zero(ast_config_AST_SYSTEM_NAME)) {
+								s->displaysystemname = 1;
+							} else {
+								ast_log(LOG_ERROR, "Can't enable displaysystemname in manager.conf - no system name configured in asterisk.conf\n");
+							}
+						}
 					} else if (!strcasecmp(v->name, "permit") ||
 						   !strcasecmp(v->name, "deny")) {
 						ha = ast_append_ha(v->name, v->value, ha);