mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-17 02:02:22 +00:00
INFO/Record request configurable to use dynamic features
Adds two new options to SIP peers allowing them to specify features (dynamic or builtin) to use when sending INFO/record requests. Recordonfeature activates whatever feature is specified when recieving a record: on request while recordofffeature activates whatever feature is specified when receiving a record: off request. Both of these features can be disabled by setting the feature to an empty string. (closes issue ASTERISK-16507) Reported by: Jon Bright Review: https://reviewboard.asterisk.org/r/1634/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349098 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -17751,6 +17751,8 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct
|
||||
ao2_t_ref(credentials, -1, "Unref peer auth for show");
|
||||
}
|
||||
ast_cli(fd, " Context : %s\n", peer->context);
|
||||
ast_cli(fd, " Record On feature : %s\n", peer->record_on_feature);
|
||||
ast_cli(fd, " Record Off feature : %s\n", peer->record_off_feature);
|
||||
ast_cli(fd, " Subscr.Cont. : %s\n", S_OR(peer->subscribecontext, "<Not set>") );
|
||||
ast_cli(fd, " Language : %s\n", peer->language);
|
||||
ast_cli(fd, " Tonezone : %s\n", peer->zone[0] != '\0' ? peer->zone : "<Not set>");
|
||||
@@ -18502,6 +18504,8 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
||||
ast_cli(a->fd, " Allowed transports: %s\n", get_transport_list(default_transports));
|
||||
ast_cli(a->fd, " Outbound transport: %s\n", sip_get_transport(default_primary_transport));
|
||||
ast_cli(a->fd, " Context: %s\n", sip_cfg.default_context);
|
||||
ast_cli(a->fd, " Record on feature: %s\n", sip_cfg.default_record_on_feature);
|
||||
ast_cli(a->fd, " Record off feature: %s\n", sip_cfg.default_record_off_feature);
|
||||
ast_cli(a->fd, " Force rport: %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_NAT_FORCE_RPORT)));
|
||||
ast_cli(a->fd, " DTMF: %s\n", dtmfmode2str(ast_test_flag(&global_flags[0], SIP_DTMF)));
|
||||
ast_cli(a->fd, " Qualify: %d\n", default_qualify);
|
||||
@@ -19204,15 +19208,13 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
|
||||
return;
|
||||
} else if (!ast_strlen_zero(c = sip_get_header(req, "Record"))) {
|
||||
/* INFO messages generated by some phones to start/stop recording
|
||||
on phone calls.
|
||||
OEJ: I think this should be something that is enabled/disabled
|
||||
per device. I don't want incoming callers to record calls in my
|
||||
pbx.
|
||||
*/
|
||||
|
||||
struct ast_call_feature *feat;
|
||||
* on phone calls.
|
||||
*/
|
||||
|
||||
struct ast_call_feature *feat = NULL;
|
||||
int j;
|
||||
struct ast_frame f = { AST_FRAME_DTMF, };
|
||||
int suppress_warning = 0; /* Supress warning if the feature is blank */
|
||||
|
||||
if (!p->owner) { /* not a PBX call */
|
||||
transmit_response(p, "481 Call leg/transaction does not exist", req);
|
||||
@@ -19222,9 +19224,27 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
|
||||
|
||||
/* first, get the feature string, if it exists */
|
||||
ast_rdlock_call_features();
|
||||
feat = ast_find_call_feature("automon");
|
||||
if (p->relatedpeer) {
|
||||
if (!strcasecmp(c, "on")) {
|
||||
if (ast_strlen_zero(p->relatedpeer->record_on_feature)) {
|
||||
suppress_warning = 1;
|
||||
} else {
|
||||
feat = ast_find_call_feature(p->relatedpeer->record_on_feature);
|
||||
}
|
||||
} else if (!strcasecmp(c, "off")) {
|
||||
if (ast_strlen_zero(p->relatedpeer->record_on_feature)) {
|
||||
suppress_warning = 1;
|
||||
} else {
|
||||
feat = ast_find_call_feature(p->relatedpeer->record_off_feature);
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Received INFO requesting to record with invalid value: %s\n", c);
|
||||
}
|
||||
}
|
||||
if (!feat || ast_strlen_zero(feat->exten)) {
|
||||
ast_log(LOG_WARNING, "Recording requested, but no One Touch Monitor registered. (See features.conf)\n");
|
||||
if (!suppress_warning) {
|
||||
ast_log(LOG_WARNING, "Recording requested, but no One Touch Monitor registered. (See features.conf)\n");
|
||||
}
|
||||
/* 403 means that we don't support this feature, so don't request it again */
|
||||
transmit_response(p, "403 Forbidden", req);
|
||||
ast_unlock_call_features();
|
||||
@@ -27666,6 +27686,8 @@ static void set_peer_defaults(struct sip_peer *peer)
|
||||
ast_copy_flags(&peer->flags[1], &global_flags[1], SIP_PAGE2_FLAGS_TO_COPY);
|
||||
ast_copy_flags(&peer->flags[2], &global_flags[2], SIP_PAGE3_FLAGS_TO_COPY);
|
||||
ast_string_field_set(peer, context, sip_cfg.default_context);
|
||||
ast_string_field_set(peer, record_on_feature, sip_cfg.default_record_on_feature);
|
||||
ast_string_field_set(peer, record_off_feature, sip_cfg.default_record_off_feature);
|
||||
ast_string_field_set(peer, messagecontext, sip_cfg.messagecontext);
|
||||
ast_string_field_set(peer, subscribecontext, sip_cfg.default_subscribecontext);
|
||||
ast_string_field_set(peer, language, default_language);
|
||||
@@ -27975,6 +27997,10 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
|
||||
} else if (!strcasecmp(v->name, "context")) {
|
||||
ast_string_field_set(peer, context, v->value);
|
||||
ast_set_flag(&peer->flags[1], SIP_PAGE2_HAVEPEERCONTEXT);
|
||||
} else if (!strcasecmp(v->name, "recordonfeature")) {
|
||||
ast_string_field_set(peer, record_on_feature, v->value);
|
||||
} else if (!strcasecmp(v->name, "recordofffeature")) {
|
||||
ast_string_field_set(peer, record_off_feature, v->value);
|
||||
} else if (!strcasecmp(v->name, "outofcall_message_context")) {
|
||||
ast_string_field_set(peer, messagecontext, v->value);
|
||||
} else if (!strcasecmp(v->name, "subscribecontext")) {
|
||||
@@ -28734,6 +28760,8 @@ static int reload_config(enum channelreloadreason reason)
|
||||
|
||||
/* Initialize some reasonable defaults at SIP reload (used both for channel and as default for devices */
|
||||
ast_copy_string(sip_cfg.default_context, DEFAULT_CONTEXT, sizeof(sip_cfg.default_context));
|
||||
ast_copy_string(sip_cfg.default_record_on_feature, DEFAULT_RECORD_FEATURE, sizeof(sip_cfg.default_record_on_feature));
|
||||
ast_copy_string(sip_cfg.default_record_off_feature, DEFAULT_RECORD_FEATURE, sizeof(sip_cfg.default_record_off_feature));
|
||||
sip_cfg.default_subscribecontext[0] = '\0';
|
||||
sip_cfg.default_max_forwards = DEFAULT_MAX_FORWARDS;
|
||||
default_language[0] = '\0';
|
||||
@@ -28801,6 +28829,10 @@ static int reload_config(enum channelreloadreason reason)
|
||||
|
||||
if (!strcasecmp(v->name, "context")) {
|
||||
ast_copy_string(sip_cfg.default_context, v->value, sizeof(sip_cfg.default_context));
|
||||
} else if (!strcasecmp(v->name, "recordonfeature")) {
|
||||
ast_copy_string(sip_cfg.default_record_on_feature, v->value, sizeof(sip_cfg.default_record_on_feature));
|
||||
} else if (!strcasecmp(v->name, "recordofffeature")) {
|
||||
ast_copy_string(sip_cfg.default_record_off_feature, v->value, sizeof(sip_cfg.default_record_off_feature));
|
||||
} else if (!strcasecmp(v->name, "subscribecontext")) {
|
||||
ast_copy_string(sip_cfg.default_subscribecontext, v->value, sizeof(sip_cfg.default_subscribecontext));
|
||||
} else if (!strcasecmp(v->name, "callcounter")) {
|
||||
|
Reference in New Issue
Block a user