From 05c6628c55683e7ded7c28bd9ce8c0a20d580f98 Mon Sep 17 00:00:00 2001 From: Jonathan Rose Date: Mon, 24 Oct 2011 20:01:28 +0000 Subject: Outbound SIP OPTIONS messages will now include fromuser of related peer. This behavior matches up more closely with the way invite/register/etc are handled. This patch also modifies some adjacent code for code style compliance. Pretty minor. (closes issue ASTERISK-17616) Reported by: Jeremy Kister Patches: chan_sip.c-options-fromuser-fix-v1.patch uploaded by Jeremy Kister (license #6232) ........ Merged revisions 342061 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 342062 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@342063 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'channels') diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 20498a00a..8b9b7cb7e 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -26401,7 +26401,7 @@ static int sip_poke_peer(struct sip_peer *peer, int force) return -1; } peer->call = dialog_ref(p, "copy sip alloc from p to peer->call"); - + p->sa = peer->addr; p->recv = peer->addr; copy_socket_data(&p->socket, &peer->socket); @@ -26410,13 +26410,19 @@ static int sip_poke_peer(struct sip_peer *peer, int force) ast_copy_flags(&p->flags[2], &peer->flags[2], SIP_PAGE3_FLAGS_TO_COPY); /* Send OPTIONs to peer's fullcontact */ - if (!ast_strlen_zero(peer->fullcontact)) + if (!ast_strlen_zero(peer->fullcontact)) { ast_string_field_set(p, fullcontact, peer->fullcontact); + } + + if (!ast_strlen_zero(peer->fromuser)) { + ast_string_field_set(p, fromuser, peer->fromuser); + } - if (!ast_strlen_zero(peer->tohost)) + if (!ast_strlen_zero(peer->tohost)) { ast_string_field_set(p, tohost, peer->tohost); - else + } else { ast_string_field_set(p, tohost, ast_sockaddr_stringify_host_remote(&peer->addr)); + } /* Recalculate our side, and recalculate Call ID */ ast_sip_ouraddrfor(&p->sa, &p->ourip, p); -- cgit v1.2.3