mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 02:26:23 +00:00
Version 0.3.0 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
88
chanvars.c
88
chanvars.c
@@ -1,39 +1,81 @@
|
||||
#include <asterisk/chanvars.h>
|
||||
/*
|
||||
* Asterisk -- A telephony toolkit for Linux.
|
||||
*
|
||||
* Channel Variables
|
||||
*
|
||||
* Copyright (C) 2002, Mark Spencer
|
||||
*
|
||||
* Mark Spencer <markster@linux-support.net>
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License
|
||||
*/
|
||||
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
struct ast_var_t *ast_var_assign(char *name,char *value) {
|
||||
#include <asterisk/chanvars.h>
|
||||
#include <asterisk/logger.h>
|
||||
|
||||
struct ast_var_t *ast_var_assign(char *name, char *value)
|
||||
{
|
||||
int i;
|
||||
struct ast_var_t *var;
|
||||
|
||||
var=malloc(sizeof(struct ast_var_t));
|
||||
var = malloc(sizeof(struct ast_var_t));
|
||||
|
||||
if (var == NULL)
|
||||
{
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i=strlen(value);
|
||||
var->value=malloc(i+1);
|
||||
strncpy(var->value,value,i);
|
||||
var->value[i]='\0';
|
||||
i = strlen(value);
|
||||
var->value = malloc(i + 1);
|
||||
if (var->value == NULL)
|
||||
{
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
free(var);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strncpy(var->value, value, i);
|
||||
var->value[i] = '\0';
|
||||
|
||||
i=strlen(name);
|
||||
var->name=malloc(i+1);
|
||||
strncpy(var->name,name,i);
|
||||
var->name[i]='\0';
|
||||
return(var);
|
||||
i = strlen(name);
|
||||
var->name = malloc(i + 1);
|
||||
if (var->name == NULL)
|
||||
{
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
free(var->value);
|
||||
free(var);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strncpy(var->name, name, i);
|
||||
var->name[i] = '\0';
|
||||
|
||||
return var;
|
||||
}
|
||||
|
||||
void ast_var_delete(struct ast_var_t *var) {
|
||||
if (var!=NULL) {
|
||||
if (var->name!=NULL) free(var->name);
|
||||
if (var->value!=NULL) free(var->value);
|
||||
free(var);
|
||||
}
|
||||
void ast_var_delete(struct ast_var_t *var)
|
||||
{
|
||||
if (var == NULL) return;
|
||||
|
||||
if (var->name != NULL) free(var->name);
|
||||
if (var->value != NULL) free(var->value);
|
||||
|
||||
free(var);
|
||||
}
|
||||
|
||||
char *ast_var_name(struct ast_var_t *var) {
|
||||
return(var->name);
|
||||
char *ast_var_name(struct ast_var_t *var)
|
||||
{
|
||||
return (var != NULL ? var->name : NULL);
|
||||
}
|
||||
|
||||
char *ast_var_value(struct ast_var_t *var) {
|
||||
return(var->value);
|
||||
char *ast_var_value(struct ast_var_t *var)
|
||||
{
|
||||
return (var != NULL ? var->value : NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -49,3 +49,26 @@ mode=immediate
|
||||
;
|
||||
;msn=39907835
|
||||
;device => /dev/ttyI0
|
||||
|
||||
;===============
|
||||
; More complex ISDN example
|
||||
;
|
||||
; A single device which listens to 3 MSNs
|
||||
; the wildcard '*' can be used when all MSN's should be accepted.
|
||||
; (The incoming number can be used to go directly into the extension
|
||||
; with the matching number. I.e. if MSN 33 is called, (context,33)
|
||||
; will tried first, than (context,s) and finally (default,s).
|
||||
;
|
||||
;msn=50780020
|
||||
;incomingmsn=50780020,50780021,50780022
|
||||
;device => /dev/ttyI2
|
||||
;
|
||||
; two other devices, which are in group '1' and are used when an
|
||||
; outgoing dial used: exten => s,1,Dial,Modem/g1:1234|60|r
|
||||
; (we do not need more outgoing devices, since ISDN2 has only 2 channels.)
|
||||
; Lines can be in more than one group (1-31); comma seperated list.
|
||||
;
|
||||
group=1 ; group=1,2,3,9-12
|
||||
;msn=50780023
|
||||
;device => /dev/ttyI3
|
||||
;device => /dev/ttyI4
|
||||
|
@@ -1,13 +1,11 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# asterisk This shell script takes care of starting and stopping
|
||||
# asterisk (printer daemon).
|
||||
# asterisk This shell script takes care of starting and stopping Asterisk.
|
||||
#
|
||||
#
|
||||
# chkconfig: 2345 60 60
|
||||
# description: asterisk is the print daemon required for lpr to work properly. \
|
||||
# It is basically a server that arbitrates print jobs to printer(s).
|
||||
# description: Asterisk is the Linux based PBX
|
||||
# processname: asterisk
|
||||
# config: /etc/printcap
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
@@ -1,3 +1,16 @@
|
||||
/*
|
||||
* Asterisk -- A telephony toolkit for Linux.
|
||||
*
|
||||
* Channel Variables
|
||||
*
|
||||
* Copyright (C) 2002, Mark Spencer
|
||||
*
|
||||
* Mark Spencer <markster@linux-support.net>
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License
|
||||
*/
|
||||
|
||||
#ifndef _ASTERISK_CHANVARS_INCLUDE
|
||||
#define _ASTERISK_CHANVARS_INCLUDE
|
||||
|
||||
|
@@ -1,13 +1,11 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# asterisk This shell script takes care of starting and stopping
|
||||
# asterisk (printer daemon).
|
||||
# asterisk This shell script takes care of starting and stopping Asterisk.
|
||||
#
|
||||
#
|
||||
# chkconfig: 2345 60 60
|
||||
# description: asterisk is the print daemon required for lpr to work properly. \
|
||||
# It is basically a server that arbitrates print jobs to printer(s).
|
||||
# description: Asterisk is the Linux based PBX
|
||||
# processname: asterisk
|
||||
# config: /etc/printcap
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
Reference in New Issue
Block a user