mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
Version 0.1.9 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -42,19 +42,41 @@ disallow=lpc10 ; Icky sound quality... Mr. Roboto.
|
||||
;register => marko:secretpass@tormenta.linux-support.net
|
||||
;register => joe@remotehost:5656
|
||||
;
|
||||
; Finally, you can set values for your TOS bits to help improve
|
||||
; performance. Valid values are:
|
||||
; lowdelay -- Minimize delay
|
||||
; throughput -- Maximize throughput
|
||||
; reliability -- Maximize reliability
|
||||
; mincost -- Minimize cost
|
||||
; none -- No flags
|
||||
;
|
||||
tos=lowdelay
|
||||
;
|
||||
; Trust Caller*ID Coming from iaxtel.com
|
||||
;
|
||||
[iaxtel]
|
||||
type=user
|
||||
context=default
|
||||
deny=0.0.0.0/0.0.0.0
|
||||
permit=216.207.245.47/255.255.255.255
|
||||
|
||||
;
|
||||
; Guest sections for unauthenticated connection attempts. Just
|
||||
; specify an empty secret, or provide no secret section.
|
||||
;
|
||||
[guest]
|
||||
type=user
|
||||
context=default
|
||||
callerid="Guest IAX User"
|
||||
;
|
||||
; Further user sections may be added, specifying a context and a
|
||||
; secret used for connections with that given authentication name.
|
||||
; Limited IP based access control is allowed by use of "allow" and
|
||||
; "deny" keywords. Multiple rules are permitted. Multiple permitted
|
||||
; contexts may be specified, in which case the first will be the default.
|
||||
; You can also override caller*ID so that when you receive a call you
|
||||
; set the Caller*ID to be what you want instead of trusting what
|
||||
; the remote user provides
|
||||
;
|
||||
;[markster]
|
||||
;type=user
|
||||
@@ -62,8 +84,9 @@ context=default
|
||||
;context=local
|
||||
;auth=md5,plaintext
|
||||
;secret=markpasswd
|
||||
;callerid="Mark Spencer" <(256) 428-6275>
|
||||
;deny=0.0.0.0/0.0.0.0
|
||||
;allow=209.16.236.73/255.255.255.0
|
||||
;permit=209.16.236.73/255.255.255.0
|
||||
;
|
||||
; Peers may also be specified, with a secret and
|
||||
; a remote hostname.
|
||||
@@ -76,3 +99,29 @@ host=216.207.245.57
|
||||
;host=asterisk.linux-support.net
|
||||
;port=5036
|
||||
;mask=255.255.255.255
|
||||
|
||||
;
|
||||
; Peers can remotely register as well, so that they can be
|
||||
; mobile. Default IP's can also optionally be given but
|
||||
; are not required. Caller*ID can be suggested to the other
|
||||
; side as well if it is for example a phone instead of another
|
||||
; PBX.
|
||||
;
|
||||
|
||||
;[dynamichost]
|
||||
;host=dynamic
|
||||
;secret=mysecret
|
||||
;defaultip=216.207.245.34
|
||||
;callerid="Some Host" <(256) 428-6011>
|
||||
;
|
||||
|
||||
;
|
||||
; Friends are a short cut for creating a user and
|
||||
; a peer with the same values.
|
||||
;
|
||||
;[marko]
|
||||
;type=friend
|
||||
;host=dynamic
|
||||
;secret=moofoo
|
||||
;context=default
|
||||
;allow=0.0.0.0/0.0.0.0
|
||||
|
90
frame.c
90
frame.c
@@ -14,10 +14,38 @@
|
||||
#include <asterisk/frame.h>
|
||||
#include <asterisk/logger.h>
|
||||
#include <asterisk/options.h>
|
||||
#include <asterisk/cli.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "asterisk.h"
|
||||
|
||||
#ifdef TRACE_FRAMES
|
||||
static int headers = 0;
|
||||
static struct ast_frame *headerlist = NULL;
|
||||
static pthread_mutex_t framelock = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
||||
static struct ast_frame *ast_frame_header_new(void)
|
||||
{
|
||||
struct ast_frame *f;
|
||||
f = malloc(sizeof(struct ast_frame));
|
||||
#ifdef TRACE_FRAMES
|
||||
if (f) {
|
||||
headers++;
|
||||
f->prev = NULL;
|
||||
pthread_mutex_lock(&framelock);
|
||||
f->next = headerlist;
|
||||
if (headerlist)
|
||||
headerlist->prev = f;
|
||||
headerlist = f;
|
||||
pthread_mutex_unlock(&framelock);
|
||||
}
|
||||
#endif
|
||||
return f;
|
||||
}
|
||||
|
||||
/*
|
||||
* Important: I should be made more efficient. Frame headers should
|
||||
@@ -35,28 +63,27 @@ void ast_frfree(struct ast_frame *fr)
|
||||
free(fr->src);
|
||||
}
|
||||
if (fr->mallocd & AST_MALLOCD_HDR) {
|
||||
#ifdef TRACE_FRAMES
|
||||
headers--;
|
||||
pthread_mutex_lock(&framelock);
|
||||
if (fr->next)
|
||||
fr->next->prev = fr->prev;
|
||||
if (fr->prev)
|
||||
fr->prev->next = fr->next;
|
||||
else
|
||||
headerlist = fr->next;
|
||||
pthread_mutex_unlock(&framelock);
|
||||
#endif
|
||||
free(fr);
|
||||
}
|
||||
}
|
||||
|
||||
void ast_frchain(struct ast_frame_chain *fc)
|
||||
{
|
||||
struct ast_frame_chain *last;
|
||||
while(fc) {
|
||||
last = fc;
|
||||
fc = fc->next;
|
||||
if (last->fr)
|
||||
ast_frfree(last->fr);
|
||||
free(last);
|
||||
}
|
||||
}
|
||||
|
||||
struct ast_frame *ast_frisolate(struct ast_frame *fr)
|
||||
{
|
||||
struct ast_frame *out;
|
||||
if (!(fr->mallocd & AST_MALLOCD_HDR)) {
|
||||
/* Allocate a new header if needed */
|
||||
out = malloc(sizeof(struct ast_frame));
|
||||
out = ast_frame_header_new();
|
||||
if (!out) {
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
return NULL;
|
||||
@@ -107,7 +134,7 @@ struct ast_frame *ast_frdup(struct ast_frame *f)
|
||||
|
||||
struct ast_frame *ast_fr_fdread(int fd)
|
||||
{
|
||||
char buf[4096];
|
||||
char buf[65536];
|
||||
int res;
|
||||
int ttl = sizeof(struct ast_frame);
|
||||
struct ast_frame *f = (struct ast_frame *)buf;
|
||||
@@ -198,3 +225,38 @@ int ast_getformatbyname(char *name)
|
||||
return 0x7FFFFFFF;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef TRACE_FRAMES
|
||||
static int show_frame_stats(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct ast_frame *f;
|
||||
int x=1;
|
||||
if (argc != 3)
|
||||
return RESULT_SHOWUSAGE;
|
||||
ast_cli(fd, " Framer Statistics \n");
|
||||
ast_cli(fd, "---------------------------\n");
|
||||
ast_cli(fd, "Total allocated headers: %d\n", headers);
|
||||
ast_cli(fd, "Queue Dump:\n");
|
||||
pthread_mutex_lock(&framelock);
|
||||
for (f=headerlist; f; f = f->next) {
|
||||
ast_cli(fd, "%d. Type %d, subclass %d from %s\n", x++, f->frametype, f->subclass, f->src ? f->src : "<Unknown>");
|
||||
}
|
||||
pthread_mutex_unlock(&framelock);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static char frame_stats_usage[] =
|
||||
"Usage: show frame stats\n"
|
||||
" Displays debugging statistics from framer\n";
|
||||
|
||||
struct ast_cli_entry cli_frame_stats =
|
||||
{ { "show", "frame", "stats", NULL }, show_frame_stats, "Shows frame statistics", frame_stats_usage };
|
||||
#endif
|
||||
|
||||
int init_framer(void)
|
||||
{
|
||||
#ifdef TRACE_FRAMES
|
||||
ast_cli_register(&cli_frame_stats);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user