[asterisk-commits] oej: branch oej/02-labarea r61753 - in
/team/oej/02-labarea: ./ apps/ channel...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Apr 21 08:47:53 MST 2007
Author: oej
Date: Sat Apr 21 10:47:52 2007
New Revision: 61753
URL: http://svn.digium.com/view/asterisk?view=rev&rev=61753
Log:
Reset automerge
Added:
team/oej/02-labarea/apps/app_minivm.c
- copied unchanged from r61708, trunk/apps/app_minivm.c
team/oej/02-labarea/configs/extensions_minivm.conf.sample
- copied unchanged from r61708, trunk/configs/extensions_minivm.conf.sample
team/oej/02-labarea/configs/minivm.conf.sample
- copied unchanged from r61708, trunk/configs/minivm.conf.sample
Modified:
team/oej/02-labarea/ (props changed)
team/oej/02-labarea/apps/app_dial.c
team/oej/02-labarea/apps/app_queue.c
team/oej/02-labarea/apps/app_speech_utils.c
team/oej/02-labarea/apps/app_voicemail.c
team/oej/02-labarea/channels/chan_iax2.c
team/oej/02-labarea/channels/chan_oss.c
team/oej/02-labarea/channels/chan_sip.c
team/oej/02-labarea/channels/iax2-parser.c
team/oej/02-labarea/channels/iax2-parser.h
team/oej/02-labarea/channels/iax2.h
team/oej/02-labarea/funcs/func_callerid.c
team/oej/02-labarea/funcs/func_cdr.c
team/oej/02-labarea/funcs/func_channel.c
team/oej/02-labarea/funcs/func_groupcount.c
team/oej/02-labarea/funcs/func_timeout.c
team/oej/02-labarea/include/asterisk/config.h
team/oej/02-labarea/include/asterisk/rtp.h
team/oej/02-labarea/main/cdr.c
team/oej/02-labarea/main/config.c
team/oej/02-labarea/main/loader.c
team/oej/02-labarea/main/manager.c
team/oej/02-labarea/main/rtp.c
team/oej/02-labarea/main/say.c
team/oej/02-labarea/sounds/Makefile
Propchange: team/oej/02-labarea/
------------------------------------------------------------------------------
automerge = http://edvina.net/training/
Propchange: team/oej/02-labarea/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/oej/02-labarea/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Apr 21 10:47:52 2007
@@ -1,1 +1,1 @@
-/trunk:1-61623
+/trunk:1-61752
Modified: team/oej/02-labarea/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/apps/app_dial.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/apps/app_dial.c (original)
+++ team/oej/02-labarea/apps/app_dial.c Sat Apr 21 10:47:52 2007
@@ -92,7 +92,10 @@
"ends the call.\n"
" The optional URL will be sent to the called party if the channel supports it.\n"
" If the OUTBOUND_GROUP variable is set, all peer channels created by this\n"
-"application will be put into that group (as in Set(GROUP()=...).\n\n"
+"application will be put into that group (as in Set(GROUP()=...).\n"
+" If the OUTBOUND_GROUP_ONCE variable is set, all peer channels created by this\n"
+"application will be put into that group (as in Set(GROUP()=...). Unlike OUTBOUND_GROUP,\n"
+"however, the variable will be unset after use.\n\n"
" Options:\n"
" A(x) - Play an announcement to the called party, using 'x' as the file.\n"
" C - Reset the CDR for this call.\n"
@@ -1274,10 +1277,15 @@
if (continue_exec)
*continue_exec = 0;
-
+
/* If a channel group has been specified, get it for use when we create peer channels */
- outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
-
+ if ((outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP_ONCE"))) {
+ outbound_group = ast_strdupa(outbound_group);
+ pbx_builtin_setvar_helper(chan, "OUTBOUND_GROUP_ONCE", NULL);
+ } else {
+ outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
+ }
+
ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING);
/* loop through the list of dial destinations */
rest = args.peers;
Modified: team/oej/02-labarea/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/apps/app_queue.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/apps/app_queue.c (original)
+++ team/oej/02-labarea/apps/app_queue.c Sat Apr 21 10:47:52 2007
@@ -2122,7 +2122,7 @@
ast_frfree(f);
return NULL;
}
- if ((f->frametype == AST_FRAME_DTMF) && (f->subclass != '*') && valid_exit(qe, f->subclass)) {
+ if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass)) {
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_3 "User pressed digit: %c\n", f->subclass);
*to = 0;
Modified: team/oej/02-labarea/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/apps/app_speech_utils.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/apps/app_speech_utils.c (original)
+++ team/oej/02-labarea/apps/app_speech_utils.c Sat Apr 21 10:47:52 2007
@@ -132,6 +132,9 @@
struct ast_speech_result *result = results;
char *tmp = NULL;
int nbest_num = 0, wanted_num = 0, i = 0;
+
+ if (!result)
+ return NULL;
if ((tmp = strchr(result_num, '/'))) {
*tmp++ = '\0';
Modified: team/oej/02-labarea/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/apps/app_voicemail.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/apps/app_voicemail.c (original)
+++ team/oej/02-labarea/apps/app_voicemail.c Sat Apr 21 10:47:52 2007
@@ -839,7 +839,7 @@
ast_log(LOG_WARNING, "Failed to get category structure.\n");
break;
}
- ast_variable_update(cat, vmu->mailbox, new, NULL);
+ ast_variable_update(cat, vmu->mailbox, new, NULL, 0);
}
}
/* save the results */
@@ -871,7 +871,7 @@
break;
}
if (!var)
- ast_variable_update(cat, "vmsecret", new, NULL);
+ ast_variable_update(cat, "vmsecret", new, NULL, 0);
else
ast_variable_append(cat, var);
}
@@ -1392,7 +1392,7 @@
void *fdm = MAP_FAILED;
size_t fdlen = -1;
SQLHSTMT stmt;
- SQLINTEGER len;
+ SQLLEN len;
char sql[PATH_MAX];
char msgnums[20];
char fn[PATH_MAX];
@@ -3967,7 +3967,7 @@
*duration += prepend_duration;
msg_cat = ast_category_get(msg_cfg, "message");
snprintf(duration_str, 11, "%ld", *duration);
- if (!ast_variable_update(msg_cat, "duration", duration_str, NULL)) {
+ if (!ast_variable_update(msg_cat, "duration", duration_str, NULL, 0)) {
config_text_file_save(textfile, msg_cfg, "app_voicemail");
STORE(curdir, vmu->mailbox, context, curmsg, chan, vmu, vmfmts, *duration, vms);
}
Modified: team/oej/02-labarea/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/channels/chan_iax2.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/channels/chan_iax2.c (original)
+++ team/oej/02-labarea/channels/chan_iax2.c Sat Apr 21 10:47:52 2007
@@ -577,6 +577,8 @@
AST_STRING_FIELD(accountcode);
AST_STRING_FIELD(mohinterpret);
AST_STRING_FIELD(mohsuggest);
+ /*! received OSP token */
+ AST_STRING_FIELD(osptoken);
);
/*! permitted authentication methods */
@@ -851,6 +853,9 @@
static void destroy_user(struct iax2_user *user);
static void prune_peers(void);
+static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen);
+static int acf_channel_write(struct ast_channel *chan, const char *function, char *data, const char *value);
+
static const struct ast_channel_tech iax2_tech = {
.type = "IAX2",
.description = tdesc,
@@ -874,6 +879,8 @@
.bridge = iax2_bridge,
.transfer = iax2_transfer,
.fixup = iax2_fixup,
+ .func_channel_read = acf_channel_read,
+ .func_channel_write = acf_channel_write,
};
static void insert_idle_thread(struct iax2_thread *thread)
@@ -2890,6 +2897,11 @@
struct parsed_dial_string pds;
struct create_addr_info cai;
struct ast_var_t *var;
+ const char* osp_token_ptr;
+ unsigned int osp_token_length;
+ unsigned char osp_block_index;
+ unsigned int osp_block_length;
+ unsigned char osp_buffer[256];
if ((c->_state != AST_STATE_DOWN) && (c->_state != AST_STATE_RESERVED)) {
ast_log(LOG_WARNING, "Channel is already in use (%s)?\n", c->name);
@@ -3009,6 +3021,25 @@
iaxs[callno]->pingtime = autokill / 2;
iaxs[callno]->initid = ast_sched_add(sched, autokill * 2, auto_congest, CALLNO_TO_PTR(callno));
}
+
+ /* Check if there is an OSP token set by IAXCHANINFO function */
+ osp_token_ptr = iaxs[callno]->osptoken;
+ if (!ast_strlen_zero(osp_token_ptr)) {
+ if ((osp_token_length = strlen(osp_token_ptr)) <= IAX_MAX_OSPTOKEN_SIZE) {
+ osp_block_index = 0;
+ while (osp_token_length > 0) {
+ osp_block_length = IAX_MAX_OSPBLOCK_SIZE < osp_token_length ? IAX_MAX_OSPBLOCK_SIZE : osp_token_length;
+ osp_buffer[0] = osp_block_index;
+ memcpy(osp_buffer + 1, osp_token_ptr, osp_block_length);
+ iax_ie_append_raw(&ied, IAX_IE_OSPTOKEN, osp_buffer, osp_block_length + 1);
+ osp_block_index++;
+ osp_token_ptr += osp_block_length;
+ osp_token_length -= osp_block_length;
+ }
+ } else
+ ast_log(LOG_WARNING, "OSP token is too long\n");
+ } else if (option_debug && iaxdebug)
+ ast_log(LOG_DEBUG, "OSP token is undefined\n");
/* send the command using the appropriate socket for this peer */
iaxs[callno]->sockfd = cai.sockfd;
@@ -6316,6 +6347,36 @@
iaxs[fr->callno]->remote_rr.ooo = ies->rr_ooo;
}
+static void save_osptoken(struct iax_frame *fr, struct iax_ies *ies)
+{
+ int i;
+ unsigned int length, offset = 0;
+ char full_osptoken[IAX_MAX_OSPBUFF_SIZE];
+
+ for (i = 0; i < IAX_MAX_OSPBLOCK_NUM; i++) {
+ length = ies->ospblocklength[i];
+ if (length != 0) {
+ if (length > IAX_MAX_OSPBLOCK_SIZE) {
+ /* OSP token block length wrong, clear buffer */
+ offset = 0;
+ break;
+ } else {
+ memcpy(full_osptoken + offset, ies->osptokenblock[i], length);
+ offset += length;
+ }
+ } else {
+ break;
+ }
+ }
+ *(full_osptoken + offset) = '\0';
+ if (strlen(full_osptoken) != offset) {
+ /* OSP token length wrong, clear buffer */
+ *full_osptoken = '\0';
+ }
+
+ ast_string_field_set(iaxs[fr->callno], osptoken, full_osptoken);
+}
+
static int socket_read(int *id, int fd, short events, void *cbdata)
{
struct iax2_thread *thread;
@@ -6940,6 +7001,8 @@
ast_mutex_lock(&iaxsl[fr->callno]);
} else
exists = 0;
+ /* Get OSP token if it does exist */
+ save_osptoken(fr, &ies);
if (ast_strlen_zero(iaxs[fr->callno]->secret) && ast_strlen_zero(iaxs[fr->callno]->inkeys)) {
if (strcmp(iaxs[fr->callno]->exten, "TBD") && !exists) {
memset(&ied0, 0, sizeof(ied0));
@@ -9824,6 +9887,61 @@
"\n"
};
+static int acf_channel_write(struct ast_channel *chan, const char *function, char *args, const char *value)
+{
+ struct chan_iax2_pvt *pvt;
+ unsigned int callno;
+ int res = 0;
+
+ if (!chan || chan->tech != &iax2_tech) {
+ ast_log(LOG_ERROR, "This function requires a valid IAX2 channel\n");
+ return -1;
+ }
+
+ callno = PTR_TO_CALLNO(chan->tech_pvt);
+ ast_mutex_lock(&iaxsl[callno]);
+ if (!(pvt = iaxs[callno])) {
+ ast_mutex_unlock(&iaxsl[callno]);
+ return -1;
+ }
+
+ if (!strcasecmp(args, "osptoken"))
+ ast_string_field_set(pvt, osptoken, value);
+ else
+ res = -1;
+
+ ast_mutex_unlock(&iaxsl[callno]);
+
+ return res;
+}
+
+static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *args, char *buf, size_t buflen)
+{
+ struct chan_iax2_pvt *pvt;
+ unsigned int callno;
+ int res = 0;
+
+ if (!chan || chan->tech != &iax2_tech) {
+ ast_log(LOG_ERROR, "This function requires a valid IAX2 channel\n");
+ return -1;
+ }
+
+ callno = PTR_TO_CALLNO(chan->tech_pvt);
+ ast_mutex_lock(&iaxsl[callno]);
+ if (!(pvt = iaxs[callno])) {
+ ast_mutex_unlock(&iaxsl[callno]);
+ return -1;
+ }
+
+ if (!strcasecmp(args, "osptoken"))
+ ast_copy_string(buf, pvt->osptoken, buflen);
+ else
+ res = -1;
+
+ ast_mutex_unlock(&iaxsl[callno]);
+
+ return res;
+}
/*! \brief Part of the device state notification system ---*/
static int iax2_devicestate(void *data)
Modified: team/oej/02-labarea/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/channels/chan_oss.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/channels/chan_oss.c (original)
+++ team/oej/02-labarea/channels/chan_oss.c Sat Apr 21 10:47:52 2007
@@ -1021,7 +1021,7 @@
{
struct ast_channel *c;
- c = ast_channel_alloc(1, state, o->cid_num, o->cid_name, "", o->ext, o->ctx, 0, "OSS/%s", o->device + 5);
+ c = ast_channel_alloc(1, state, o->cid_num, o->cid_name, "", ext, ctx, 0, "OSS/%s", o->device + 5);
if (c == NULL)
return NULL;
c->tech = &oss_tech;
Modified: team/oej/02-labarea/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/channels/chan_sip.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/channels/chan_sip.c (original)
+++ team/oej/02-labarea/channels/chan_sip.c Sat Apr 21 10:47:52 2007
@@ -1426,6 +1426,7 @@
static int sip_show_peer(int fd, int argc, char *argv[]);
static int sip_show_user(int fd, int argc, char *argv[]);
static int sip_show_registry(int fd, int argc, char *argv[]);
+static int sip_unregister(int fd, int argc, char *argv[]);
static int sip_show_settings(int fd, int argc, char *argv[]);
static const char *subscription_type2str(enum subscriptiontype subtype) attribute_pure;
static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
@@ -4768,7 +4769,8 @@
for (p = dialoglist; p; p = p->next) {
/* In pedantic, we do not want packets with bad syntax to be connected to a PVT */
int found = FALSE;
-
+ if (ast_strlen_zero(p->callid))
+ continue;
if (req->method == SIP_REGISTER)
found = (!strcmp(p->callid, req->callid));
else
@@ -5007,6 +5009,16 @@
dst[i] = c + 1; /* record start of next line */
}
}
+ /* Check for last header without CRLF. The RFC for SDP requires CRLF,
+ but since some devices send without, we'll be generous in what we accept.
+ */
+ if (!ast_strlen_zero(dst[i])) {
+ if (sipdebug && option_debug > 3)
+ ast_log(LOG_DEBUG, "%7s %2d [%3d]: %s\n",
+ req->headers < 0 ? "Header" : "Body",
+ i, (int)strlen(dst[i]), dst[i]);
+ i++;
+ }
/* update count of header or body lines */
if (req->headers >= 0) /* we are in the body */
req->lines = i;
@@ -6084,7 +6096,7 @@
snprintf(tmp, sizeof(tmp), "%d", p->expiry);
add_header(resp, "Expires", tmp);
if (p->expiry) { /* Only add contact if we have an expiry time */
- char contact[256];
+ char contact[BUFSIZ];
snprintf(contact, sizeof(contact), "%s;expires=%d", p->our_contact, p->expiry);
add_header(resp, "Contact", contact); /* Not when we unregister */
}
@@ -7120,7 +7132,7 @@
/*! \brief Check Contact: URI of SIP message */
static void extract_uri(struct sip_pvt *p, struct sip_request *req)
{
- char stripped[256];
+ char stripped[BUFSIZ];
char *c;
ast_copy_string(stripped, get_header(req, "Contact"), sizeof(stripped));
@@ -8289,7 +8301,7 @@
/*! \brief Save contact header for 200 OK on INVITE */
static int parse_ok_contact(struct sip_pvt *pvt, struct sip_request *req)
{
- char contact[250];
+ char contact[BUFSIZ];
char *c;
/* Look for brackets */
@@ -11026,6 +11038,25 @@
return RESULT_SUCCESS;
#undef FORMAT
#undef FORMAT2
+}
+
+/*! \brief Unregister (force expiration) a SIP peer in the registry via CLI */
+static int sip_unregister(int fd, int argc, char *argv[])
+{
+ struct sip_peer *peer;
+ int load_realtime = 0;
+
+ if (argc != 3)
+ return RESULT_SHOWUSAGE;
+
+ if ((peer = find_peer(argv[2], NULL, load_realtime))) {
+ expire_register(peer);
+ ast_cli(fd, "Unregistered peer \'%s\'\n\n", argv[2]);
+ } else {
+ ast_cli(fd, "Attempted to unregister an unknown peer \'%s\' via CLI\n", argv[2]);
+ }
+
+ return 0;
}
/*! \brief List global settings for the SIP channel */
@@ -12028,6 +12059,10 @@
"Usage: sip show registry\n"
" Lists all registration requests and status.\n";
+static const char sip_unregister_usage[] =
+"Usage: sip unregister <peer>\n"
+" Unregister (force expiration) a SIP peer from the registry\n";
+
static const char debug_usage[] =
"Usage: sip debug\n"
" Enables dumping of SIP packets for debugging purposes\n\n"
@@ -12326,7 +12361,7 @@
/*! \brief Parse 302 Moved temporalily response */
static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req)
{
- char tmp[256];
+ char tmp[BUFSIZ];
char *s, *e;
char *domain;
@@ -15172,6 +15207,9 @@
else if (ast_strlen_zero(p->context))
ast_string_field_set(p, context, default_context);
+ /* Get full contact header - this needs to be used as a request URI in NOTIFY's */
+ parse_ok_contact(p, req);
+
build_contact(p);
if (gotdest) {
transmit_response(p, "404 Not Found", req);
@@ -18222,6 +18260,10 @@
sip_show_registry, "List SIP registration status",
show_reg_usage },
+ { { "sip", "unregister", NULL },
+ sip_unregister, "Unregister (force expiration) a SIP peer from the registery\n",
+ sip_unregister_usage },
+
{ { "sip", "show", "settings", NULL },
sip_show_settings, "Show SIP global settings",
show_settings_usage },
Modified: team/oej/02-labarea/channels/iax2-parser.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/channels/iax2-parser.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/channels/iax2-parser.c (original)
+++ team/oej/02-labarea/channels/iax2-parser.c Sat Apr 21 10:47:52 2007
@@ -264,6 +264,7 @@
{ IAX_IE_RR_DROPPED, "RR_DROPPED", dump_int },
{ IAX_IE_RR_OOO, "RR_OUTOFORDER", dump_int },
{ IAX_IE_VARIABLE, "VARIABLE", dump_string },
+ { IAX_IE_OSPTOKEN, "OSPTOKEN" },
};
static struct iax2_ie prov_ies[] = {
@@ -617,6 +618,7 @@
int ie;
char tmp[256], *tmp2;
struct ast_variable *var, *var2, *prev;
+ unsigned int count;
memset(ies, 0, (int)sizeof(struct iax_ies));
ies->msgcount = -1;
ies->firmwarever = -1;
@@ -930,6 +932,15 @@
ies->vars = var;
}
break;
+ case IAX_IE_OSPTOKEN:
+ if ((count = data[2]) < IAX_MAX_OSPBLOCK_NUM) {
+ ies->osptokenblock[count] = (char *)data + 2 + 1;
+ ies->ospblocklength[count] = len - 1;
+ } else {
+ snprintf(tmp, (int)sizeof(tmp), "Expected OSP token block index to be 0~%d but was %d\n", IAX_MAX_OSPBLOCK_NUM - 1, count);
+ errorf(tmp);
+ }
+ break;
default:
snprintf(tmp, (int)sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);
outputf(tmp);
Modified: team/oej/02-labarea/channels/iax2-parser.h
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/channels/iax2-parser.h?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/channels/iax2-parser.h (original)
+++ team/oej/02-labarea/channels/iax2-parser.h Sat Apr 21 10:47:52 2007
@@ -74,6 +74,8 @@
unsigned int rr_dropped;
unsigned int rr_ooo;
struct ast_variable *vars;
+ char *osptokenblock[IAX_MAX_OSPBLOCK_NUM];
+ unsigned int ospblocklength[IAX_MAX_OSPBLOCK_NUM];
};
#define DIRECTION_INGRESS 1
Modified: team/oej/02-labarea/channels/iax2.h
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/channels/iax2.h?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/channels/iax2.h (original)
+++ team/oej/02-labarea/channels/iax2.h Sat Apr 21 10:47:52 2007
@@ -129,7 +129,12 @@
#define IAX_IE_RR_DROPPED 50 /* Dropped frames (presumably by jitterbuf) u32 */
#define IAX_IE_RR_OOO 51 /* Frames received Out of Order u32 */
#define IAX_IE_VARIABLE 52 /* Remote variables */
-
+#define IAX_IE_OSPTOKEN 53 /* OSP token */
+
+#define IAX_MAX_OSPBLOCK_SIZE 254 /* Max OSP token block size, 255 bytes - 1 byte OSP token block index */
+#define IAX_MAX_OSPBLOCK_NUM 4
+#define IAX_MAX_OSPTOKEN_SIZE (IAX_MAX_OSPBLOCK_SIZE * IAX_MAX_OSPBLOCK_NUM)
+#define IAX_MAX_OSPBUFF_SIZE (IAX_MAX_OSPTOKEN_SIZE + 16)
#define IAX_AUTH_PLAINTEXT (1 << 0)
#define IAX_AUTH_MD5 (1 << 1)
Modified: team/oej/02-labarea/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/funcs/func_callerid.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/funcs/func_callerid.c (original)
+++ team/oej/02-labarea/funcs/func_callerid.c Sat Apr 21 10:47:52 2007
@@ -60,7 +60,9 @@
{
char *opt = data;
- /* XXX we are not always clearing the buffer. Is this correct ? */
+ if (!chan)
+ return -1;
+
if (strchr(opt, '|')) {
char name[80], num[80];
@@ -116,7 +118,7 @@
static int callerid_write(struct ast_channel *chan, const char *cmd, char *data,
const char *value)
{
- if (!value)
+ if (!value || !chan)
return -1;
if (!strncasecmp("all", data, 3)) {
Modified: team/oej/02-labarea/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/funcs/func_cdr.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/funcs/func_cdr.c (original)
+++ team/oej/02-labarea/funcs/func_cdr.c Sat Apr 21 10:47:52 2007
@@ -59,7 +59,7 @@
{
char *ret;
struct ast_flags flags = { 0 };
- struct ast_cdr *cdr = chan->cdr;
+ struct ast_cdr *cdr = chan ? chan->cdr : NULL;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(variable);
AST_APP_ARG(options);
@@ -96,7 +96,7 @@
AST_APP_ARG(options);
);
- if (ast_strlen_zero(parse) || !value)
+ if (ast_strlen_zero(parse) || !value || !chan)
return -1;
AST_STANDARD_APP_ARGS(args, parse);
Modified: team/oej/02-labarea/funcs/func_channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/funcs/func_channel.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/funcs/func_channel.c (original)
+++ team/oej/02-labarea/funcs/func_channel.c Sat Apr 21 10:47:52 2007
@@ -182,6 +182,9 @@
" rtt Round trip time\n"
" all All statistics (in a form suited to logging, but not for parsing)\n"
"\n"
+ "chan_iax2 provides the following additional options:\n"
+ "R/W osptoken Get or set the OSP token information for a call\n"
+ "\n"
"Additional items may be available from the channel driver providing\n"
"the channel; see its documentation for details.\n"
"\n"
Modified: team/oej/02-labarea/funcs/func_groupcount.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/funcs/func_groupcount.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/funcs/func_groupcount.c (original)
+++ team/oej/02-labarea/funcs/func_groupcount.c Sat Apr 21 10:47:52 2007
@@ -157,6 +157,9 @@
struct varshead *headp;
char tmp1[1024] = "";
char tmp2[1024] = "";
+
+ if (!chan)
+ return -1;
headp = &chan->varshead;
AST_LIST_TRAVERSE(headp, current, entries) {
Modified: team/oej/02-labarea/funcs/func_timeout.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/funcs/func_timeout.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/funcs/func_timeout.c (original)
+++ team/oej/02-labarea/funcs/func_timeout.c Sat Apr 21 10:47:52 2007
@@ -46,6 +46,9 @@
{
time_t myt;
+ if (!chan)
+ return -1;
+
if (!data) {
ast_log(LOG_ERROR, "Must specify type of timeout to get.\n");
return -1;
@@ -90,6 +93,9 @@
int x;
char timestr[64];
struct tm myt;
+
+ if (!chan)
+ return -1;
if (!data) {
ast_log(LOG_ERROR, "Must specify type of timeout to set.\n");
Modified: team/oej/02-labarea/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/include/asterisk/config.h?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/include/asterisk/config.h (original)
+++ team/oej/02-labarea/include/asterisk/config.h Sat Apr 21 10:47:52 2007
@@ -212,7 +212,8 @@
struct ast_variable *ast_variable_new(const char *name, const char *value);
void ast_variable_append(struct ast_category *category, struct ast_variable *variable);
int ast_variable_delete(struct ast_category *category, const char *variable, const char *match);
-int ast_variable_update(struct ast_category *category, const char *variable, const char *value, const char *match);
+int ast_variable_update(struct ast_category *category, const char *variable,
+ const char *value, const char *match, unsigned int object);
int config_text_file_save(const char *filename, const struct ast_config *cfg, const char *generator);
Modified: team/oej/02-labarea/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/include/asterisk/rtp.h?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/include/asterisk/rtp.h (original)
+++ team/oej/02-labarea/include/asterisk/rtp.h Sat Apr 21 10:47:52 2007
@@ -84,16 +84,17 @@
AST_LIST_ENTRY(ast_rtp_protocol) list;
};
+/*! \brief RTCP quality report storage */
struct ast_rtp_quality {
- unsigned int local_ssrc; /* Our SSRC */
- unsigned int local_lostpackets; /* Our lost packets */
- double local_jitter; /* Our calculated jitter */
- unsigned int local_count; /* Number of received packets */
- unsigned int remote_ssrc; /* Their SSRC */
- unsigned int remote_lostpackets; /* Their lost packets */
- double remote_jitter; /* Their reported jitter */
- unsigned int remote_count; /* Number of transmitted packets */
- double rtt; /* Round trip time */
+ unsigned int local_ssrc; /*!< Our SSRC */
+ unsigned int local_lostpackets; /*!< Our lost packets */
+ double local_jitter; /*!< Our calculated jitter */
+ unsigned int local_count; /*!< Number of received packets */
+ unsigned int remote_ssrc; /*!< Their SSRC */
+ unsigned int remote_lostpackets; /*!< Their lost packets */
+ double remote_jitter; /*!< Their reported jitter */
+ unsigned int remote_count; /*!< Number of transmitted packets */
+ double rtt; /*!< Round trip time */
};
/*! RTP callback structure */
Modified: team/oej/02-labarea/main/cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/main/cdr.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/main/cdr.c (original)
+++ team/oej/02-labarea/main/cdr.c Sat Apr 21 10:47:52 2007
@@ -512,6 +512,8 @@
void ast_cdr_merge(struct ast_cdr *to, struct ast_cdr *from)
{
+ struct ast_cdr *tcdr;
+
if (!to || !from)
return;
@@ -587,15 +589,15 @@
ast_copy_string(to->dst, from->dst, sizeof(to->dst));
from->dst[0] = 0; /* theft */
}
- if (!to->amaflags && from->amaflags) {
+ if (ast_test_flag(from, AST_CDR_FLAG_LOCKED) || (!to->amaflags && from->amaflags)) {
to->amaflags = from->amaflags;
from->amaflags = 0; /* theft */
}
- if (ast_strlen_zero(to->accountcode) && !ast_strlen_zero(from->accountcode)) {
+ if (ast_test_flag(from, AST_CDR_FLAG_LOCKED) || (ast_strlen_zero(to->accountcode) && !ast_strlen_zero(from->accountcode))) {
ast_copy_string(to->accountcode, from->accountcode, sizeof(to->accountcode));
from->accountcode[0] = 0; /* theft */
}
- if (ast_strlen_zero(to->userfield) && !ast_strlen_zero(from->userfield)) {
+ if (ast_test_flag(from, AST_CDR_FLAG_LOCKED) || (ast_strlen_zero(to->userfield) && !ast_strlen_zero(from->userfield))) {
ast_copy_string(to->userfield, from->userfield, sizeof(to->userfield));
from->userfield[0] = 0; /* theft */
}
@@ -612,6 +614,16 @@
ast_set_flag(to, AST_CDR_FLAG_CHILD);
if (ast_test_flag(from, AST_CDR_FLAG_POST_DISABLED))
ast_set_flag(to, AST_CDR_FLAG_POST_DISABLED);
+
+ /* last, but not least, we need to merge any forked CDRs to the 'to' cdr */
+ while (from->next) {
+ /* just rip 'em off the 'from' and insert them on the 'to' */
+ tcdr = from->next;
+ from->next = tcdr->next;
+ tcdr->next = NULL;
+ /* tcdr is now ripped from the current list; */
+ ast_cdr_append(to, tcdr);
+ }
}
void ast_cdr_start(struct ast_cdr *cdr)
@@ -817,8 +829,9 @@
ast_string_field_set(chan, accountcode, account);
for ( ; cdr ; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
+ }
}
return 0;
}
Modified: team/oej/02-labarea/main/config.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/main/config.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/main/config.c (original)
+++ team/oej/02-labarea/main/config.c Sat Apr 21 10:47:52 2007
@@ -468,54 +468,41 @@
return res;
}
-int ast_variable_update(struct ast_category *category, const char *variable, const char *value, const char *match)
+int ast_variable_update(struct ast_category *category, const char *variable,
+ const char *value, const char *match, unsigned int object)
{
struct ast_variable *cur, *prev=NULL, *newer;
- newer = ast_variable_new(variable, value);
- if (!newer)
+
+ if (!(newer = ast_variable_new(variable, value)))
return -1;
- cur = category->root;
- while (cur) {
- if (cur->name == variable) {
- newer->next = cur->next;
- newer->object = cur->object;
- if (prev)
- prev->next = newer;
- else
- category->root = newer;
- if (category->last == cur)
- category->last = newer;
- cur->next = NULL;
- ast_variables_destroy(cur);
- return 0;
- }
- prev = cur;
- cur = cur->next;
- }
-
- prev = NULL;
- cur = category->root;
- while (cur) {
- if (!strcasecmp(cur->name, variable) && (ast_strlen_zero(match) || !strcasecmp(cur->value, match))) {
- newer->next = cur->next;
- newer->object = cur->object;
- if (prev)
- prev->next = newer;
- else
- category->root = newer;
- if (category->last == cur)
- category->last = newer;
- cur->next = NULL;
- ast_variables_destroy(cur);
- return 0;
- }
- prev = cur;
- cur = cur->next;
- }
+
+ newer->object = object;
+
+ for (cur = category->root; cur; prev = cur, cur = cur->next) {
+ if (strcasecmp(cur->name, variable) ||
+ (!ast_strlen_zero(match) && strcasecmp(cur->value, match)))
+ continue;
+
+ newer->next = cur->next;
+ newer->object = cur->object || object;
+ if (prev)
+ prev->next = newer;
+ else
+ category->root = newer;
+ if (category->last == cur)
+ category->last = newer;
+
+ cur->next = NULL;
+ ast_variables_destroy(cur);
+
+ return 0;
+ }
+
if (prev)
prev->next = newer;
else
category->root = newer;
+
return 0;
}
Modified: team/oej/02-labarea/main/loader.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/main/loader.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/main/loader.c (original)
+++ team/oej/02-labarea/main/loader.c Sat Apr 21 10:47:52 2007
@@ -529,6 +529,7 @@
ast_verbose("The previous reload command didn't finish yet\n");
return -1; /* reload already in progress */
}
+ ast_lastreloadtime = time(NULL);
/* Call "predefined" reload here first */
for (i = 0; reload_classes[i].name; i++) {
@@ -537,7 +538,6 @@
res = 2; /* found and reloaded */
}
}
- ast_lastreloadtime = time(NULL);
if (name && res) {
ast_mutex_unlock(&reloadlock);
Modified: team/oej/02-labarea/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/main/manager.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/main/manager.c (original)
+++ team/oej/02-labarea/main/manager.c Sat Apr 21 10:47:52 2007
@@ -1121,6 +1121,8 @@
struct ast_variable *v;
for (x=0;x<100000;x++) {
+ unsigned int object = 0;
+
snprintf(hdr, sizeof(hdr), "Action-%06d", x);
action = astman_get_header(m, hdr);
if (ast_strlen_zero(action))
@@ -1131,6 +1133,10 @@
var = astman_get_header(m, hdr);
snprintf(hdr, sizeof(hdr), "Value-%06d", x);
value = astman_get_header(m, hdr);
+ if (!ast_strlen_zero(value) && *value == '>') {
+ object = 1;
+ value++;
+ }
snprintf(hdr, sizeof(hdr), "Match-%06d", x);
match = astman_get_header(m, hdr);
if (!strcasecmp(action, "newcat")) {
@@ -1151,7 +1157,7 @@
ast_category_delete(cfg, cat);
} else if (!strcasecmp(action, "update")) {
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) && (category = ast_category_get(cfg, cat)))
- ast_variable_update(category, var, value, match);
+ ast_variable_update(category, var, value, match, object);
} else if (!strcasecmp(action, "delete")) {
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) && (category = ast_category_get(cfg, cat)))
ast_variable_delete(category, var, match);
@@ -1159,7 +1165,7 @@
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) &&
(category = ast_category_get(cfg, cat)) &&
(v = ast_variable_new(var, value))){
- if (match && !strcasecmp(match, "object"))
+ if (object || (match && !strcasecmp(match, "object")))
v->object = 1;
ast_variable_append(category, v);
}
@@ -1483,7 +1489,7 @@
const char *name = astman_get_header(m, "Channel");
const char *varname = astman_get_header(m, "Variable");
char *varval;
- char workspace[1024];
+ char workspace[1024] = "";
if (ast_strlen_zero(varname)) {
astman_send_error(s, m, "No variable specified");
@@ -1500,6 +1506,7 @@
if (varname[strlen(varname) - 1] == ')') {
ast_func_read(c, (char *) varname, workspace, sizeof(workspace));
+ varval = workspace;
} else {
pbx_retrieve_variable(c, varname, &varval, workspace, sizeof(workspace), NULL);
}
Modified: team/oej/02-labarea/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/02-labarea/main/rtp.c?view=diff&rev=61753&r1=61752&r2=61753
==============================================================================
--- team/oej/02-labarea/main/rtp.c (original)
+++ team/oej/02-labarea/main/rtp.c Sat Apr 21 10:47:52 2007
@@ -145,8 +145,8 @@
unsigned int dtmfsamples;
/* DTMF Transmission Variables */
unsigned int lastdigitts;
- char sending_digit; /* boolean - are we sending digits */
- char send_digit; /* digit we are sending */
+ char sending_digit; /*!< boolean - are we sending digits */
+ char send_digit; /*!< digit we are sending */
int send_payload;
int send_duration;
int nat;
@@ -995,25 +995,27 @@
lsr = (double)((ntohl(rtcpheader[i + 4]) & 0xffff0000) >> 16) + (double)((double)(ntohl(rtcpheader[i + 4]) & 0xffff) / 1000000.);
dlsr = (double)(ntohl(rtcpheader[i + 5])/65536.);
rtt = a - dlsr - lsr;
- rtp->rtcp->accumulated_transit += rtt;
- rtp->rtcp->rtt = rtt;
- if (rtp->rtcp->maxrtt<rtt)
- rtp->rtcp->maxrtt = rtt;
- if (rtp->rtcp->minrtt>rtt)
- rtp->rtcp->minrtt = rtt;
+ if (rtt >= 0) {
+ rtp->rtcp->accumulated_transit += rtt;
+ rtp->rtcp->rtt = rtt;
+ if (rtp->rtcp->maxrtt < rtt)
+ rtp->rtcp->maxrtt = rtt;
+ if (rtp->rtcp->minrtt > rtt)
+ rtp->rtcp->minrtt = rtt;
+ }
}
rtp->rtcp->reported_jitter = ntohl(rtcpheader[i + 3]);
rtp->rtcp->reported_lost = ntohl(rtcpheader[i + 1]) & 0xffffff;
if (rtcp_debug_test_addr(&sin)) {
- ast_verbose("Fraction lost: %ld\n", (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24));
- ast_verbose("Packets lost so far: %d\n", rtp->rtcp->reported_lost);
- ast_verbose("Highest sequence number: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff));
- ast_verbose("Sequence number cycles: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff) >> 16);
- ast_verbose("Interarrival jitter: %u\n", rtp->rtcp->reported_jitter);
- ast_verbose("Last SR(our NTP): %lu.%010lu\n",(unsigned long) ntohl(rtcpheader[i + 4]) >> 16,((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096);
- ast_verbose("DLSR: %4.4f (sec)\n",ntohl(rtcpheader[i + 5])/65536.0);
+ ast_verbose(" Fraction lost: %ld\n", (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24));
+ ast_verbose(" Packets lost so far: %d\n", rtp->rtcp->reported_lost);
+ ast_verbose(" Highest sequence number: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff));
+ ast_verbose(" Sequence number cycles: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff) >> 16);
+ ast_verbose(" Interarrival jitter: %u\n", rtp->rtcp->reported_jitter);
+ ast_verbose(" Last SR(our NTP): %lu.%010lu\n",(unsigned long) ntohl(rtcpheader[i + 4]) >> 16,((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096);
+ ast_verbose(" DLSR: %4.4f (sec)\n",ntohl(rtcpheader[i + 5])/65536.0);
if (rtt)
- ast_verbose("RTT: %f(sec)\n", rtt);
+ ast_verbose(" RTT: %f(sec)\n", rtt);
}
break;
case RTCP_PT_FUR:
@@ -1155,7 +1157,6 @@
unsigned int seqno;
int version;
int payloadtype;
- int tseqno;
int hdrlen = 12;
int padding;
int mark;
@@ -1276,8 +1277,6 @@
rtp->rxcount++; /* Only count reasonably valid packets, this'll make the rtcp stats more accurate */
- tseqno = rtp->lastrxseqno +1;
-
if (rtp->rxcount==1) {
/* This is the first RTP packet successfully received from source */
rtp->seedrxseqno = seqno;
@@ -1288,11 +1287,8 @@
/* Schedule transmission of Receiver Report */
rtp->rtcp->schedid = ast_sched_add(rtp->sched, ast_rtcp_calc_interval(rtp), ast_rtcp_write, rtp);
}
-
- if (tseqno > RTP_SEQ_MOD) { /* if tseqno is greater than RTP_SEQ_MOD it would indicate that the sender cycled */
+ if ( (int)rtp->lastrxseqno - (int)seqno > 100) /* if so it would indicate that the sender cycled; allow for misordering */
rtp->cycles += RTP_SEQ_MOD;
- ast_verbose("SEQNO cycled: %u\t%d\n", rtp->cycles, seqno);
- }
rtp->lastrxseqno = seqno;
@@ -2452,7 +2448,7 @@
rtcpheader[7] = htonl(rtp->themssrc);
rtcpheader[8] = htonl(((fraction & 0xff) << 24) | (lost & 0xffffff));
rtcpheader[9] = htonl((rtp->cycles) | ((rtp->lastrxseqno & 0xffff)));
- rtcpheader[10] = htonl((unsigned int)rtp->rxjitter);
+ rtcpheader[10] = htonl((unsigned int)(rtp->rxjitter * 65536.));
rtcpheader[11] = htonl(rtp->rtcp->themrxlsr);
rtcpheader[12] = htonl((((dlsr.tv_sec * 1000) + (dlsr.tv_usec / 1000)) * 65536) / 1000);
len += 24;
@@ -2554,7 +2550,7 @@
rtcpheader[2] = htonl(rtp->themssrc);
rtcpheader[3] = htonl(((fraction & 0xff) << 24) | (lost & 0xffffff));
rtcpheader[4] = htonl((rtp->cycles) | ((rtp->lastrxseqno & 0xffff)));
- rtcpheader[5] = htonl((unsigned int)rtp->rxjitter);
+ rtcpheader[5] = htonl((unsigned int)(rtp->rxjitter * 65536.));
rtcpheader[6] = htonl(rtp->rtcp->themrxlsr);
rtcpheader[7] = htonl((((dlsr.tv_sec * 1000) + (dlsr.tv_usec / 1000)) * 65536) / 1000);
Modified: team/oej/02-labarea/main/say.c
[... 30 lines stripped ...]
More information about the asterisk-commits
mailing list