Index: apps/app_confbridge.c =================================================================== --- apps/app_confbridge.c (revision 433419) +++ apps/app_confbridge.c (working copy) @@ -605,6 +605,8 @@ static void send_join_event(struct ast_channel *chan, const char *conf_name) { + char *e_callerid_num = astman_escape_output(S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "")); + char *e_callerid_name = astman_escape_output(S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "")); /*** DOCUMENTATION Raised when a channel joins a Confbridge conference. @@ -626,13 +628,17 @@ ast_channel_name(chan), ast_channel_uniqueid(chan), conf_name, - S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), - S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "") + e_callerid_num, + e_callerid_name ); + ast_free(e_callerid_num); + ast_free(e_callerid_name); } static void send_leave_event(struct ast_channel *chan, const char *conf_name) { + char *e_callerid_num = astman_escape_output(S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "")); + char *e_callerid_name = astman_escape_output(S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "")); /*** DOCUMENTATION Raised when a channel leaves a Confbridge conference. @@ -653,9 +659,11 @@ ast_channel_name(chan), ast_channel_uniqueid(chan), conf_name, - S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), - S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "") + e_callerid_num, + e_callerid_name ); + ast_free(e_callerid_num); + ast_free(e_callerid_name); } /*! Index: apps/app_dial.c =================================================================== --- apps/app_dial.c (revision 433419) +++ apps/app_dial.c (working copy) @@ -834,6 +834,10 @@ ***/ + char *e_calleridnum = astman_escape_output(S_COR(ast_channel_caller(src)->id.number.valid, ast_channel_caller(src)->id.number.str, "")); + char *e_calleridname = astman_escape_output(S_COR(ast_channel_caller(src)->id.name.valid, ast_channel_caller(src)->id.name.str, "")); + char *e_connectedline_num = astman_escape_output(S_COR(ast_channel_connected(src)->id.number.valid, ast_channel_connected(src)->id.number.str, "")); + char *e_connectedline_name = astman_escape_output(S_COR(ast_channel_connected(src)->id.name.valid, ast_channel_connected(src)->id.name.str, "")); ast_manager_event_multichan(EVENT_FLAG_CALL, "Dial", 2, chans, "SubEvent: Begin\r\n" "Channel: %s\r\n" @@ -845,13 +849,14 @@ "UniqueID: %s\r\n" "DestUniqueID: %s\r\n" "Dialstring: %s\r\n", - ast_channel_name(src), ast_channel_name(dst), - S_COR(ast_channel_caller(src)->id.number.valid, ast_channel_caller(src)->id.number.str, ""), - S_COR(ast_channel_caller(src)->id.name.valid, ast_channel_caller(src)->id.name.str, ""), - S_COR(ast_channel_connected(src)->id.number.valid, ast_channel_connected(src)->id.number.str, ""), - S_COR(ast_channel_connected(src)->id.name.valid, ast_channel_connected(src)->id.name.str, ""), + ast_channel_name(src), ast_channel_name(dst), e_calleridnum, e_calleridname, + e_connectedline_num, e_connectedline_name, ast_channel_uniqueid(src), ast_channel_uniqueid(dst), dialstring ? dialstring : ""); + ast_free(e_calleridnum); + ast_free(e_calleridname); + ast_free(e_connectedline_num); + ast_free(e_connectedline_name); } static void senddialendevent(struct ast_channel *src, const char *dialstatus) Index: apps/app_meetme.c =================================================================== --- apps/app_meetme.c (revision 433419) +++ apps/app_meetme.c (working copy) @@ -2898,7 +2898,13 @@ char *mailbox, *context; struct ast_format_cap *cap_slin = ast_format_cap_alloc_nolock(); struct ast_format tmpfmt; + //for escaping asterisk manager output + char *e_calleridnum = NULL; + char *e_calleridname = NULL; + char *e_connectedlinenum = NULL; + char *e_connectedlinename = NULL; + if (!cap_slin) { goto conf_run_cleanup; } @@ -3385,6 +3391,11 @@ ***/ + e_calleridnum = astman_escape_output(S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, "")); + e_calleridname = astman_escape_output(S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, "")); + e_connectedlinenum = astman_escape_output(S_COR(ast_channel_connected(user->chan)->id.number.valid, ast_channel_connected(user->chan)->id.number.str, "")); + e_connectedlinename = astman_escape_output(S_COR(ast_channel_connected(user->chan)->id.name.valid, ast_channel_connected(user->chan)->id.name.str, "")); + ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeJoin", "Channel: %s\r\n" "Uniqueid: %s\r\n" @@ -3396,12 +3407,16 @@ "ConnectedLineName: %s\r\n", ast_channel_name(chan), ast_channel_uniqueid(chan), conf->confno, user->user_no, - S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, ""), - S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, ""), - S_COR(ast_channel_connected(user->chan)->id.number.valid, ast_channel_connected(user->chan)->id.number.str, ""), - S_COR(ast_channel_connected(user->chan)->id.name.valid, ast_channel_connected(user->chan)->id.name.str, "") + e_calleridnum, + e_calleridname, + e_connectedlinenum, + e_connectedlinename ); sent_event = 1; + ast_free(e_calleridnum); + ast_free(e_calleridname); + ast_free(e_connectedlinenum); + ast_free(e_connectedlinename); } if (!firstpass && !ast_test_flag64(confflags, CONFFLAG_MONITOR) && @@ -4226,6 +4241,10 @@ ***/ + e_calleridnum = S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, ""); + e_calleridname = S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, ""); + e_connectedline_num = S_COR(ast_channel_connected(user->chan)->id.number.valid, ast_channel_connected(user->chan)->id.number.str, ""); + e_connectedline_name = S_COR(ast_channel_connected(user->chan)->id.name.valid, ast_channel_connected(user->chan)->id.name.str, ""); ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeLeave", "Channel: %s\r\n" "Uniqueid: %s\r\n" @@ -4238,11 +4257,15 @@ "Duration: %ld\r\n", ast_channel_name(chan), ast_channel_uniqueid(chan), conf->confno, user->user_no, - S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, ""), - S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, ""), - S_COR(ast_channel_connected(user->chan)->id.number.valid, ast_channel_connected(user->chan)->id.number.str, ""), - S_COR(ast_channel_connected(user->chan)->id.name.valid, ast_channel_connected(user->chan)->id.name.str, ""), + e_calleridnum, + e_calleridname, + e_connectedline_num, + e_connectedline_name, (long)(now.tv_sec - user->jointime)); + ast_free(e_calleridnum); + ast_free(e_calleridname); + ast_free(e_connectedline_num); + ast_free(e_connectedline_name); } if (setusercount) { Index: apps/app_queue.c =================================================================== --- apps/app_queue.c (revision 433419) +++ apps/app_queue.c (working copy) @@ -1676,6 +1676,10 @@ */ static int update_status(struct call_queue *q, struct member *m, const int status) { + char *e_queue = astman_escape_output(q->name); + char *e_location = astman_escape_output(m->interface); + char *e_membername = astman_escape_output(m->membername); + m->status = status; if (q->maskmemberstatus) { @@ -1748,10 +1752,12 @@ "LastCall: %d\r\n" "Status: %d\r\n" "Paused: %d\r\n", - q->name, m->interface, m->membername, m->state_interface, m->dynamic ? "dynamic" : m->realtime ? "realtime" : "static", + e_queue, e_location, e_membername, m->state_interface, m->dynamic ? "dynamic" : m->realtime ? "realtime" : "static", m->penalty, m->calls, (int)m->lastcall, m->status, m->paused ); - + ast_free(e_queue); + ast_free(e_location); + ast_free(e_membername); return 0; } @@ -2979,6 +2985,13 @@ if (*reason == QUEUE_UNKNOWN && q->maxlen && (q->count >= q->maxlen)) { *reason = QUEUE_FULL; } else if (*reason == QUEUE_UNKNOWN) { + //asterisk manager escaped output vars + char *e_calleridnum = NULL; + char *e_calleridname = NULL; + char *e_connectedlinenum = NULL; + char *e_connectedlinename = NULL; + char *e_queue = NULL; + /* There's space for us, put us at the right position inside * the queue. * Take into account the priority of the calling user */ @@ -3039,6 +3052,11 @@ ***/ + e_calleridnum = astman_escape_output(S_COR(ast_channel_caller(qe->chan)->id.number.valid, ast_channel_caller(qe->chan)->id.number.str, "unknown")); + e_calleridname = astman_escape_output(S_COR(ast_channel_caller(qe->chan)->id.name.valid, ast_channel_caller(qe->chan)->id.name.str, "unknown")); + e_connectedlinenum = astman_escape_output(S_COR(ast_channel_connected(qe->chan)->id.number.valid, ast_channel_connected(qe->chan)->id.number.str, "unknown")); + e_connectedlinename = astman_escape_output(S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown")); + e_queue = astman_escape_output(q->name); ast_manager_event(qe->chan, EVENT_FLAG_CALL, "Join", "Channel: %s\r\n" "CallerIDNum: %s\r\n" @@ -3050,12 +3068,17 @@ "Count: %d\r\n" "Uniqueid: %s\r\n", ast_channel_name(qe->chan), - S_COR(ast_channel_caller(qe->chan)->id.number.valid, ast_channel_caller(qe->chan)->id.number.str, "unknown"),/* XXX somewhere else it is */ - S_COR(ast_channel_caller(qe->chan)->id.name.valid, ast_channel_caller(qe->chan)->id.name.str, "unknown"), - S_COR(ast_channel_connected(qe->chan)->id.number.valid, ast_channel_connected(qe->chan)->id.number.str, "unknown"),/* XXX somewhere else it is */ - S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown"), - q->name, qe->pos, q->count, ast_channel_uniqueid(qe->chan)); + e_calleridnum, + e_calleridname, + e_connectedlinenum, + e_connectedlinename, + e_queue, qe->pos, q->count, ast_channel_uniqueid(qe->chan)); ast_debug(1, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, ast_channel_name(qe->chan), qe->pos ); + ast_free(e_calleridnum); + ast_free(e_calleridname); + ast_free(e_connectedlinenum); + ast_free(e_connectedlinename); + ast_free(e_queue); } ao2_unlock(q); queue_t_unref(q, "Done with realtime queue"); @@ -3323,6 +3346,7 @@ for (current = q->head; current; current = current->next) { if (current == qe) { char posstr[20]; + char *e_queue = NULL; q->count--; if (!q->count) { ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s", q->name); @@ -3342,9 +3366,11 @@ ***/ + e_queue = astman_escape_output(q->name); ast_manager_event(qe->chan, EVENT_FLAG_CALL, "Leave", "Channel: %s\r\nQueue: %s\r\nCount: %d\r\nPosition: %d\r\nUniqueid: %s\r\n", - ast_channel_name(qe->chan), q->name, q->count, qe->pos, ast_channel_uniqueid(qe->chan)); + ast_channel_name(qe->chan), e_queue, q->count, qe->pos, ast_channel_uniqueid(qe->chan)); + ast_free(e_queue); ast_debug(1, "Queue '%s' Leave, Channel '%s'\n", q->name, ast_channel_name(qe->chan)); /* Take us out of the queue */ if (prev) { @@ -3789,7 +3815,15 @@ if (qe->parent->eventwhencalled) { char vars[2048]; +; char *e_queue = astman_escape_output(qe->parent->name); + char *e_agentcalled = astman_escape_output(tmp->interface); + char *e_agentname = astman_escape_output(tmp->member->membername); + char *e_calleridnum = astman_escape_output(S_COR(ast_channel_caller(qe->chan)->id.number.valid, ast_channel_caller(qe->chan)->id.number.str, "unknown")); + char *e_calleridname = astman_escape_output(S_COR(ast_channel_caller(qe->chan)->id.name.valid, ast_channel_caller(qe->chan)->id.name.str, "unknown")); + char *e_connectedlinenum = astman_escape_output(S_COR(ast_channel_connected(qe->chan)->id.number.valid, ast_channel_connected(qe->chan)->id.number.str, "unknown")); + char *e_connectedlinename = astman_escape_output(S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown")); + ast_channel_lock_both(tmp->chan, qe->chan); /*** DOCUMENTATION @@ -3829,17 +3863,23 @@ "Priority: %d\r\n" "Uniqueid: %s\r\n" "%s", - qe->parent->name, tmp->interface, tmp->member->membername, ast_channel_name(qe->chan), ast_channel_name(tmp->chan), - S_COR(ast_channel_caller(qe->chan)->id.number.valid, ast_channel_caller(qe->chan)->id.number.str, "unknown"), - S_COR(ast_channel_caller(qe->chan)->id.name.valid, ast_channel_caller(qe->chan)->id.name.str, "unknown"), - S_COR(ast_channel_connected(qe->chan)->id.number.valid, ast_channel_connected(qe->chan)->id.number.str, "unknown"), - S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown"), + e_queue, e_agentcalled, e_agentname, ast_channel_name(qe->chan), ast_channel_name(tmp->chan), + e_calleridnum, + e_calleridname, + e_connectedlinenum, + e_connectedlinename, ast_channel_context(qe->chan), ast_channel_exten(qe->chan), ast_channel_priority(qe->chan), ast_channel_uniqueid(qe->chan), qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : ""); ast_channel_unlock(tmp->chan); ast_channel_unlock(qe->chan); - + ast_free(e_queue); + ast_free(e_agentcalled); + ast_free(e_agentname); + ast_free(e_calleridnum); + ast_free(e_calleridname); + ast_free(e_connectedlinenum); + ast_free(e_connectedlinename); ast_verb(3, "Called %s\n", tmp->interface); } @@ -4021,6 +4061,7 @@ /*! \brief Record that a caller gave up on waiting in queue */ static void record_abandoned(struct queue_ent *qe) { + char *e_queue = astman_escape_output(qe->parent->name); set_queue_variables(qe->parent, qe->chan); ao2_lock(qe->parent); /*** DOCUMENTATION @@ -4044,8 +4085,8 @@ "Position: %d\r\n" "OriginalPosition: %d\r\n" "HoldTime: %d\r\n", - qe->parent->name, ast_channel_uniqueid(qe->chan), qe->pos, qe->opos, (int)(time(NULL) - qe->start)); - + e_queue, ast_channel_uniqueid(qe->chan), qe->pos, qe->opos, (int)(time(NULL) - qe->start)); + ast_free(e_queue); qe->parent->callsabandoned++; ao2_unlock(qe->parent); } @@ -4063,6 +4104,10 @@ if (qe->parent->eventwhencalled) { char vars[2048]; + char *e_queue = astman_escape_output(qe->parent->name); + char *e_member = astman_escape_output(interface); + char *e_membername = astman_escape_output(membername); + /*** DOCUMENTATION Raised when an agent is notified of a member in the queue and fails to answer. @@ -4081,7 +4126,7 @@ AgentCalled - ***/ + ***/ manager_event(EVENT_FLAG_AGENT, "AgentRingNoAnswer", "Queue: %s\r\n" "Uniqueid: %s\r\n" @@ -4090,13 +4135,16 @@ "MemberName: %s\r\n" "RingTime: %d\r\n" "%s", - qe->parent->name, + e_queue, ast_channel_uniqueid(qe->chan), ast_channel_name(qe->chan), - interface, - membername, + e_member, + e_membername, rnatime, qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : ""); + ast_free(e_queue); + ast_free(e_member); + ast_free(e_membername); } ast_queue_log(qe->parent->name, ast_channel_uniqueid(qe->chan), membername, "RINGNOANSWER", "%d", rnatime); if (qe->parent->autopause != QUEUE_AUTOPAUSE_OFF && autopause) { @@ -5007,6 +5055,9 @@ char *vars, size_t vars_len, enum agent_complete_reason rsn) { const char *reason = NULL; /* silence dumb compilers */ + char *e_queue = NULL; + char *e_member = NULL; + char *e_membername = NULL; if (!qe->parent->eventwhencalled) { return; @@ -5050,6 +5101,10 @@ ***/ + e_queue = astman_escape_output(queuename); + e_member = astman_escape_output(member->interface); + e_membername = astman_escape_output(member->membername); + manager_event(EVENT_FLAG_AGENT, "AgentComplete", "Queue: %s\r\n" "Uniqueid: %s\r\n" @@ -5060,9 +5115,12 @@ "TalkTime: %ld\r\n" "Reason: %s\r\n" "%s", - queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername, + e_queue, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), e_member, e_membername, (long)(callstart - qe->start), (long)(time(NULL) - callstart), reason, qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, vars_len) : ""); + ast_free(e_queue); + ast_free(e_member); + ast_free(e_membername); } struct queue_transfer_ds { @@ -5593,7 +5651,11 @@ /* Agent must have hung up */ ast_log(LOG_WARNING, "Agent on %s hungup on the customer.\n", ast_channel_name(peer)); ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "AGENTDUMP", "%s", ""); - if (qe->parent->eventwhencalled) + if (qe->parent->eventwhencalled) { + char *e_queue = astman_escape_output(queuename); + char *e_member = astman_escape_output(member->interface); + char *e_membername = astman_escape_output(member->membername); + /*** DOCUMENTATION Raised when an agent hangs up on a member in the queue. @@ -5616,8 +5678,12 @@ "Member: %s\r\n" "MemberName: %s\r\n" "%s", - queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername, + e_queue, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), e_member, e_membername, qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : ""); + ast_free(e_queue); + ast_free(e_member); + ast_free(e_membername); + } ast_autoservice_chan_hangup_peer(qe->chan, peer); ao2_ref(member, -1); goto out; @@ -5921,7 +5987,10 @@ } } - if (qe->parent->eventwhencalled) + if (qe->parent->eventwhencalled) { + char *e_queuename = astman_escape_output(queuename); + char *e_member = astman_escape_output(member->interface); + char *e_membername = astman_escape_output(member->membername); /*** DOCUMENTATION Raised when an agent answers and is bridged to a member in the queue. @@ -5950,9 +6019,13 @@ "BridgedChannel: %s\r\n" "RingTime: %ld\r\n" "%s", - queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername, + e_queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), e_member, e_membername, (long) time(NULL) - qe->start, ast_channel_uniqueid(peer), (long)(orig - to > 0 ? (orig - to) / 1000 : 0), qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : ""); + ast_free(e_queuename); + ast_free(e_member); + ast_free(e_membername); + } ast_copy_string(oldcontext, ast_channel_context(qe->chan), sizeof(oldcontext)); ast_copy_string(oldexten, ast_channel_exten(qe->chan), sizeof(oldexten)); @@ -6143,6 +6216,9 @@ if ((q = ao2_t_find(queues, &tmpq, OBJ_POINTER, "Temporary reference for interface removal"))) { ao2_lock(q); if ((mem = ao2_find(q->members, &tmpmem, OBJ_POINTER))) { + char *e_queue = astman_escape_output(q->name); + char *e_location = astman_escape_output(mem->interface); + char *e_membername = astman_escape_output(mem->membername); /* XXX future changes should beware of this assumption!! */ /*Change Penalty on realtime users*/ if (mem->realtime && !ast_strlen_zero(mem->rt_uniqueid) && negative_penalty_invalid) { @@ -6171,8 +6247,11 @@ "Queue: %s\r\n" "Location: %s\r\n" "MemberName: %s\r\n", - q->name, mem->interface, mem->membername); + e_queue, e_location, e_membername); member_remove_from_queue(q, mem); + ast_free(e_queue); + ast_free(e_location); + ast_free(e_membername); ao2_ref(mem, -1); if (queue_persistent_members) { @@ -6216,6 +6295,10 @@ ao2_lock(q); if ((old_member = interface_exists(q, interface)) == NULL) { if ((new_member = create_queue_member(interface, membername, penalty, paused, state_interface, q->ringinuse))) { + char *e_queue = astman_escape_output(q->name); + char *e_location = astman_escape_output(new_member->interface); + char *e_membername = astman_escape_output(new_member->membername); + char *e_stateinterface = astman_escape_output(state_interface); new_member->ringinuse = q->ringinuse; new_member->dynamic = 1; member_add_to_queue(q, new_member); @@ -6251,11 +6334,16 @@ "LastCall: %d\r\n" "Status: %d\r\n" "Paused: %d\r\n", - q->name, new_member->interface, new_member->membername, state_interface, + e_queue, e_location, e_membername, e_stateinterface, "dynamic", new_member->penalty, new_member->calls, (int) new_member->lastcall, new_member->status, new_member->paused); + ast_free(e_queue); + ast_free(e_location); + ast_free(e_membername); + ast_free(e_stateinterface); + if (is_member_available(q, new_member)) { ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name); } @@ -6331,6 +6419,10 @@ ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", S_OR(reason, "")); if (!ast_strlen_zero(reason)) { + char *e_queue = astman_escape_output(q->name); + char *e_location = astman_escape_output(mem->interface); + char *e_membername = astman_escape_output(mem->membername); + char *e_reason = astman_escape_output(reason); /*** DOCUMENTATION Raised when a member is paused/unpaused in the queue with a reason. @@ -6355,8 +6447,15 @@ "MemberName: %s\r\n" "Paused: %d\r\n" "Reason: %s\r\n", - q->name, mem->interface, mem->membername, paused, reason); + e_queue, e_location, e_membername, paused, e_reason); + ast_free(e_queue); + ast_free(e_location); + ast_free(e_membername); + ast_free(e_reason); } else { + char *e_queue = astman_escape_output(q->name); + char *e_location = astman_escape_output(mem->interface); + char *e_membername = astman_escape_output(mem->membername); /*** DOCUMENTATION Raised when a member is paused/unpaused in the queue without a reason. @@ -6377,7 +6476,10 @@ "Location: %s\r\n" "MemberName: %s\r\n" "Paused: %d\r\n", - q->name, mem->interface, mem->membername, paused); + e_queue, e_location, e_membername, paused); + ast_free(e_queue); + ast_free(e_location); + ast_free(e_membername); } ao2_ref(mem, -1); } @@ -6414,6 +6516,8 @@ ao2_lock(q); if ((mem = interface_exists(q, interface))) { + char *e_queue = astman_escape_output(q->name); + char *e_location = astman_escape_output(mem->interface); foundinterface++; if (!mem->realtime) { mem->penalty = penalty; @@ -6439,8 +6543,10 @@ "Queue: %s\r\n" "Location: %s\r\n" "Penalty: %d\r\n", - q->name, mem->interface, penalty); + e_queue, e_location, penalty); ao2_ref(mem, -1); + ast_free(e_queue); + ast_free(e_location); } ao2_unlock(q); @@ -6455,6 +6561,8 @@ ao2_lock(q); if ((mem = interface_exists(q, interface))) { + char *e_queue = astman_escape_output(q->name); + char *e_location = astman_escape_output(mem->interface); foundinterface++; if (!mem->realtime) { mem->ringinuse = ringinuse; @@ -6485,8 +6593,10 @@ "Queue: %s\r\n" "Location: %s\r\n" "Ringinuse: %d\r\n", - q->name, mem->interface, ringinuse); + e_queue, e_location, ringinuse); ao2_ref(mem, -1); + ast_free(e_queue); + ast_free(e_location); } ao2_unlock(q); Index: apps/app_stack.c =================================================================== --- apps/app_stack.c (revision 433419) +++ apps/app_stack.c (working copy) @@ -235,6 +235,9 @@ { struct ast_var_t *variables; int found = 0; + //escaped otuput for asterisk manager values + char *e_var = NULL; + char *e_value = NULL; /* Does this variable already exist? */ AST_LIST_TRAVERSE(&frame->varshead, variables, entries) { @@ -261,12 +264,16 @@ ***/ + e_var = astman_escape_output(var); + e_value = astman_escape_output(value); manager_event(EVENT_FLAG_DIALPLAN, "VarSet", "Channel: %s\r\n" "Variable: LOCAL(%s)\r\n" "Value: %s\r\n" "Uniqueid: %s\r\n", - ast_channel_name(chan), var, value, ast_channel_uniqueid(chan)); + ast_channel_name(chan), e_var, e_value, ast_channel_uniqueid(chan)); + ast_free(e_var); + ast_free(e_value); return 0; } Index: apps/app_userevent.c =================================================================== --- apps/app_userevent.c (revision 433419) +++ apps/app_userevent.c (working copy) @@ -64,6 +64,7 @@ { char *parse; int x; + char *e_eventname; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(eventname); AST_APP_ARG(extra)[100]; @@ -100,14 +101,14 @@ ***/ + e_eventname = astman_escape_output(args.eventname); manager_event(EVENT_FLAG_USER, "UserEvent", "UserEvent: %s\r\n" "Uniqueid: %s\r\n" "%s", - args.eventname, ast_channel_uniqueid(chan), ast_str_buffer(body)); - + e_eventname, ast_channel_uniqueid(chan), ast_str_buffer(body)); ast_free(body); - + ast_free(e_eventname); return 0; } Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 433419) +++ apps/app_voicemail.c (working copy) @@ -7800,6 +7800,7 @@ int newmsgs = 0, oldmsgs = 0, urgentmsgs = 0; const char *category; char *myserveremail = serveremail; + char *e_mailbox = NULL; ast_channel_lock(chan); if ((category = pbx_builtin_getvar_helper(chan, "VM_CATEGORY"))) { @@ -7838,6 +7839,7 @@ struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE }; char filename[PATH_MAX]; + snprintf(filename, sizeof(filename), "%s.txt", fn); msg_cfg = ast_config_load(filename, config_flags); if (msg_cfg && msg_cfg != CONFIG_STATUS_FILEINVALID) { @@ -7869,6 +7871,7 @@ queue_mwi_event(ext_context, urgentmsgs, newmsgs, oldmsgs); + e_mailbox = astman_escape_output(vmu->mailbox); /*** DOCUMENTATION Raised when a new message has been left in a voicemail mailbox. @@ -7892,7 +7895,8 @@ "Mailbox: %s@%s\r\n" "Waiting: %d\r\n" "New: %d\r\n" - "Old: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs); + "Old: %d\r\n", e_mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs); + ast_free(e_mailbox); run_externnotify(vmu->context, vmu->mailbox, flag); #ifdef IMAP_STORAGE @@ -11558,6 +11562,7 @@ close_mailbox(&vms, vmu); if (valid) { int new = 0, old = 0, urgent = 0; + char *e_mailbox = astman_escape_output(ext_context); snprintf(ext_context, sizeof(ext_context), "%s@%s", vms.username, vmu->context); /*** DOCUMENTATION @@ -11564,7 +11569,8 @@ Raised when a user has finished listening to their messages. ***/ - ast_manager_event(chan, EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, has_voicemail(ext_context, NULL)); + ast_manager_event(chan, EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", e_mailbox, has_voicemail(ext_context, NULL)); + ast_free(e_mailbox); /* Urgent flag not passwd to externnotify here */ run_externnotify(vmu->context, vmu->mailbox, NULL); ast_app_inboxcount2(ext_context, &urgent, &new, &old); Index: cdr/cdr_manager.c =================================================================== --- cdr/cdr_manager.c (revision 433419) +++ cdr/cdr_manager.c (working copy) @@ -142,6 +142,15 @@ char strAnswerTime[80] = ""; char strEndTime[80] = ""; char buf[CUSTOM_FIELDS_BUF_SIZE]; + // + char *e_accountcode = astman_escape_output(cdr->accountcode); + char *e_source = astman_escape_output(cdr->src); + char *e_destination = astman_escape_output(cdr->dst); + char *e_destinationcontext = astman_escape_output(cdr->dcontext); + char *e_callerid = astman_escape_output(cdr->clid); + char *e_lastapplication = astman_escape_output(cdr->lastapp); + char *e_lastdata = astman_escape_output(cdr->lastdata); + char *e_userfield = astman_escape_output(cdr->userfield); if (!enablecdr) return 0; @@ -191,11 +200,18 @@ "UniqueID: %s\r\n" "UserField: %s\r\n" "%s", - cdr->accountcode, cdr->src, cdr->dst, cdr->dcontext, cdr->clid, cdr->channel, - cdr->dstchannel, cdr->lastapp, cdr->lastdata, strStartTime, strAnswerTime, strEndTime, + e_accountcode, e_source, e_destination, e_destinationcontext, e_callerid, cdr->channel, + cdr->dstchannel, e_lastapplication, e_lastdata, strStartTime, strAnswerTime, strEndTime, cdr->duration, cdr->billsec, ast_cdr_disp2str(cdr->disposition), - ast_cdr_flags2str(cdr->amaflags), cdr->uniqueid, cdr->userfield,buf); - + ast_cdr_flags2str(cdr->amaflags), cdr->uniqueid, e_userfield, buf); + ast_free(e_accountcode); + ast_free(e_source); + ast_free(e_destination); + ast_free(e_destinationcontext); + ast_free(e_callerid); + ast_free(e_lastapplication); + ast_free(e_lastdata); + ast_free(e_userfield); return 0; } Index: cel/cel_manager.c =================================================================== --- cel/cel_manager.c (revision 433419) +++ cel/cel_manager.c (working copy) @@ -71,6 +71,18 @@ struct ast_cel_event_record record = { .version = AST_CEL_EVENT_RECORD_VERSION, }; + char *e_accountcode = astman_escape_output(record.account_code); + char *e_calleridnum = astman_escape_output(record.caller_id_num); + char *e_calleridname = astman_escape_output(record.caller_id_name); + char *e_calleridani = astman_escape_output(record.caller_id_ani); + char *e_calleridrdnis = astman_escape_output(record.caller_id_rdnis); + char *e_calleriddnid = astman_escape_output(record.caller_id_dnid); + char *e_exten = astman_escape_output(record.extension); + char *e_context = astman_escape_output(record.context); + char *e_application = astman_escape_output(record.application_name); + char *e_appdata = astman_escape_output(record.application_data); + char *e_userfield = astman_escape_output(record.user_field); + char *e_extra = astman_escape_output(record.extra); if (!enablecel) { return; @@ -117,26 +129,38 @@ "%s" "Extra: %s\r\n", event_name, - record.account_code, - record.caller_id_num, - record.caller_id_name, - record.caller_id_ani, - record.caller_id_rdnis, - record.caller_id_dnid, - record.extension, - record.context, + e_accountcode, + e_calleridnum, + e_calleridname, + e_calleridani, + e_calleridrdnis, + e_calleriddnid, + e_exten, + e_context, record.channel_name, - record.application_name, - record.application_data, + e_application, + e_appdata, start_time, ast_cel_get_ama_flag_name(record.amaflag), record.unique_id, record.linked_id, - record.user_field, + e_userfield, record.peer, record.peer_account, user_defined_header, - record.extra); + e_extra); + ast_free(e_accountcode); + ast_free(e_calleridnum); + ast_free(e_calleridname); + ast_free(e_calleridani); + ast_free(e_calleridrdnis); + ast_free(e_calleriddnid); + ast_free(e_exten); + ast_free(e_context); + ast_free(e_application); + ast_free(e_appdata); + ast_free(e_userfield); + ast_free(e_extra); } static int load_config(int reload) Index: channels/chan_agent.c =================================================================== --- channels/chan_agent.c (revision 433419) +++ channels/chan_agent.c (working copy) @@ -2062,6 +2062,7 @@ if (!res) { long logintime; char agent[AST_MAX_AGENT]; + char *e_agent = NULL; snprintf(agent, sizeof(agent), "Agent/%s", p->agent); @@ -2073,7 +2074,7 @@ /* Must be done after starting HOLD. */ p->lastdisc = ast_tvnow(); time(&p->loginstart); - + e_agent = astman_escape_output(p->agent); /*** DOCUMENTATION Raised when an Agent has logged in. @@ -2092,7 +2093,8 @@ "Agent: %s\r\n" "Channel: %s\r\n" "Uniqueid: %s\r\n", - p->agent, ast_channel_name(chan), ast_channel_uniqueid(chan)); + e_agent, ast_channel_name(chan), ast_channel_uniqueid(chan)); + ast_free(e_agent); 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)); @@ -2176,6 +2178,7 @@ ast_mutex_unlock(&p->lock); ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "%s", agent); + e_agent = astman_escape_output(p->agent); /*** DOCUMENTATION Raised when an Agent has logged off. @@ -2191,7 +2194,8 @@ "Agent: %s\r\n" "Logintime: %ld\r\n" "Uniqueid: %s\r\n", - p->agent, logintime, ast_channel_uniqueid(chan)); + e_agent, logintime, ast_channel_uniqueid(chan)); + ast_free(e_agent); ast_queue_log("NONE", ast_channel_uniqueid(chan), agent, "AGENTLOGOFF", "%s|%ld", ast_channel_name(chan), logintime); ast_verb(2, "Agent '%s' logged out\n", p->agent); Index: channels/chan_iax2.c =================================================================== --- channels/chan_iax2.c (revision 433419) +++ channels/chan_iax2.c (working copy) @@ -1461,10 +1461,12 @@ and IAX2 call identifiers */ static void iax2_ami_channelupdate(struct chan_iax2_pvt *pvt) { + char *e_peer = astman_escape_output(pvt->peer ? pvt->peer : ""); manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nChanneltype: IAX2\r\nIAX2-callno-local: %d\r\nIAX2-callno-remote: %d\r\nIAX2-peer: %s\r\n", pvt->owner ? ast_channel_name(pvt->owner) : "", - pvt->callno, pvt->peercallno, pvt->peer ? pvt->peer : ""); + pvt->callno, pvt->peercallno, e_peer); + ast_free(e_peer); } static const struct ast_datastore_info iax2_variable_datastore_info = { @@ -8698,6 +8700,7 @@ reg->expire = iax2_sched_replace(reg->expire, sched, (5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg); if (inaddrcmp(&oldus, ®->us) || (reg->messages != oldmsgs)) { + char *e_domain = astman_escape_output(ast_inet_ntoa(sin->sin_addr)); if (reg->messages > 255) { snprintf(msgstatus, sizeof(msgstatus), " with %d new and %d old messages waiting", reg->messages & 0xff, reg->messages >> 8); } else if (reg->messages > 1) { @@ -8709,7 +8712,8 @@ } snprintf(ourip, sizeof(ourip), "%s:%d", ast_inet_ntoa(reg->us.sin_addr), ntohs(reg->us.sin_port)); ast_verb(3, "Registered IAX2 to '%s', who sees us as %s%s\n", ast_inet_ntoa(sin->sin_addr), ourip, msgstatus); - manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: IAX2\r\nDomain: %s\r\nStatus: Registered\r\n", ast_inet_ntoa(sin->sin_addr)); + manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: IAX2\r\nDomain: %s\r\nStatus: Registered\r\n", e_domain); + ast_free(e_domain); } reg->regstate = REG_STATE_REGISTERED; return 0; Index: channels/chan_local.c =================================================================== --- channels/chan_local.c (revision 433419) +++ channels/chan_local.c (working copy) @@ -891,6 +891,8 @@ char *slash; const char *exten; const char *context; + char *e_context = NULL; + char *e_exten = NULL; if (!p) { return -1; @@ -973,7 +975,8 @@ chan = ast_channel_unref(chan); /* we already unlocked it, so clear it hear so the cleanup label won't touch it. */ goto return_cleanup; } - + e_context = astman_escape_output(p->context); + e_exten = astman_escape_output(p->exten); /*** DOCUMENTATION Raised when two halves of a Local Channel form a bridge. @@ -1008,10 +1011,11 @@ "Exten: %s\r\n" "LocalOptimization: %s\r\n", ast_channel_name(p->owner), ast_channel_name(p->chan), ast_channel_uniqueid(p->owner), ast_channel_uniqueid(p->chan), - p->context, p->exten, + e_context, e_exten, ast_test_flag(p, LOCAL_NO_OPTIMIZATION) ? "No" : "Yes"); + ast_free(e_context); + ast_free(e_exten); - /* Start switch on sub channel */ if (!(res = ast_pbx_start(chan))) { ao2_lock(p);