aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-05 00:42:09 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-05 00:42:09 +0000
commit9003c50da3530cb4e5c3595294f2c9785d14dead (patch)
treef2b5a6aa039d6ad8b52f037cd460d6c438cfd354 /channels/chan_sip.c
parent04f4188e6dd14e33c56862e6c4d8b1db54b203c0 (diff)
ensure that Remote-Party-ID is sent even on secondary INVITEs within a dialog (issue #5322)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6728 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rwxr-xr-xchannels/chan_sip.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 35ac5a354..407c0b46e 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2083,7 +2083,7 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner)
if (p->rpid)
free(p->rpid);
- if (p->rpid_from)
+ if (p->rpid_from && (p->rpid_from != p->from))
free(p->rpid_from);
/* Unlink us from the owner if we have one */
@@ -4034,6 +4034,10 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in
add_header(req, "CSeq", tmp);
add_header(req, "User-Agent", default_useragent);
+
+ if (ast_test_flag(p, SIP_OUTGOING) && (sipmethod == SIP_INVITE) && ast_test_flag(p, SIP_SENDRPID))
+ add_header(req, "Remote-Party-ID", p->rpid);
+
return 0;
}
@@ -4748,14 +4752,15 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho
/* SLD: FIXME?: do Route: here too? I think not cos this is the first request.
* OTOH, then we won't have anything in p->route anyway */
/* Build Remote Party-ID and From */
- if (ast_test_flag(p, SIP_SENDRPID)) {
+ if (ast_test_flag(p, SIP_SENDRPID))
build_rpid(p);
- add_header(req, "From", p->rpid_from);
- } else
- add_header(req, "From", from);
+ else
+ p->rpid_from = p->from;
+
+ add_header(req, "From", (sipmethod == SIP_INVITE) ? p->rpid_from : p->from);
+ add_header(req, "To", to);
ast_copy_string(p->exten, l, sizeof(p->exten));
build_contact(p);
- add_header(req, "To", to);
add_header(req, "Contact", p->our_contact);
add_header(req, "Call-ID", p->callid);
add_header(req, "CSeq", tmp);