#include <asterisk/frame.h>
#include <asterisk/channel.h>
#include <asterisk/channel_pvt.h>
+#include <asterisk/config_pvt.h>
#include <asterisk/logger.h>
#include <asterisk/module.h>
#include <asterisk/pbx.h>
struct iax2_user *next;
int notransfer;
int usejitterbuf;
+ struct ast_variable *vars;
};
struct iax2_peer {
struct iax2_dpcache *dpentries;
int notransfer; /* do we want native bridging */
int usejitterbuf; /* use jitter buffer on this channel? */
+ struct ast_variable *vars;
};
static struct ast_iax2_queue {
if (pvt->reg) {
pvt->reg->callno = 0;
}
- if (!owner)
+ if (!owner) {
+ if (pvt->vars) {
+ ast_destroy_realtime(pvt->vars);
+ pvt->vars = NULL;
+ }
free(pvt);
+ }
}
if (owner) {
ast_mutex_unlock(&owner->lock);
{
struct ast_channel *tmp;
struct chan_iax2_pvt *i;
+ struct ast_variable *v = NULL;
+
/* Don't hold call lock */
ast_mutex_unlock(&iaxsl[callno]);
tmp = ast_channel_alloc(1);
tmp = NULL;
}
}
+ for (v = i->vars ; v ; v = v->next)
+ pbx_builtin_setvar_helper(tmp,v->name,v->value);
+
}
return tmp;
}
int bestscore = 0;
int gotcapability=0;
char iabuf[INET_ADDRSTRLEN];
+ struct ast_variable *v = NULL, *tmpvar = NULL;
if (!iaxs[callno])
return res;
}
if (user) {
/* We found our match (use the first) */
-
+ /* copy vars */
+ for (v = user->vars ; v ; v = v->next) {
+ if((tmpvar = ast_new_variable(v->name, v->value))) {
+ tmpvar->next = iaxs[callno]->vars;
+ iaxs[callno]->vars = tmpvar;
+ }
+ }
+
/* Store the requested username if not specified */
if (ast_strlen_zero(iaxs[callno]->username))
strncpy(iaxs[callno]->username, user->name, sizeof(iaxs[callno]->username)-1);
struct iax2_context *oldcon = NULL;
int format;
int found;
+ char *varname = NULL, *varval = NULL;
+ struct ast_variable *tmpvar = NULL;
prev = NULL;
ast_mutex_lock(&userl.lock);
} else if (!strcasecmp(v->name, "permit") ||
!strcasecmp(v->name, "deny")) {
user->ha = ast_append_ha(v->name, v->value, user->ha);
+ } else if (!strcasecmp(v->name, "setvar")) {
+ varname = ast_strdupa(v->value);
+ if (varname && (varval = strchr(varname,'='))) {
+ *varval = '\0';
+ varval++;
+ if((tmpvar = ast_new_variable(varname, varval))) {
+ tmpvar->next = user->vars;
+ user->vars = tmpvar;
+ }
+ }
} else if (!strcasecmp(v->name, "allow")) {
format = ast_getformatbyname(v->value);
if (format < 1)
{
ast_free_ha(user->ha);
free_context(user->contexts);
+ if(user->vars) {
+ ast_destroy_realtime(user->vars);
+ user->vars = NULL;
+ }
free(user);
}
#include <asterisk/lock.h>
#include <asterisk/channel.h>
#include <asterisk/channel_pvt.h>
+#include <asterisk/config_pvt.h>
#include <asterisk/config.h>
#include <asterisk/logger.h>
#include <asterisk/module.h>
struct ast_rtp *vrtp; /* Video RTP session */
struct sip_pkt *packets; /* Packets scheduled for re-transmission */
struct sip_history *history; /* History of this SIP dialog */
+ struct ast_variable *vars;
struct sip_pvt *next; /* Next call in chain */
} *iflist = NULL;
int progressinband;
struct ast_ha *ha; /* ACL setting */
int temponly; /* Flag for temporary users (realtime) */
+ struct ast_variable *vars;
struct sip_user *next;
};
static void destroy_user(struct sip_user *user)
{
ast_free_ha(user->ha);
+ if(user->vars) {
+ ast_destroy_realtime(user->vars);
+ user->vars = NULL;
+ }
free(user);
}
free(cp);
}
ast_mutex_destroy(&p->lock);
+ if(p->vars) {
+ ast_destroy_realtime(p->vars);
+ p->vars = NULL;
+ }
free(p);
}
}
static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title)
{
struct ast_channel *tmp;
+ struct ast_variable *v = NULL;
int fmt;
-
+
ast_mutex_unlock(&i->lock);
/* Don't hold a sip pvt lock while we allocate a channel */
tmp = ast_channel_alloc(1);
tmp = NULL;
}
}
+ for (v = i->vars ; v ; v = v->next)
+ pbx_builtin_setvar_helper(tmp,v->name,v->value);
} else
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
return tmp;
if (!p->rtp) {
ast_log(LOG_WARNING, "Unable to create RTP session: %s\n", strerror(errno));
ast_mutex_destroy(&p->lock);
+ if(p->vars) {
+ ast_destroy_realtime(p->vars);
+ p->vars = NULL;
+ }
free(p);
return NULL;
}
char *t;
char calleridname[50];
int debug=sip_debug_test_addr(sin);
+ struct ast_variable *tmpvar = NULL, *v = NULL;
/* Terminate URI */
t = uri;
user = find_user(of);
/* Find user based on user name in the from header */
if (user && ast_apply_ha(user->ha, sin)) {
+ /* copy vars */
+ for (v = user->vars ; v ; v = v->next) {
+ if((tmpvar = ast_new_variable(v->name, v->value))) {
+ tmpvar->next = p->vars;
+ p->vars = tmpvar;
+ }
+ }
p->nat = user->nat;
#ifdef OSP_SUPPORT
p->ospauth = user->ospauth;
struct sip_user *user;
int format;
struct ast_ha *oldha = NULL;
+ char *varname = NULL, *varval = NULL;
+ struct ast_variable *tmpvar = NULL;
+
user = (struct sip_user *)malloc(sizeof(struct sip_user));
if (user) {
memset(user, 0, sizeof(struct sip_user));
while(v) {
if (!strcasecmp(v->name, "context")) {
strncpy(user->context, v->value, sizeof(user->context) - 1);
+ } else if (!strcasecmp(v->name, "setvar")) {
+ varname = ast_strdupa(v->value);
+ if (varname && (varval = strchr(varname,'='))) {
+ *varval = '\0';
+ varval++;
+ if((tmpvar = ast_new_variable(varname, varval))) {
+ tmpvar->next = user->vars;
+ user->vars = tmpvar;
+ }
+
+ }
} else if (!strcasecmp(v->name, "permit") ||
!strcasecmp(v->name, "deny")) {
user->ha = ast_append_ha(v->name, v->value, user->ha);
p = p->next;
/* Free associated memory */
ast_mutex_destroy(&pl->lock);
+ if(pl->vars) {
+ ast_destroy_realtime(pl->vars);
+ pl->vars = NULL;
+ }
free(pl);
}
iflist = NULL;