diff options
author | Joshua Colp <jcolp@digium.com> | 2012-07-09 19:51:37 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2012-07-09 19:51:37 +0000 |
commit | 7baa8bf43de107cec6c172cd30d93d20961a5d12 (patch) | |
tree | a6c61a533c366efd6aae066cba0a4d74b6e77e55 /channels | |
parent | b46e1b45e4a1c466c89c59065abf760cc278714a (diff) |
Add support for exposing the received contact URI and also for setting the request URI in messages.
(closes issue AST-911)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369847 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8f44194ba..324328933 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -17347,6 +17347,7 @@ static void receive_message(struct sip_pvt *p, struct sip_request *req, struct a char *from; char *to; char from_name[50]; + char stripped[SIPBUFSIZE]; if (strncmp(content_type, "text/plain", strlen("text/plain"))) { /* No text/plain attachment */ transmit_response(p, "415 Unsupported Media Type", req); /* Good enough, or? */ @@ -17500,6 +17501,9 @@ static void receive_message(struct sip_pvt *p, struct sip_request *req, struct a res |= ast_msg_set_var(msg, "SIP_PEERNAME", p->peername); } + ast_copy_string(stripped, sip_get_header(req, "Contact"), sizeof(stripped)); + res |= ast_msg_set_var(msg, "SIP_FULLCONTACT", get_in_brackets(stripped)); + res |= ast_msg_set_exten(msg, "%s", p->exten); res |= set_message_vars_from_req(msg, req); @@ -25468,6 +25472,7 @@ static int block_msg_header(const char *header_name) "CSeq", "Allow", "Content-Length", + "Request-URI", }; for (idx = 0; idx < ARRAY_LEN(hdr); ++idx) { @@ -25495,6 +25500,17 @@ static int sip_msg_send(const struct ast_msg *msg, const char *to, const char *f return -1; } + for (iter = ast_msg_var_iterator_init(msg); + ast_msg_var_iterator_next(msg, iter, &var, &val); + ast_msg_var_unref_current(iter)) { + if (!strcasecmp(var, "Request-URI")) { + ast_string_field_set(pvt, fullcontact, val); + ast_msg_var_unref_current(iter); + break; + } + } + ast_msg_var_iterator_destroy(iter); + to_uri = ast_strdupa(to); to_uri = get_in_brackets(to_uri); parse_uri(to_uri, "sip:,sips:", &to_user, NULL, &to_host, NULL); |