summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-09-29 07:27:22 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-09-29 07:27:22 -0500
commit9425eaa96dcf8860f3d7a544f68d3ca98f565d94 (patch)
treee8c4e4b6c5a48aac5cc4cf5f57c45b9b985f58bc /apps
parent549d7260653bac4604d5dcf3dd4a9d6409a92210 (diff)
parent6bf304bf251e31ab7c7a4d89508445b84fb5d551 (diff)
Merge "app_queue.c: Factor out a connected line update routine." into 13
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index dbaa16718..2ca3a9e8e 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4561,6 +4561,34 @@ static void rna(int rnatime, struct queue_ent *qe, struct ast_channel *peer, cha
return;
}
+/*!
+ * \internal
+ * \brief Update connected line on chan from peer.
+ * \since 13.6.0
+ *
+ * \param chan Channel to get connected line updated.
+ * \param peer Channel providing connected line information.
+ * \param is_caller Non-zero if chan is the calling channel.
+ *
+ * \return Nothing
+ */
+static void update_connected_line_from_peer(struct ast_channel *chan, struct ast_channel *peer, int is_caller)
+{
+ struct ast_party_connected_line connected_caller;
+
+ ast_party_connected_line_init(&connected_caller);
+
+ ast_channel_lock(peer);
+ ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(peer));
+ ast_channel_unlock(peer);
+ connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
+ if (ast_channel_connected_line_sub(peer, chan, &connected_caller, 0)
+ && ast_channel_connected_line_macro(peer, chan, &connected_caller, is_caller, 0)) {
+ ast_channel_update_connected_line(chan, &connected_caller, NULL);
+ }
+ ast_party_connected_line_free(&connected_caller);
+}
+
#define AST_MAX_WATCHERS 256
/*!
* \brief Wait for a member to answer the call
@@ -4595,12 +4623,9 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
#ifdef HAVE_EPOLL
struct callattempt *epollo;
#endif
- struct ast_party_connected_line connected_caller;
char *inchan_name;
struct timeval start_time_tv = ast_tvnow();
- ast_party_connected_line_init(&connected_caller);
-
ast_channel_lock(qe->chan);
inchan_name = ast_strdupa(ast_channel_name(qe->chan));
ast_channel_unlock(qe->chan);
@@ -4685,15 +4710,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
ast_channel_update_connected_line(in, &o->connected, NULL);
}
} else if (!o->dial_callerid_absent) {
- ast_channel_lock(o->chan);
- ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(o->chan));
- ast_channel_unlock(o->chan);
- connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
- if (ast_channel_connected_line_sub(o->chan, in, &connected_caller, 0) &&
- ast_channel_connected_line_macro(o->chan, in, &connected_caller, 1, 0)) {
- ast_channel_update_connected_line(in, &connected_caller, NULL);
- }
- ast_party_connected_line_free(&connected_caller);
+ update_connected_line_from_peer(in, o->chan, 1);
}
}
if (o->aoc_s_rate_list) {
@@ -4856,15 +4873,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
ast_channel_update_connected_line(in, &o->connected, NULL);
}
} else if (!o->dial_callerid_absent) {
- ast_channel_lock(o->chan);
- ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(o->chan));
- ast_channel_unlock(o->chan);
- connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
- if (ast_channel_connected_line_sub(o->chan, in, &connected_caller, 0) &&
- ast_channel_connected_line_macro(o->chan, in, &connected_caller, 1, 0)) {
- ast_channel_update_connected_line(in, &connected_caller, NULL);
- }
- ast_party_connected_line_free(&connected_caller);
+ update_connected_line_from_peer(in, o->chan, 1);
}
}
if (o->aoc_s_rate_list) {