Hi list,
I've got to be honnest and admit that I don't know the SIP-related RFC's
by heart. So my question may seem completely heretic to some of you.
What I want to know is whether it's possible to set, somewhere in
Asterisk's configuration files, the host part of the Contact header for
INVITE messages sent by Asterisk.
Currently (I use Asterisk version 1.2.8), I get:
|
| Contact: sip:[EMAIL PROTECTED]
but instead I'd like Asterisk to send:
|
| Contact: sip:[EMAIL PROTECTED]
Is this:
1) possible with Asterisk 1.2.8?
2) possible with more recent Asterisk releases?
3) planed for future development?
4) RFC compliant?
In case some of you are interested, I've already got a quirk-and-dirty
patch of my own, against chan_sip.c, to implement that feature. But I
suspect there is something wrong with it: either it could have been
achivied otherwise without having to patch anything, or this patch may
break compatibility stuff that I'm not aware of... See attached file for
more details.
Yoann Aubineau
Index: channels/chan_sip.c
===
--- channels/chan_sip.c (revision 540)
+++ channels/chan_sip.c (working copy)
@@ -343,6 +343,7 @@
static char default_callerid[AST_MAX_EXTENSION] = DEFAULT_CALLERID;
static char default_fromdomain[AST_MAX_EXTENSION] = ;
+static char default_contactdomain[AST_MAX_EXTENSION] = ;
#define DEFAULT_NOTIFYMIME application/simple-message-summary
static char default_notifymime[AST_MAX_EXTENSION] = DEFAULT_NOTIFYMIME;
@@ -4774,12 +4775,15 @@
static void build_contact(struct sip_pvt *p)
{
char iabuf[INET_ADDRSTRLEN];
+ char *contactdomain = NULL;
+ contactdomain = (default_contactdomain) ? default_contactdomain : ast_inet_ntoa(iabuf, sizeof(iabuf), p-ourip);
+
/* Construct Contact: header */
if (ourport != 5060)/* Needs to be 5060, according to the RFC */
- snprintf(p-our_contact, sizeof(p-our_contact), sip:%s%s%s:%d, p-exten, ast_strlen_zero(p-exten) ? : @, ast_inet_ntoa(iabuf, sizeof(iabuf), p-ourip), ourport);
+ snprintf(p-our_contact, sizeof(p-our_contact), sip:%s%s%s:%d, p-exten, ast_strlen_zero(p-exten) ? : @, contactdomain, ourport);
else
- snprintf(p-our_contact, sizeof(p-our_contact), sip:%s%s%s, p-exten, ast_strlen_zero(p-exten) ? : @, ast_inet_ntoa(iabuf, sizeof(iabuf), p-ourip));
+ snprintf(p-our_contact, sizeof(p-our_contact), sip:%s%s%s, p-exten, ast_strlen_zero(p-exten) ? : @, contactdomain);
}
/*! \brief build_rpid: Build the Remote Party-ID From using callingpres options ---*/
@@ -12626,6 +12630,7 @@
default_subscribecontext[0] = '\0';
default_language[0] = '\0';
default_fromdomain[0] = '\0';
+ default_contactdomain[0] = '\0';
default_qualify = 0;
allow_external_domains = 1; /* Allow external invites */
externhost[0] = '\0';
@@ -12749,6 +12754,9 @@
ast_copy_string(default_callerid, v-value, sizeof(default_callerid));
} else if (!strcasecmp(v-name, fromdomain)) {
ast_copy_string(default_fromdomain, v-value, sizeof(default_fromdomain));
+ } else if (!strcasecmp(v-name, contactdomain)) {
+ ast_copy_string(default_contactdomain, v-value, sizeof(default_contactdomain));
+ ast_log(LOG_DEBUG, Value for contactdomain is '%s'\n, v-value);
} else if (!strcasecmp(v-name, outboundproxy)) {
if (ast_get_ip_or_srv(outboundproxyip, v-value, _sip._udp) 0)
ast_log(LOG_WARNING, Unable to locate host '%s'\n, v-value);
___
--Bandwidth and Colocation provided by Easynews.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users