diff options
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_agent.c | 37 | ||||
-rw-r--r-- | channels/chan_dahdi.c | 3 | ||||
-rw-r--r-- | channels/chan_h323.c | 2 | ||||
-rw-r--r-- | channels/chan_iax2.c | 7 | ||||
-rw-r--r-- | channels/chan_mgcp.c | 3 | ||||
-rw-r--r-- | channels/chan_sip.c | 29 | ||||
-rw-r--r-- | channels/chan_skinny.c | 7 | ||||
-rw-r--r-- | channels/chan_unistim.c | 2 |
8 files changed, 26 insertions, 64 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c index d72254ee7..57f0914cf 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -112,10 +112,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") <option name="d"> <para>make the app return <literal>-1</literal> if there is an error condition.</para> </option> - <option name="c"> - <para>change the CDR so that the source of the call is - <literal>Agent/agent_id</literal></para> - </option> <option name="n"> <para>don't generate the warnings when there is no callerid or the agentid is not known. It's handy if you want to have one context @@ -234,7 +230,6 @@ static char recordformat[AST_MAX_BUF] = ""; static char recordformatext[AST_MAX_BUF] = ""; static char urlprefix[AST_MAX_BUF] = ""; static char savecallsin[AST_MAX_BUF] = ""; -static int updatecdr = 0; static char beep[AST_MAX_BUF] = "beep"; #define GETAGENTBYCALLERID "AGENTBYCALLERID" @@ -573,7 +568,7 @@ static int agent_answer(struct ast_channel *ast) static int __agent_start_monitoring(struct ast_channel *ast, struct agent_pvt *p, int needlock) { - char tmp[AST_MAX_BUF],tmp2[AST_MAX_BUF], *pointer; + char tmp[AST_MAX_BUF], tmp2[AST_MAX_BUF], *pointer; char filename[AST_MAX_BUF]; int res = -1; if (!p) @@ -590,9 +585,7 @@ static int __agent_start_monitoring(struct ast_channel *ast, struct agent_pvt *p #if 0 ast_verbose("name is %s, link is %s\n",tmp, tmp2); #endif - if (!ast_channel_cdr(ast)) - ast_channel_cdr_set(ast, ast_cdr_alloc()); - ast_cdr_setuserfield(ast, tmp2); + ast_cdr_setuserfield(ast_channel_name(ast), tmp2); res = 0; } else ast_log(LOG_ERROR, "Recording already started on that call.\n"); @@ -1199,11 +1192,6 @@ static int read_agent_config(int reload) strcpy(agentgoodbye,v->value); } else if (!strcasecmp(v->name, "musiconhold")) { ast_copy_string(moh, v->value, sizeof(moh)); - } else if (!strcasecmp(v->name, "updatecdr")) { - if (ast_true(v->value)) - updatecdr = 1; - else - updatecdr = 0; } else if (!strcasecmp(v->name, "autologoffunavail")) { if (ast_true(v->value)) autologoffunavail = 1; @@ -1898,7 +1886,6 @@ static int login_exec(struct ast_channel *chan, const char *data) const char *tmpoptions = NULL; int play_announcement = 1; char agent_goodbye[AST_MAX_FILENAME_LEN]; - int update_cdr = updatecdr; user[0] = '\0'; xpass[0] = '\0'; @@ -1918,14 +1905,6 @@ static int login_exec(struct ast_channel *chan, const char *data) tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTMAXLOGINTRIES"); ast_verb(3, "Saw variable AGENTMAXLOGINTRIES=%s, setting max_login_tries to: %d on Channel '%s'.\n",tmpoptions,max_login_tries,ast_channel_name(chan)); } - if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTUPDATECDR"))) { - if (ast_true(pbx_builtin_getvar_helper(chan, "AGENTUPDATECDR"))) - update_cdr = 1; - else - update_cdr = 0; - tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTUPDATECDR"); - ast_verb(3, "Saw variable AGENTUPDATECDR=%s, setting update_cdr to: %d on Channel '%s'.\n",tmpoptions,update_cdr,ast_channel_name(chan)); - } if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTGOODBYE"))) { strcpy(agent_goodbye, pbx_builtin_getvar_helper(chan, "AGENTGOODBYE")); tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTGOODBYE"); @@ -2093,8 +2072,6 @@ static int login_exec(struct ast_channel *chan, const char *data) "Channel: %s\r\n" "Uniqueid: %s\r\n", p->agent, ast_channel_name(chan), ast_channel_uniqueid(chan)); - if (update_cdr && ast_channel_cdr(chan)) - snprintf(ast_channel_cdr(chan)->channel, sizeof(ast_channel_cdr(chan)->channel), "%s", agent); ast_queue_log("NONE", ast_channel_uniqueid(chan), agent, "AGENTLOGIN", "%s", ast_channel_name(chan)); ast_verb(2, "Agent '%s' logged in (format %s/%s)\n", p->agent, ast_getformatname(ast_channel_readformat(chan)), ast_getformatname(ast_channel_writeformat(chan))); @@ -2242,17 +2219,16 @@ static int agentmonitoroutgoing_exec(struct ast_channel *chan, const char *data) { int exitifnoagentid = 0; int nowarnings = 0; - int changeoutgoing = 0; int res = 0; char agent[AST_MAX_AGENT]; if (data) { - if (strchr(data, 'd')) + if (strchr(data, 'd')) { exitifnoagentid = 1; - if (strchr(data, 'n')) + } + if (strchr(data, 'n')) { nowarnings = 1; - if (strchr(data, 'c')) - changeoutgoing = 1; + } } if (ast_channel_caller(chan)->id.number.valid && !ast_strlen_zero(ast_channel_caller(chan)->id.number.str)) { @@ -2266,7 +2242,6 @@ static int agentmonitoroutgoing_exec(struct ast_channel *chan, const char *data) AST_LIST_LOCK(&agents); AST_LIST_TRAVERSE(&agents, p, list) { if (!strcasecmp(p->agent, tmp)) { - if (changeoutgoing) snprintf(ast_channel_cdr(chan)->channel, sizeof(ast_channel_cdr(chan)->channel), "Agent/%s", p->agent); __agent_start_monitoring(chan, p, 1); break; } diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 109fac06d..24337e385 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -107,7 +107,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/callerid.h" #include "asterisk/adsi.h" #include "asterisk/cli.h" -#include "asterisk/cdr.h" #include "asterisk/cel.h" #include "asterisk/features.h" #include "asterisk/musiconhold.h" @@ -17726,7 +17725,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct } else if (!strcasecmp(v->name, "accountcode")) { ast_copy_string(confp->chan.accountcode, v->value, sizeof(confp->chan.accountcode)); } else if (!strcasecmp(v->name, "amaflags")) { - y = ast_cdr_amaflags2int(v->value); + y = ast_channel_string2amaflag(v->value); if (y < 0) ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d.\n", v->value, v->lineno); else diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 61817dbff..e26bb5fb6 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -1482,7 +1482,7 @@ static struct oh323_user *build_user(const char *name, struct ast_variable *v, s /* Let us know we need to use ip authentication */ user->host = 1; } else if (!strcasecmp(v->name, "amaflags")) { - format = ast_cdr_amaflags2int(v->value); + format = ast_channel_string2amaflag(v->value); if (format < 0) { ast_log(LOG_WARNING, "Invalid AMA Flags: %s at line %d\n", v->value, v->lineno); } else { diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 7c0de9936..486af52a7 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -77,7 +77,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/cli.h" #include "asterisk/translate.h" #include "asterisk/md5.h" -#include "asterisk/cdr.h" #include "asterisk/crypto.h" #include "asterisk/acl.h" #include "asterisk/manager.h" @@ -12802,7 +12801,7 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, st } else if (!strcasecmp(v->name, "language")) { ast_string_field_set(user, language, v->value); } else if (!strcasecmp(v->name, "amaflags")) { - format = ast_cdr_amaflags2int(v->value); + format = ast_channel_string2amaflag(v->value); if (format < 0) { ast_log(LOG_WARNING, "Invalid AMA Flags: %s at line %d\n", v->value, v->lineno); } else { @@ -13273,7 +13272,7 @@ static int set_config(const char *config_file, int reload, int forced) } else if (!strcasecmp(v->name, "mohsuggest")) { ast_copy_string(mohsuggest, v->value, sizeof(mohsuggest)); } else if (!strcasecmp(v->name, "amaflags")) { - format = ast_cdr_amaflags2int(v->value); + format = ast_channel_string2amaflag(v->value); if (format < 0) { ast_log(LOG_WARNING, "Invalid AMA Flags: %s at line %d\n", v->value, v->lineno); } else { @@ -14513,7 +14512,7 @@ static int users_data_provider_get(const struct ast_data_search *search, continue; } ast_data_add_int(data_enum_node, "value", user->amaflags); - ast_data_add_str(data_enum_node, "text", ast_cdr_flags2str(user->amaflags)); + ast_data_add_str(data_enum_node, "text", ast_channel_amaflags2string(user->amaflags)); ast_data_add_bool(data_user, "access-control", ast_acl_list_is_empty(user->acl) ? 0 : 1); diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 9080dbaf0..5a0b7ad84 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -67,7 +67,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/callerid.h" #include "asterisk/cli.h" #include "asterisk/say.h" -#include "asterisk/cdr.h" #include "asterisk/astdb.h" #include "asterisk/features.h" #include "asterisk/app.h" @@ -4087,7 +4086,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) } else if (!strcasecmp(v->name, "accountcode")) { ast_copy_string(accountcode, v->value, sizeof(accountcode)); } else if (!strcasecmp(v->name, "amaflags")) { - y = ast_cdr_amaflags2int(v->value); + y = ast_channel_string2amaflag(v->value); if (y < 0) { ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d\n", v->value, v->lineno); } else { diff --git a/channels/chan_sip.c b/channels/chan_sip.c index eb79d237e..fbd7f1c22 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -20224,7 +20224,7 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct ast_cli(fd, " Tonezone : %s\n", peer->zone[0] != '\0' ? peer->zone : "<Not set>"); if (!ast_strlen_zero(peer->accountcode)) ast_cli(fd, " Accountcode : %s\n", peer->accountcode); - ast_cli(fd, " AMA flags : %s\n", ast_cdr_flags2str(peer->amaflags)); + ast_cli(fd, " AMA flags : %s\n", ast_channel_amaflags2string(peer->amaflags)); ast_cli(fd, " Transfer mode: %s\n", transfermode2str(peer->allowtransfer)); ast_cli(fd, " CallingPres : %s\n", ast_describe_caller_presentation(peer->callingpres)); if (!ast_strlen_zero(peer->fromuser)) @@ -20362,7 +20362,7 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct astman_append(s, "ToneZone: %s\r\n", peer->zone[0] != '\0' ? peer->zone : "<Not set>"); if (!ast_strlen_zero(peer->accountcode)) astman_append(s, "Accountcode: %s\r\n", peer->accountcode); - astman_append(s, "AMAflags: %s\r\n", ast_cdr_flags2str(peer->amaflags)); + astman_append(s, "AMAflags: %s\r\n", ast_channel_amaflags2string(peer->amaflags)); astman_append(s, "CID-CallingPres: %s\r\n", ast_describe_caller_presentation(peer->callingpres)); if (!ast_strlen_zero(peer->fromuser)) astman_append(s, "SIP-FromUser: %s\r\n", peer->fromuser); @@ -20537,7 +20537,7 @@ static char *sip_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args ast_cli(a->fd, " Language : %s\n", user->language); if (!ast_strlen_zero(user->accountcode)) ast_cli(a->fd, " Accountcode : %s\n", user->accountcode); - ast_cli(a->fd, " AMA flags : %s\n", ast_cdr_flags2str(user->amaflags)); + ast_cli(a->fd, " AMA flags : %s\n", ast_channel_amaflags2string(user->amaflags)); ast_cli(a->fd, " Tonezone : %s\n", user->zone[0] != '\0' ? user->zone : "<Not set>"); ast_cli(a->fd, " Transfer mode: %s\n", transfermode2str(user->allowtransfer)); ast_cli(a->fd, " MaxCallBR : %d kbps\n", user->maxcallbitrate); @@ -20724,8 +20724,6 @@ static int show_chanstats_cb(void *__cur, void *__arg, int flags) struct sip_pvt *cur = __cur; struct ast_rtp_instance_stats stats; char durbuf[10]; - int duration; - int durh, durm, durs; struct ast_channel *c; struct __show_chan_arg *arg = __arg; int fd = arg->fd; @@ -20756,12 +20754,8 @@ static int show_chanstats_cb(void *__cur, void *__arg, int flags) return 0; } - if (c && ast_channel_cdr(c) && !ast_tvzero(ast_channel_cdr(c)->start)) { - duration = (int)(ast_tvdiff_ms(ast_tvnow(), ast_channel_cdr(c)->start) / 1000); - durh = duration / 3600; - durm = (duration % 3600) / 60; - durs = duration % 60; - snprintf(durbuf, sizeof(durbuf), "%02d:%02d:%02d", durh, durm, durs); + if (c) { + ast_format_duration_hh_mm_ss(ast_channel_get_duration(c), durbuf, sizeof(durbuf)); } else { durbuf[0] = '\0'; } @@ -21694,11 +21688,8 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req) } else if (!ast_strlen_zero(c = sip_get_header(req, "X-ClientCode"))) { /* Client code (from SNOM phone) */ if (ast_test_flag(&p->flags[0], SIP_USECLIENTCODE)) { - if (p->owner && ast_channel_cdr(p->owner)) { - ast_cdr_setuserfield(p->owner, c); - } - if (p->owner && ast_bridged_channel(p->owner) && ast_channel_cdr(ast_bridged_channel(p->owner))) { - ast_cdr_setuserfield(ast_bridged_channel(p->owner), c); + if (p->owner) { + ast_cdr_setuserfield(ast_channel_name(p->owner), c); } transmit_response(p, "200 OK", req); } else { @@ -24831,7 +24822,7 @@ static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, ast_channel_unlock(c); sip_pvt_unlock(p); - ast_raw_answer(c, 1); + ast_raw_answer(c); ast_channel_lock(replaces_chan); bridge = ast_channel_get_bridge(replaces_chan); @@ -30458,7 +30449,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str } else if (!strcasecmp(v->name, "callbackextension")) { ast_string_field_set(peer, callback, v->value); } else if (!strcasecmp(v->name, "amaflags")) { - format = ast_cdr_amaflags2int(v->value); + format = ast_channel_string2amaflag(v->value); if (format < 0) { ast_log(LOG_WARNING, "Invalid AMA Flags for peer: %s at line %d\n", v->value, v->lineno); } else { @@ -34023,7 +34014,7 @@ static int peers_data_provider_get(const struct ast_data_search *search, continue; } ast_data_add_int(enum_node, "value", peer->amaflags); - ast_data_add_str(enum_node, "text", ast_cdr_flags2str(peer->amaflags)); + ast_data_add_str(enum_node, "text", ast_channel_amaflags2string(peer->amaflags)); /* sip options */ data_sip_options = ast_data_add_node(data_peer, "sipoptions"); diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 5e0756654..ad51edf10 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -67,7 +67,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/cli.h" #include "asterisk/manager.h" #include "asterisk/say.h" -#include "asterisk/cdr.h" #include "asterisk/astdb.h" #include "asterisk/features.h" #include "asterisk/app.h" @@ -4477,7 +4476,7 @@ static char *_skinny_show_line(int type, int fd, struct mansession *s, const str ast_str_reset(tmp_str); ast_cli(fd, "Language: %s\n", S_OR(l->language, "<not set>")); ast_cli(fd, "Accountcode: %s\n", S_OR(l->accountcode, "<not set>")); - ast_cli(fd, "AmaFlag: %s\n", ast_cdr_flags2str(l->amaflags)); + ast_cli(fd, "AmaFlag: %s\n", ast_channel_amaflags2string(l->amaflags)); ast_cli(fd, "CallerId Number: %s\n", S_OR(l->cid_num, "<not set>")); ast_cli(fd, "CallerId Name: %s\n", S_OR(l->cid_name, "<not set>")); ast_cli(fd, "Hide CallerId: %s\n", (l->hidecallerid ? "Yes" : "No")); @@ -4535,7 +4534,7 @@ static char *_skinny_show_line(int type, int fd, struct mansession *s, const str ast_str_reset(tmp_str); astman_append(s, "Language: %s\r\n", S_OR(l->language, "<not set>")); astman_append(s, "Accountcode: %s\r\n", S_OR(l->accountcode, "<not set>")); - astman_append(s, "AMAflags: %s\r\n", ast_cdr_flags2str(l->amaflags)); + astman_append(s, "AMAflags: %s\r\n", ast_channel_amaflags2string(l->amaflags)); astman_append(s, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), l->cid_name, l->cid_num, "")); astman_append(s, "HideCallerId: %s\r\n", (l->hidecallerid ? "Yes" : "No")); astman_append(s, "CFwdAll: %s\r\n", S_COR((l->cfwdtype & SKINNY_CFWD_ALL), l->call_forward_all, "<not set>")); @@ -7809,7 +7808,7 @@ static void config_parse_variables(int type, void *item, struct ast_variable *vp } } else if (!strcasecmp(v->name, "amaflags")) { if (type & (TYPE_DEF_LINE | TYPE_LINE)) { - int tempamaflags = ast_cdr_amaflags2int(v->value); + int tempamaflags = ast_channel_string2amaflag(v->value); if (tempamaflags < 0) { ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d\n", v->value, v->lineno); } else { diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index fbc6adda2..f512b0f6f 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -6392,7 +6392,7 @@ static struct unistim_device *build_device(const char *cat, const struct ast_var ast_copy_string(lt->accountcode, v->value, sizeof(lt->accountcode)); } else if (!strcasecmp(v->name, "amaflags")) { int y; - y = ast_cdr_amaflags2int(v->value); + y = ast_channel_string2amaflag(v->value); if (y < 0) { ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d\n", v->value, v->lineno); |