summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2006-04-17 14:00:44 +0000
committerOlle Johansson <oej@edvina.net>2006-04-17 14:00:44 +0000
commit5320c6b76a52fcbdf6c534ed94e51fa5ffdebd03 (patch)
tree17b0e78eee9a4838f5837a6e8fd654d50bd2fa74
parent42918c225af0e1b5bbde0e5ae703da79c16d7dc6 (diff)
- Add supported header
- Send cause codes as well git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20908 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--channels/chan_sip.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 7d7114b8f..4b581917e 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4314,6 +4314,7 @@ static int respprep(struct sip_request *resp, struct sip_pvt *p, const char *msg
copy_header(resp, req, "CSeq");
add_header(resp, "User-Agent", global_useragent);
add_header(resp, "Allow", ALLOWED_METHODS);
+ add_header(resp, "Supported", SUPPORTED_EXTENSIONS);
if (msg[0] == '2' && (p->method == SIP_SUBSCRIBE || p->method == SIP_REGISTER)) {
/* For registration responses, we also need expiry and
contact info */
@@ -4448,8 +4449,12 @@ static int __transmit_response(struct sip_pvt *p, const char *msg, struct sip_re
add_header_contentLength(&resp, 0);
/* If we are cancelling an incoming invite for some reason, add information
about the reason why we are doing this in clear text */
- if (msg[0] != '1' && p->owner && p->owner->hangupcause) {
+ if (p->method == SIP_INVITE && msg[0] != '1' && p->owner && p->owner->hangupcause) {
+ char buf[10];
+
add_header(&resp, "X-Asterisk-HangupCause", ast_cause2str(p->owner->hangupcause));
+ snprintf(buf, sizeof(buf), "%d", p->owner->hangupcause);
+ add_header(&resp, "X-Asterisk-HangupCauseCode", buf);
}
add_blank_header(&resp);
return send_response(p, &resp, reliable, seqno);
@@ -5905,10 +5910,12 @@ static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, int seqn
}
/* If we are hanging up and know a cause for that, send it in clear text to make
debugging easier. */
- if (sipmethod == SIP_BYE) {
- if (p->owner && p->owner->hangupcause) {
- add_header(&resp, "X-Asterisk-HangupCause", ast_cause2str(p->owner->hangupcause));
- }
+ if (sipmethod == SIP_BYE && p->owner && p->owner->hangupcause) {
+ char buf[10];
+
+ add_header(&resp, "X-Asterisk-HangupCause", ast_cause2str(p->owner->hangupcause));
+ snprintf(buf, sizeof(buf), "%d", p->owner->hangupcause);
+ add_header(&resp, "X-Asterisk-HangupCauseCode", buf);
}
add_header_contentLength(&resp, 0);