[asterisk-commits] file: branch 10-digiumphones r369846 - /branches/10-digiumphones/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 9 14:51:26 CDT 2012
Author: file
Date: Mon Jul 9 14:51:23 2012
New Revision: 369846
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369846
Log:
Add support for exposing the received contact URI and also for setting the request URI in messages.
(closes issue AST-911)
Modified:
branches/10-digiumphones/channels/chan_sip.c
Modified: branches/10-digiumphones/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/channels/chan_sip.c?view=diff&rev=369846&r1=369845&r2=369846
==============================================================================
--- branches/10-digiumphones/channels/chan_sip.c (original)
+++ branches/10-digiumphones/channels/chan_sip.c Mon Jul 9 14:51:23 2012
@@ -16964,6 +16964,7 @@
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? */
@@ -17116,6 +17117,9 @@
if (!ast_strlen_zero(p->peername)) {
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);
@@ -24955,6 +24959,7 @@
"CSeq",
"Allow",
"Content-Length",
+ "Request-URI",
};
for (idx = 0; idx < ARRAY_LEN(hdr); ++idx) {
@@ -24981,6 +24986,17 @@
if (!(pvt = sip_alloc(NULL, NULL, 0, SIP_MESSAGE, NULL))) {
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);
More information about the asterisk-commits
mailing list