diff options
author | Kinsey Moore <kmoore@digium.com> | 2014-06-05 11:59:09 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2014-06-05 11:59:09 +0000 |
commit | 6fd8940d4c62c2ab052a3a7877278bee1eea5563 (patch) | |
tree | 0902b54187f26ce3b0752e77d958671c0298c39a /channels/chan_pjsip.c | |
parent | cfb9c8bff1969dacadf97292c49bc3e1dcf17b17 (diff) |
PJSIP: Send initial connected line information
This makes chan_pjsip send connected line information when it is called
so that connected line information is available on the connected
channel.
(closes issue DPMA-442)
Reported by: John Bigelow
Review: https://reviewboard.asterisk.org/r/3584/
........
Merged revisions 415191 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415192 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_pjsip.c')
-rw-r--r-- | channels/chan_pjsip.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index 26dda4ae2..fcf2a4c1d 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -1467,6 +1467,38 @@ static int chan_pjsip_digit_end(struct ast_channel *ast, char digit, unsigned in return res; } +static void update_initial_connected_line(struct ast_sip_session *session) +{ + struct ast_party_connected_line connected; + struct ast_set_party_connected_line update_connected; + struct ast_sip_endpoint_id_configuration *id = &session->endpoint->id; + + if (!id->self.number.valid && !id->self.name.valid) { + return; + } + + /* Supply initial connected line information if available. */ + memset(&update_connected, 0, sizeof(update_connected)); + ast_party_connected_line_init(&connected); + connected.id.number = id->self.number; + connected.id.name = id->self.name; + connected.id.tag = id->self.tag; + connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; + + if (connected.id.number.valid) { + update_connected.id.number = 1; + } + + if (connected.id.name.valid) { + update_connected.id.name = 1; + } + + /* Invalidate any earlier private connected id representation */ + ast_set_party_id_all(&update_connected.priv); + + ast_channel_queue_connected_line_update(session->channel, &connected, &update_connected); +} + static int call(void *data) { struct ast_sip_session *session = data; @@ -1477,6 +1509,7 @@ static int call(void *data) if (res) { ast_queue_hangup(session->channel); } else { + update_initial_connected_line(session); ast_sip_session_send_request(session, tdata); } ao2_ref(session, -1); |