diff options
author | Luigi Rizzo <rizzo@icir.org> | 2006-04-21 16:04:25 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2006-04-21 16:04:25 +0000 |
commit | 6553aa3a36410caaf0108695f1d9a6dd8d5f84b6 (patch) | |
tree | 4a08697ba95ef06d9a0ba7753fe641234bb81fbc /res/res_features.c | |
parent | 68730ba487bda915e49a9bea15be7dc077f5761b (diff) |
merge some common code into a function
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@21986 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_features.c')
-rw-r--r-- | res/res_features.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/res/res_features.c b/res/res_features.c index 0ee99aacc..b89ff80cd 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -1393,6 +1393,19 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast return res; } +static void post_manager_event(const char *s, int num, struct ast_channel *chan) +{ + manager_event(EVENT_FLAG_CALL, s, + "Exten: %d\r\n" + "Channel: %s\r\n" + "CallerID: %s\r\n" + "CallerIDName: %s\r\n\r\n", + num, chan->name, + S_OR(chan->cid.cid_num, "<unknown>"), + S_OR(chan->cid.cid_name, "<unknown>") + ); +} + /*! \brief Take care of parked calls and unpark them if needed */ static void *do_parking_thread(void *ignore) { @@ -1453,15 +1466,7 @@ static void *do_parking_thread(void *ignore) set_c_e_p(chan, pu->context, pu->exten, pu->priority); } - manager_event(EVENT_FLAG_CALL, "ParkedCallTimeOut", - "Exten: %d\r\n" - "Channel: %s\r\n" - "CallerID: %s\r\n" - "CallerIDName: %s\r\n", - pu->parkingnum, chan->name, - S_OR(chan->cid.cid_num, "<unknown>"), - S_OR(chan->cid.cid_name, "<unknown>") - ); + post_manager_event("ParkedCallTimeOut", pu->parkingnum, chan); if (option_verbose > 1) ast_verbose(VERBOSE_PREFIX_2 "Timeout for %s parked on %d. Returning to %s,%s,%d\n", chan->name, pu->parkingnum, chan->context, chan->exten, chan->priority); @@ -1503,15 +1508,7 @@ static void *do_parking_thread(void *ignore) if (!f || (f->frametype == AST_FRAME_CONTROL && f->subclass == AST_CONTROL_HANGUP)) { if (f) ast_frfree(f); - manager_event(EVENT_FLAG_CALL, "ParkedCallGiveUp", - "Exten: %d\r\n" - "Channel: %s\r\n" - "CallerID: %s\r\n" - "CallerIDName: %s\r\n", - pu->parkingnum, chan->name, - S_OR(chan->cid.cid_num, "<unknown>"), - S_OR(chan->cid.cid_name, "<unknown>") - ); + post_manager_event("ParkedCallGiveUp", pu->parkingnum, chan); /* There's a problem, hang them up*/ if (option_verbose > 1) |