Index: apps/app_dial.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v retrieving revision 1.28 diff -u -r1.28 app_dial.c --- apps/app_dial.c 22 Oct 2003 04:25:13 -0000 1.28 +++ apps/app_dial.c 22 Oct 2003 17:20:47 -0000 @@ -587,6 +587,7 @@ tmp->chan->ani = strdup(chan->ani); else tmp->chan->ani = NULL; + strncpy(tmp->chan->accountcode, chan->accountcode, sizeof(tmp->chan->accountcode)-1); /* Pass hidecallerid setting */ tmp->chan->restrictcid = chan->restrictcid; /* Pass callingpres setting */ Index: channels/chan_iax2.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v retrieving revision 1.54 diff -u -r1.54 chan_iax2.c --- channels/chan_iax2.c 6 Oct 2003 05:01:08 -0000 1.54 +++ channels/chan_iax2.c 22 Oct 2003 17:20:50 -0000 @@ -171,6 +171,7 @@ int hascallerid; int capability; int trunk; + int trusted; char callerid[AST_MAX_EXTENSION]; struct ast_ha *ha; struct iax2_context *contexts; @@ -206,6 +207,7 @@ int capability; /* Capability */ int delme; /* I need to be deleted */ int trunk; /* Treat as an IAX trunking */ + int sendinfo; /* send call info to peer */ struct timeval txtrunktime; /* Transmit trunktime */ struct timeval rxtrunktime; /* Receive trunktime */ struct timeval lasttxtime; /* Last transmitted trunktime */ @@ -336,6 +338,8 @@ char ani[80]; /* Whether or not ani should be transmitted in addition to Caller*ID */ int sendani; + /* Whether or not the accountcode and other infos should be transmitted /lele/ */ + int sendinfo; /* Whether to request autoanswer */ int autoanswer; /* DNID */ @@ -376,7 +380,7 @@ /* Status of knowledge of peer ADSI capability */ int peeradsicpe; - + /* Who we are bridged to */ unsigned short bridgecallno; unsigned int bridgesfmt; @@ -1507,7 +1511,7 @@ return 0; } -static int create_addr(struct sockaddr_in *sin, int *capability, int *sendani, int *maxtime, char *peer, char *context, int *trunk, int *notransfer, char *secret, int seclen) +static int create_addr(struct sockaddr_in *sin, int *capability, int *sendani, int *maxtime, char *peer, char *context, int *trunk, int *notransfer, int *sendinfo, char *secret, int seclen) { struct hostent *hp; struct iax2_peer *p; @@ -1536,6 +1540,8 @@ *trunk = p->trunk; if (capability) *capability = p->capability; + if (sendinfo) + *sendinfo = p->sendinfo; if (secret) strncpy(secret, p->secret, seclen); if (p->addr.sin_addr.s_addr) { @@ -1659,7 +1665,7 @@ strsep(&stringp, ":"); portno = strsep(&stringp, ":"); } - if (create_addr(&sin, NULL, NULL, NULL, hname, context, NULL, NULL, storedsecret, sizeof(storedsecret) - 1)) { + if (create_addr(&sin, NULL, NULL, NULL, hname, context, NULL, NULL, NULL, storedsecret, sizeof(storedsecret) - 1)) { ast_log(LOG_WARNING, "No address associated with '%s'\n", hname); return -1; } @@ -1720,6 +1726,9 @@ iax_ie_append_int(&ied, IAX_IE_CAPABILITY, p->capability); iax_ie_append_short(&ied, IAX_IE_ADSICPE, c->adsicpe); iax_ie_append_int(&ied, IAX_IE_DATETIME, iax2_datetime()); + if(p->sendinfo) + iax_ie_append_str(&ied, IAX_IE_ACCOUNTCODE, c->accountcode); + /* Transmit the string in a "NEW" request */ #if 0 /* XXX We have no equivalent XXX */ @@ -2664,6 +2673,8 @@ strncpy(iaxs[callno]->context, ies->called_context, sizeof(iaxs[callno]->context)-1); if (ies->language) strncpy(iaxs[callno]->language, ies->language, sizeof(iaxs[callno]->language)-1); + if (ies->accountcode) + strncpy(iaxs[callno]->accountcode, ies->accountcode, sizeof(iaxs[callno]->accountcode)-1); if (ies->username) strncpy(iaxs[callno]->username, ies->username, sizeof(iaxs[callno]->username)-1); if (ies->format) @@ -2721,6 +2732,8 @@ } if (strlen(user->accountcode)) strncpy(iaxs[callno]->accountcode, user->accountcode, sizeof(iaxs[callno]->accountcode)-1); + else if(!user->trusted) + strcpy(iaxs[callno]->accountcode, ""); if (user->amaflags) iaxs[callno]->amaflags = user->amaflags; iaxs[callno]->notransfer = user->notransfer; @@ -4696,6 +4709,7 @@ char *stringp=NULL; int capability = iax2_capability; int trunk; + int sendinfo; int notransfer = 0; strncpy(s, (char *)data, sizeof(s)-1); /* FIXME The next two lines seem useless */ @@ -4708,7 +4722,7 @@ if (!st) st = s; /* Populate our address from the given */ - if (create_addr(&sin, &capability, &sendani, &maxtime, st, NULL, &trunk, ¬ransfer, NULL, 0)) { + if (create_addr(&sin, &capability, &sendani, &maxtime, st, NULL, &trunk, ¬ransfer, &sendinfo, NULL, 0)) { return NULL; } callno = find_callno(0, 0, &sin, NEW_FORCE, 1); @@ -4725,6 +4739,7 @@ iaxs[callno]->sendani = sendani; iaxs[callno]->maxtime = maxtime; iaxs[callno]->notransfer = notransfer; + iaxs[callno]->sendinfo = sendinfo; c = ast_iax2_new(iaxs[callno], AST_STATE_DOWN, capability); ast_mutex_unlock(&iaxsl[callno]); if (c) { @@ -4951,6 +4966,8 @@ peer->hascallerid=1; } else if (!strcasecmp(v->name, "sendani")) { peer->sendani = ast_true(v->value); + } else if (!strcasecmp(v->name, "sendinfo")) { + peer->sendinfo = ast_true(v->value); } else if (!strcasecmp(v->name, "inkeys")) { strncpy(peer->inkeys, v->value, sizeof(peer->inkeys)); } else if (!strcasecmp(v->name, "outkey")) { @@ -5031,6 +5048,8 @@ user->hascallerid=1; } else if (!strcasecmp(v->name, "accountcode")) { strncpy(user->accountcode, v->value, sizeof(user->accountcode)-1); + } else if (!strcasecmp(v->name, "trusted")) { + user->trusted = ast_true(v->value); } else if (!strcasecmp(v->name, "amaflags")) { format = ast_cdr_amaflags2int(v->value); if (format < 0) { @@ -5362,7 +5381,7 @@ host = st; } /* Populate our address from the given */ - if (create_addr(&sin, NULL, NULL, NULL, host, NULL, NULL, NULL, NULL, 0)) { + if (create_addr(&sin, NULL, NULL, NULL, host, NULL, NULL, NULL, NULL, NULL, 0)) { return -1; } ast_log(LOG_DEBUG, "host: %s, user: %s, password: %s, context: %s\n", host, username, password, context); Index: channels/iax2-parser.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.c,v retrieving revision 1.13 diff -u -r1.13 iax2-parser.c --- channels/iax2-parser.c 22 Oct 2003 02:53:39 -0000 1.13 +++ channels/iax2-parser.c 22 Oct 2003 17:20:51 -0000 @@ -120,6 +120,7 @@ { IAX_IE_PROVISIONING, "PROVISIONING" }, { IAX_IE_AESPROVISIONING, "AES PROVISIONING" }, { IAX_IE_DATETIME, "DATE TIME", dump_int }, + { IAX_IE_ACCOUNTCODE, "ACCOUNTCODE", dump_string }, }; const char *iax_ie2str(int ie) @@ -506,6 +507,9 @@ errorf(tmp); } else ies->datetime = ntohl(*((unsigned int *)(data + 2))); + break; + case IAX_IE_ACCOUNTCODE: + ies->accountcode = data + 2; break; default: snprintf(tmp, sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len); Index: channels/iax2-parser.h =================================================================== RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.h,v retrieving revision 1.5 diff -u -r1.5 iax2-parser.h --- channels/iax2-parser.h 1 Oct 2003 22:59:06 -0000 1.5 +++ channels/iax2-parser.h 22 Oct 2003 17:20:51 -0000 @@ -44,6 +44,7 @@ int musiconhold; unsigned int transferid; unsigned int datetime; + char *accountcode; }; #define DIRECTION_INGRESS 1 Index: channels/iax2.h =================================================================== RCS file: /usr/cvsroot/asterisk/channels/iax2.h,v retrieving revision 1.7 diff -u -r1.7 iax2.h --- channels/iax2.h 1 Oct 2003 22:59:06 -0000 1.7 +++ channels/iax2.h 22 Oct 2003 17:20:51 -0000 @@ -104,6 +104,8 @@ #define IAX_IE_PROVISIONING 29 /* Provisioning info */ #define IAX_IE_AESPROVISIONING 30 /* AES Provisioning info */ #define IAX_IE_DATETIME 31 /* Date/Time */ +#define IAX_IE_ACCOUNTCODE 32 /* Original Account code */ + #define IAX_AUTH_PLAINTEXT (1 << 0) #define IAX_AUTH_MD5 (1 << 1)