diff -Nru a/apps/app_queue.c b/apps/app_queue.c --- a/apps/app_queue.c 2005-01-08 11:27:54 -07:00 +++ b/apps/app_queue.c 2005-01-08 11:27:54 -07:00 @@ -256,6 +256,7 @@ /* Queue strategy things */ int rrpos; /* Round Robin - position */ int memberdelay; /* Seconds to delay connecting member to caller */ + struct ast_variable *vars; /* Variables to be set in member channels */ struct member *members; /* Member channels to be tried */ struct queue_ent *head; /* Start of the actual queue */ @@ -498,6 +499,10 @@ ast_mutex_unlock(&qlock); free_members(q, 1); ast_mutex_destroy(&q->lock); + if (q->vars) { + ast_destroy_realtime(q->vars); + q->vars = NULL; + } free(q); } @@ -766,6 +771,7 @@ char tech[256]; char *location; char qname[80] = ""; + struct ast_variable *v; if (use_weight) { /* fast path */ if (compare_weight(qe->parent,tmp,qname)) { @@ -825,6 +831,11 @@ tmp->chan->cid.cid_ani = strdup(qe->chan->cid.cid_ani); /* Presense of ADSI CPE on outgoing channel follows ours */ tmp->chan->adsicpe = qe->chan->adsicpe; + + /* If there are variables to set in the member channel, do so */ + for (v = qe->parent->vars ; v ; v = v->next) + pbx_builtin_setvar_helper(tmp->chan, v->name, v->value); + /* Place the call, but don't wait on the answer */ res = ast_call(tmp->chan, location, 0); if (res) { @@ -2254,7 +2265,16 @@ } var = ast_variable_browse(cfg, cat); while(var) { - if (!strcasecmp(var->name, "member")) { + if (var->name[0] == '@') { + char *varname; + struct ast_variable *tmpvar; + + varname = ast_strdupa(var->name+1); + if ((tmpvar = ast_new_variable(varname, var->value))) { + tmpvar->next = q->vars; + q->vars = tmpvar; + } + } else if (!strcasecmp(var->name, "member")) { /* Add a new member */ cur = malloc(sizeof(struct member)); if (cur) { diff -Nru a/channels/chan_iax2.c b/channels/chan_iax2.c --- a/channels/chan_iax2.c 2005-01-08 11:27:54 -07:00 +++ b/channels/chan_iax2.c 2005-01-08 11:27:54 -07:00 @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -6929,6 +6928,7 @@ int found; char *varname = NULL, *varval = NULL; struct ast_variable *tmpvar = NULL; + static int setvar_deprecation_warning = 1; prev = NULL; ast_mutex_lock(&userl.lock); @@ -6984,6 +6984,10 @@ !strcasecmp(v->name, "deny")) { user->ha = ast_append_ha(v->name, v->value, user->ha); } else if (!strcasecmp(v->name, "setvar")) { + if (setvar_deprecation_warning) { + ast_log(LOG_WARNING, "setvar is deprecated in iax.conf, use @ instead, line %d\n", v->lineno); + setvar_deprecation_warning = 0; + } varname = ast_strdupa(v->value); if (varname && (varval = strchr(varname,'='))) { *varval = '\0'; @@ -6992,6 +6996,12 @@ tmpvar->next = user->vars; user->vars = tmpvar; } + } + } else if (v->name[0] == '@') { + varname = ast_strdupa(v->name+1); + if ((tmpvar = ast_new_variable(varname, v->value))) { + tmpvar->next = user->vars; + user->vars = tmpvar; } } else if (!strcasecmp(v->name, "allow")) { format = ast_getformatbyname(v->value); diff -Nru a/channels/chan_sip.c b/channels/chan_sip.c --- a/channels/chan_sip.c 2005-01-08 11:27:54 -07:00 +++ b/channels/chan_sip.c 2005-01-08 11:27:54 -07:00 @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -8615,6 +8614,7 @@ struct ast_ha *oldha = NULL; char *varname = NULL, *varval = NULL; struct ast_variable *tmpvar = NULL; + static int setvar_deprecation_warning = 1; user = (struct sip_user *)malloc(sizeof(struct sip_user)); if (user) { @@ -8646,6 +8646,10 @@ if (!strcasecmp(v->name, "context")) { strncpy(user->context, v->value, sizeof(user->context) - 1); } else if (!strcasecmp(v->name, "setvar")) { + if (setvar_deprecation_warning) { + ast_log(LOG_WARNING, "setvar is deprecated in sip.conf, use @ instead, line %d\n", v->lineno); + setvar_deprecation_warning = 0; + } varname = ast_strdupa(v->value); if (varname && (varval = strchr(varname,'='))) { *varval = '\0'; @@ -8654,7 +8658,12 @@ tmpvar->next = user->vars; user->vars = tmpvar; } - + } + } else if (v->name[0] == '@') { + varname = ast_strdupa(v->name+1); + if ((tmpvar = ast_new_variable(varname, v->value))) { + tmpvar->next = user->vars; + user->vars = tmpvar; } } else if (!strcasecmp(v->name, "permit") || !strcasecmp(v->name, "deny")) { diff -Nru a/include/asterisk/config.h b/include/asterisk/config.h --- a/include/asterisk/config.h 2005-01-08 11:27:54 -07:00 +++ b/include/asterisk/config.h 2005-01-08 11:27:54 -07:00 @@ -62,6 +62,19 @@ */ char *ast_category_browse(struct ast_config *config, char *prev); +/*! + \brief Allocates a new ast_variable with specified name and value. + \param name The new variable's name. + \value value The new variable's value. + + Parameters are copied into the variable, so if you supply pointers + to allocated storage you must free them yourself after the variable + is created. + + Returns the created variable, or NULL on failure. + */ +struct ast_variable *ast_new_variable(char *name, char *value); + //! Goes through variables /*! * Somewhat similar in intent as the ast_category_browse. The category MUST be an actual pointer to an actual category (such as one obtained by using ast_category_browse()). diff -Nru a/include/asterisk/config_pvt.h b/include/asterisk/config_pvt.h --- a/include/asterisk/config_pvt.h 2005-01-08 11:27:54 -07:00 +++ b/include/asterisk/config_pvt.h 2005-01-08 11:27:54 -07:00 @@ -51,7 +51,6 @@ struct ast_config *ast_new_config(void); struct ast_category *ast_new_category(char *name); -struct ast_variable *ast_new_variable(char *name,char *value); void ast_category_append(struct ast_config *config, struct ast_category *cat); void ast_category_destroy(struct ast_category *cat); int ast_cust_config_register(struct ast_config_reg *new);