Allow "fromuser" option and don't append port number if it's specified (you can do it with fromdomain=temp.com:5060
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@802 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
14009dbfa1
commit
c7c91a93f2
|
@ -185,6 +185,7 @@ static struct sip_pvt {
|
||||||
char remote_party_id[256];
|
char remote_party_id[256];
|
||||||
char context[AST_MAX_EXTENSION];
|
char context[AST_MAX_EXTENSION];
|
||||||
char fromdomain[AST_MAX_EXTENSION]; /* Domain to show in the from field */
|
char fromdomain[AST_MAX_EXTENSION]; /* Domain to show in the from field */
|
||||||
|
char fromuser[AST_MAX_EXTENSION]; /* Domain to show in the user field */
|
||||||
char language[MAX_LANGUAGE];
|
char language[MAX_LANGUAGE];
|
||||||
char theirtag[256]; /* Their tag */
|
char theirtag[256]; /* Their tag */
|
||||||
char username[81];
|
char username[81];
|
||||||
|
@ -256,6 +257,7 @@ struct sip_peer {
|
||||||
char context[80]; /* JK02: peers need context too to allow parking etc */
|
char context[80]; /* JK02: peers need context too to allow parking etc */
|
||||||
char methods[80];
|
char methods[80];
|
||||||
char username[80];
|
char username[80];
|
||||||
|
char fromuser[80];
|
||||||
char fromdomain[80];
|
char fromdomain[80];
|
||||||
char mailbox[AST_MAX_EXTENSION];
|
char mailbox[AST_MAX_EXTENSION];
|
||||||
int lastmsgssent;
|
int lastmsgssent;
|
||||||
|
@ -588,6 +590,8 @@ static int create_addr(struct sip_pvt *r, char *peer)
|
||||||
strncpy(r->username, p->username, sizeof(r->username)-1);
|
strncpy(r->username, p->username, sizeof(r->username)-1);
|
||||||
if (strlen(p->fromdomain))
|
if (strlen(p->fromdomain))
|
||||||
strncpy(r->fromdomain, p->fromdomain, sizeof(r->fromdomain)-1);
|
strncpy(r->fromdomain, p->fromdomain, sizeof(r->fromdomain)-1);
|
||||||
|
if (strlen(p->fromuser))
|
||||||
|
strncpy(r->fromuser, p->fromuser, sizeof(r->fromuser)-1);
|
||||||
r->insecure = p->insecure;
|
r->insecure = p->insecure;
|
||||||
r->canreinvite = p->canreinvite;
|
r->canreinvite = p->canreinvite;
|
||||||
r->maxtime = p->maxms;
|
r->maxtime = p->maxms;
|
||||||
|
@ -2262,7 +2266,10 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, char *cmd, c
|
||||||
}
|
}
|
||||||
if (!n)
|
if (!n)
|
||||||
n = l;
|
n = l;
|
||||||
if (ourport != 5060)
|
/* Allow user to be overridden */
|
||||||
|
if (strlen(p->fromuser))
|
||||||
|
l = p->fromuser;
|
||||||
|
if ((ourport != 5060) && !strlen(p->fromdomain))
|
||||||
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=as%08x", n, l, strlen(p->fromdomain) ? p->fromdomain : inet_ntoa(p->ourip), ourport, p->tag);
|
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=as%08x", n, l, strlen(p->fromdomain) ? p->fromdomain : inet_ntoa(p->ourip), ourport, p->tag);
|
||||||
else
|
else
|
||||||
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=as%08x", n, l, strlen(p->fromdomain) ? p->fromdomain : inet_ntoa(p->ourip), p->tag);
|
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=as%08x", n, l, strlen(p->fromdomain) ? p->fromdomain : inet_ntoa(p->ourip), p->tag);
|
||||||
|
@ -4898,6 +4905,8 @@ static struct sip_peer *build_peer(char *name, struct ast_variable *v)
|
||||||
strncpy(peer->context, v->value, sizeof(peer->context)-1);
|
strncpy(peer->context, v->value, sizeof(peer->context)-1);
|
||||||
else if (!strcasecmp(v->name, "fromdomain"))
|
else if (!strcasecmp(v->name, "fromdomain"))
|
||||||
strncpy(peer->fromdomain, v->value, sizeof(peer->fromdomain)-1);
|
strncpy(peer->fromdomain, v->value, sizeof(peer->fromdomain)-1);
|
||||||
|
else if (!strcasecmp(v->name, "fromuser"))
|
||||||
|
strncpy(peer->fromuser, v->value, sizeof(peer->fromuser)-1);
|
||||||
else if (!strcasecmp(v->name, "dtmfmode")) {
|
else if (!strcasecmp(v->name, "dtmfmode")) {
|
||||||
if (!strcasecmp(v->value, "inband"))
|
if (!strcasecmp(v->value, "inband"))
|
||||||
peer->dtmfmode=SIP_DTMF_INBAND;
|
peer->dtmfmode=SIP_DTMF_INBAND;
|
||||||
|
|
|
@ -44,6 +44,7 @@ context = default ; Default for incoming calls
|
||||||
;[cisco1]
|
;[cisco1]
|
||||||
;type=friend
|
;type=friend
|
||||||
;username=cisco1
|
;username=cisco1
|
||||||
|
;fromuser=markster ; Specify user to put in "from" instead of callerid
|
||||||
;secret=blah
|
;secret=blah
|
||||||
;host=dynamic
|
;host=dynamic
|
||||||
;defaultip=192.168.0.4
|
;defaultip=192.168.0.4
|
||||||
|
|
Loading…
Reference in New Issue