diff --git a/UPGRADE.txt b/UPGRADE.txt index 2b7faf067c92cb773a95bf4e89140ef2ec9fae29..3cd4c2d53ed196676c1348f7760a6c9083d9851c 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -61,3 +61,14 @@ Formats: choppiness or the clipping of loud signal peaks. To increasing the volume of voicemail messages, use the 'volgain' option in voicemail.conf +Channel Drivers: + +* chan_sip.c: a small upgrade to support the "Record" button on the SNOM360, + which sends a sip INFO message with a "Record: on" or "Record: off" + header. If asterisk is set up (via features.conf) to accept "One Touch Monitor" + requests (by default, via '*1'), then the user-configured dialpad sequence + is generated, and recording can be started and stopped via this button. The + file names and formats are all controlled via the normal mechanisms. If the + user has not configured the automon feature, the normal "415 Unsupported media type" + is returned, and nothing is done. + diff --git a/channels/chan_sip.c b/channels/chan_sip.c index db1b06324c9d9e40a5ed1d5db97617f4e947df12..919912853524c4c8eb6877ba5f1c0a6c71159e71 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -11645,6 +11645,38 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req) transmit_response(p, "403 Unauthorized", req); } return; + } else if (!ast_strlen_zero(c = get_header(req, "Record"))) { + /* first, get the feature string, if it exists */ + struct ast_call_feature *feat = find_feature("automon"); + + if (!feat || ast_strlen_zero(feat->exten)) { + ast_log(LOG_WARNING,"Recording requested, but no One Touch Monitor registered. (See features.conf)\n"); + transmit_response(p, "415 Unsupported media type", req); + return; + } else { + int j; + struct ast_frame f = { AST_FRAME_DTMF, }; + f.len = 100; + for (j=0; j<strlen(feat->exten); j++) { + f.subclass = feat->exten[j]; + ast_queue_frame(p->owner, &f); + if (sipdebug) + ast_verbose("* DTMF-relay event received: %c\n", f.subclass); + } + } + + if (strcasecmp(c,"on")== 0) { + + ast_log(LOG_NOTICE,"Got a Request to Record the channel!\n"); + transmit_response(p, "200 OK", req); + return; + + } else if (strcasecmp(c,"off")== 0) { + + ast_log(LOG_NOTICE,"Got a Request to Stop Recording the channel\n"); + transmit_response(p, "200 OK", req); + return; + } } /* Other type of INFO message, not really understood by Asterisk */ /* if (get_msg_text(buf, sizeof(buf), req)) { */ diff --git a/include/asterisk/features.h b/include/asterisk/features.h index db25e7d238d16f5ce34e83306ac5863e7bed9a1c..02b8fa5fd796db81c93960c80f6cdf63f3f7dae8 100644 --- a/include/asterisk/features.h +++ b/include/asterisk/features.h @@ -94,4 +94,8 @@ void ast_register_feature(struct ast_call_feature *feature); \param feature the ast_call_feature object which was registered before*/ void ast_unregister_feature(struct ast_call_feature *feature); +/*! \brief look for a feature entry by its sname + \param name a string ptr, should match "automon", "blindxfer", "atxfer", etc. */ +struct ast_call_feature *find_feature(char *name); + #endif /* _AST_FEATURES_H */ diff --git a/res/res_features.c b/res/res_features.c index 25aa622bda06b18630cb7d49fd352dd4d6edad01..7cc4686c45b2bb623f3efe59090fcb5b385b8007 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -1056,7 +1056,7 @@ static void ast_unregister_features(void) } /*! \brief find a feature by name */ -static struct ast_call_feature *find_feature(char *name) +struct ast_call_feature *find_feature(char *name) { struct ast_call_feature *tmp;