From 165f15288626bf6b9aea43be9f2f1aeea5ae18f7 Mon Sep 17 00:00:00 2001 From: rizzo Date: Fri, 21 Apr 2006 16:04:25 +0000 Subject: merge some common code into a function git-svn-id: http://svn.digium.com/svn/asterisk/trunk@21986 f38db490-d61c-443f-a65b-d21fe96a405b --- res/res_features.c | 33 +++++++++++++++------------------ 1 file 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, ""), + S_OR(chan->cid.cid_name, "") + ); +} + /*! \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, ""), - S_OR(chan->cid.cid_name, "") - ); + 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, ""), - S_OR(chan->cid.cid_name, "") - ); + post_manager_event("ParkedCallGiveUp", pu->parkingnum, chan); /* There's a problem, hang them up*/ if (option_verbose > 1) -- cgit v1.2.3