[asterisk-commits] wedhorn: trunk r378634 - /trunk/channels/chan_skinny.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Jan 6 15:38:03 CST 2013
Author: wedhorn
Date: Sun Jan 6 15:37:59 2013
New Revision: 378634
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=378634
Log:
Skinny blob cleanup
Cleanup of red blobs in chan_skinny and possible other small formatting issues.
Review: https://reviewboard.asterisk.org/r/2262/
Modified:
trunk/channels/chan_skinny.c
Modified: trunk/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=378634&r1=378633&r2=378634
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Sun Jan 6 15:37:59 2013
@@ -1306,9 +1306,9 @@
char exten[AST_MAX_EXTENSION]; \
char context[AST_MAX_CONTEXT]; \
char language[MAX_LANGUAGE]; \
- char cid_num[AST_MAX_EXTENSION]; \
- char cid_name[AST_MAX_EXTENSION]; \
- char lastcallerid[AST_MAX_EXTENSION]; \
+ char cid_num[AST_MAX_EXTENSION]; \
+ char cid_name[AST_MAX_EXTENSION]; \
+ char lastcallerid[AST_MAX_EXTENSION]; \
int cfwdtype; \
char call_forward_all[AST_MAX_EXTENSION]; \
char call_forward_busy[AST_MAX_EXTENSION]; \
@@ -1366,15 +1366,15 @@
static struct skinny_line_options{
SKINNY_LINE_OPTIONS
} default_line_struct = {
- .callwaiting = 1,
+ .callwaiting = 1,
.transfer = 1,
- .mwiblink = 0,
- .dnd = 0,
- .hidecallerid = 0,
+ .mwiblink = 0,
+ .dnd = 0,
+ .hidecallerid = 0,
.amaflags = 0,
- .instance = 0,
- .directmedia = 0,
- .nat = 0,
+ .instance = 0,
+ .directmedia = 0,
+ .nat = 0,
.getforward = 0,
.prune = 0,
};
@@ -1474,15 +1474,15 @@
SKINNY_DEVICE_OPTIONS
} default_device_struct = {
.transfer = 1,
- .earlyrtp = 1,
- .callwaiting = 1,
- .mwiblink = 0,
- .dnd = 0,
+ .earlyrtp = 1,
+ .callwaiting = 1,
+ .mwiblink = 0,
+ .dnd = 0,
.prune = 0,
.hookstate = SKINNY_ONHOOK,
};
static struct skinny_device_options *default_device = &default_device_struct;
-
+
static AST_LIST_HEAD_STATIC(devices, skinny_device);
struct skinnysession {
@@ -1534,7 +1534,7 @@
.fixup = skinny_fixup,
.send_digit_begin = skinny_senddigit_begin,
.send_digit_end = skinny_senddigit_end,
- .bridge = ast_rtp_instance_bridge,
+ .bridge = ast_rtp_instance_bridge,
};
static int skinny_extensionstate_cb(char *context, char *id, struct ast_state_cb_info *info, void *data);
@@ -1613,7 +1613,7 @@
(btn++)->buttonDefinition = BT_NONE;
for (i = 0; i < 13; i++)
(btn++)->buttonDefinition = BT_SPEEDDIAL;
-
+
break;
case SKINNY_DEVICE_12SPPLUS:
case SKINNY_DEVICE_12SP:
@@ -1840,7 +1840,7 @@
{
struct skinny_subline *subline;
struct skinny_line *l;
-
+
AST_LIST_TRAVERSE(&d->lines, l, list){
AST_LIST_TRAVERSE(&l->sublines, subline, list){
if (subline->callid == callid) {
@@ -2052,7 +2052,7 @@
} else if (strcmp(newcontext, oldcontext)) {
stalecontext = oldcontext;
}
-
+
}
if (stalecontext)
ast_context_destroy(ast_context_find(stalecontext), "Skinny");
@@ -2360,11 +2360,11 @@
if (!sub || !sub->owner || !sub->line || !sub->line->device) {
return;
}
-
+
ast = sub->owner;
l = sub->line;
d = l->device;
-
+
if (sub->calldirection == SKINNY_INCOMING) {
fromname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, "");
fromnum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, "");
@@ -2395,11 +2395,11 @@
if (!sub || !sub->owner || !sub->line || !sub->line->device) {
return;
}
-
+
ast = sub->owner;
l = sub->line;
d = l->device;
-
+
if (sub->calldirection == SKINNY_INCOMING) {
fromname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, "");
fromnum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, "");
@@ -2917,10 +2917,10 @@
static void transmit_reset(struct skinny_device *d, int fullrestart)
{
struct skinny_req *req;
-
+
if (!(req = req_alloc(sizeof(struct reset_message), RESET_MESSAGE)))
return;
-
+
if (fullrestart)
req->data.reset.resetType = 2;
else
@@ -3152,7 +3152,7 @@
struct skinny_device *d = l->device;
struct skinny_line *l2;
int dev_msgs = 0;
-
+
if (!d || !d->session) {
return;
}
@@ -3242,7 +3242,7 @@
struct sockaddr_in them = { 0, };
struct ast_sockaddr them_tmp;
struct ast_sockaddr us_tmp;
-
+
sub = ast_channel_tech_pvt(c);
if (ast_channel_state(c) != AST_STATE_UP)
@@ -3441,7 +3441,7 @@
case CLI_GENERATE:
return NULL;
}
-
+
if (a->argc != e->args)
return CLI_SHOWUSAGE;
@@ -3483,7 +3483,7 @@
if (pos != 3)
return NULL;
-
+
AST_LIST_TRAVERSE(&devices, d, list) {
AST_LIST_TRAVERSE(&d->lines, l, list) {
if (!strncasecmp(word, l->name, wordlen) && ++which > state)
@@ -3521,7 +3521,7 @@
if (a->argc == 4 && !strcasecmp(a->argv[3], "restart"))
fullrestart = 1;
-
+
transmit_reset(d, fullrestart);
}
}
@@ -3702,7 +3702,7 @@
if (total)
*total = total_devices;
-
+
return CLI_SUCCESS;
}
@@ -3797,7 +3797,7 @@
}
AST_LIST_TRAVERSE(&d->addons, sa, list) {
numaddons++;
- }
+ }
ast_cli(fd, "Addons: %d\n", numaddons);
AST_LIST_TRAVERSE(&d->addons, sa, list) {
ast_cli(fd, " %s\n", sa->type);
@@ -3908,7 +3908,7 @@
}
if (!s) {
- ast_cli(fd, "Name Device Name Instance Label \n");
+ ast_cli(fd, "Name Device Name Instance Label \n");
ast_cli(fd, "-------------------- -------------------- -------- --------------------\n");
}
AST_LIST_LOCK(&lines);
@@ -4150,7 +4150,7 @@
}
}
}
-
+
AST_LIST_UNLOCK(&devices);
return CLI_SUCCESS;
}
@@ -4204,7 +4204,7 @@
return NULL;
case CLI_GENERATE:
return NULL;
- }
+ }
if (a->argc != 3)
return CLI_SHOWUSAGE;
@@ -4890,7 +4890,7 @@
} else {
sub->subline = NULL;
}
-
+
AST_LIST_INSERT_HEAD(&l->sub, sub, list);
//l->activesub = sub;
}
@@ -5125,7 +5125,7 @@
}
sub->substate = SUBSTATE_CONNECTED;
l->activesub = sub;
- return;
+ return;
case SUBSTATE_HOLD:
if (sub->substate != SUBSTATE_CONNECTED) {
ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_HOLD from %s (on call-%d)\n", substate2str(sub->substate), sub->callid);
@@ -5138,7 +5138,7 @@
transmit_callstate(d, l->instance, subline->callid, SKINNY_CALLREMOTEMULTILINE);
transmit_selectsoftkeys(d, l->instance, subline->callid, KEYDEF_SLACONNECTEDNOTACTIVE);
transmit_displaypromptstatus(d, "In Use", 0, l->instance, subline->callid);
-
+
sub->substate = SUBSTATE_HOLD;
ast_queue_control_data(sub->owner, AST_CONTROL_HOLD,
@@ -5195,7 +5195,7 @@
transmit_callstate(d, l->instance, sub->callid, SKINNY_ONHOOK);
transmit_clearpromptmessage(d, l->instance, sub->callid);
transmit_ringer_mode(d, SKINNY_RING_OFF);
- transmit_definetimedate(d);
+ transmit_definetimedate(d);
transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_OFF);
} else {
transmit_stop_tone(d, l->instance, sub->callid);
@@ -5252,9 +5252,9 @@
ast_channel_exten_set(c, sub->exten);
ast_copy_string(l->lastnumberdialed, sub->exten, sizeof(l->lastnumberdialed));
}
-
+
sub->substate = SUBSTATE_DIALING;
-
+
if (ast_pthread_create(&t, NULL, skinny_newcall, c)) {
ast_log(LOG_WARNING, "Unable to create new call thread: %s\n", strerror(errno));
ast_hangup(c);
@@ -5265,7 +5265,7 @@
ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_RINGOUT from %s (on call-%d)\n", substate2str(sub->substate), sub->callid);
return;
}
-
+
if (!d->earlyrtp) {
transmit_start_tone(d, SKINNY_ALERT, l->instance, sub->callid);
}
@@ -5287,7 +5287,7 @@
if (d->hookstate == SKINNY_ONHOOK) {
l->activesub = sub;
}
-
+
if (sub->substate != SUBSTATE_RINGIN || sub->substate != SUBSTATE_CALLWAIT) {
ast_setstate(c, AST_STATE_RINGING);
ast_queue_control(c, AST_CONTROL_RINGING);
@@ -5302,7 +5302,7 @@
send_callinfo(sub);
transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_BLINK);
transmit_start_tone(d, SKINNY_CALLWAITTONE, l->instance, sub->callid);
-
+
ast_setstate(c, AST_STATE_RINGING);
ast_queue_control(c, AST_CONTROL_RINGING);
sub->substate = SUBSTATE_CALLWAIT;
@@ -5421,7 +5421,7 @@
if (sub == l->activesub) {
d->hookstate = SKINNY_ONHOOK;
- transmit_speaker_mode(d, SKINNY_SPEAKEROFF);
+ transmit_speaker_mode(d, SKINNY_SPEAKEROFF);
if (sub->related) {
activate_sub = sub->related;
setsubstate(sub, SUBSTATE_ONHOOK);
@@ -5826,12 +5826,12 @@
} else {
c = sub->owner;
}
-
+
if (!c) {
ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n", l->name, d->name);
break;
}
-
+
sub = ast_channel_tech_pvt(c);
if (sub->substate == SUBSTATE_UNSET || sub->substate == SUBSTATE_OFFHOOK){
dialandactivatesub(sub, l->vmexten);
@@ -6082,13 +6082,13 @@
handle_transfer_button(sub);
return 0;
}
-
+
ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Skinny/%s", l->name);
-
+
dumpsub(sub, 0);
d->hookstate = SKINNY_ONHOOK;
-
+
/* Not ideal, but let's send updated time at onhook and offhook, as it clears the display */
transmit_definetimedate(d);
@@ -6384,10 +6384,9 @@
sub = ast_channel_tech_pvt(c);
dialandactivatesub(sub, req->data.enbloccallmessage.calledParty);
}
-
+
return 1;
}
-
static int handle_soft_key_event_message(struct skinny_req *req, struct skinnysession *s)
{
@@ -6586,7 +6585,7 @@
handle_transfer_button(sub);
return 0;
}
-
+
ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Skinny/%s", l->name);
if (sub) {
@@ -6599,7 +6598,7 @@
}
d->hookstate = SKINNY_ONHOOK;
-
+
/* Not ideal, but let's send updated time at onhook and offhook, as it clears the display */
transmit_definetimedate(d);
@@ -6866,14 +6865,14 @@
AST_LIST_TRAVERSE_SAFE_BEGIN(&sessions, cur, list) {
if (cur == s) {
AST_LIST_REMOVE_CURRENT(list);
- if (s->fd > -1)
+ if (s->fd > -1)
close(s->fd);
-
+
if (!s->device)
ast_atomic_fetchadd_int(&unauth_sessions, -1);
ast_mutex_destroy(&s->lock);
-
+
ast_free(s);
}
}
@@ -7150,45 +7149,45 @@
return tmpc;
}
- #define TYPE_GENERAL 1
- #define TYPE_DEF_DEVICE 2
- #define TYPE_DEF_LINE 4
- #define TYPE_DEVICE 8
- #define TYPE_LINE 16
-
- #define CLINE_OPTS ((struct skinny_line_options *)item)
- #define CLINE ((struct skinny_line *)item)
- #define CDEV_OPTS ((struct skinny_device_options *)item)
- #define CDEV ((struct skinny_device *)item)
-
- static void config_parse_variables(int type, void *item, struct ast_variable *vptr)
- {
- struct ast_variable *v;
- int lineInstance = 1;
- int speeddialInstance = 1;
-
- while(vptr) {
- v = vptr;
- vptr = vptr->next;
-
- if (type & (TYPE_GENERAL)) {
- char newcontexts[AST_MAX_CONTEXT];
+#define TYPE_GENERAL 1
+#define TYPE_DEF_DEVICE 2
+#define TYPE_DEF_LINE 4
+#define TYPE_DEVICE 8
+#define TYPE_LINE 16
+
+#define CLINE_OPTS ((struct skinny_line_options *)item)
+#define CLINE ((struct skinny_line *)item)
+#define CDEV_OPTS ((struct skinny_device_options *)item)
+#define CDEV ((struct skinny_device *)item)
+
+static void config_parse_variables(int type, void *item, struct ast_variable *vptr)
+{
+ struct ast_variable *v;
+ int lineInstance = 1;
+ int speeddialInstance = 1;
+
+ while(vptr) {
+ v = vptr;
+ vptr = vptr->next;
+
+ if (type & (TYPE_GENERAL)) {
+ char newcontexts[AST_MAX_CONTEXT];
char oldcontexts[AST_MAX_CONTEXT];
- char *stringp, *context, *oldregcontext;
- if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
- v = v->next;
- continue;
- }
- if (!strcasecmp(v->name, "bindaddr")) {
- if (!(hp = ast_gethostbyname(v->value, &ahp))) {
- ast_log(LOG_WARNING, "Invalid address: %s\n", v->value);
- } else {
- memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr));
- }
- continue;
- } else if (!strcasecmp(v->name, "keepalive")) {
- keep_alive = atoi(v->value);
- continue;
+ char *stringp, *context, *oldregcontext;
+ if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
+ v = v->next;
+ continue;
+ }
+ if (!strcasecmp(v->name, "bindaddr")) {
+ if (!(hp = ast_gethostbyname(v->value, &ahp))) {
+ ast_log(LOG_WARNING, "Invalid address: %s\n", v->value);
+ } else {
+ memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr));
+ }
+ continue;
+ } else if (!strcasecmp(v->name, "keepalive")) {
+ keep_alive = atoi(v->value);
+ continue;
} else if (!strcasecmp(v->name, "authtimeout")) {
int timeout = atoi(v->value);
@@ -7209,174 +7208,174 @@
auth_limit = limit;
}
continue;
- } else if (!strcasecmp(v->name, "regcontext")) {
- ast_copy_string(newcontexts, v->value, sizeof(newcontexts));
- stringp = newcontexts;
+ } else if (!strcasecmp(v->name, "regcontext")) {
+ ast_copy_string(newcontexts, v->value, sizeof(newcontexts));
+ stringp = newcontexts;
/* Initialize copy of current global_regcontext for later use in removing stale contexts */
ast_copy_string(oldcontexts, regcontext, sizeof(oldcontexts));
oldregcontext = oldcontexts;
- /* Let's remove any contexts that are no longer defined in regcontext */
- cleanup_stale_contexts(stringp, oldregcontext);
- /* Create contexts if they don't exist already */
- while ((context = strsep(&stringp, "&"))) {
- ast_copy_string(used_context, context, sizeof(used_context));
- ast_context_find_or_create(NULL, NULL, context, "Skinny");
- }
- ast_copy_string(regcontext, v->value, sizeof(regcontext));
- continue;
- } else if (!strcasecmp(v->name, "vmexten")) {
- ast_copy_string(vmexten, v->value, sizeof(vmexten));
- continue;
- } else if (!strcasecmp(v->name, "dateformat")) {
- memcpy(date_format, v->value, sizeof(date_format));
- continue;
- } else if (!strcasecmp(v->name, "tos")) {
- if (ast_str2tos(v->value, &qos.tos))
- ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
- continue;
- } else if (!strcasecmp(v->name, "tos_audio")) {
- if (ast_str2tos(v->value, &qos.tos_audio))
- ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
- continue;
- } else if (!strcasecmp(v->name, "tos_video")) {
- if (ast_str2tos(v->value, &qos.tos_video))
- ast_log(LOG_WARNING, "Invalid tos_video value at line %d, refer to QoS documentation\n", v->lineno);
- continue;
- } else if (!strcasecmp(v->name, "cos")) {
- if (ast_str2cos(v->value, &qos.cos))
- ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
- continue;
- } else if (!strcasecmp(v->name, "cos_audio")) {
- if (ast_str2cos(v->value, &qos.cos_audio))
- ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
- continue;
- } else if (!strcasecmp(v->name, "cos_video")) {
- if (ast_str2cos(v->value, &qos.cos_video))
- ast_log(LOG_WARNING, "Invalid cos_video value at line %d, refer to QoS documentation\n", v->lineno);
- continue;
- } else if (!strcasecmp(v->name, "bindport")) {
- if (sscanf(v->value, "%5d", &ourport) == 1) {
- bindaddr.sin_port = htons(ourport);
- } else {
- ast_log(LOG_WARNING, "Invalid bindport '%s' at line %d of %s\n", v->value, v->lineno, config);
- }
- continue;
- } else if (!strcasecmp(v->name, "allow")) {
- ast_parse_allow_disallow(&default_prefs, default_cap, v->value, 1);
- continue;
- } else if (!strcasecmp(v->name, "disallow")) {
- ast_parse_allow_disallow(&default_prefs, default_cap, v->value, 0);
- continue;
- }
- }
-
- if (!strcasecmp(v->name, "transfer")) {
- if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
- CDEV_OPTS->transfer = ast_true(v->value);
- continue;
- } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- CLINE_OPTS->transfer = ast_true(v->value);
- continue;
- }
- } else if (!strcasecmp(v->name, "callwaiting")) {
- if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
- CDEV_OPTS->callwaiting = ast_true(v->value);
- continue;
- } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- CLINE_OPTS->callwaiting = ast_true(v->value);
- continue;
- }
- } else if (!strcasecmp(v->name, "directmedia") || !strcasecmp(v->name, "canreinvite")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- CLINE_OPTS->directmedia = ast_true(v->value);
- continue;
- }
- } else if (!strcasecmp(v->name, "nat")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- CLINE_OPTS->nat = ast_true(v->value);
- continue;
- }
- } else if (!strcasecmp(v->name, "context")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->context, v->value, sizeof(CLINE_OPTS->context));
- continue;
- }
- }else if (!strcasecmp(v->name, "vmexten")) {
- if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
- ast_copy_string(CDEV_OPTS->vmexten, v->value, sizeof(CDEV_OPTS->vmexten));
- continue;
- } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->vmexten, v->value, sizeof(CLINE_OPTS->vmexten));
- continue;
- }
- } else if (!strcasecmp(v->name, "mwiblink")) {
- if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
- CDEV_OPTS->mwiblink = ast_true(v->value);
- continue;
- } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- CLINE_OPTS->mwiblink = ast_true(v->value);
- continue;
- }
- } else if (!strcasecmp(v->name, "linelabel")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->label, v->value, sizeof(CLINE_OPTS->label));
- continue;
- }
- } else if (!strcasecmp(v->name, "callerid")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- if (!strcasecmp(v->value, "asreceived")) {
- CLINE_OPTS->cid_num[0] = '\0';
- CLINE_OPTS->cid_name[0] = '\0';
- } else {
- ast_callerid_split(v->value, CLINE_OPTS->cid_name, sizeof(CLINE_OPTS->cid_name), CLINE_OPTS->cid_num, sizeof(CLINE_OPTS->cid_num));
- }
- continue;
- }
- } else if (!strcasecmp(v->name, "amaflags")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- int tempamaflags = ast_cdr_amaflags2int(v->value);
- if (tempamaflags < 0) {
- ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d\n", v->value, v->lineno);
- } else {
- CLINE_OPTS->amaflags = tempamaflags;
- }
- continue;
- }
- } else if (!strcasecmp(v->name, "regexten")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->regexten, v->value, sizeof(CLINE_OPTS->regexten));
- continue;
- }
- } else if (!strcasecmp(v->name, "language")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->language, v->value, sizeof(CLINE_OPTS->language));
- continue;
- }
- } else if (!strcasecmp(v->name, "accountcode")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->accountcode, v->value, sizeof(CLINE_OPTS->accountcode));
- continue;
- }
- } else if (!strcasecmp(v->name, "mohinterpret") || !strcasecmp(v->name, "musiconhold")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->mohinterpret, v->value, sizeof(CLINE_OPTS->mohinterpret));
- continue;
- }
- } else if (!strcasecmp(v->name, "mohsuggest")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->mohsuggest, v->value, sizeof(CLINE_OPTS->mohsuggest));
- continue;
- }
- } else if (!strcasecmp(v->name, "callgroup")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- CLINE_OPTS->callgroup = ast_get_group(v->value);
- continue;
- }
- } else if (!strcasecmp(v->name, "pickupgroup")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- CLINE_OPTS->pickupgroup = ast_get_group(v->value);
- continue;
- }
+ /* Let's remove any contexts that are no longer defined in regcontext */
+ cleanup_stale_contexts(stringp, oldregcontext);
+ /* Create contexts if they don't exist already */
+ while ((context = strsep(&stringp, "&"))) {
+ ast_copy_string(used_context, context, sizeof(used_context));
+ ast_context_find_or_create(NULL, NULL, context, "Skinny");
+ }
+ ast_copy_string(regcontext, v->value, sizeof(regcontext));
+ continue;
+ } else if (!strcasecmp(v->name, "vmexten")) {
+ ast_copy_string(vmexten, v->value, sizeof(vmexten));
+ continue;
+ } else if (!strcasecmp(v->name, "dateformat")) {
+ memcpy(date_format, v->value, sizeof(date_format));
+ continue;
+ } else if (!strcasecmp(v->name, "tos")) {
+ if (ast_str2tos(v->value, &qos.tos))
+ ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
+ continue;
+ } else if (!strcasecmp(v->name, "tos_audio")) {
+ if (ast_str2tos(v->value, &qos.tos_audio))
+ ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
+ continue;
+ } else if (!strcasecmp(v->name, "tos_video")) {
+ if (ast_str2tos(v->value, &qos.tos_video))
+ ast_log(LOG_WARNING, "Invalid tos_video value at line %d, refer to QoS documentation\n", v->lineno);
+ continue;
+ } else if (!strcasecmp(v->name, "cos")) {
+ if (ast_str2cos(v->value, &qos.cos))
+ ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
+ continue;
+ } else if (!strcasecmp(v->name, "cos_audio")) {
+ if (ast_str2cos(v->value, &qos.cos_audio))
+ ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
+ continue;
+ } else if (!strcasecmp(v->name, "cos_video")) {
+ if (ast_str2cos(v->value, &qos.cos_video))
+ ast_log(LOG_WARNING, "Invalid cos_video value at line %d, refer to QoS documentation\n", v->lineno);
+ continue;
+ } else if (!strcasecmp(v->name, "bindport")) {
+ if (sscanf(v->value, "%5d", &ourport) == 1) {
+ bindaddr.sin_port = htons(ourport);
+ } else {
+ ast_log(LOG_WARNING, "Invalid bindport '%s' at line %d of %s\n", v->value, v->lineno, config);
+ }
+ continue;
+ } else if (!strcasecmp(v->name, "allow")) {
+ ast_parse_allow_disallow(&default_prefs, default_cap, v->value, 1);
+ continue;
+ } else if (!strcasecmp(v->name, "disallow")) {
+ ast_parse_allow_disallow(&default_prefs, default_cap, v->value, 0);
+ continue;
+ }
+ }
+
+ if (!strcasecmp(v->name, "transfer")) {
+ if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
+ CDEV_OPTS->transfer = ast_true(v->value);
+ continue;
+ } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ CLINE_OPTS->transfer = ast_true(v->value);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "callwaiting")) {
+ if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
+ CDEV_OPTS->callwaiting = ast_true(v->value);
+ continue;
+ } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ CLINE_OPTS->callwaiting = ast_true(v->value);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "directmedia") || !strcasecmp(v->name, "canreinvite")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ CLINE_OPTS->directmedia = ast_true(v->value);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "nat")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ CLINE_OPTS->nat = ast_true(v->value);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "context")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->context, v->value, sizeof(CLINE_OPTS->context));
+ continue;
+ }
+ }else if (!strcasecmp(v->name, "vmexten")) {
+ if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
+ ast_copy_string(CDEV_OPTS->vmexten, v->value, sizeof(CDEV_OPTS->vmexten));
+ continue;
+ } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->vmexten, v->value, sizeof(CLINE_OPTS->vmexten));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "mwiblink")) {
+ if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
+ CDEV_OPTS->mwiblink = ast_true(v->value);
+ continue;
+ } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ CLINE_OPTS->mwiblink = ast_true(v->value);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "linelabel")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->label, v->value, sizeof(CLINE_OPTS->label));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "callerid")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ if (!strcasecmp(v->value, "asreceived")) {
+ CLINE_OPTS->cid_num[0] = '\0';
+ CLINE_OPTS->cid_name[0] = '\0';
+ } else {
+ ast_callerid_split(v->value, CLINE_OPTS->cid_name, sizeof(CLINE_OPTS->cid_name), CLINE_OPTS->cid_num, sizeof(CLINE_OPTS->cid_num));
+ }
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "amaflags")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ int tempamaflags = ast_cdr_amaflags2int(v->value);
+ if (tempamaflags < 0) {
+ ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d\n", v->value, v->lineno);
+ } else {
+ CLINE_OPTS->amaflags = tempamaflags;
+ }
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "regexten")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->regexten, v->value, sizeof(CLINE_OPTS->regexten));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "language")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->language, v->value, sizeof(CLINE_OPTS->language));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "accountcode")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->accountcode, v->value, sizeof(CLINE_OPTS->accountcode));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "mohinterpret") || !strcasecmp(v->name, "musiconhold")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->mohinterpret, v->value, sizeof(CLINE_OPTS->mohinterpret));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "mohsuggest")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->mohsuggest, v->value, sizeof(CLINE_OPTS->mohsuggest));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "callgroup")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ CLINE_OPTS->callgroup = ast_get_group(v->value);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "pickupgroup")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ CLINE_OPTS->pickupgroup = ast_get_group(v->value);
+ continue;
+ }
} else if (!strcasecmp(v->name, "namedcallgroup")) {
if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
CLINE_OPTS->named_callgroups = ast_get_namedgroups(v->value);
@@ -7387,103 +7386,103 @@
CLINE_OPTS->named_pickupgroups = ast_get_namedgroups(v->value);
continue;
}
- } else if (!strcasecmp(v->name, "immediate")) {
- if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE | TYPE_DEF_LINE | TYPE_LINE)) {
- CLINE_OPTS->immediate = ast_true(v->value);
- continue;
- }
- } else if (!strcasecmp(v->name, "cancallforward")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- CLINE_OPTS->cancallforward = ast_true(v->value);
- continue;
- }
- } else if (!strcasecmp(v->name, "mailbox")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->mailbox, v->value, sizeof(CLINE_OPTS->mailbox));
- continue;
- }
- } else if ( !strcasecmp(v->name, "parkinglot")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->parkinglot, v->value, sizeof(CLINE_OPTS->parkinglot));
- continue;
- }
- } else if (!strcasecmp(v->name, "hasvoicemail")) {
- if (type & (TYPE_LINE)) {
- if (ast_true(v->value) && ast_strlen_zero(CLINE->mailbox)) {
- ast_copy_string(CLINE->mailbox, CLINE->name, sizeof(CLINE->mailbox));
- }
- continue;
- }
- } else if (!strcasecmp(v->name, "threewaycalling")) {
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- CLINE_OPTS->threewaycalling = ast_true(v->value);
- continue;
- }
- } else if (!strcasecmp(v->name, "setvar")) {
- if (type & (TYPE_LINE)) {
- CLINE->chanvars = add_var(v->value, CLINE->chanvars);
- continue;
- }
- } else if (!strcasecmp(v->name, "earlyrtp")) {
- if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
- CDEV_OPTS->earlyrtp = ast_true(v->value);
- continue;
- }
- } else if (!strcasecmp(v->name, "host")) {
- if (type & (TYPE_DEVICE)) {
+ } else if (!strcasecmp(v->name, "immediate")) {
+ if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE | TYPE_DEF_LINE | TYPE_LINE)) {
+ CLINE_OPTS->immediate = ast_true(v->value);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "cancallforward")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ CLINE_OPTS->cancallforward = ast_true(v->value);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "mailbox")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->mailbox, v->value, sizeof(CLINE_OPTS->mailbox));
+ continue;
+ }
+ } else if ( !strcasecmp(v->name, "parkinglot")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->parkinglot, v->value, sizeof(CLINE_OPTS->parkinglot));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "hasvoicemail")) {
+ if (type & (TYPE_LINE)) {
+ if (ast_true(v->value) && ast_strlen_zero(CLINE->mailbox)) {
+ ast_copy_string(CLINE->mailbox, CLINE->name, sizeof(CLINE->mailbox));
+ }
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "threewaycalling")) {
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ CLINE_OPTS->threewaycalling = ast_true(v->value);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "setvar")) {
+ if (type & (TYPE_LINE)) {
+ CLINE->chanvars = add_var(v->value, CLINE->chanvars);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "earlyrtp")) {
+ if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
+ CDEV_OPTS->earlyrtp = ast_true(v->value);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "host")) {
+ if (type & (TYPE_DEVICE)) {
struct ast_sockaddr CDEV_addr_tmp;
CDEV_addr_tmp.ss.ss_family = AF_INET;
if (ast_get_ip(&CDEV_addr_tmp, v->value)) {
- ast_log(LOG_WARNING, "Bad IP '%s' at line %d.\n", v->value, v->lineno);
- }
+ ast_log(LOG_WARNING, "Bad IP '%s' at line %d.\n", v->value, v->lineno);
+ }
ast_sockaddr_to_sin(&CDEV_addr_tmp,
&CDEV->addr);
- continue;
- }
- } else if (!strcasecmp(v->name, "port")) {
- if (type & (TYPE_DEF_DEVICE)) {
- CDEV->addr.sin_port = htons(atoi(v->value));
- continue;
- }
- } else if (!strcasecmp(v->name, "device")) {
- if (type & (TYPE_DEVICE)) {
- ast_copy_string(CDEV_OPTS->id, v->value, sizeof(CDEV_OPTS->id));
- continue;
- }
- } else if (!strcasecmp(v->name, "permit") || !strcasecmp(v->name, "deny")) {
- if (type & (TYPE_DEVICE)) {
- CDEV->ha = ast_append_ha(v->name, v->value, CDEV->ha, NULL);
- continue;
- }
- } else if (!strcasecmp(v->name, "allow")) {
- if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
- ast_parse_allow_disallow(&CDEV->confprefs, CDEV->confcap, v->value, 1);
- continue;
- }
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_parse_allow_disallow(&CLINE->confprefs, CLINE->confcap, v->value, 1);
- continue;
- }
- } else if (!strcasecmp(v->name, "disallow")) {
- if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
- ast_parse_allow_disallow(&CDEV->confprefs, CDEV->confcap, v->value, 0);
- continue;
- }
- if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
- ast_parse_allow_disallow(&CLINE->confprefs, CLINE->confcap, v->value, 0);
- continue;
- }
- } else if (!strcasecmp(v->name, "version")) {
- if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
- ast_copy_string(CDEV_OPTS->version_id, v->value, sizeof(CDEV_OPTS->version_id));
- continue;
- }
- } else if (!strcasecmp(v->name, "line")) {
- if (type & (TYPE_DEVICE)) {
- struct skinny_line *l;
- AST_LIST_TRAVERSE(&lines, l, all) {
- if (!strcasecmp(v->value, l->name) && !l->prune) {
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "port")) {
+ if (type & (TYPE_DEF_DEVICE)) {
+ CDEV->addr.sin_port = htons(atoi(v->value));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "device")) {
+ if (type & (TYPE_DEVICE)) {
+ ast_copy_string(CDEV_OPTS->id, v->value, sizeof(CDEV_OPTS->id));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "permit") || !strcasecmp(v->name, "deny")) {
+ if (type & (TYPE_DEVICE)) {
+ CDEV->ha = ast_append_ha(v->name, v->value, CDEV->ha, NULL);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "allow")) {
+ if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
+ ast_parse_allow_disallow(&CDEV->confprefs, CDEV->confcap, v->value, 1);
+ continue;
+ }
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_parse_allow_disallow(&CLINE->confprefs, CLINE->confcap, v->value, 1);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "disallow")) {
+ if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
+ ast_parse_allow_disallow(&CDEV->confprefs, CDEV->confcap, v->value, 0);
+ continue;
+ }
+ if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
+ ast_parse_allow_disallow(&CLINE->confprefs, CLINE->confcap, v->value, 0);
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "version")) {
+ if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
+ ast_copy_string(CDEV_OPTS->version_id, v->value, sizeof(CDEV_OPTS->version_id));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "line")) {
+ if (type & (TYPE_DEVICE)) {
+ struct skinny_line *l;
+ AST_LIST_TRAVERSE(&lines, l, all) {
+ if (!strcasecmp(v->value, l->name) && !l->prune) {
/* FIXME: temp solution about line conflicts */
struct skinny_device *d;
@@ -7505,28 +7504,28 @@
AST_LIST_INSERT_HEAD(&CDEV->lines, l, list);
l->device = CDEV;
}
- break;
- }
- }
- continue;
- }
- } else if (!strcasecmp(v->name, "subline")) {
- if (type & (TYPE_LINE)) {
- struct skinny_subline *subline;
- struct skinny_container *container;
+ break;
+ }
+ }
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "subline")) {
+ if (type & (TYPE_LINE)) {
+ struct skinny_subline *subline;
+ struct skinny_container *container;
char buf[256];
char *stringp = buf, *exten, *stname, *context;
- if (!(subline = ast_calloc(1, sizeof(*subline)))) {
- ast_log(LOG_WARNING, "Unable to allocate memory for subline %s. Ignoring subline.\n", v->value);
- continue;
- }
- if (!(container = ast_calloc(1, sizeof(*container)))) {
- ast_log(LOG_WARNING, "Unable to allocate memory for subline %s container. Ignoring subline.\n", v->value);
+ if (!(subline = ast_calloc(1, sizeof(*subline)))) {
+ ast_log(LOG_WARNING, "Unable to allocate memory for subline %s. Ignoring subline.\n", v->value);
+ continue;
+ }
+ if (!(container = ast_calloc(1, sizeof(*container)))) {
+ ast_log(LOG_WARNING, "Unable to allocate memory for subline %s container. Ignoring subline.\n", v->value);
ast_free(subline);
- continue;
- }
-
+ continue;
+ }
+
ast_copy_string(buf, v->value, sizeof(buf));
exten = strsep(&stringp, "@");
ast_copy_string(subline->exten, ast_strip(exten), sizeof(subline->exten));
@@ -7544,34 +7543,34 @@
container->data = subline;
subline->container = container;
AST_LIST_INSERT_HEAD(&CLINE->sublines, subline, list);
- continue;
- }
- } else if (!strcasecmp(v->name, "dialoutcontext")) {
- if (type & (TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->dialoutcontext, v->value, sizeof(CLINE_OPTS->dialoutcontext));
continue;
}
- } else if (!strcasecmp(v->name, "dialoutexten")) {
- if (type & (TYPE_LINE)) {
- ast_copy_string(CLINE_OPTS->dialoutexten, v->value, sizeof(CLINE_OPTS->dialoutexten));
+ } else if (!strcasecmp(v->name, "dialoutcontext")) {
+ if (type & (TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->dialoutcontext, v->value, sizeof(CLINE_OPTS->dialoutcontext));
continue;
}
- } else if (!strcasecmp(v->name, "speeddial")) {
- if (type & (TYPE_DEVICE)) {
- struct skinny_speeddial *sd;
- struct skinny_container *container;
+ } else if (!strcasecmp(v->name, "dialoutexten")) {
+ if (type & (TYPE_LINE)) {
+ ast_copy_string(CLINE_OPTS->dialoutexten, v->value, sizeof(CLINE_OPTS->dialoutexten));
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "speeddial")) {
+ if (type & (TYPE_DEVICE)) {
+ struct skinny_speeddial *sd;
+ struct skinny_container *container;
char buf[256];
char *stringp = buf, *exten, *context, *label;
- if (!(sd = ast_calloc(1, sizeof(*sd)))) {
- ast_log(LOG_WARNING, "Unable to allocate memory for speeddial %s. Ignoring speeddial.\n", v->name);
- continue;
- }
- if (!(container = ast_calloc(1, sizeof(*container)))) {
- ast_log(LOG_WARNING, "Unable to allocate memory for speeddial %s container. Ignoring speeddial.\n", v->name);
+ if (!(sd = ast_calloc(1, sizeof(*sd)))) {
+ ast_log(LOG_WARNING, "Unable to allocate memory for speeddial %s. Ignoring speeddial.\n", v->name);
+ continue;
+ }
+ if (!(container = ast_calloc(1, sizeof(*container)))) {
+ ast_log(LOG_WARNING, "Unable to allocate memory for speeddial %s container. Ignoring speeddial.\n", v->name);
ast_free(sd);
- continue;
- }
+ continue;
+ }
ast_copy_string(buf, v->value, sizeof(buf));
exten = strsep(&stringp, ",");
@@ -7596,146 +7595,146 @@
container->data = sd;
sd->container = container;
AST_LIST_INSERT_HEAD(&CDEV->speeddials, sd, list);
- continue;
- }
- } else if (!strcasecmp(v->name, "addon")) {
- if (type & (TYPE_DEVICE)) {
- struct skinny_addon *a;
- if (!(a = ast_calloc(1, sizeof(*a)))) {
- ast_log(LOG_WARNING, "Unable to allocate memory for addon %s. Ignoring addon.\n", v->name);
- continue;
- } else {
- ast_mutex_init(&a->lock);
- ast_copy_string(a->type, v->value, sizeof(a->type));
- AST_LIST_INSERT_HEAD(&CDEV->addons, a, list);
- }
- continue;
- }
-
- } else {
- ast_log(LOG_WARNING, "Don't know keyword '%s' at line %d\n", v->name, v->lineno);
- continue;
- }
- ast_log(LOG_WARNING, "Invalid category used: %s at line %d\n", v->name, v->lineno);
- }
- }
-
- static struct skinny_line *config_line(const char *lname, struct ast_variable *v)
- {
- struct skinny_line *l, *temp;
+ continue;
+ }
+ } else if (!strcasecmp(v->name, "addon")) {
+ if (type & (TYPE_DEVICE)) {
+ struct skinny_addon *a;
+ if (!(a = ast_calloc(1, sizeof(*a)))) {
+ ast_log(LOG_WARNING, "Unable to allocate memory for addon %s. Ignoring addon.\n", v->name);
+ continue;
+ } else {
+ ast_mutex_init(&a->lock);
+ ast_copy_string(a->type, v->value, sizeof(a->type));
+ AST_LIST_INSERT_HEAD(&CDEV->addons, a, list);
+ }
+ continue;
+ }
+
+ } else {
+ ast_log(LOG_WARNING, "Don't know keyword '%s' at line %d\n", v->name, v->lineno);
+ continue;
+ }
+ ast_log(LOG_WARNING, "Invalid category used: %s at line %d\n", v->name, v->lineno);
+ }
+}
+
+static struct skinny_line *config_line(const char *lname, struct ast_variable *v)
+{
+ struct skinny_line *l, *temp;
int update = 0;
struct skinny_container *container;
-
[... 314 lines stripped ...]
More information about the asterisk-commits
mailing list