Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
08b307c9
Commit
08b307c9
authored
10 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "cdr/cdr_odbc.c: Added to record new columns add on CDR 1.8 Asterisk Version" into 11
parents
be468b26
d6e208a8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
UPGRADE.txt
+5
-0
5 additions, 0 deletions
UPGRADE.txt
cdr/cdr_odbc.c
+27
-5
27 additions, 5 deletions
cdr/cdr_odbc.c
configs/cdr_odbc.conf.sample
+1
-0
1 addition, 0 deletions
configs/cdr_odbc.conf.sample
with
33 additions
and
5 deletions
UPGRADE.txt
+
5
−
0
View file @
08b307c9
...
...
@@ -51,6 +51,11 @@ chan_dahdi:
ring-ring-ring pattern would exceed the pattern limits and stop
Caller-ID detection.
cdr_odbc:
- Added support for post-1.8 CDR columns 'peeraccount', 'linkedid', and
'sequence'. Support for the new columns can be enabled via the newcdrcolumns
option in cdr_odbc.conf.
from 11.15 to 11.16
chan_dahdi:
- The CALLERID(ani2) value for incoming calls is now populated in featdmf
...
...
This diff is collapsed.
Click to expand it.
cdr/cdr_odbc.c
+
27
−
5
View file @
08b307c9
...
...
@@ -55,6 +55,7 @@ enum {
CONFIG_DISPOSITIONSTRING
=
1
<<
2
,
CONFIG_HRTIME
=
1
<<
3
,
CONFIG_REGISTERED
=
1
<<
4
,
CONFIG_NEWCDRCOLUMNS
=
1
<<
5
,
};
static
struct
ast_flags
config
=
{
0
};
...
...
@@ -63,23 +64,29 @@ static SQLHSTMT execute_cb(struct odbc_obj *obj, void *data)
{
struct
ast_cdr
*
cdr
=
data
;
SQLRETURN
ODBC_res
;
char
sqlcmd
[
2048
]
=
""
,
timestr
[
128
];
char
sqlcmd
[
2048
]
=
""
,
timestr
[
128
]
,
new_columns
[
120
]
=
""
,
new_values
[
7
]
=
""
;
struct
ast_tm
tm
;
SQLHSTMT
stmt
;
int
i
=
0
;
ast_localtime
(
&
cdr
->
start
,
&
tm
,
ast_test_flag
(
&
config
,
CONFIG_USEGMTIME
)
?
"GMT"
:
NULL
);
ast_strftime
(
timestr
,
sizeof
(
timestr
),
DATE_FORMAT
,
&
tm
);
if
(
ast_test_flag
(
&
config
,
CONFIG_NEWCDRCOLUMNS
))
{
snprintf
(
new_columns
,
sizeof
(
new_columns
),
"%s"
,
",peeraccount,linkedid,sequence"
);
snprintf
(
new_values
,
sizeof
(
new_values
),
"%s"
,
",?,?,?"
);
}
if
(
ast_test_flag
(
&
config
,
CONFIG_LOGUNIQUEID
))
{
snprintf
(
sqlcmd
,
sizeof
(
sqlcmd
),
"INSERT INTO %s "
"(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,"
"lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) "
"VALUES ({ts '%s'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
,
table
,
timestr
);
"lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield
%s
) "
"VALUES ({ts '%s'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
%s
)"
,
table
,
new_columns
,
timestr
,
new_values
);
}
else
{
snprintf
(
sqlcmd
,
sizeof
(
sqlcmd
),
"INSERT INTO %s "
"(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,"
"duration,billsec,disposition,amaflags,accountcode) "
"VALUES ({ts '%s'},?,?,?,?,?,?,?,?,?,?,?,?,?)"
,
table
,
timestr
);
"duration,billsec,disposition,amaflags,accountcode
%s
) "
"VALUES ({ts '%s'},?,?,?,?,?,?,?,?,?,?,?,?,?
%s
)"
,
table
,
new_columns
,
timestr
,
new_values
);
}
ODBC_res
=
SQLAllocHandle
(
SQL_HANDLE_STMT
,
obj
->
con
,
&
stmt
);
...
...
@@ -122,9 +129,17 @@ static SQLHSTMT execute_cb(struct odbc_obj *obj, void *data)
SQLBindParameter
(
stmt
,
12
,
SQL_PARAM_INPUT
,
SQL_C_SLONG
,
SQL_INTEGER
,
0
,
0
,
&
cdr
->
amaflags
,
0
,
NULL
);
SQLBindParameter
(
stmt
,
13
,
SQL_PARAM_INPUT
,
SQL_C_CHAR
,
SQL_CHAR
,
sizeof
(
cdr
->
accountcode
),
0
,
cdr
->
accountcode
,
0
,
NULL
);
i
=
14
;
if
(
ast_test_flag
(
&
config
,
CONFIG_LOGUNIQUEID
))
{
SQLBindParameter
(
stmt
,
14
,
SQL_PARAM_INPUT
,
SQL_C_CHAR
,
SQL_CHAR
,
sizeof
(
cdr
->
uniqueid
),
0
,
cdr
->
uniqueid
,
0
,
NULL
);
SQLBindParameter
(
stmt
,
15
,
SQL_PARAM_INPUT
,
SQL_C_CHAR
,
SQL_CHAR
,
sizeof
(
cdr
->
userfield
),
0
,
cdr
->
userfield
,
0
,
NULL
);
i
=
16
;
}
if
(
ast_test_flag
(
&
config
,
CONFIG_NEWCDRCOLUMNS
))
{
SQLBindParameter
(
stmt
,
i
,
SQL_PARAM_INPUT
,
SQL_C_CHAR
,
SQL_CHAR
,
sizeof
(
cdr
->
peeraccount
),
0
,
cdr
->
peeraccount
,
0
,
NULL
);
SQLBindParameter
(
stmt
,
i
+
1
,
SQL_PARAM_INPUT
,
SQL_C_CHAR
,
SQL_CHAR
,
sizeof
(
cdr
->
linkedid
),
0
,
cdr
->
linkedid
,
0
,
NULL
);
SQLBindParameter
(
stmt
,
i
+
2
,
SQL_PARAM_INPUT
,
SQL_C_SLONG
,
SQL_INTEGER
,
0
,
0
,
&
cdr
->
sequence
,
0
,
NULL
);
}
ODBC_res
=
SQLExecDirect
(
stmt
,
(
unsigned
char
*
)
sqlcmd
,
SQL_NTS
);
...
...
@@ -251,6 +266,13 @@ static int odbc_load_module(int reload)
ast_set_flag
(
&
config
,
CONFIG_REGISTERED
);
}
}
if
(((
tmp
=
ast_variable_retrieve
(
cfg
,
"global"
,
"newcdrcolumns"
)))
&&
ast_true
(
tmp
))
{
ast_set_flag
(
&
config
,
CONFIG_NEWCDRCOLUMNS
);
ast_debug
(
1
,
"cdr_odbc: Add new cdr fields
\n
"
);
}
else
{
ast_clear_flag
(
&
config
,
CONFIG_NEWCDRCOLUMNS
);
ast_debug
(
1
,
"cdr_odbc: Not add new cdr fields
\n
"
);
}
}
while
(
0
);
if
(
ast_test_flag
(
&
config
,
CONFIG_REGISTERED
)
&&
(
!
cfg
||
dsn
==
NULL
||
table
==
NULL
))
{
...
...
This diff is collapsed.
Click to expand it.
configs/cdr_odbc.conf.sample
+
1
−
0
View file @
08b307c9
...
...
@@ -9,3 +9,4 @@
;table=cdr ;"cdr" is default table name
;usegmtime=no ; set to "yes" to log in GMT
;hrtime=yes ;Enables microsecond accuracy with the billsec and duration fields
;newcdrcolumns=yes ; Enable logging of post-1.8 CDR columns (peeraccount, linkedid, sequence)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment