[asterisk-commits] mjordan: branch mjordan/voicemail_refactor_11_10_19 r349726 - in /team/mjorda...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 5 15:05:39 CST 2012
Author: mjordan
Date: Thu Jan 5 15:05:34 2012
New Revision: 349726
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=349726
Log:
Resovled svn merge issues
Modified:
team/mjordan/voicemail_refactor_11_10_19/ (props changed)
team/mjordan/voicemail_refactor_11_10_19/CHANGES
team/mjordan/voicemail_refactor_11_10_19/apps/app_voicemail.c
team/mjordan/voicemail_refactor_11_10_19/apps/confbridge/conf_config_parser.c
team/mjordan/voicemail_refactor_11_10_19/channels/chan_dahdi.c
team/mjordan/voicemail_refactor_11_10_19/channels/chan_sip.c
team/mjordan/voicemail_refactor_11_10_19/channels/sip/include/dialog.h
team/mjordan/voicemail_refactor_11_10_19/channels/sip/include/sip.h
team/mjordan/voicemail_refactor_11_10_19/configs/sip.conf.sample
team/mjordan/voicemail_refactor_11_10_19/configs/voicemail.conf.sample
team/mjordan/voicemail_refactor_11_10_19/contrib/init.d/rc.debian.asterisk
team/mjordan/voicemail_refactor_11_10_19/contrib/realtime/mysql/voicemail.sql
team/mjordan/voicemail_refactor_11_10_19/contrib/scripts/autosupport
team/mjordan/voicemail_refactor_11_10_19/contrib/scripts/autosupport.8
team/mjordan/voicemail_refactor_11_10_19/include/asterisk/astobj2.h
team/mjordan/voicemail_refactor_11_10_19/include/asterisk/dsp.h
team/mjordan/voicemail_refactor_11_10_19/include/asterisk/module.h
team/mjordan/voicemail_refactor_11_10_19/include/asterisk/res_fax.h
team/mjordan/voicemail_refactor_11_10_19/main/asterisk.c
team/mjordan/voicemail_refactor_11_10_19/main/astobj2.c
team/mjordan/voicemail_refactor_11_10_19/main/audiohook.c
team/mjordan/voicemail_refactor_11_10_19/main/dsp.c
team/mjordan/voicemail_refactor_11_10_19/main/features.c
team/mjordan/voicemail_refactor_11_10_19/main/pbx.c
team/mjordan/voicemail_refactor_11_10_19/main/rtp_engine.c
team/mjordan/voicemail_refactor_11_10_19/res/res_fax.c
team/mjordan/voicemail_refactor_11_10_19/res/res_fax_spandsp.c
team/mjordan/voicemail_refactor_11_10_19/res/res_musiconhold.c
team/mjordan/voicemail_refactor_11_10_19/res/res_timing_dahdi.c
team/mjordan/voicemail_refactor_11_10_19/res/res_timing_pthread.c
team/mjordan/voicemail_refactor_11_10_19/res/res_timing_timerfd.c
team/mjordan/voicemail_refactor_11_10_19/utils/ (props changed)
Propchange: team/mjordan/voicemail_refactor_11_10_19/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.
Propchange: team/mjordan/voicemail_refactor_11_10_19/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 5 15:05:34 2012
@@ -1,1 +1,1 @@
-/trunk:1-349065
+/trunk:1-349725
Modified: team/mjordan/voicemail_refactor_11_10_19/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_11_10_19/CHANGES?view=diff&rev=349726&r1=349725&r2=349726
==============================================================================
--- team/mjordan/voicemail_refactor_11_10_19/CHANGES (original)
+++ team/mjordan/voicemail_refactor_11_10_19/CHANGES Thu Jan 5 15:05:34 2012
@@ -21,12 +21,20 @@
* Added menu action participant_count. This will playback the number of current
participants in a conference.
+Voicemail
+------------------
+ * Addition of the VM_INFO function - see Dialplan function changes
+ * The imapserver, imapport, and imapflags configuration options can now be
+ overriden on a user by user basis.
+
SIP Changes
-----------
* Asterisk will no longer substitute CID number for CID name into display
name field if CID number exists without a CID name. This change improves
compatibility with certain device features such as Avaya IP500's directory
lookup service.
+ * A new setting for autocreatepeer (autocreatepeer=persistent) allows peers
+ created using that setting to not be removed during SIP reload.
Chan_local changes
------------------
Modified: team/mjordan/voicemail_refactor_11_10_19/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_11_10_19/apps/app_voicemail.c?view=diff&rev=349726&r1=349725&r2=349726
==============================================================================
--- team/mjordan/voicemail_refactor_11_10_19/apps/app_voicemail.c (original)
+++ team/mjordan/voicemail_refactor_11_10_19/apps/app_voicemail.c Thu Jan 5 15:05:34 2012
@@ -468,7 +468,7 @@
static void set_update(MAILSTREAM * stream);
static void init_vm_state(struct vm_state *vms);
static int save_body(BODY *body, struct vm_state *vms, char *section, char *format, int is_intro);
-static void get_mailbox_delimiter(MAILSTREAM *stream);
+static void get_mailbox_delimiter(struct vm_state *vms, MAILSTREAM *stream);
static void mm_parsequota (MAILSTREAM *stream, unsigned char *msg, QUOTALIST *pquota);
static void imap_mailbox_name(char *spec, size_t len, struct vm_state *vms, int box, int target);
static int imap_store_file(const char *dir, const char *mailboxuser, const char *mailboxcontext, int msgnum, struct ast_channel *chan, struct ast_vm_user *vmu, char *fmt, int duration, struct vm_state *vms, const char *flag);
@@ -691,6 +691,56 @@
int linelength;
int ateof;
unsigned char iobuf[BASEMAXINLINE];
+};
+
+/*! Structure for linked list of users
+ * Use ast_vm_user_destroy() to free one of these structures. */
+struct ast_vm_user {
+ char context[AST_MAX_CONTEXT]; /*!< Voicemail context */
+ char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox id, unique within vm context */
+ char password[80]; /*!< Secret pin code, numbers only */
+ char fullname[80]; /*!< Full name, for directory app */
+ char email[80]; /*!< E-mail address */
+ char *emailsubject; /*!< E-mail subject */
+ char *emailbody; /*!< E-mail body */
+ char pager[80]; /*!< E-mail address to pager (no attachment) */
+ char serveremail[80]; /*!< From: Mail address */
+ char mailcmd[160]; /*!< Configurable mail command */
+ char language[MAX_LANGUAGE]; /*!< Config: Language setting */
+ char zonetag[80]; /*!< Time zone */
+ char locale[20]; /*!< The locale (for presentation of date/time) */
+ char callback[80];
+ char dialout[80];
+ char uniqueid[80]; /*!< Unique integer identifier */
+ char exit[80];
+ char attachfmt[20]; /*!< Attachment format */
+ unsigned int flags; /*!< VM_ flags */
+ int saydurationm;
+ int minsecs; /*!< Minimum number of seconds per message for this mailbox */
+ int maxmsg; /*!< Maximum number of msgs per folder for this mailbox */
+ int maxdeletedmsg; /*!< Maximum number of deleted msgs saved for this mailbox */
+ int maxsecs; /*!< Maximum number of seconds per message for this mailbox */
+ int passwordlocation; /*!< Storage location of the password */
+#ifdef IMAP_STORAGE
+ char imapserver[48]; /*!< IMAP server address */
+ char imapport[8]; /*!< IMAP server port */
+ char imapflags[128]; /*!< IMAP optional flags */
+ char imapuser[80]; /*!< IMAP server login */
+ char imappassword[80]; /*!< IMAP server password if authpassword not defined */
+ char imapfolder[64]; /*!< IMAP voicemail folder */
+ char imapvmshareid[80]; /*!< Shared mailbox ID to use rather than the dialed one */
+ int imapversion; /*!< If configuration changes, use the new values */
+#endif
+ double volgain; /*!< Volume gain for voicemails sent via email */
+ AST_LIST_ENTRY(ast_vm_user) list;
+};
+
+/*! Voicemail time zones */
+struct vm_zone {
+ AST_LIST_ENTRY(vm_zone) list;
+ char name[80];
+ char timezone[80];
+ char msg_format[512];
};
#define VMSTATE_MAX_MSG_ARRAY 256
@@ -722,6 +772,9 @@
int vmArrayIndex;
char imapuser[80]; /*!< IMAP server login */
char imapfolder[64]; /*!< IMAP voicemail folder */
+ char imapserver[48]; /*!< IMAP server address */
+ char imapport[8]; /*!< IMAP server port */
+ char imapflags[128]; /*!< IMAP optional flags */
int imapversion;
int interactive;
char introfn[PATH_MAX]; /*!< Name of prepended file */
@@ -1059,6 +1112,9 @@
vmu->emailbody = NULL;
#ifdef IMAP_STORAGE
ast_copy_string(vmu->imapfolder, imapfolder, sizeof(vmu->imapfolder));
+ ast_copy_string(vmu->imapserver, imapserver, sizeof(vmu->imapserver));
+ ast_copy_string(vmu->imapport, imapport, sizeof(vmu->imapport));
+ ast_copy_string(vmu->imapflags, imapflags, sizeof(vmu->imapflags));
#endif
}
@@ -1095,11 +1151,21 @@
} else if (!strcasecmp(var, "imapuser")) {
ast_copy_string(vmu->imapuser, value, sizeof(vmu->imapuser));
vmu->imapversion = imapversion;
+ } else if (!strcasecmp(var, "imapserver")) {
+ ast_copy_string(vmu->imapserver, value, sizeof(vmu->imapserver));
+ vmu->imapversion = imapversion;
+ } else if (!strcasecmp(var, "imapport")) {
+ ast_copy_string(vmu->imapport, value, sizeof(vmu->imapport));
+ vmu->imapversion = imapversion;
+ } else if (!strcasecmp(var, "imapflags")) {
+ ast_copy_string(vmu->imapflags, value, sizeof(vmu->imapflags));
+ vmu->imapversion = imapversion;
} else if (!strcasecmp(var, "imappassword") || !strcasecmp(var, "imapsecret")) {
ast_copy_string(vmu->imappassword, value, sizeof(vmu->imappassword));
vmu->imapversion = imapversion;
} else if (!strcasecmp(var, "imapfolder")) {
ast_copy_string(vmu->imapfolder, value, sizeof(vmu->imapfolder));
+ vmu->imapversion = imapversion;
} else if (!strcasecmp(var, "imapvmshareid")) {
ast_copy_string(vmu->imapvmshareid, value, sizeof(vmu->imapvmshareid));
vmu->imapversion = imapversion;
@@ -1366,11 +1432,21 @@
} else if (!strcasecmp(var->name, "imapuser")) {
ast_copy_string(retval->imapuser, var->value, sizeof(retval->imapuser));
retval->imapversion = imapversion;
+ } else if (!strcasecmp(var->name, "imapserver")) {
+ ast_copy_string(retval->imapserver, var->value, sizeof(retval->imapserver));
+ retval->imapversion = imapversion;
+ } else if (!strcasecmp(var->name, "imapport")) {
+ ast_copy_string(retval->imapport, var->value, sizeof(retval->imapport));
+ retval->imapversion = imapversion;
+ } else if (!strcasecmp(var->name, "imapflags")) {
+ ast_copy_string(retval->imapflags, var->value, sizeof(retval->imapflags));
+ retval->imapversion = imapversion;
} else if (!strcasecmp(var->name, "imappassword") || !strcasecmp(var->name, "imapsecret")) {
ast_copy_string(retval->imappassword, var->value, sizeof(retval->imappassword));
retval->imapversion = imapversion;
} else if (!strcasecmp(var->name, "imapfolder")) {
ast_copy_string(retval->imapfolder, var->value, sizeof(retval->imapfolder));
+ retval->imapversion = imapversion;
} else if (!strcasecmp(var->name, "imapvmshareid")) {
ast_copy_string(retval->imapvmshareid, var->value, sizeof(retval->imapvmshareid));
retval->imapversion = imapversion;
@@ -2533,15 +2609,16 @@
}
/* Build up server information */
- ast_build_string(&t, &left, "{%s:%s/imap", imapserver, imapport);
+ ast_build_string(&t, &left, "{%s:%s/imap", S_OR(vms->imapserver, imapserver), S_OR(vms->imapport, imapport));
/* Add authentication user if present */
if (!ast_strlen_zero(authuser))
ast_build_string(&t, &left, "/authuser=%s", authuser);
/* Add flags if present */
- if (!ast_strlen_zero(imapflags))
- ast_build_string(&t, &left, "/%s", imapflags);
+ if (!ast_strlen_zero(imapflags) || !(ast_strlen_zero(vms->imapflags))) {
+ ast_build_string(&t, &left, "/%s", S_OR(vms->imapflags, imapflags));
+ }
/* End with username */
#if 1
@@ -2600,7 +2677,7 @@
ast_log(LOG_ERROR, "Can't connect to imap server %s\n", tmp);
return -1;
}
- get_mailbox_delimiter(stream);
+ get_mailbox_delimiter(vms, stream);
/* update delimiter in imapfolder */
for (cp = vms->imapfolder; *cp; cp++)
if (*cp == '/')
@@ -2633,6 +2710,9 @@
ast_copy_string(vms->imapuser, vmu->imapuser, sizeof(vms->imapuser));
ast_copy_string(vms->imapfolder, vmu->imapfolder, sizeof(vms->imapfolder));
+ ast_copy_string(vms->imapserver, vmu->imapserver, sizeof(vms->imapserver));
+ ast_copy_string(vms->imapport, vmu->imapport, sizeof(vms->imapport));
+ ast_copy_string(vms->imapflags, vmu->imapflags, sizeof(vms->imapflags));
vms->imapversion = vmu->imapversion;
ast_debug(3, "Before init_mailstream, user is %s\n", vmu->imapuser);
@@ -2998,6 +3078,9 @@
return NULL;
ast_copy_string(vms_p->imapuser, vmu->imapuser, sizeof(vms_p->imapuser));
ast_copy_string(vms_p->imapfolder, vmu->imapfolder, sizeof(vms_p->imapfolder));
+ ast_copy_string(vms_p->imapserver, vmu->imapserver, sizeof(vms_p->imapserver));
+ ast_copy_string(vms_p->imapport, vmu->imapport, sizeof(vms_p->imapport));
+ ast_copy_string(vms_p->imapflags, vmu->imapflags, sizeof(vms_p->imapflags));
ast_copy_string(vms_p->username, vmu->mailbox, sizeof(vms_p->username)); /* save for access from interactive entry point */
ast_copy_string(vms_p->context, vmu->context, sizeof(vms_p->context));
vms_p->mailstream = NIL; /* save for access from interactive entry point */
@@ -3229,14 +3312,15 @@
/*!
* \brief Get delimiter via mm_list callback
+ * \param vms The voicemail state object
* \param stream
*
* Determines the delimiter character that is used by the underlying IMAP based mail store.
*/
/* MUTEX should already be held */
-static void get_mailbox_delimiter(MAILSTREAM *stream) {
+static void get_mailbox_delimiter(struct vm_state *vms, MAILSTREAM *stream) {
char tmp[50];
- snprintf(tmp, sizeof(tmp), "{%s}", imapserver);
+ snprintf(tmp, sizeof(tmp), "{%s}", S_OR(vms->imapserver, imapserver));
mail_list(stream, tmp, "*");
}
@@ -10826,7 +10910,7 @@
"[PBX]: New message \\\\${VM_MSGNUM}\\\\ in mailbox ${VM_MAILBOX}";
#ifdef IMAP_STORAGE
static const char option_string2[] = "imapuser=imapuser|imappassword=imappasswd|"
- "imapfolder=INBOX|imapvmshareid=6000";
+ "imapfolder=INBOX|imapvmshareid=6000|imapserver=imapserver|imapport=1234|imapflags=flagged";
#endif
switch (cmd) {
@@ -10978,6 +11062,18 @@
}
if (strcasecmp(vmu->imapvmshareid, "6000")) {
ast_test_status_update(test, "Parse failure for imapvmshareid option\n");
+ res = 1;
+ }
+ if (strcasecmp(vmu->imapserver, "imapserver")) {
+ ast_test_status_update(test, "Parse failure for imapserver option\n");
+ res = 1;
+ }
+ if (strcasecmp(vmu->imapport, "1234")) {
+ ast_test_status_update(test, "Parse failure for imapport option\n");
+ res = 1;
+ }
+ if (strcasecmp(vmu->imapflags, "flagged")) {
+ ast_test_status_update(test, "Parse failure for imapflags option\n");
res = 1;
}
#endif
@@ -11772,6 +11868,9 @@
#ifdef IMAP_STORAGE
"OldMessageCount: %d\r\n"
"IMAPUser: %s\r\n"
+ "IMAPServer: %s\r\n"
+ "IMAPPort: %s\r\n"
+ "IMAPFlags: %s\r\n"
#endif
"\r\n",
actionid,
@@ -11800,7 +11899,11 @@
vmu->maxmsg,
vmu->maxsecs,
#ifdef IMAP_STORAGE
- new, old, vmu->imapuser
+ new, old,
+ vmu->imapuser,
+ vmu->imapserver,
+ vmu->imapport,
+ vmu->imapflags
#else
count_messages(vmu, dirname)
#endif
Modified: team/mjordan/voicemail_refactor_11_10_19/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_11_10_19/apps/confbridge/conf_config_parser.c?view=diff&rev=349726&r1=349725&r2=349726
==============================================================================
--- team/mjordan/voicemail_refactor_11_10_19/apps/confbridge/conf_config_parser.c (original)
+++ team/mjordan/voicemail_refactor_11_10_19/apps/confbridge/conf_config_parser.c Thu Jan 5 15:05:34 2012
@@ -1332,8 +1332,9 @@
conf_user_profile_copy(result, &b_data->u_profile);
return result;
}
- }
- ast_channel_unlock(chan);
+ } else {
+ ast_channel_unlock(chan);
+ }
}
if (ast_strlen_zero(user_profile_name)) {
Modified: team/mjordan/voicemail_refactor_11_10_19/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_11_10_19/channels/chan_dahdi.c?view=diff&rev=349726&r1=349725&r2=349726
==============================================================================
--- team/mjordan/voicemail_refactor_11_10_19/channels/chan_dahdi.c (original)
+++ team/mjordan/voicemail_refactor_11_10_19/channels/chan_dahdi.c Thu Jan 5 15:05:34 2012
@@ -6655,7 +6655,7 @@
struct dahdi_pvt *p = chan->tech_pvt;
/* all supported options require data */
- if (!data || (*datalen < 1)) {
+ if (!p || !data || (*datalen < 1)) {
errno = EINVAL;
return -1;
}
@@ -6701,7 +6701,7 @@
/* all supported options require data */
- if (!data || (datalen < 1)) {
+ if (!p || !data || (datalen < 1)) {
errno = EINVAL;
return -1;
}
@@ -6913,6 +6913,12 @@
{
struct dahdi_pvt *p = chan->tech_pvt;
int res = 0;
+
+ if (!p) {
+ /* No private structure! */
+ *buf = '\0';
+ return -1;
+ }
if (!strcasecmp(data, "rxgain")) {
ast_mutex_lock(&p->lock);
@@ -7046,6 +7052,11 @@
{
struct dahdi_pvt *p = chan->tech_pvt;
int res = 0;
+
+ if (!p) {
+ /* No private structure! */
+ return -1;
+ }
if (!strcasecmp(data, "buffers")) {
int num_bufs, policy;
Modified: team/mjordan/voicemail_refactor_11_10_19/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_11_10_19/channels/chan_sip.c?view=diff&rev=349726&r1=349725&r2=349726
==============================================================================
--- team/mjordan/voicemail_refactor_11_10_19/channels/chan_sip.c (original)
+++ team/mjordan/voicemail_refactor_11_10_19/channels/chan_sip.c Thu Jan 5 15:05:34 2012
@@ -2222,7 +2222,7 @@
\return Always returns 0 */
#define append_history(p, event, fmt , args... ) append_history_full(p, "%-15s " fmt, event, ## args)
-struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
+struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func)
{
if (p)
#ifdef REF_DEBUG
@@ -2235,7 +2235,7 @@
return p;
}
-struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
+struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func)
{
if (p)
#ifdef REF_DEBUG
@@ -4116,14 +4116,16 @@
return 0;
}
-static int send_provisional_keepalive(const void *data) {
+static int send_provisional_keepalive(const void *data)
+{
struct sip_pvt *pvt = (struct sip_pvt *) data;
return send_provisional_keepalive_full(pvt, 0);
}
-static int send_provisional_keepalive_with_sdp(const void *data) {
- struct sip_pvt *pvt = (void *)data;
+static int send_provisional_keepalive_with_sdp(const void *data)
+{
+ struct sip_pvt *pvt = (void *) data;
return send_provisional_keepalive_full(pvt, 1);
}
@@ -12809,6 +12811,7 @@
struct sip_cc_agent_pvt *agent_pvt = agent->private_data;
char uri[SIPBUFSIZE];
char state_str[64];
+ char subscription_state_hdr[64];
if (state < CC_QUEUED || state > CC_READY) {
ast_log(LOG_WARNING, "Invalid state provided for transmit_cc_notify (%d)\n", state);
@@ -12819,6 +12822,8 @@
snprintf(state_str, sizeof(state_str), "%s\r\n", sip_cc_notify_state_map[state].state_string);
add_header(&req, "Event", "call-completion");
add_header(&req, "Content-Type", "application/call-completion");
+ snprintf(subscription_state_hdr, sizeof(subscription_state_hdr), "active;expires=%d", subscription->expiry);
+ add_header(&req, "Subscription-State", subscription_state_hdr);
if (state == CC_READY) {
generate_uri(subscription, agent_pvt->notify_uri, sizeof(agent_pvt->notify_uri));
snprintf(uri, sizeof(uri) - 1, "cc-URI: %s\r\n", agent_pvt->notify_uri);
@@ -14998,7 +15003,7 @@
}
ao2_unlock(peer);
}
- if (!peer && sip_cfg.autocreatepeer) {
+ if (!peer && sip_cfg.autocreatepeer != AUTOPEERS_DISABLED) {
/* Create peer if we have autocreate mode enabled */
peer = temp_peer(name);
if (peer) {
@@ -16715,6 +16720,18 @@
return map_s_x(strefreshers, s, -1);
}
+/* Autocreatepeer modes */
+static struct _map_x_s autopeermodes[] = {
+ { AUTOPEERS_DISABLED, "Off"},
+ { AUTOPEERS_VOLATILE, "Volatile"},
+ { AUTOPEERS_PERSIST, "Persisted"},
+ { -1, NULL},
+};
+
+static const char *autocreatepeer2str(enum autocreatepeer_mode r)
+{
+ return map_x_s(autopeermodes, r, "Unknown");
+}
static int peer_status(struct sip_peer *peer, char *status, int statuslen)
{
@@ -17739,6 +17756,8 @@
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>");
@@ -18336,7 +18355,7 @@
ast_cli(a->fd, " Videosupport: %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT)));
ast_cli(a->fd, " Textsupport: %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT)));
ast_cli(a->fd, " Ignore SDP sess. ver.: %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_IGNORESDPVERSION)));
- ast_cli(a->fd, " AutoCreate Peer: %s\n", AST_CLI_YESNO(sip_cfg.autocreatepeer));
+ ast_cli(a->fd, " AutoCreate Peer: %s\n", autocreatepeer2str(sip_cfg.autocreatepeer));
ast_cli(a->fd, " Match Auth Username: %s\n", AST_CLI_YESNO(global_match_auth_username));
ast_cli(a->fd, " Allow unknown access: %s\n", AST_CLI_YESNO(sip_cfg.allowguest));
ast_cli(a->fd, " Allow subscriptions: %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)));
@@ -18490,6 +18509,8 @@
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);
@@ -19192,15 +19213,13 @@
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);
@@ -19210,9 +19229,27 @@
/* 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();
@@ -27654,6 +27691,8 @@
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);
@@ -27963,6 +28002,10 @@
} 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")) {
@@ -28477,7 +28520,9 @@
static int peer_markall_func(void *device, void *arg, int flags)
{
struct sip_peer *peer = device;
- peer->the_mark = 1;
+ if (!peer->selfdestruct || sip_cfg.autocreatepeer != AUTOPEERS_PERSIST) {
+ peer->the_mark = 1;
+ }
return 0;
}
@@ -28602,11 +28647,6 @@
}
ASTOBJ_UNLOCK(iterator);
} while(0));
-
- /* Then, actually destroy users and registry */
- ASTOBJ_CONTAINER_DESTROYALL(®l, sip_registry_destroy);
- ast_debug(4, "--------------- Done destroying registry list\n");
- ao2_t_callback(peers, OBJ_NODATA, peer_markall_func, NULL, "callback to mark all peers");
}
/* Reset certificate handling for TLS sessions */
@@ -28725,6 +28765,8 @@
/* 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';
@@ -28792,6 +28834,10 @@
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")) {
@@ -29012,7 +29058,11 @@
proxy_update(&sip_cfg.outboundproxy);
} else if (!strcasecmp(v->name, "autocreatepeer")) {
- sip_cfg.autocreatepeer = ast_true(v->value);
+ if (!strcasecmp(v->value, "persist")) {
+ sip_cfg.autocreatepeer = AUTOPEERS_PERSIST;
+ } else {
+ sip_cfg.autocreatepeer = ast_true(v->value) ? AUTOPEERS_VOLATILE : AUTOPEERS_DISABLED;
+ }
} else if (!strcasecmp(v->name, "match_auth_username")) {
global_match_auth_username = ast_true(v->value);
} else if (!strcasecmp(v->name, "srvlookup")) {
@@ -29288,6 +29338,13 @@
} else if (!strcasecmp(v->name, "parkinglot")) {
ast_copy_string(default_parkinglot, v->value, sizeof(default_parkinglot));
}
+ }
+
+ if (reason != CHANNEL_MODULE_LOAD) {
+ /* Then, actually destroy users and registry */
+ ASTOBJ_CONTAINER_DESTROYALL(®l, sip_registry_destroy);
+ ast_debug(4, "--------------- Done destroying registry list\n");
+ ao2_t_callback(peers, OBJ_NODATA, peer_markall_func, NULL, "callback to mark all peers");
}
if (subscribe_network_change) {
Modified: team/mjordan/voicemail_refactor_11_10_19/channels/sip/include/dialog.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_11_10_19/channels/sip/include/dialog.h?view=diff&rev=349726&r1=349725&r2=349726
==============================================================================
--- team/mjordan/voicemail_refactor_11_10_19/channels/sip/include/dialog.h (original)
+++ team/mjordan/voicemail_refactor_11_10_19/channels/sip/include/dialog.h Thu Jan 5 15:05:34 2012
@@ -31,8 +31,8 @@
*/
#define dialog_ref(arg1,arg2) dialog_ref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
#define dialog_unref(arg1,arg2) dialog_unref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func);
-struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func);
+struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func);
+struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func);
struct sip_pvt *sip_alloc(ast_string_field callid, struct ast_sockaddr *sin,
int useglobal_nat, const int intended_method, struct sip_request *req);
Modified: team/mjordan/voicemail_refactor_11_10_19/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_11_10_19/channels/sip/include/sip.h?view=diff&rev=349726&r1=349725&r2=349726
==============================================================================
--- team/mjordan/voicemail_refactor_11_10_19/channels/sip/include/sip.h (original)
+++ team/mjordan/voicemail_refactor_11_10_19/channels/sip/include/sip.h Thu Jan 5 15:05:34 2012
@@ -34,6 +34,7 @@
#include "asterisk/astobj.h"
#include "asterisk/indications.h"
#include "asterisk/security_events.h"
+#include "asterisk/features.h"
#ifndef FALSE
#define FALSE 0
@@ -182,6 +183,7 @@
*/
/*@{*/
#define DEFAULT_CONTEXT "default" /*!< The default context for [general] section as well as devices */
+#define DEFAULT_RECORD_FEATURE "automon" /*!< The default feature specified for use with INFO */
#define DEFAULT_MOHINTERPRET "default" /*!< The default music class */
#define DEFAULT_MOHSUGGEST ""
#define DEFAULT_VMEXTEN "asterisk" /*!< Default voicemail extension */
@@ -207,7 +209,7 @@
#define DEFAULT_NOTIFYRINGING TRUE /*!< Notify devicestate system on ringing state */
#define DEFAULT_NOTIFYCID DISABLED /*!< Include CID with ringing notifications */
#define DEFAULT_PEDANTIC TRUE /*!< Follow SIP standards for dialog matching */
-#define DEFAULT_AUTOCREATEPEER FALSE /*!< Don't create peers automagically */
+#define DEFAULT_AUTOCREATEPEER AUTOPEERS_DISABLED /*!< Don't create peers automagically */
#define DEFAULT_MATCHEXTERNADDRLOCALLY FALSE /*!< Match extern IP locally default setting */
#define DEFAULT_QUALIFY FALSE /*!< Don't monitor devices */
#define DEFAULT_CALLEVENTS FALSE /*!< Extra manager SIP call events */
@@ -556,6 +558,14 @@
SIP_TRANSPORT_TLS = 1 << 2, /*!< TCP/TLS - reliable and secure transport for signalling */
};
+/*! \brief Automatic peer registration behavior
+*/
+enum autocreatepeer_mode {
+ AUTOPEERS_DISABLED = 0, /*!< Automatic peer creation disabled */
+ AUTOPEERS_VOLATILE, /*!< Automatic peers dropped on sip reload (pre-1.8 behavior) */
+ AUTOPEERS_PERSIST /*!< Automatic peers survive sip configuration reload */
+};
+
/*! \brief States whether a SIP message can create a dialog in Asterisk. */
enum can_create_dialog {
CAN_NOT_CREATE_DIALOG,
@@ -709,7 +719,7 @@
int rtautoclear; /*!< Realtime ?? */
int directrtpsetup; /*!< Enable support for Direct RTP setup (no re-invites) */
int pedanticsipchecking; /*!< Extra checking ? Default off */
- int autocreatepeer; /*!< Auto creation of peers at registration? Default off. */
+ enum autocreatepeer_mode autocreatepeer; /*!< Auto creation of peers at registration? Default off. */
int srvlookup; /*!< SRV Lookup on or off. Default is on */
int allowguest; /*!< allow unauthenticated peers to connect? */
int alwaysauthreject; /*!< Send 401 Unauthorized for all failing requests */
@@ -736,6 +746,8 @@
struct sip_proxy outboundproxy; /*!< Outbound proxy */
char default_context[AST_MAX_CONTEXT];
char default_subscribecontext[AST_MAX_CONTEXT];
+ char default_record_on_feature[FEATURE_MAX_LEN];
+ char default_record_off_feature[FEATURE_MAX_LEN];
struct ast_ha *contact_ha; /*! \brief Global list of addresses dynamic peers are not allowed to use */
struct ast_format_cap *caps; /*!< Supported codecs */
int tcp_enabled;
@@ -1235,6 +1247,8 @@
AST_STRING_FIELD(engine); /*!< RTP Engine to use */
AST_STRING_FIELD(unsolicited_mailbox); /*!< Mailbox to store received unsolicited MWI NOTIFY messages information in */
AST_STRING_FIELD(zone); /*!< Tonezone for this device */
+ AST_STRING_FIELD(record_on_feature); /*!< Feature to use when receiving INFO with record: on during a call */
+ AST_STRING_FIELD(record_off_feature); /*!< Feature to use when receiving INFO with record: off during a call */
);
struct sip_socket socket; /*!< Socket used for this peer */
enum sip_transport default_outbound_transport; /*!< Peer Registration may change the default outbound transport.
Modified: team/mjordan/voicemail_refactor_11_10_19/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_11_10_19/configs/sip.conf.sample?view=diff&rev=349726&r1=349725&r2=349726
==============================================================================
--- team/mjordan/voicemail_refactor_11_10_19/configs/sip.conf.sample (original)
+++ team/mjordan/voicemail_refactor_11_10_19/configs/sip.conf.sample Thu Jan 5 15:05:34 2012
@@ -143,6 +143,16 @@
; In this case Realm will be based on request 'From'/'To' header
; and should match one of domain names.
; Otherwise default 'realm=...' will be used.
+;recordonfeature=automixmon ; Default feature to use when receiving 'Record: on' header
+ ; from an INFO message. Defaults to 'automon'. Works with
+ ; dynamic features. Feature must be usable on requesting
+ ; channel for it to work. Setting this value to a blank
+ ; will disable it.
+;recordofffeature=automixmon ; Default feature to use when receiving 'Record: off' header
+ ; from an INFO message. Defaults to 'automon'. Works with
+ ; dynamic features. Feature must be usable on requesting
+ ; channel for it to work. Setting this value to a blank
+ ; will disable it.
; With the current situation, you can do one of four things:
; a) Listen on a specific IPv4 address. Example: bindaddr=192.0.2.1
@@ -478,6 +488,16 @@
;use_q850_reason = no ; Default "no"
; Set to yes add Reason header and use Reason header if it is available.
+
+;autocreatepeers=no ; Allow any not exsplicitly defined here UAC to register
+ ; WITHOUT AUTHENTICATION. Enabling this options poses a high
+ ; potential security risk and should be avoided unless the
+ ; server is behind a trusted firewall.
+ ; When enabled by setting to "yes", the autocreated peers are
+ ; pruned immediately when the "sip reload" command is issued
+ ; through CLI. When enabled by setting to "persist", the auto-
+ ; created peers survive the "sip reload" command.
+
;
;------------------------ TLS settings ------------------------------------------------------------
;tlscertfile=</path/to/certificate.pem> ; Certificate file (*.pem format only) to use for TLS connections
@@ -1258,6 +1278,8 @@
;[grandstream1]
;type=friend
;context=from-sip ; Where to start in the dialplan when this phone calls
+;recordonfeature=dynamicfeature1 ; Feature to use when INFO with Record: on is received.
+;recordofffeature=dynamicfeature2 ; Feature to use when INFO with Record: off is received.
;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'.
Modified: team/mjordan/voicemail_refactor_11_10_19/configs/voicemail.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_11_10_19/configs/voicemail.conf.sample?view=diff&rev=349726&r1=349725&r2=349726
==============================================================================
--- team/mjordan/voicemail_refactor_11_10_19/configs/voicemail.conf.sample (original)
+++ team/mjordan/voicemail_refactor_11_10_19/configs/voicemail.conf.sample Thu Jan 5 15:05:34 2012
@@ -185,20 +185,43 @@
;pollfreq=30 ; If the "pollmailboxes" option is enabled, this option
; ; sets the polling frequency. The default is once every
; ; 30 seconds.
-; If using IMAP storage, specify whether voicemail greetings should be stored
-; via IMAP. If no, then greetings are stored as if IMAP storage were not enabled
-;imapgreetings=no
-; If imapgreetings=yes, then specify which folder to store your greetings in. If
-; you do not specify a folder, then INBOX will be used
-;greetingsfolder=INBOX
-; Some IMAP server implementations store folders under INBOX instead of
-; using a top level folder (ex. INBOX/Friends). In this case, user
-; imapparentfolder to set the parent folder. For example, Cyrus IMAP does
-; NOT use INBOX as the parent. Default is to have no parent folder set.
-;imapparentfolder=INBOX
-;
-;
-;
+;
+
+; -----------------------------------------------------------------------------
+; IMAP configuration settings only
+; These settings are only applicable when Asterisk is compiled with IMAP support.
+;
+;imapgreetings=no ; If using IMAP storage, specify whether voicemail greetings
+ ; should be stored via IMAP. If no, then greetings are stored
+ ; as if IMAP storage were not enabled.
+;greetingsfolder=INBOX ; If imapgreetings=yes, then specify which folder to store
+ ; your greetings in. If you do not specify a folder, then INBOX
+ ; will be used
[... 1672 lines stripped ...]
More information about the asterisk-commits
mailing list