|
|
|
@ -251,7 +251,7 @@ static int recordhistory = 0; /* Record SIP history. Off by default */
|
|
|
|
|
|
|
|
|
|
static char global_musicclass[MAX_LANGUAGE] = ""; /* Global music on hold class */
|
|
|
|
|
#define DEFAULT_REALM "asterisk"
|
|
|
|
|
static char global_realm[AST_MAX_EXTENSION] = DEFAULT_REALM; /* Default realm */
|
|
|
|
|
static char global_realm[MAXHOSTNAMELEN] = DEFAULT_REALM; /* Default realm */
|
|
|
|
|
static char regcontext[AST_MAX_EXTENSION] = ""; /* Context for auto-extensions */
|
|
|
|
|
|
|
|
|
|
/* Expire slowly */
|
|
|
|
@ -406,10 +406,10 @@ static struct sip_pvt {
|
|
|
|
|
char from[256]; /* The From: header */
|
|
|
|
|
char useragent[256]; /* User agent in SIP request */
|
|
|
|
|
char context[AST_MAX_EXTENSION]; /* Context for this call */
|
|
|
|
|
char fromdomain[AST_MAX_EXTENSION]; /* Domain to show in the from field */
|
|
|
|
|
char fromdomain[MAXHOSTNAMELEN]; /* Domain to show in the from field */
|
|
|
|
|
char fromuser[AST_MAX_EXTENSION]; /* User to show in the user field */
|
|
|
|
|
char fromname[AST_MAX_EXTENSION]; /* Name to show in the user field */
|
|
|
|
|
char tohost[AST_MAX_EXTENSION]; /* Host we should put in the "to" field */
|
|
|
|
|
char tohost[MAXHOSTNAMELEN]; /* Host we should put in the "to" field */
|
|
|
|
|
char language[MAX_LANGUAGE]; /* Default language for this call */
|
|
|
|
|
char musicclass[MAX_LANGUAGE]; /* Music on Hold class */
|
|
|
|
|
char rdnis[256]; /* Referring DNIS */
|
|
|
|
@ -428,11 +428,11 @@ static struct sip_pvt {
|
|
|
|
|
char fullcontact[128]; /* The Contact: that the UA registers with us */
|
|
|
|
|
char accountcode[20]; /* Account code */
|
|
|
|
|
char our_contact[256]; /* Our contact header */
|
|
|
|
|
char realm[256]; /* Authorization realm */
|
|
|
|
|
char realm[MAXHOSTNAMELEN]; /* Authorization realm */
|
|
|
|
|
char nonce[256]; /* Authorization nonce */
|
|
|
|
|
char opaque[256]; /* Opaque nonsense */
|
|
|
|
|
char qop[80]; /* Quality of Protection, since SIP wasn't complicated enough yet. */
|
|
|
|
|
char domain[256]; /* Authorization domain */
|
|
|
|
|
char domain[MAXHOSTNAMELEN]; /* Authorization domain */
|
|
|
|
|
char lastmsg[256]; /* Last Message sent/received */
|
|
|
|
|
int amaflags; /* AMA Flags */
|
|
|
|
|
int pendinginvite; /* Any pending invite */
|
|
|
|
@ -489,7 +489,7 @@ struct sip_user {
|
|
|
|
|
ASTOBJ_COMPONENTS(struct sip_user);
|
|
|
|
|
char secret[80]; /* Password */
|
|
|
|
|
char md5secret[80]; /* Password in md5 */
|
|
|
|
|
char context[80]; /* Default context for incoming calls */
|
|
|
|
|
char context[AST_MAX_EXTENSION]; /* Default context for incoming calls */
|
|
|
|
|
char cid_num[80]; /* Caller ID num */
|
|
|
|
|
char cid_name[80]; /* Caller ID name */
|
|
|
|
|
char accountcode[20]; /* Account code */
|
|
|
|
@ -519,15 +519,15 @@ struct sip_peer {
|
|
|
|
|
char secret[80]; /* Password */
|
|
|
|
|
char md5secret[80]; /* Password in MD5 */
|
|
|
|
|
struct sip_auth *auth; /* Realm authentication list */
|
|
|
|
|
char context[80]; /* Default context for incoming calls */
|
|
|
|
|
char context[AST_MAX_EXTENSION]; /* Default context for incoming calls */
|
|
|
|
|
char username[80]; /* Temporary username until registration */
|
|
|
|
|
char accountcode[20]; /* Account code */
|
|
|
|
|
int amaflags; /* AMA Flags (for billing) */
|
|
|
|
|
char tohost[80]; /* If not dynamic, IP address */
|
|
|
|
|
char tohost[MAXHOSTNAMELEN]; /* If not dynamic, IP address */
|
|
|
|
|
char regexten[AST_MAX_EXTENSION]; /* Extension to register (if regcontext is used) */
|
|
|
|
|
char fromuser[80]; /* From: user when calling this peer */
|
|
|
|
|
char fromdomain[80]; /* From: domain when calling this peer */
|
|
|
|
|
char fullcontact[128]; /* Contact registred with us (not in sip.conf) */
|
|
|
|
|
char fromdomain[MAXHOSTNAMELEN]; /* From: domain when calling this peer */
|
|
|
|
|
char fullcontact[256]; /* Contact registred with us (not in sip.conf) */
|
|
|
|
|
char cid_num[80]; /* Caller ID num */
|
|
|
|
|
char cid_name[80]; /* Caller ID name */
|
|
|
|
|
int callingpres; /* Calling id presentation */
|
|
|
|
@ -588,10 +588,10 @@ struct sip_registry {
|
|
|
|
|
int portno; /* Optional port override */
|
|
|
|
|
char username[80]; /* Who we are registering as */
|
|
|
|
|
char authuser[80]; /* Who we *authenticate* as */
|
|
|
|
|
char hostname[80]; /* Domain or host we register to */
|
|
|
|
|
char hostname[MAXHOSTNAMELEN]; /* Domain or host we register to */
|
|
|
|
|
char secret[80]; /* Password or key name in []'s */
|
|
|
|
|
char md5secret[80];
|
|
|
|
|
char contact[80]; /* Contact extension */
|
|
|
|
|
char contact[256]; /* Contact extension */
|
|
|
|
|
char random[80];
|
|
|
|
|
int expire; /* Sched ID of expiration */
|
|
|
|
|
int timeout; /* sched id of sip_reg_timeout */
|
|
|
|
@ -604,9 +604,9 @@ struct sip_registry {
|
|
|
|
|
struct sockaddr_in us; /* Who the server thinks we are */
|
|
|
|
|
|
|
|
|
|
/* Saved headers */
|
|
|
|
|
char realm[256]; /* Authorization realm */
|
|
|
|
|
char realm[MAXHOSTNAMELEN]; /* Authorization realm */
|
|
|
|
|
char nonce[256]; /* Authorization nonce */
|
|
|
|
|
char domain[256]; /* Authorization domain */
|
|
|
|
|
char domain[MAXHOSTNAMELEN]; /* Authorization domain */
|
|
|
|
|
char opaque[256]; /* Opaque nonsense */
|
|
|
|
|
char qop[80]; /* Quality of Protection. */
|
|
|
|
|
|
|
|
|
@ -637,7 +637,7 @@ static int sipsock = -1;
|
|
|
|
|
|
|
|
|
|
static struct sockaddr_in bindaddr;
|
|
|
|
|
static struct sockaddr_in externip;
|
|
|
|
|
static char externhost[256] = "";
|
|
|
|
|
static char externhost[MAXHOSTNAMELEN] = "";
|
|
|
|
|
static time_t externexpire = 0;
|
|
|
|
|
static int externrefresh = 10;
|
|
|
|
|
static struct ast_ha *localaddr;
|
|
|
|
@ -749,6 +749,7 @@ static int __sip_xmit(struct sip_pvt *p, char *data, int len)
|
|
|
|
|
{
|
|
|
|
|
int res;
|
|
|
|
|
char iabuf[INET_ADDRSTRLEN];
|
|
|
|
|
|
|
|
|
|
if (ast_test_flag(p, SIP_NAT) & SIP_NAT_ROUTE)
|
|
|
|
|
res=sendto(sipsock, data, len, 0, (struct sockaddr *)&p->recv, sizeof(struct sockaddr_in));
|
|
|
|
|
else
|
|
|
|
@ -1457,7 +1458,7 @@ static int create_addr(struct sip_pvt *r, char *opeer)
|
|
|
|
|
char *port;
|
|
|
|
|
char *callhost;
|
|
|
|
|
int portno;
|
|
|
|
|
char host[256], *hostn;
|
|
|
|
|
char host[MAXHOSTNAMELEN], *hostn;
|
|
|
|
|
char peer[256]="";
|
|
|
|
|
|
|
|
|
|
ast_copy_string(peer, opeer, sizeof(peer));
|
|
|
|
@ -1534,7 +1535,7 @@ static int create_addr(struct sip_pvt *r, char *opeer)
|
|
|
|
|
else
|
|
|
|
|
portno = DEFAULT_SIP_PORT;
|
|
|
|
|
if (srvlookup) {
|
|
|
|
|
char service[256];
|
|
|
|
|
char service[MAXHOSTNAMELEN];
|
|
|
|
|
int tportno;
|
|
|
|
|
int ret;
|
|
|
|
|
snprintf(service, sizeof(service), "_sip._udp.%s", peer);
|
|
|
|
|