[asterisk-commits] bmd: branch group/newcdr r117325 - in /team/group/newcdr: cel/ include/asteri...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 20 14:08:57 CDT 2008
Author: bmd
Date: Tue May 20 14:08:56 2008
New Revision: 117325
URL: http://svn.digium.com/view/asterisk?view=rev&rev=117325
Log:
This started out as an attempt to move peeraccount into cel_custom,
but ended with me refactoring the creation of the temporary channel
for pbx_substitute_variables_helper in cel_custom and
cel_sqlite3_custom.
Modified:
team/group/newcdr/cel/cel_custom.c
team/group/newcdr/cel/cel_pgsql.c
team/group/newcdr/cel/cel_sqlite3_custom.c
team/group/newcdr/include/asterisk/cel.h
team/group/newcdr/include/asterisk/event_defs.h
team/group/newcdr/main/cel.c
Modified: team/group/newcdr/cel/cel_custom.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/cel/cel_custom.c?view=diff&rev=117325&r1=117324&r2=117325
==============================================================================
--- team/group/newcdr/cel/cel_custom.c (original)
+++ team/group/newcdr/cel/cel_custom.c Tue May 20 14:08:56 2008
@@ -108,82 +108,26 @@
return res;
}
-
-
static void custom_log(const struct ast_event *event, void *userdata)
{
- /* Make sure we have a big enough buf */
- char buf[2048];
- struct varshead *headp;
- enum ast_cel_eventtype eventtype;
- const char *userdefname = 0;
- struct timeval eventtime = {0};
- struct ast_channel tchan = {0}; /* just so we store the data in vars and do var subst on the mapping line from the config file */
- const char *cid_ani, *cid_rdnis, *cid_name, *cid_num, *cid_dnid;
- const char *exten, *context, *channame, *appname, *appdata, *accountcode, *uniqueid, *linkedid, *peer, *userfield;
- unsigned int amaflag;
- struct ast_var_t *vardata;
-
- ast_string_field_init(&tchan, 128);
- headp = &tchan.varshead;
- AST_LIST_HEAD_INIT_NOLOCK(headp);
+ char buf[2048]; /* to store the log line */
+ struct ast_channel *tchan;
/* Abort if no master file is specified */
if (ast_strlen_zero(master))
return;
- eventtype = (enum ast_cel_eventtype)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TYPE);
- eventtime.tv_sec = (time_t)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TIME);
- eventtime.tv_usec = (time_t)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TIME_USEC);
- if (eventtype == CEL_USER_DEFINED)
- userdefname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USEREVENT_NAME);
- cid_name = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDNAME);
- cid_num = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDNUM);
- cid_ani = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDANI);
- cid_rdnis = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDRDNIS);
- cid_dnid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDDNID);
- exten = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_EXTEN);
- context = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CONTEXT);
- channame = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CHANNAME);
- appname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_APPNAME);
- appdata = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_APPDATA);
- accountcode = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_ACCTCODE);
- uniqueid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_UNIQUEID);
- linkedid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_LINKEDID);
- amaflag = ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_AMAFLAGS);
- userfield = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USERFIELD);
- peer = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_PEER);
-
- /* fill in all the fields of the dummy channel tchan */
- cel_set_backend_channel_vars(&tchan, eventtype, userdefname, eventtime, cid_name, cid_num,
- cid_ani, cid_rdnis, cid_dnid, exten, context, channame,
- appname, appdata, accountcode, uniqueid, amaflag, userfield, peer, linkedid);
+ tchan = ast_cel_fabricate_channel_from_event(event);
+ if (!tchan) {
+ ast_log(LOG_ERROR, "Unable to fabricate channel from CEL event\n");
+ return;
+ }
memset(buf, 0 , sizeof(buf));
- /* Quite possibly the first use of a static struct ast_channel, we need it so the var funcs will work */
- /* fix this code */
-
- pbx_substitute_variables_helper(&tchan, format, buf, sizeof(buf) - 1);
+ pbx_substitute_variables_helper(tchan, format, buf, sizeof(buf) - 1);
- /* get rid of the headp list, it's function is done */
- while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
- ast_var_delete(vardata);
- ast_string_field_free_memory(&tchan);
- if (tchan.cid.cid_name)
- free(tchan.cid.cid_name);
- if (tchan.cid.cid_num)
- free(tchan.cid.cid_num);
- if (tchan.cid.cid_ani)
- free(tchan.cid.cid_ani);
- if (tchan.cid.cid_rdnis)
- free(tchan.cid.cid_rdnis);
- if (tchan.cid.cid_dnid)
- free(tchan.cid.cid_dnid);
- if (tchan.appl)
- free((char*)tchan.appl);
- if (tchan.data)
- free((char*)tchan.data);
-
+ ast_cel_free_fabricated_channel(tchan);
+
/* because of the absolutely unconditional need for the
highest reliability possible in writing billing records,
we open write and close the log file each time */
Modified: team/group/newcdr/cel/cel_pgsql.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/cel/cel_pgsql.c?view=diff&rev=117325&r1=117324&r2=117325
==============================================================================
--- team/group/newcdr/cel/cel_pgsql.c (original)
+++ team/group/newcdr/cel/cel_pgsql.c Tue May 20 14:08:56 2008
@@ -82,9 +82,8 @@
enum ast_cel_eventtype eventtype;
const char *userdefname = 0;
struct timeval eventtime = {0};
- struct ast_channel tchan = {0}; /* just so we store the data in vars and do var subst on the mapping line from the config file */
const char *cid_ani, *cid_rdnis, *cid_name, *cid_num, *cid_dnid;
- const char *exten, *context, *channame, *appname, *appdata, *accountcode, *uniqueid, *linkedid, *userfield, *peer;
+ const char *exten, *context, *channame, *appname, *appdata, *accountcode, *peeraccount, *uniqueid, *linkedid, *userfield, *peer;
unsigned int amaflag;
eventtype = (enum ast_cel_eventtype)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TYPE);
@@ -103,15 +102,12 @@
appname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_APPNAME);
appdata = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_APPDATA);
accountcode = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_ACCTCODE);
+ peeraccount = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_ACCTCODE);
uniqueid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_UNIQUEID);
linkedid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_LINKEDID);
amaflag = ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_AMAFLAGS);
userfield = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USERFIELD);
peer = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_PEER);
-
- cel_set_backend_channel_vars(&tchan, eventtype, userdefname, eventtime, cid_name, cid_num,
- cid_ani, cid_rdnis, cid_dnid, exten, context, channame,
- appname, appdata, accountcode, uniqueid, amaflag, userfield, peer, linkedid);
ast_mutex_lock(&pgsql_lock);
Modified: team/group/newcdr/cel/cel_sqlite3_custom.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/cel/cel_sqlite3_custom.c?view=diff&rev=117325&r1=117324&r2=117325
==============================================================================
--- team/group/newcdr/cel/cel_sqlite3_custom.c (original)
+++ team/group/newcdr/cel/cel_sqlite3_custom.c Tue May 20 14:08:56 2008
@@ -159,76 +159,26 @@
int res = 0;
char *zErr = 0;
char *sql_cmd;
- struct varshead *headp;
- struct ast_channel dummy = { 0, };
+ struct ast_channel *tchan;
int count;
- enum ast_cel_eventtype eventtype;
- char *userdefname = 0;
- struct timeval eventtime = {0};
- const char *cid_ani, *cid_rdnis, *cid_name, *cid_num, *cid_dnid;
- const char *exten, *context, *channame, *appname, *appdata, *accountcode, *uniqueid, *userfield, *peer, *linkedid;
- unsigned int amaflag;
- struct ast_var_t *vardata;
-
- ast_string_field_init(&dummy, 128);
- headp = &dummy.varshead;
- AST_LIST_HEAD_INIT_NOLOCK(headp);
-
- eventtype = (enum ast_cel_eventtype)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TYPE);
- eventtime.tv_sec = (time_t)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TIME);
- eventtime.tv_usec = (time_t)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TIME_USEC);
- if (eventtype == CEL_USER_DEFINED)
- userdefname = (char*)ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USEREVENT_NAME);
- cid_name = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDNAME);
- cid_num = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDNUM);
- cid_ani = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDANI);
- cid_rdnis = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDRDNIS);
- cid_dnid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDDNID);
- exten = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_EXTEN);
- context = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CONTEXT);
- channame = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CHANNAME);
- appname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_APPNAME);
- appdata = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_APPDATA);
- accountcode = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_ACCTCODE);
- uniqueid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_UNIQUEID);
- linkedid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_LINKEDID);
- amaflag = ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_AMAFLAGS);
- userfield = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USERFIELD);
- peer = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_PEER);
-
- cel_set_backend_channel_vars(&dummy, eventtype, userdefname, eventtime, cid_name, cid_num,
- cid_ani, cid_rdnis, cid_dnid, exten, context, channame,
- appname, appdata, accountcode, uniqueid, amaflag, userfield, peer, linkedid);
+
+ tchan = ast_cel_fabricate_channel_from_event(event);
+ if (!tchan) {
+ ast_log(LOG_ERROR, "Unable to fabricate channel from CEL event\n");
+ return;
+ }
{ /* Make it obvious that only sql_cmd should be used outside of this block */
char *sql_tmp_cmd;
char sql_insert_cmd[2048] = "";
sql_tmp_cmd = sqlite3_mprintf("INSERT INTO %q (%q) VALUES (%q)", table, columns, values);
- pbx_substitute_variables_helper(&dummy, sql_tmp_cmd, sql_insert_cmd, sizeof(sql_insert_cmd) - 1);
+ pbx_substitute_variables_helper(tchan, sql_tmp_cmd, sql_insert_cmd, sizeof(sql_insert_cmd) - 1);
sqlite3_free(sql_tmp_cmd);
sql_cmd = alloca(strlen(sql_insert_cmd) * 2 + 1);
do_escape(sql_cmd, sql_insert_cmd);
}
- /* get rid of the headp list, it's function is done */
- while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
- ast_var_delete(vardata);
- ast_string_field_free_memory(&dummy);
- if (dummy.cid.cid_name)
- free(dummy.cid.cid_name);
- if (dummy.cid.cid_num)
- free(dummy.cid.cid_num);
- if (dummy.cid.cid_ani)
- free(dummy.cid.cid_ani);
- if (dummy.cid.cid_rdnis)
- free(dummy.cid.cid_rdnis);
- if (dummy.cid.cid_dnid)
- free(dummy.cid.cid_dnid);
- if (dummy.appl)
- free((char*)dummy.appl);
- if (dummy.data)
- free((char*)dummy.data);
-
+ ast_cel_free_fabricated_channel(tchan);
ast_mutex_lock(&lock);
Modified: team/group/newcdr/include/asterisk/cel.h
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/include/asterisk/cel.h?view=diff&rev=117325&r1=117324&r2=117325
==============================================================================
--- team/group/newcdr/include/asterisk/cel.h (original)
+++ team/group/newcdr/include/asterisk/cel.h Tue May 20 14:08:56 2008
@@ -118,15 +118,9 @@
*/
int ast_cel_setvar(struct ast_channel *chan, const char *name, const char *value);
-
-void cel_set_backend_channel_vars(struct ast_channel *chan, enum ast_cel_eventtype eventtype,
- const char *usereventname, struct timeval eventtime,
- const char *cid_name, const char *cid_num, const char *cid_ani,
- const char *cid_rdnis, const char *cid_dnid, const char *exten,
- const char *context, const char *channame, const char *appname,
- const char *appdata, const char *accountcode,
- const char *uniqueid, unsigned int amaflag, const char *userfield,
- const char *peer, const char *linkedid);
+/*! Create a fake channel containing the serialized channel date in the given cel event */
+struct ast_channel* ast_cel_fabricate_channel_from_event(const struct ast_event *event);
+void ast_cel_free_fabricated_channel(struct ast_channel *tchan);
/*! Frees the cel struct */
void ast_cel_destroy(struct ast_cel *cel);
@@ -134,8 +128,6 @@
void ast_cel_report_event(const struct ast_channel *chan, enum ast_cel_eventtype, char *userdefevname, const struct ast_channel *peer2);
-extern int cel_default_amaflags;
-extern char cel_default_accountcode[AST_MAX_ACCOUNT_CODE];
int ast_cel_engine_init(void);
inline int track_event(enum ast_cel_eventtype et);
void ast_cel_engine_term(void);
Modified: team/group/newcdr/include/asterisk/event_defs.h
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/include/asterisk/event_defs.h?view=diff&rev=117325&r1=117324&r2=117325
==============================================================================
--- team/group/newcdr/include/asterisk/event_defs.h (original)
+++ team/group/newcdr/include/asterisk/event_defs.h Tue May 20 14:08:56 2008
@@ -211,6 +211,12 @@
* Payload type: STR
*/
AST_EVENT_IE_CEL_LINKEDID = 0x19,
+ /*!
+ * \brief Channel Event peeraccount
+ * Used by: AST_EVENT_CEL
+ * Payload type: STR
+ */
+ AST_EVENT_IE_CEL_PEERACCT = 0x20,
/*!
* \brief Device Name
* Used by AST_EVENT_DEVICE_STATE
Modified: team/group/newcdr/main/cel.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/main/cel.c?view=diff&rev=117325&r1=117324&r2=117325
==============================================================================
--- team/group/newcdr/main/cel.c (original)
+++ team/group/newcdr/main/cel.c Tue May 20 14:08:56 2008
@@ -49,10 +49,6 @@
#include "asterisk/config.h"
#include "asterisk/cli.h"
#include "asterisk/stringfields.h"
-
-/*! Default AMA flag for billing records (CEL's) */
-int cel_default_amaflags = AST_CEL_DOCUMENTATION;
-char cel_default_accountcode[AST_MAX_ACCOUNT_CODE];
static int cel_enabled; /*! Is the CEL subsystem enabled ? */
static long long eventset = 0; /*! which events we want to track; up to 64 events */
@@ -540,26 +536,59 @@
*ret = workspace;
}
-void cel_set_backend_channel_vars(struct ast_channel *chan, enum ast_cel_eventtype eventtype,
- const char *usereventname, struct timeval eventtime,
- const char *cid_name, const char *cid_num, const char *cid_ani,
- const char *cid_rdnis, const char *cid_dnid, const char *exten,
- const char *context, const char *channame, const char *appname,
- const char *appdata, const char *accountcode, const char *uniqueid,
- unsigned int amaflag, const char *userfield, const char *peer, const char *linkedid)
-{
- /* this routine is only called to populate a dummy channel struct with the data,
- so the CEL func can grab the correct datum and have it substituted, the same as if
- a real channel were being used with the CEL func. What we do for re-use!! */
- /* set the eventtime, eventtype fields */
-
+/* this routine is only called to populate a dummy channel struct with the data,
+ so the CEL func can grab the correct datum and have it substituted, the same as if
+ a real channel were being used with the CEL func. What we do for re-use!! */
+struct ast_channel* ast_cel_fabricate_channel_from_event(const struct ast_event *event)
+{
+ enum ast_cel_eventtype eventtype;
+ struct timeval eventtime = {0};
+ const char *userdefname = 0;
+ struct varshead *headp;
struct ast_var_t *newvariable;
- struct varshead *headp = &chan->varshead;
char timebuf[30];
- /* next, insert them */
+ struct ast_channel *tchan;
+
+ const char *cid_ani, *cid_rdnis, *cid_name, *cid_num, *cid_dnid;
+ const char *exten, *context, *channame, *appname, *appdata, *accountcode, *peeraccount, *uniqueid, *linkedid, *peer, *userfield;
+ unsigned int amaflag;
+
+ /* do not call ast_channel_alloc because this is not really a real channel */
+ if (!(tchan = ast_calloc(1, sizeof(*tchan))))
+ return NULL;
+
+ ast_string_field_init(tchan, 128);
+ headp = &tchan->varshead;
+ AST_LIST_HEAD_INIT_NOLOCK(headp);
+
+ /* first, get the variables from the event */
+ eventtype = (enum ast_cel_eventtype)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TYPE);
+ eventtime.tv_sec = (time_t)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TIME);
+ eventtime.tv_usec = (time_t)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TIME_USEC);
if (eventtype == CEL_USER_DEFINED)
- newvariable = ast_var_assign("eventtype", usereventname);
+ userdefname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USEREVENT_NAME);
+ cid_name = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDNAME);
+ cid_num = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDNUM);
+ cid_ani = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDANI);
+ cid_rdnis = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDRDNIS);
+ cid_dnid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDDNID);
+ exten = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_EXTEN);
+ context = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CONTEXT);
+ channame = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CHANNAME);
+ appname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_APPNAME);
+ appdata = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_APPDATA);
+ accountcode = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_ACCTCODE);
+ peeraccount = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_PEERACCT);
+ uniqueid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_UNIQUEID);
+ linkedid = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_LINKEDID);
+ amaflag = ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_AMAFLAGS);
+ userfield = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USERFIELD);
+ peer = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_PEER);
+
+ /* next, fill the channel with their data */
+ if (eventtype == CEL_USER_DEFINED)
+ newvariable = ast_var_assign("eventtype", userdefname);
else
newvariable = ast_var_assign("eventtype", ast_cel_eventtype2str(eventtype));
AST_LIST_INSERT_HEAD(headp, newvariable, entries);
@@ -568,23 +597,56 @@
newvariable = ast_var_assign("eventtime", timebuf);
AST_LIST_INSERT_HEAD(headp, newvariable, entries);
- chan->cid.cid_name = ast_strdup(cid_name);
- chan->cid.cid_num = ast_strdup(cid_num);
- chan->cid.cid_ani = ast_strdup(cid_ani);
- chan->cid.cid_rdnis = ast_strdup(cid_rdnis);
- chan->cid.cid_dnid = ast_strdup(cid_dnid);
+ tchan->cid.cid_name = ast_strdup(cid_name);
+ tchan->cid.cid_num = ast_strdup(cid_num);
+ tchan->cid.cid_ani = ast_strdup(cid_ani);
+ tchan->cid.cid_rdnis = ast_strdup(cid_rdnis);
+ tchan->cid.cid_dnid = ast_strdup(cid_dnid);
- ast_copy_string(chan->exten, exten, sizeof(chan->exten));
- ast_copy_string(chan->context, context, sizeof(chan->context));
- ast_string_field_set(chan,name,channame);
- ast_string_field_set(chan,uniqueid,uniqueid);
- ast_string_field_set(chan,linkedid,linkedid);
- ast_string_field_set(chan,accountcode,accountcode);
- ast_string_field_set(chan,userfield,userfield);
- ast_string_field_set(chan,language,peer); /* we'll hide the peer name in the language field -- CEL had best be able to tell a dummy channel from a real one!*/
- chan->appl = ast_strdup(appname);
- chan->data = ast_strdup(appdata);
- chan->amaflags = amaflag;
+ ast_copy_string(tchan->exten, exten, sizeof(tchan->exten));
+ ast_copy_string(tchan->context, context, sizeof(tchan->context));
+ ast_string_field_set(tchan,name,channame);
+ ast_string_field_set(tchan,uniqueid,uniqueid);
+ ast_string_field_set(tchan,linkedid,linkedid);
+ ast_string_field_set(tchan,accountcode,accountcode);
+ ast_string_field_set(tchan,peeraccount,peeraccount);
+ ast_string_field_set(tchan,userfield,userfield);
+
+ /* XXX - set BRIDGEPEER in the channel variables instead */
+ ast_string_field_set(tchan,language,peer); /* we'll hide the peer name in the language field -- CEL had best be able to tell a dummy channel from a real one!*/
+ tchan->appl = ast_strdup(appname);
+ tchan->data = ast_strdup(appdata);
+ tchan->amaflags = amaflag;
+
+ return tchan;
+}
+
+
+void ast_cel_free_fabricated_channel(struct ast_channel *tchan)
+{
+ struct ast_var_t *vardata;
+ struct varshead *headp = &tchan->varshead;
+
+ /* get rid of the headp list, it's function is done */
+ while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
+ ast_var_delete(vardata);
+ ast_string_field_free_memory(tchan);
+ if (tchan->cid.cid_name)
+ free(tchan->cid.cid_name);
+ if (tchan->cid.cid_num)
+ free(tchan->cid.cid_num);
+ if (tchan->cid.cid_ani)
+ free(tchan->cid.cid_ani);
+ if (tchan->cid.cid_rdnis)
+ free(tchan->cid.cid_rdnis);
+ if (tchan->cid.cid_dnid)
+ free(tchan->cid.cid_dnid);
+ if (tchan->appl)
+ free((char*)tchan->appl);
+ if (tchan->data)
+ free((char*)tchan->data);
+
+ free(tchan);
}
@@ -637,6 +699,7 @@
AST_EVENT_IE_CEL_APPDATA, AST_EVENT_IE_PLTYPE_STR, chan->data,
AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_PLTYPE_UINT, chan->amaflags,
AST_EVENT_IE_CEL_ACCTCODE, AST_EVENT_IE_PLTYPE_STR, chan->accountcode,
+ AST_EVENT_IE_CEL_PEERACCT, AST_EVENT_IE_PLTYPE_STR, chan->peeraccount,
AST_EVENT_IE_CEL_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, chan->uniqueid,
AST_EVENT_IE_CEL_LINKEDID, AST_EVENT_IE_PLTYPE_STR, chan->linkedid,
AST_EVENT_IE_CEL_USERFIELD, AST_EVENT_IE_PLTYPE_STR, chan->userfield,
More information about the asterisk-commits
mailing list