aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES6
-rw-r--r--channels/chan_dahdi.c26
-rw-r--r--channels/chan_iax2.c19
-rw-r--r--channels/chan_sip.c24
-rw-r--r--channels/sip/include/sip.h1
-rw-r--r--configs/chan_dahdi.conf.sample8
-rw-r--r--configs/iax.conf.sample2
-rw-r--r--configs/sip.conf.sample2
-rw-r--r--configs/users.conf.sample2
9 files changed, 71 insertions, 19 deletions
diff --git a/CHANGES b/CHANGES
index 1d0e7827d..1a511502a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -23,6 +23,9 @@ Asterisk Manager Interface
for chan_dahdi ISDN channels.
* Added new action MeetmeListRooms to list active conferences (shows same
data as "meetme list" at the CLI).
+ * DAHDIShowChannels, SIPshowpeer, SIPpeers, and IAXpeers now contains a
+ Description field that is set by 'description' in the channel configuration
+ file.
Asterisk HTTP Server
--------------------------
@@ -41,6 +44,9 @@ CLI Changes
alternate configuration file to use.
* 'dialplan add extension' command will now automatically create a context if
the specified context does not exist with a message indicated it did so.
+ * 'sip show peers', 'iax show peers', and 'dahdi show peers' now contains a
+ Description field which can be populated with 'description' in the channel
+ configuration files (sip.conf, iax2.conf, and chan_dahdi.conf).
CDR
--------------------------
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 79257b0ac..bbb5c1ac5 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -979,6 +979,11 @@ struct dahdi_pvt {
* \note The "context" string read in from chan_dahdi.conf
*/
char context[AST_MAX_CONTEXT];
+ /*!
+ * \brief A description for the channel configuration
+ * \note The "description" string read in from chan_dahdi.conf
+ */
+ char description[32];
/*!
* \brief Saved context string.
*/
@@ -1276,6 +1281,7 @@ struct dahdi_pvt {
MEMBER(dahdi_pvt, use_smdi, AST_DATA_BOOLEAN) \
MEMBER(dahdi_pvt, context, AST_DATA_STRING) \
MEMBER(dahdi_pvt, defcontext, AST_DATA_STRING) \
+ MEMBER(dahdi_pvt, description, AST_DATA_STRING) \
MEMBER(dahdi_pvt, exten, AST_DATA_STRING) \
MEMBER(dahdi_pvt, language, AST_DATA_STRING) \
MEMBER(dahdi_pvt, mohinterpret, AST_DATA_STRING) \
@@ -12682,6 +12688,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
ast_copy_string(tmp->mohinterpret, conf->chan.mohinterpret, sizeof(tmp->mohinterpret));
ast_copy_string(tmp->mohsuggest, conf->chan.mohsuggest, sizeof(tmp->mohsuggest));
ast_copy_string(tmp->context, conf->chan.context, sizeof(tmp->context));
+ ast_copy_string(tmp->description, conf->chan.description, sizeof(tmp->description));
ast_copy_string(tmp->parkinglot, conf->chan.parkinglot, sizeof(tmp->parkinglot));
tmp->cid_ton = 0;
if (analog_lib_handles(tmp->sig, tmp->radio, tmp->oprmode)) {
@@ -14995,8 +15002,8 @@ static int action_dahdirestart(struct mansession *s, const struct message *m)
static char *dahdi_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
-#define FORMAT "%7s %-10.10s %-15.15s %-10.10s %-20.20s %-10.10s %-10.10s\n"
-#define FORMAT2 "%7s %-10.10s %-15.15s %-10.10s %-20.20s %-10.10s %-10.10s\n"
+#define FORMAT "%7s %-10.10s %-15.15s %-10.10s %-20.20s %-10.10s %-10.10s %-32.32s\n"
+#define FORMAT2 "%7s %-10.10s %-15.15s %-10.10s %-20.20s %-10.10s %-10.10s %-32.32s\n"
unsigned int targetnum = 0;
int filtertype = 0;
struct dahdi_pvt *tmp = NULL;
@@ -15033,7 +15040,7 @@ static char *dahdi_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl
}
}
- ast_cli(a->fd, FORMAT2, "Chan", "Extension", "Context", "Language", "MOH Interpret", "Blocked", "State");
+ ast_cli(a->fd, FORMAT2, "Chan", "Extension", "Context", "Language", "MOH Interpret", "Blocked", "State", "Description");
ast_mutex_lock(&iflock);
for (tmp = iflist; tmp; tmp = tmp->next) {
if (filtertype) {
@@ -15071,7 +15078,7 @@ static char *dahdi_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl
snprintf(statestr, sizeof(statestr), "%s", "In Service");
- ast_cli(a->fd, FORMAT, tmps, tmp->exten, tmp->context, tmp->language, tmp->mohinterpret, blockstr, statestr);
+ ast_cli(a->fd, FORMAT, tmps, tmp->exten, tmp->context, tmp->language, tmp->mohinterpret, blockstr, statestr, tmp->description);
}
ast_mutex_unlock(&iflock);
return CLI_SUCCESS;
@@ -15107,6 +15114,7 @@ static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli
for (tmp = iflist; tmp; tmp = tmp->next) {
if (tmp->channel == channel) {
ast_cli(a->fd, "Channel: %d\n", tmp->channel);
+ ast_cli(a->fd, "Description: %s\n", tmp->description);
ast_cli(a->fd, "File Descriptor: %d\n", tmp->subs[SUB_REAL].dfd);
ast_cli(a->fd, "Span: %d\n", tmp->span);
ast_cli(a->fd, "Extension: %s\n", tmp->exten);
@@ -15812,6 +15820,7 @@ static int action_dahdishowchannels(struct mansession *s, const struct message *
"Context: %s\r\n"
"DND: %s\r\n"
"Alarm: %s\r\n"
+ "Description: %s\r\n"
"%s"
"\r\n",
tmp->channel,
@@ -15822,7 +15831,8 @@ static int action_dahdishowchannels(struct mansession *s, const struct message *
tmp->sig,
tmp->context,
dahdi_dnd(tmp, -1) ? "Enabled" : "Disabled",
- alarm2str(alm), idText);
+ alarm2str(alm),
+ tmp->description, idText);
} else {
astman_append(s,
"Event: DAHDIShowChannels\r\n"
@@ -15832,12 +15842,14 @@ static int action_dahdishowchannels(struct mansession *s, const struct message *
"Context: %s\r\n"
"DND: %s\r\n"
"Alarm: %s\r\n"
+ "Description: %s\r\n"
"%s"
"\r\n",
tmp->channel, sig2str(tmp->sig), tmp->sig,
tmp->context,
dahdi_dnd(tmp, -1) ? "Enabled" : "Disabled",
- alarm2str(alm), idText);
+ alarm2str(alm),
+ tmp->description, idText);
}
}
}
@@ -16836,6 +16848,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
confp->chan.dtmfrelax = 0;
} else if (!strcasecmp(v->name, "mailbox")) {
ast_copy_string(confp->chan.mailbox, v->value, sizeof(confp->chan.mailbox));
+ } else if (!strcasecmp(v->name, "description")) {
+ ast_copy_string(confp->chan.description, v->value, sizeof(confp->chan.description));
} else if (!strcasecmp(v->name, "hasvoicemail")) {
if (ast_true(v->value) && ast_strlen_zero(confp->chan.mailbox)) {
ast_copy_string(confp->chan.mailbox, cat, sizeof(confp->chan.mailbox));
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index ab28ec6dc..0db1f2299 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -484,6 +484,7 @@ struct iax2_peer {
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(name);
AST_STRING_FIELD(username);
+ AST_STRING_FIELD(description); /*!< Description of the peer */
AST_STRING_FIELD(secret);
AST_STRING_FIELD(dbsecret);
AST_STRING_FIELD(outkey); /*!< What key we use to talk to this peer */
@@ -3837,6 +3838,7 @@ static char *handle_cli_iax2_show_peer(struct ast_cli_entry *e, int cmd, struct
encmethods_to_str(peer->encmethods, encmethods);
ast_cli(a->fd, "\n\n");
ast_cli(a->fd, " * Name : %s\n", peer->name);
+ ast_cli(a->fd, " Description : %s\n", peer->description);
ast_cli(a->fd, " Secret : %s\n", ast_strlen_zero(peer->secret) ? "<Not set>" : "<Set>");
ast_cli(a->fd, " Context : %s\n", peer->context);
ast_cli(a->fd, " Parking lot : %s\n", peer->parkinglot);
@@ -6712,8 +6714,8 @@ static int __iax2_show_peers(int fd, int *total, struct mansession *s, const int
int unmonitored_peers = 0;
struct ao2_iterator i;
-#define FORMAT2 "%-15.15s %-15.15s %s %-15.15s %-8s %s %-10s\n"
-#define FORMAT "%-15.15s %-15.15s %s %-15.15s %-5d%s %s %-10s\n"
+#define FORMAT2 "%-15.15s %-15.15s %s %-15.15s %-8s %s %-11s %-32.32s\n"
+#define FORMAT "%-15.15s %-15.15s %s %-15.15s %-5d%s %s %-11s %-32.32s\n"
struct iax2_peer *peer = NULL;
char name[256];
@@ -6755,7 +6757,7 @@ static int __iax2_show_peers(int fd, int *total, struct mansession *s, const int
if (!s)
- ast_cli(fd, FORMAT2, "Name/Username", "Host", " ", "Mask", "Port", " ", "Status");
+ ast_cli(fd, FORMAT2, "Name/Username", "Host", " ", "Mask", "Port", " ", "Status", "Description");
i = ao2_iterator_init(peers, 0);
for (peer = ao2_iterator_next(&i); peer;
@@ -6801,7 +6803,8 @@ static int __iax2_show_peers(int fd, int *total, struct mansession *s, const int
"Dynamic: %s\r\n"
"Trunk: %s\r\n"
"Encryption: %s\r\n"
- "Status: %s\r\n\r\n",
+ "Status: %s\r\n"
+ "Description: %s\r\n\r\n",
idtext,
name,
ast_sockaddr_stringify_addr(&peer->addr),
@@ -6809,7 +6812,8 @@ static int __iax2_show_peers(int fd, int *total, struct mansession *s, const int
ast_test_flag64(peer, IAX_DYNAMIC) ? "yes" : "no",
ast_test_flag64(peer, IAX_TRUNK) ? "yes" : "no",
peer->encmethods ? ast_str_buffer(encmethods) : "no",
- status);
+ status,
+ peer->description);
} else {
ast_cli(fd, FORMAT, name,
ast_sockaddr_stringify_addr(&peer->addr),
@@ -6818,7 +6822,8 @@ static int __iax2_show_peers(int fd, int *total, struct mansession *s, const int
ast_sockaddr_port(&peer->addr),
ast_test_flag64(peer, IAX_TRUNK) ? "(T)" : " ",
peer->encmethods ? "(E)" : " ",
- status);
+ status,
+ peer->description);
}
total_peers++;
}
@@ -12459,6 +12464,8 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
ast_string_field_set(peer, mohsuggest, v->value);
} else if (!strcasecmp(v->name, "dbsecret")) {
ast_string_field_set(peer, dbsecret, v->value);
+ } else if (!strcasecmp(v->name, "description")) {
+ ast_string_field_set(peer, description, v->value);
} else if (!strcasecmp(v->name, "trunk")) {
ast_set2_flag64(peer, ast_true(v->value), IAX_TRUNK);
if (ast_test_flag64(peer, IAX_TRUNK) && !timer) {
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 23566a023..b1f32c06b 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -15997,8 +15997,8 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
struct ao2_iterator i;
/* the last argument is left-aligned, so we don't need a size anyways */
-#define FORMAT2 "%-25.25s %-39.39s %-3.3s %-10.10s %-3.3s %-8s %-10s %s\n"
-#define FORMAT "%-25.25s %-39.39s %-3.3s %-3.3s %-3.3s %-8d %-10s %s\n"
+#define FORMAT2 "%-25.25s %-39.39s %-3.3s %-10.10s %-3.3s %-8s %-11s %-32.32s %s\n"
+#define FORMAT "%-25.25s %-39.39s %-3.3s %-10.10s %-3.3s %-8d %-11s %-32.32s %s\n"
char name[256];
int total_peers = 0;
@@ -16038,7 +16038,7 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
}
if (!s) /* Normal list */
- ast_cli(fd, FORMAT2, "Name/username", "Host", "Dyn", "Forcerport", "ACL", "Port", "Status", (realtimepeers ? "Realtime" : ""));
+ ast_cli(fd, FORMAT2, "Name/username", "Host", "Dyn", "Forcerport", "ACL", "Port", "Status", "Description", (realtimepeers ? "Realtime" : ""));
i = ao2_iterator_init(peers, 0);
@@ -16103,6 +16103,7 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT) ? " N " : " ", /* NAT=yes? */
peer->ha ? " A " : " ", /* permit/deny */
ast_sockaddr_isnull(&peer->addr) ? 0 : ast_sockaddr_port(&peer->addr), status,
+ peer->description ? peer->description : "",
realtimepeers ? (peer->is_realtime ? "Cached RT":"") : "");
if (!s) {/* Normal CLI list */
@@ -16112,6 +16113,7 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT) ? " N " : " ", /* NAT=yes? */
peer->ha ? " A " : " ", /* permit/deny */
ast_sockaddr_isnull(&peer->addr) ? 0 : ast_sockaddr_port(&peer->addr), status,
+ peer->description ? peer->description : "",
realtimepeers ? (peer->is_realtime ? "Cached RT":"") : "");
} else { /* Manager format */
/* The names here need to be the same as other channels */
@@ -16128,7 +16130,8 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
"TextSupport: %s\r\n"
"ACL: %s\r\n"
"Status: %s\r\n"
- "RealtimeDevice: %s\r\n\r\n",
+ "RealtimeDevice: %s\r\n"
+ "Description: %s\r\n\r\n",
idtext,
peer->name,
ast_sockaddr_isnull(&peer->addr) ? "-none-" : ast_sockaddr_stringify_fmt(&peer->addr, AST_SOCKADDR_STR_HOST),
@@ -16139,7 +16142,8 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
ast_test_flag(&peer->flags[1], SIP_PAGE2_TEXTSUPPORT) ? "yes" : "no", /* TEXTSUPPORT=yes? */
peer->ha ? "yes" : "no", /* permit/deny */
status,
- realtimepeers ? (peer->is_realtime ? "yes":"no") : "no");
+ realtimepeers ? (peer->is_realtime ? "yes":"no") : "no",
+ peer->description);
}
ao2_unlock(peer);
unref_peer(peer, "toss iterator peer ptr");
@@ -16717,6 +16721,7 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct
struct ast_str *mailbox_str = ast_str_alloca(512);
ast_cli(fd, "\n\n");
ast_cli(fd, " * Name : %s\n", peer->name);
+ ast_cli(fd, " Description : %s\n", peer->description);
if (realtimepeers) { /* Realtime is enabled */
ast_cli(fd, " Realtime peer: %s\n", peer->is_realtime ? "Yes, cached" : "No");
}
@@ -16924,7 +16929,8 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct
astman_append(s, "ChanVariable: %s=%s\r\n", v->name, v->value);
}
}
- astman_append(s, "SIP-Use-Reason-Header : %s\n", (ast_test_flag(&peer->flags[1], SIP_PAGE2_Q850_REASON)) ? "Y" : "N");
+ astman_append(s, "SIP-Use-Reason-Header : %s\r\n", (ast_test_flag(&peer->flags[1], SIP_PAGE2_Q850_REASON)) ? "Y" : "N");
+ astman_append(s, "Description : %s\r\n", peer->description);
peer = unref_peer(peer, "sip_show_peer: unref_peer: done with peer");
@@ -26105,6 +26111,7 @@ static void set_peer_defaults(struct sip_peer *peer)
peer->call_limit=INT_MAX;
ast_string_field_set(peer, vmexten, default_vmexten);
ast_string_field_set(peer, secret, "");
+ ast_string_field_set(peer, description, "");
ast_string_field_set(peer, remotesecret, "");
ast_string_field_set(peer, md5secret, "");
ast_string_field_set(peer, cid_num, "");
@@ -26347,6 +26354,8 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
ast_string_field_set(peer, remotesecret, v->value);
} else if (!strcasecmp(v->name, "secret")) {
ast_string_field_set(peer, secret, v->value);
+ } else if (!strcasecmp(v->name, "description")) {
+ ast_string_field_set(peer, description, v->value);
} else if (!strcasecmp(v->name, "md5secret")) {
ast_string_field_set(peer, md5secret, v->value);
} else if (!strcasecmp(v->name, "auth")) {
@@ -29090,7 +29099,8 @@ AST_TEST_DEFINE(test_sip_peers_get)
MEMBER(sip_peer, maxms, AST_DATA_MILLISECONDS) \
MEMBER(sip_peer, qualifyfreq, AST_DATA_MILLISECONDS) \
MEMBER(sip_peer, timer_t1, AST_DATA_MILLISECONDS) \
- MEMBER(sip_peer, timer_b, AST_DATA_MILLISECONDS)
+ MEMBER(sip_peer, timer_b, AST_DATA_MILLISECONDS) \
+ MEMBER(sip_peer, description, AST_DATA_STRING)
AST_DATA_STRUCTURE(sip_peer, DATA_EXPORT_SIP_PEER);
diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h
index e5d8205e5..f3c27ad64 100644
--- a/channels/sip/include/sip.h
+++ b/channels/sip/include/sip.h
@@ -1157,6 +1157,7 @@ struct sip_peer {
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(secret); /*!< Password for inbound auth */
AST_STRING_FIELD(md5secret); /*!< Password in MD5 */
+ AST_STRING_FIELD(description); /*!< Description of this peer */
AST_STRING_FIELD(remotesecret); /*!< Remote secret (trunks, remote devices) */
AST_STRING_FIELD(context); /*!< Default context for incoming calls */
AST_STRING_FIELD(subscribecontext); /*!< Default context for subscriptions */
diff --git a/configs/chan_dahdi.conf.sample b/configs/chan_dahdi.conf.sample
index 761c5760b..dca09cb56 100644
--- a/configs/chan_dahdi.conf.sample
+++ b/configs/chan_dahdi.conf.sample
@@ -820,6 +820,11 @@ pickupgroup=1
;
;useincomingcalleridondahditransfer = yes
;
+; Add a description for the channel which can be shown through the Asterisk
+; console when executing the 'dahdi show channels' command is run.
+;
+;description=Phone located in lobby
+;
; AMA flags affects the recording of Call Detail Records. If specified
; it may be 'default', 'omit', 'billing', or 'documentation'.
;
@@ -1068,10 +1073,13 @@ pickupgroup=1
;
;
;callerid="Green Phone"<(256) 428-6121>
+;description=Reception Phone ; add a description for 'dahdi show channels'
;channel => 1
;callerid="Black Phone"<(256) 428-6122>
+;description=Courtesy Phone
;channel => 2
;callerid="CallerID Phone" <(630) 372-1564>
+;description= ; reset the description for following channels
;channel => 3
;callerid="Pac Tel Phone" <(256) 428-6124>
;channel => 4
diff --git a/configs/iax.conf.sample b/configs/iax.conf.sample
index a3d0fea12..d08aa31dc 100644
--- a/configs/iax.conf.sample
+++ b/configs/iax.conf.sample
@@ -504,6 +504,7 @@ type=peer
username=asterisk
secret=supersecret
host=216.207.245.47
+description=Demo System At Digium ; Description of this peer, as listed by 'iax2 show peers'
;sendani=no
;host=asterisk.linux-support.net
;port=5036
@@ -544,6 +545,7 @@ host=216.207.245.47
;[biggateway]
;type=peer
;host=192.168.0.1
+;description=Gateway to PSTN
;context=*
;secret=myscret
;trunk=yes ; Use IAX2 trunking with this host
diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample
index a60ea347d..5c8fa4de9 100644
--- a/configs/sip.conf.sample
+++ b/configs/sip.conf.sample
@@ -1100,6 +1100,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
; use_q850_reason
; maxforwards
; encryption
+; description ; Used to provide a description of the peer in console output
;[sip_proxy]
; For incoming calls only. Example: FWD (Free World Dialup)
@@ -1195,6 +1196,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
;context=from-sip ; Where to start in the dialplan when this phone calls
;callerid=John Doe <1234> ; Full caller ID, to override the phones config
; on incoming calls to Asterisk
+;description=Courtesy Phone ; Description of the peer. Shown when doing 'sip show peers'.
;host=192.168.0.23 ; we have a static but private IP address
; No registration allowed
;nat=no ; there is not NAT between phone and Asterisk
diff --git a/configs/users.conf.sample b/configs/users.conf.sample
index 7612546b3..50b80a1c5 100644
--- a/configs/users.conf.sample
+++ b/configs/users.conf.sample
@@ -87,6 +87,8 @@ pickupgroup = 1
;[6000]
;fullname = Joe User
+;description = Courtesy Phone In Lobby ; Used to provide a description of the
+ ; peer in console output
;email = joe@foo.bar
;secret = 1234
;dahdichan = 1