aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-17 22:45:50 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-17 22:45:50 +0000
commitcb94645753b4477cd2d259fb7b866a16196adc49 (patch)
tree2d5f01ac995d23694161ca3dff2b78bfe21d137a /channels/chan_dahdi.c
parent106b8fe198c7683bc5a74edc783df187ed608a7c (diff)
Merged revisions 131868 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r131868 | jpeeler | 2008-07-17 17:40:00 -0500 (Thu, 17 Jul 2008) | 6 lines Add configuration option to chan_dahdi.conf to allow buffering policy and number of buffers to be configured per channel. Syntax: buffers=<num of buffers>,<policy> Where the number of buffers is some non-negative integer and the policy is either "full", "half", or "immediate". ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@131869 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c52
1 files changed, 35 insertions, 17 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 4f4ed4768..8e0743e17 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -507,6 +507,8 @@ static struct dahdi_pvt {
struct dahdi_pvt *master; /*!< Master to us (we follow their conferencing) */
int inconference; /*!< If our real should be in the conference */
+ int buf_no; /*!< Number of buffers */
+ int buf_policy; /*!< Buffer policy */
int sig; /*!< Signalling style */
int radio; /*!< radio type */
int outsigmod; /*!< Outbound Signalling style (modifier) */
@@ -794,7 +796,10 @@ static struct dahdi_chan_conf dahdi_chan_conf_default(void) {
.polarityonanswerdelay = 600,
- .sendcalleridafter = DEFAULT_CIDRINGS
+ .sendcalleridafter = DEFAULT_CIDRINGS,
+
+ .buf_policy = DAHDI_POLICY_IMMEDIATE,
+ .buf_no = numbufs
},
.timing = {
.prewinktime = -1,
@@ -1146,9 +1151,9 @@ static int alloc_sub(struct dahdi_pvt *p, int x)
res = ioctl(p->subs[x].zfd, DAHDI_GET_BUFINFO, &bi);
if (!res) {
- bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
- bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
- bi.numbufs = numbufs;
+ bi.txbufpolicy = p->buf_policy;
+ bi.rxbufpolicy = p->buf_policy;
+ bi.numbufs = p->buf_no;
res = ioctl(p->subs[x].zfd, DAHDI_SET_BUFINFO, &bi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on channel %d: %s\n", x, strerror(errno));
@@ -8392,9 +8397,9 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
memset(&bi, 0, sizeof(bi));
res = ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_GET_BUFINFO, &bi);
if (!res) {
- bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
- bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
- bi.numbufs = numbufs;
+ bi.txbufpolicy = conf->chan.buf_policy;
+ bi.rxbufpolicy = conf->chan.buf_policy;
+ bi.numbufs = conf->chan.buf_no;
res = ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_SET_BUFINFO, &bi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on channel %d: %s\n", channel, strerror(errno));
@@ -8747,9 +8752,9 @@ static struct dahdi_pvt *chandup(struct dahdi_pvt *src)
}
res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_GET_BUFINFO, &bi);
if (!res) {
- bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
- bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
- bi.numbufs = numbufs;
+ bi.txbufpolicy = src->buf_policy;
+ bi.rxbufpolicy = src->buf_policy;
+ bi.numbufs = src->buf_no;
res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_SET_BUFINFO, &bi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on dup channel: %s\n", strerror(errno));
@@ -13565,7 +13570,7 @@ static void process_echocancel(struct dahdi_chan_conf *confp, const char *data,
static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v, int reload, int skipchannels)
{
struct dahdi_pvt *tmp;
- const char *ringc; /* temporary string for parsing the dring number. */
+ const char *tempstr; /* temporary string for parsing the dring number, buffers policy */
int y;
int found_pseudo = 0;
char dahdichan[MAX_CHANLIST_LEN] = {};
@@ -13586,6 +13591,19 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
iscrv = !strcasecmp(v->name, "crv");
if (build_channels(confp, iscrv, v->value, reload, v->lineno, &found_pseudo))
return -1;
+ } else if (!strcasecmp(v->name, "buffers")) {
+ char policy[8];
+ tempstr = v->value;
+ sscanf(tempstr, "%d,%s", &confp->chan.buf_no, policy);
+ if (confp->chan.buf_no < 0)
+ confp->chan.buf_no = numbufs;
+ if (!strcasecmp(policy, "full")) {
+ confp->chan.buf_policy = DAHDI_POLICY_WHEN_FULL;
+ } else if (!strcasecmp(policy, "half")) {
+ confp->chan.buf_policy = DAHDI_POLICY_IMMEDIATE /*HALF_FULL*/;
+ } else {
+ confp->chan.buf_policy = DAHDI_POLICY_IMMEDIATE;
+ }
} else if (!strcasecmp(v->name, "dahdichan")) {
ast_copy_string(dahdichan, v->value, sizeof(dahdichan));
} else if (!strcasecmp(v->name, "usedistinctiveringdetection")) {
@@ -13605,14 +13623,14 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
} else if (!strcasecmp(v->name, "dring3range")) {
confp->chan.drings.ringnum[2].range = atoi(v->value);
} else if (!strcasecmp(v->name, "dring1")) {
- ringc = v->value;
- sscanf(ringc, "%d,%d,%d", &confp->chan.drings.ringnum[0].ring[0], &confp->chan.drings.ringnum[0].ring[1], &confp->chan.drings.ringnum[0].ring[2]);
+ tempstr = v->value;
+ sscanf(tempstr, "%d,%d,%d", &confp->chan.drings.ringnum[0].ring[0], &confp->chan.drings.ringnum[0].ring[1], &confp->chan.drings.ringnum[0].ring[2]);
} else if (!strcasecmp(v->name, "dring2")) {
- ringc = v->value;
- sscanf(ringc,"%d,%d,%d", &confp->chan.drings.ringnum[1].ring[0], &confp->chan.drings.ringnum[1].ring[1], &confp->chan.drings.ringnum[1].ring[2]);
+ tempstr = v->value;
+ sscanf(tempstr,"%d,%d,%d", &confp->chan.drings.ringnum[1].ring[0], &confp->chan.drings.ringnum[1].ring[1], &confp->chan.drings.ringnum[1].ring[2]);
} else if (!strcasecmp(v->name, "dring3")) {
- ringc = v->value;
- sscanf(ringc, "%d,%d,%d", &confp->chan.drings.ringnum[2].ring[0], &confp->chan.drings.ringnum[2].ring[1], &confp->chan.drings.ringnum[2].ring[2]);
+ tempstr = v->value;
+ sscanf(tempstr, "%d,%d,%d", &confp->chan.drings.ringnum[2].ring[0], &confp->chan.drings.ringnum[2].ring[1], &confp->chan.drings.ringnum[2].ring[2]);
} else if (!strcasecmp(v->name, "usecallerid")) {
confp->chan.use_callerid = ast_true(v->value);
} else if (!strcasecmp(v->name, "cidsignalling")) {