static void *do_monitor(void *data);
static int restart_monitor(void);
static void peer_mailboxes_to_str(struct ast_str **mailbox_str, struct sip_peer *peer);
+static struct ast_variable *copy_vars(struct ast_variable *src);
/* static int sip_addrcmp(char *name, struct sockaddr_in *sin); Support for peer matching */
static int sip_refer_allocate(struct sip_pvt *p);
static void ast_quiet_chan(struct ast_channel *chan);
.get_codec = sip_get_codec,
};
+/*!
+ * duplicate a list of channel variables, \return the copy.
+ */
+static struct ast_variable *copy_vars(struct ast_variable *src)
+{
+ struct ast_variable *res = NULL, *tmp, *v = NULL;
+
+ for (v = src ; v ; v = v->next) {
+ if ((tmp = ast_variable_new(v->name, v->value, v->file))) {
+ tmp->next = res;
+ res = tmp;
+ }
+ }
+ return res;
+}
/*! \brief SIP TCP connection handler */
static void *sip_tcp_worker_fn(void *data)
*/
static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer)
{
+
/* this checks that the dialog is contacting the peer on a valid
* transport type based on the peers transport configuration,
* otherwise, this function bails out */
if (peer->call_limit)
ast_set_flag(&dialog->flags[0], SIP_CALL_LIMIT);
+ dialog->chanvars = copy_vars(peer->chanvars);
+
return 0;
}
pbx_builtin_setvar_helper(tmp, "_T38CALL", "1");
/* Set channel variables for this call from configuration */
- for (v = i->chanvars ; v ; v = v->next)
- pbx_builtin_setvar_helper(tmp, v->name, v->value);
+ for (v = i->chanvars ; v ; v = v->next) {
+ char valuebuf[1024];
+ pbx_builtin_setvar_helper(tmp, v->name, ast_get_encoded_str(v->value, valuebuf, sizeof(valuebuf)));
+ }
if (state != AST_STATE_DOWN && ast_pbx_start(tmp)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
return 0;
}
-/*!
- * duplicate a list of channel variables, \return the copy.
- */
-static struct ast_variable *copy_vars(struct ast_variable *src)
-{
- struct ast_variable *res = NULL, *tmp, *v = NULL;
-
- for (v = src ; v ; v = v->next) {
- if ((tmp = ast_variable_new(v->name, v->value, v->file))) {
- tmp->next = res;
- res = tmp;
- }
- }
- return res;
-}
/*! \brief helper function for check_{user|peer}_ok() */
static void replace_cid(struct sip_pvt *p, const char *rpid_num, const char *calleridname)
struct ast_variable *v;
chanvar = strsep(&chanvar, "]");
- for (v = peer->chanvars ; v ; v = v->next)
- if (!strcasecmp(v->name, chanvar))
+ for (v = peer->chanvars ; v ; v = v->next) {
+ if (!strcasecmp(v->name, chanvar)) {
ast_copy_string(buf, v->value, len);
+ }
+ }
} else if (!strncasecmp(colname, "codec[", 6)) {
char *codecnum;
int codec = 0;
/*! \brief Allow to record message and have a review option */
int ast_record_review(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path);
-/*! \brief Decode an encoded control or extended ASCII character */
+/*! \brief Decode an encoded control or extended ASCII character
+ \return Returns a pointer to the result string
+*/
int ast_get_encoded_char(const char *stream, char *result, size_t *consumed);
/*! \brief Decode a stream of encoded control or extended ASCII characters */
-int ast_get_encoded_str(const char *stream, char *result, size_t result_len);
+char *ast_get_encoded_str(const char *stream, char *result, size_t result_len);
/*! \brief Common routine for child processes, to close all fds prior to exec(2) */
void ast_close_fds_above_n(int n);