[asterisk-commits] file: branch certified-1.8.11 r369845 - /certified/branches/1.8.11/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 9 14:51:00 CDT 2012
Author: file
Date: Mon Jul 9 14:50:56 2012
New Revision: 369845
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369845
Log:
Add support for exposing the received contact URI and also for setting the request URI in messages.
(closes issue AST-911)
Modified:
certified/branches/1.8.11/channels/chan_sip.c
Modified: certified/branches/1.8.11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.11/channels/chan_sip.c?view=diff&rev=369845&r1=369844&r2=369845
==============================================================================
--- certified/branches/1.8.11/channels/chan_sip.c (original)
+++ certified/branches/1.8.11/channels/chan_sip.c Mon Jul 9 14:50:56 2012
@@ -13521,6 +13521,17 @@
struct ast_msg_var_iterator *i;
const char *var, *val;
+ i = ast_msg_var_iterator_init(msg);
+ while (ast_msg_var_iterator_next(msg, i, &var, &val)) {
+ if (!strcasecmp(var, "Request-URI")) {
+ ast_string_field_set(p, fullcontact, val);
+ ast_msg_var_unref_current(i);
+ break;
+ }
+ ast_msg_var_unref_current(i);
+ }
+ ast_msg_var_iterator_destroy(i);
+
build_via(p);
initreqprep(&req, p, SIP_MESSAGE, NULL);
ast_string_field_set(p, msg_body, ast_msg_get_body(msg));
@@ -13528,7 +13539,9 @@
i = ast_msg_var_iterator_init(msg);
while (ast_msg_var_iterator_next(msg, i, &var, &val)) {
- add_header(&req, var, val);
+ if (strcasecmp(var, "Request-URI")) {
+ add_header(&req, var, val);
+ }
ast_msg_var_unref_current(i);
}
ast_msg_var_iterator_destroy(i);
@@ -16459,7 +16472,7 @@
const char *content_type = get_header(req, "Content-Type");
struct ast_msg *msg;
int res;
- char *from, *to;
+ char *from, *to, 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? */
@@ -16596,6 +16609,9 @@
if (!ast_strlen_zero(p->peername)) {
res |= ast_msg_set_var(msg, "SIP_PEERNAME", p->peername);
}
+
+ ast_copy_string(stripped, 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);
More information about the asterisk-commits
mailing list