[Asterisk-cvs] asterisk/apps Makefile, 1.77,
1.78 app_alarmreceiver.c, 1.4, 1.5 app_chanisavail.c, 1.8,
1.9 app_db.c, 1.6, 1.7 app_dial.c, 1.94, 1.95 app_directory.c,
1.27, 1.28 app_disa.c, 1.17, 1.18 app_enumlookup.c, 1.10,
1.11 app_groupcount.c, 1.5, 1.6 app_hasnewvoicemail.c, 1.7,
1.8 app_image.c, 1.3, 1.4 app_lookupblacklist.c, 1.5,
1.6 app_lookupcidname.c, 1.3, 1.4 app_macro.c, 1.15,
1.16 app_meetme.c, 1.60, 1.61 app_osplookup.c, 1.2,
1.3 app_parkandannounce.c, 1.8, 1.9 app_privacy.c, 1.6,
1.7 app_queue.c, 1.87, 1.88 app_sendtext.c, 1.2,
1.3 app_setcallerid.c, 1.4, 1.5 app_setcidname.c, 1.4,
1.5 app_setcidnum.c, 1.4, 1.5 app_sms.c, 1.10,
1.11 app_system.c, 1.11, 1.12 app_talkdetect.c, 1.4,
1.5 app_transfer.c, 1.4, 1.5 app_txtcidname.c, 1.7,
1.8 app_url.c, 1.5, 1.6 app_voicemail.c, 1.151,
1.152 app_zapateller.c, 1.5, 1.6
markster at lists.digium.com
markster at lists.digium.com
Fri Oct 1 20:56:26 CDT 2004
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv31663/apps
Modified Files:
Makefile app_alarmreceiver.c app_chanisavail.c app_db.c
app_dial.c app_directory.c app_disa.c app_enumlookup.c
app_groupcount.c app_hasnewvoicemail.c app_image.c
app_lookupblacklist.c app_lookupcidname.c app_macro.c
app_meetme.c app_osplookup.c app_parkandannounce.c
app_privacy.c app_queue.c app_sendtext.c app_setcallerid.c
app_setcidname.c app_setcidnum.c app_sms.c app_system.c
app_talkdetect.c app_transfer.c app_txtcidname.c app_url.c
app_voicemail.c app_zapateller.c
Log Message:
Huge callerid rework (might break H.323, others)
Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/Makefile,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- Makefile 24 Sep 2004 21:32:56 -0000 1.77
+++ Makefile 2 Oct 2004 00:58:31 -0000 1.78
@@ -17,7 +17,7 @@
#APPS=app_dial.so app_playback.so app_directory.so app_intercom.so app_mp3.so
APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_mp3.so\
app_system.so app_echo.so app_record.so app_image.so app_url.so app_disa.so \
- app_qcall.so app_adsiprog.so app_getcpeid.so app_milliwatt.so \
+ app_adsiprog.so app_getcpeid.so app_milliwatt.so \
app_zapateller.so app_setcallerid.so app_festival.so \
app_queue.so app_senddtmf.so app_parkandannounce.so app_striplsd.so \
app_setcidname.so app_lookupcidname.so app_substring.so app_macro.so \
@@ -35,6 +35,11 @@
APPS+=app_intercom.so
endif
+#
+# Obsolete things...
+#
+#APPS+=app_qcall.so
+
#APPS+=app_sql_postgres.so
#APPS+=app_sql_odbc.so
#APPS+=app_rpt.so
Index: app_alarmreceiver.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_alarmreceiver.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- app_alarmreceiver.c 27 Sep 2004 05:06:22 -0000 1.4
+++ app_alarmreceiver.c 2 Oct 2004 00:58:31 -0000 1.5
@@ -318,8 +318,8 @@
char timestamp[80];
/* Extract the caller ID location */
-
- strncpy(workstring, chan->callerid, sizeof(workstring) - 1);
+ if (chan->cid.cid_num)
+ strncpy(workstring, chan->cid.cid_num, sizeof(workstring) - 1);
workstring[sizeof(workstring) - 1] = '\0';
ast_callerid_parse(workstring, &cn, &cl);
Index: app_chanisavail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_chanisavail.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- app_chanisavail.c 22 Jun 2004 19:32:52 -0000 1.8
+++ app_chanisavail.c 2 Oct 2004 00:58:31 -0000 1.9
@@ -3,7 +3,7 @@
*
* Check if Channel is Available
*
- * Copyright (C) 2003, Digium
+ * Copyright (C) 2003-2004, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
* James Golovich <james at gnuinter.net>
@@ -97,7 +97,7 @@
if (res < 1) {
pbx_builtin_setvar_helper(chan, "AVAILCHAN", "");
pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", "");
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority+=100;
else
return -1;
Index: app_db.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_db.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- app_db.c 9 Jul 2004 16:19:00 -0000 1.6
+++ app_db.c 2 Oct 2004 00:58:31 -0000 1.7
@@ -3,10 +3,10 @@
*
* Database access functions
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
* Copyright (C) 2003, Jefferson Noxon
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
* Jefferson Noxon <jeff at debian.org>
*
* This program is free software, distributed under the terms of
@@ -200,7 +200,7 @@
if (option_verbose > 2)
ast_verbose (VERBOSE_PREFIX_3 "DBget: Value not found in database.\n");
/* Send the call to n+101 priority, where n is the current priority */
- if (ast_exists_extension (chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension (chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
}
Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- app_dial.c 22 Sep 2004 05:19:06 -0000 1.94
+++ app_dial.c 2 Oct 2004 00:58:31 -0000 1.95
@@ -186,7 +186,7 @@
else if (numnochan)
strncpy(status, "CHANUNAVAIL", statussize - 1);
/* See if there is a special busy message */
- if (ast_exists_extension(in, in->context, in->exten, in->priority + 101, in->callerid))
+ if (ast_exists_extension(in, in->context, in->exten, in->priority + 101, in->cid.cid_num))
in->priority+=100;
} else {
if (option_verbose > 2)
@@ -233,10 +233,12 @@
o->stillgoing = 0;
numnochan++;
} else {
- if (o->chan->callerid)
- free(o->chan->callerid);
-
- o->chan->callerid = NULL;
+ if (o->chan->cid.cid_num)
+ free(o->chan->cid.cid_num);
+ o->chan->cid.cid_num = NULL;
+ if (o->chan->cid.cid_name)
+ free(o->chan->cid.cid_name);
+ o->chan->cid.cid_name = NULL;
if (o->forcecallerid) {
char *newcid = NULL;
@@ -245,36 +247,41 @@
newcid = in->macroexten;
else
newcid = in->exten;
- o->chan->callerid = strdup(newcid);
+ o->chan->cid.cid_num = strdup(newcid);
strncpy(o->chan->accountcode, winner->accountcode, sizeof(o->chan->accountcode) - 1);
o->chan->cdrflags = winner->cdrflags;
- if (!o->chan->callerid)
+ if (!o->chan->cid.cid_num)
ast_log(LOG_WARNING, "Out of memory\n");
} else {
- if (in->callerid) {
- o->chan->callerid = strdup(in->callerid);
- if (!o->chan->callerid)
+ if (in->cid.cid_num) {
+ o->chan->cid.cid_num = strdup(in->cid.cid_num);
+ if (!o->chan->cid.cid_num)
+ ast_log(LOG_WARNING, "Out of memory\n");
+ }
+ if (in->cid.cid_name) {
+ o->chan->cid.cid_name = strdup(in->cid.cid_name);
+ if (!o->chan->cid.cid_name)
ast_log(LOG_WARNING, "Out of memory\n");
}
strncpy(o->chan->accountcode, in->accountcode, sizeof(o->chan->accountcode) - 1);
o->chan->cdrflags = in->cdrflags;
}
- if (in->ani) {
- if (o->chan->ani)
- free(o->chan->ani);
- o->chan->ani = malloc(strlen(in->ani) + 1);
- if (o->chan->ani)
- strncpy(o->chan->ani, in->ani, strlen(in->ani));
+ if (in->cid.cid_ani) {
+ if (o->chan->cid.cid_ani)
+ free(o->chan->cid.cid_ani);
+ o->chan->cid.cid_ani = malloc(strlen(in->cid.cid_ani) + 1);
+ if (o->chan->cid.cid_ani)
+ strncpy(o->chan->cid.cid_ani, in->cid.cid_ani, strlen(in->cid.cid_ani) + 1);
else
ast_log(LOG_WARNING, "Out of memory\n");
}
- if (o->chan->rdnis)
- free(o->chan->rdnis);
+ if (o->chan->cid.cid_rdnis)
+ free(o->chan->cid.cid_rdnis);
if (!ast_strlen_zero(in->macroexten))
- o->chan->rdnis = strdup(in->macroexten);
+ o->chan->cid.cid_rdnis = strdup(in->macroexten);
else
- o->chan->rdnis = strdup(in->exten);
+ o->chan->cid.cid_rdnis = strdup(in->exten);
if (ast_call(o->chan, tmpchan, 0)) {
ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
o->stillgoing = 0;
@@ -429,7 +436,7 @@
char restofit[AST_MAX_EXTENSION];
char *transfer = NULL;
char *newnum;
- char callerid[256] = "", *l, *n;
+ char *l;
char *url=NULL; /* JDG */
struct ast_var_t *current;
struct varshead *headp, *newheadp;
@@ -668,14 +675,8 @@
strncpy(privdb, chan->exten, sizeof(privdb) - 1);
}
if (privacy) {
- if (chan->callerid)
- strncpy(callerid, chan->callerid, sizeof(callerid) - 1);
- else
- callerid[0] = '\0';
- ast_callerid_parse(callerid, &n, &l);
- if (l) {
- ast_shrink_phone_number(l);
- } else
+ l = chan->cid.cid_num;
+ if (!l)
l = "";
ast_log(LOG_NOTICE, "Privacy DB is '%s', privacy is %d, clid is '%s'\n", privdb, privacy, l);
}
@@ -797,28 +798,31 @@
tmp->chan->appl = "AppDial";
tmp->chan->data = "(Outgoing Line)";
tmp->chan->whentohangup = 0;
- if (tmp->chan->callerid)
- free(tmp->chan->callerid);
- if (tmp->chan->ani)
- free(tmp->chan->ani);
- if (chan->callerid)
- tmp->chan->callerid = strdup(chan->callerid);
- else
- tmp->chan->callerid = NULL;
+ if (tmp->chan->cid.cid_num)
+ free(tmp->chan->cid.cid_num);
+ tmp->chan->cid.cid_num = NULL;
+ if (tmp->chan->cid.cid_name)
+ free(tmp->chan->cid.cid_name);
+ tmp->chan->cid.cid_name = NULL;
+ if (tmp->chan->cid.cid_ani)
+ free(tmp->chan->cid.cid_ani);
+ tmp->chan->cid.cid_ani = NULL;
+
+ if (chan->cid.cid_num)
+ tmp->chan->cid.cid_num = strdup(chan->cid.cid_num);
+ if (chan->cid.cid_name)
+ tmp->chan->cid.cid_name = strdup(chan->cid.cid_name);
+ if (chan->cid.cid_ani)
+ tmp->chan->cid.cid_ani = strdup(chan->cid.cid_ani);
+
/* Copy language from incoming to outgoing */
strncpy(tmp->chan->language, chan->language, sizeof(tmp->chan->language) - 1);
strncpy(tmp->chan->accountcode, chan->accountcode, sizeof(tmp->chan->accountcode) - 1);
tmp->chan->cdrflags = chan->cdrflags;
if (ast_strlen_zero(tmp->chan->musicclass))
strncpy(tmp->chan->musicclass, chan->musicclass, sizeof(tmp->chan->musicclass) - 1);
- if (chan->ani)
- tmp->chan->ani = strdup(chan->ani);
- else
- tmp->chan->ani = NULL;
- /* Pass hidecallerid setting */
- tmp->chan->restrictcid = chan->restrictcid;
/* Pass callingpres setting */
- tmp->chan->callingpres = chan->callingpres;
+ tmp->chan->cid.cid_pres = chan->cid.cid_pres;
/* Presense of ADSI CPE on outgoing channel follows ours */
tmp->chan->adsicpe = chan->adsicpe;
/* pass the digital flag */
Index: app_directory.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_directory.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- app_directory.c 30 Aug 2004 01:44:41 -0000 1.27
+++ app_directory.c 2 Oct 2004 00:58:31 -0000 1.28
@@ -3,9 +3,9 @@
*
* Provide a directory of extensions
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -176,7 +176,7 @@
case '1':
/* Name selected */
loop = 0;
- if (ast_exists_extension(chan,dialcontext,ext,1,chan->callerid)) {
+ if (ast_exists_extension(chan,dialcontext,ext,1,chan->cid.cid_num)) {
strncpy(chan->exten, ext, sizeof(chan->exten)-1);
chan->priority = 0;
strncpy(chan->context, dialcontext, sizeof(chan->context)-1);
Index: app_disa.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_disa.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- app_disa.c 15 Sep 2004 22:06:30 -0000 1.17
+++ app_disa.c 2 Oct 2004 00:58:31 -0000 1.18
@@ -3,7 +3,7 @@
*
* DISA -- Direct Inward System Access Application 6/20/2001
*
- * Copyright (C) 2001, Linux Support Services, Inc.
+ * Copyright (C) 2001-2004, Digium, Inc.
*
* Jim Dixon <jim at lambdatel.com>
*
@@ -293,20 +293,20 @@
}
/* if can do some more, do it */
- if (!ast_matchmore_extension(chan,ourcontext,exten,1, chan->callerid)) {
+ if (!ast_matchmore_extension(chan,ourcontext,exten,1, chan->cid.cid_num)) {
break;
}
}
}
- if (k && ast_exists_extension(chan,ourcontext,exten,1, chan->callerid))
+ if (k && ast_exists_extension(chan,ourcontext,exten,1, chan->cid.cid_num))
{
ast_playtones_stop(chan);
/* We're authenticated and have a valid extension */
if (ourcallerid && *ourcallerid)
{
- if (chan->callerid) free(chan->callerid);
- chan->callerid = strdup(ourcallerid);
+ if (chan->cid.cid_num) free(chan->cid.cid_num);
+ chan->cid.cid_num = strdup(ourcallerid);
}
strncpy(chan->exten, exten, sizeof(chan->exten) - 1);
strncpy(chan->context, ourcontext, sizeof(chan->context) - 1);
Index: app_enumlookup.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_enumlookup.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- app_enumlookup.c 14 Jul 2004 07:22:30 -0000 1.10
+++ app_enumlookup.c 2 Oct 2004 00:58:31 -0000 1.11
@@ -3,9 +3,9 @@
*
* Time of day - Report the time of day
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -121,7 +121,7 @@
*t = 0;
pbx_builtin_setvar_helper(chan, "ENUM", tmp);
ast_log(LOG_NOTICE, "tel: ENUM set to \"%s\"\n", tmp);
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 51, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 51, chan->cid.cid_num))
chan->priority += 50;
else
res = 0;
@@ -133,7 +133,7 @@
}
if (!res) {
/* Look for a "busy" place */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
} else if (res > 0)
res = 0;
Index: app_groupcount.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_groupcount.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- app_groupcount.c 16 Jul 2004 04:32:17 -0000 1.5
+++ app_groupcount.c 2 Oct 2004 00:58:31 -0000 1.6
@@ -174,7 +174,7 @@
count = group_get_count(pbx_builtin_getvar_helper(chan, ret), ret);
if (count > max) {
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
else
res = -1;
Index: app_hasnewvoicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_hasnewvoicemail.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- app_hasnewvoicemail.c 14 Jul 2004 07:22:30 -0000 1.7
+++ app_hasnewvoicemail.c 2 Oct 2004 00:58:31 -0000 1.8
@@ -119,7 +119,7 @@
if (vmcount > 0) {
/* Branch to the next extension */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid)) {
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num)) {
chan->priority += 100;
} else
ast_log(LOG_WARNING, "VM box %s@%s has new voicemail, but extension %s, priority %d doesn't exist\n", vmbox, context, chan->exten, chan->priority + 101);
Index: app_image.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_image.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- app_image.c 22 Jun 2004 19:32:52 -0000 1.3
+++ app_image.c 2 Oct 2004 00:58:31 -0000 1.4
@@ -3,9 +3,9 @@
*
* App to transmit an image
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -51,7 +51,7 @@
LOCAL_USER_ADD(u);
if (!ast_supports_images(chan)) {
/* Does not support transport */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
return 0;
}
Index: app_lookupblacklist.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_lookupblacklist.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- app_lookupblacklist.c 22 Jun 2004 19:32:52 -0000 1.5
+++ app_lookupblacklist.c 2 Oct 2004 00:58:31 -0000 1.6
@@ -3,9 +3,9 @@
*
* App to lookup the callerid number, and see if it is blacklisted
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -48,38 +48,30 @@
static int
lookupblacklist_exec (struct ast_channel *chan, void *data)
{
- char old_cid[144] = "", *num, *name;
char blacklist[1];
- char shrunknum[64] = "";
struct localuser *u;
int bl = 0;
LOCAL_USER_ADD (u);
- if (chan->callerid)
+ if (chan->cid.cid_num)
{
- strncpy (old_cid, chan->callerid, sizeof (old_cid) - 1);
- ast_callerid_parse (old_cid, &name, &num);
- if (num)
- strncpy (shrunknum, num, sizeof (shrunknum) - 1);
- else
- num = shrunknum;
-
- ast_shrink_phone_number (shrunknum);
- if (!ast_db_get ("blacklist", shrunknum, blacklist, sizeof (blacklist)))
+ if (!ast_db_get ("blacklist", chan->cid.cid_num, blacklist, sizeof (blacklist)))
{
if (option_verbose > 2)
- ast_log(LOG_NOTICE, "Blacklisted number %s found\n",shrunknum);
+ ast_log(LOG_NOTICE, "Blacklisted number %s found\n",chan->cid.cid_num);
bl = 1;
}
- else if (!ast_db_get ("blacklist", name, blacklist, sizeof (blacklist)))
+ }
+ if (chan->cid.cid_name) {
+ if (!ast_db_get ("blacklist", chan->cid.cid_name, blacklist, sizeof (blacklist)))
{
if (option_verbose > 2)
- ast_log (LOG_NOTICE,"Blacklisted name \"%s\" found\n",name);
+ ast_log (LOG_NOTICE,"Blacklisted name \"%s\" found\n",chan->cid.cid_name);
bl = 1;
}
}
- if (bl && ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (bl && ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority+=100;
LOCAL_USER_REMOVE (u);
return 0;
Index: app_lookupcidname.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_lookupcidname.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- app_lookupcidname.c 22 Jun 2004 19:32:52 -0000 1.3
+++ app_lookupcidname.c 2 Oct 2004 00:58:31 -0000 1.4
@@ -3,9 +3,9 @@
*
* App to set callerid name from database, based on directory number
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -46,32 +46,19 @@
static int
lookupcidname_exec (struct ast_channel *chan, void *data)
{
- char old_cid[144] = "", *num, *name;
- char new_cid[144];
char dbname[64];
char shrunknum[64] = "";
struct localuser *u;
LOCAL_USER_ADD (u);
- if (chan->callerid)
- {
- strncpy (old_cid, chan->callerid, sizeof (old_cid) - 1);
- ast_callerid_parse (old_cid, &name, &num); /* this destroys the original string */
- if (num) /* It's possible to get an empty number */
- strncpy (shrunknum, num, sizeof (shrunknum) - 1);
- else
- num = shrunknum;
- ast_shrink_phone_number (shrunknum);
- if (!ast_db_get ("cidname", shrunknum, dbname, sizeof (dbname)))
- {
- snprintf (new_cid, sizeof (new_cid), "\"%s\" <%s>", dbname, num);
- ast_set_callerid (chan, new_cid, 0);
- if (option_verbose > 2)
- ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID to %s\n",
- new_cid);
+ if (chan->cid.cid_num) {
+ if (!ast_db_get ("cidname", shrunknum, dbname, sizeof (dbname))) {
+ ast_set_callerid (chan, NULL, dbname, NULL);
+ if (option_verbose > 2)
+ ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID name to %s\n",
+ dbname);
}
-
- }
+ }
LOCAL_USER_REMOVE (u);
return 0;
}
Index: app_macro.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_macro.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- app_macro.c 14 Jul 2004 07:22:30 -0000 1.15
+++ app_macro.c 2 Oct 2004 00:58:31 -0000 1.16
@@ -3,7 +3,7 @@
*
* Macro Implementation
*
- * Copyright (C) 2003, Digium
+ * Copyright (C) 2003-2004, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -85,7 +85,7 @@
return 0;
}
snprintf(fullmacro, sizeof(fullmacro), "macro-%s", macro);
- if (!ast_exists_extension(chan, fullmacro, "s", 1, chan->callerid)) {
+ if (!ast_exists_extension(chan, fullmacro, "s", 1, chan->cid.cid_num)) {
if (!ast_context_find(fullmacro))
ast_log(LOG_WARNING, "No such context '%s' for macro '%s'\n", fullmacro, macro);
else
@@ -137,8 +137,8 @@
pbx_builtin_setvar_helper(chan, varname, cur);
argc++;
}
- while(ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->callerid)) {
- if ((res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->callerid))) {
+ while(ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) {
+ if ((res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num))) {
/* Something bad happened, or a hangup has been requested. */
if (((res >= '0') && (res <= '9')) || ((res >= 'A') && (res <= 'F'))) {
/* Just return result as to the previous application as if it had been dialed */
@@ -210,7 +210,7 @@
/* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue
normally if there is any problem */
if (sscanf(offsets, "%d", &offset) == 1) {
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + offset + 1, chan->callerid)) {
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + offset + 1, chan->cid.cid_num)) {
chan->priority += offset;
}
}
Index: app_meetme.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_meetme.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- app_meetme.c 7 Sep 2004 01:22:56 -0000 1.60
+++ app_meetme.c 2 Oct 2004 00:58:31 -0000 1.61
@@ -821,7 +821,7 @@
char tmp[2];
tmp[0] = f->subclass;
tmp[1] = '\0';
- if (ast_exists_extension(chan, exitcontext, tmp, 1, chan->callerid)) {
+ if (ast_exists_extension(chan, exitcontext, tmp, 1, chan->cid.cid_num)) {
strncpy(chan->context, exitcontext, sizeof(chan->context) - 1);
strncpy(chan->exten, tmp, sizeof(chan->exten) - 1);
chan->priority = 0;
Index: app_osplookup.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_osplookup.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- app_osplookup.c 25 Jun 2004 04:27:55 -0000 1.2
+++ app_osplookup.c 2 Oct 2004 00:58:31 -0000 1.3
@@ -1,11 +1,11 @@
/*
* Asterisk -- A telephony toolkit for Linux.
*
- * Time of day - Report the time of day
+ * Open Settlement Protocol Lookup
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -110,7 +110,7 @@
}
LOCAL_USER_ADD(u);
ast_log(LOG_DEBUG, "Whoo hoo, looking up OSP on '%s' via '%s'\n", temp, provider ? provider : "<default>");
- if ((res = ast_osp_lookup(chan, provider, temp, chan->callerid, &result)) > 0) {
+ if ((res = ast_osp_lookup(chan, provider, temp, chan->cid.cid_num, &result)) > 0) {
char tmp[80];
snprintf(tmp, sizeof(tmp), "%d", result.handle);
pbx_builtin_setvar_helper(chan, "OSPHANDLE", tmp);
@@ -127,7 +127,7 @@
}
if (!res) {
/* Look for a "busy" place */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
} else if (res > 0)
res = 0;
@@ -171,7 +171,7 @@
}
if (!res) {
/* Look for a "busy" place */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
} else if (res > 0)
res = 0;
@@ -218,7 +218,7 @@
}
if (!res) {
/* Look for a "busy" place */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
} else if (res > 0)
res = 0;
Index: app_parkandannounce.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_parkandannounce.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- app_parkandannounce.c 17 Jul 2004 20:58:00 -0000 1.8
+++ app_parkandannounce.c 2 Oct 2004 00:58:31 -0000 1.9
@@ -6,9 +6,9 @@
* With TONS of help from Mark!
*
* Asterisk is Copyrighted as follows
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -142,8 +142,8 @@
if(option_verbose > 2) {
- ast_verbose( VERBOSE_PREFIX_3 "Return Context: (%s,%s,%d) ID: %s\n", chan->context,chan->exten, chan->priority, chan->callerid);
- if(!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->callerid)) {
+ ast_verbose( VERBOSE_PREFIX_3 "Return Context: (%s,%s,%d) ID: %s\n", chan->context,chan->exten, chan->priority, chan->cid.cid_num);
+ if(!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) {
ast_verbose( VERBOSE_PREFIX_3 "Warning: Return Context Invalid, call will return to default|s\n");
}
}
@@ -161,7 +161,7 @@
/* Now place the call to the extention */
- dchan = ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, dialstr,30000, &outstate, chan->callerid);
+ dchan = ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, dialstr,30000, &outstate, chan->cid.cid_num, chan->cid.cid_name);
if(dchan) {
if(dchan->_state == AST_STATE_UP) {
Index: app_privacy.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_privacy.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- app_privacy.c 22 Jun 2004 19:32:52 -0000 1.6
+++ app_privacy.c 2 Oct 2004 00:58:31 -0000 1.7
@@ -3,9 +3,9 @@
*
* Block all calls without Caller*ID, require phone # to be entered
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -62,7 +62,7 @@
struct ast_config *cfg;
LOCAL_USER_ADD (u);
- if (chan->callerid)
+ if (chan->cid.cid_num)
{
if (option_verbose > 2)
ast_verbose (VERBOSE_PREFIX_3 "CallerID Present: Skipping\n");
@@ -118,13 +118,12 @@
res = ast_streamfile(chan, "privacy-thankyou", chan->language);
if (!res)
res = ast_waitstream(chan, "");
- snprintf (new_cid, sizeof (new_cid), "\"%s\" <%s>", "Privacy Manager", phone);
- ast_set_callerid (chan, new_cid, 0);
+ ast_set_callerid (chan, phone, "Privacy Manager", NULL);
if (option_verbose > 2)
ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID to %s\n",new_cid);
} else {
/*Send the call to n+101 priority, where n is the current priority*/
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority+=100;
}
if (cfg)
Index: app_queue.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_queue.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- app_queue.c 29 Sep 2004 14:06:59 -0000 1.87
+++ app_queue.c 2 Oct 2004 00:58:31 -0000 1.88
@@ -3,9 +3,9 @@
*
* True call queues with optional send URL on answer
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* 2004-06-04: Priorities in queues added by inAccess Networks (work funded by Hellas On Line (HOL) www.hol.gr).
*
@@ -318,8 +318,11 @@
q->count++;
res = 0;
manager_event(EVENT_FLAG_CALL, "Join",
- "Channel: %s\r\nCallerID: %s\r\nQueue: %s\r\nPosition: %d\r\nCount: %d\r\n",
- qe->chan->name, (qe->chan->callerid ? qe->chan->callerid : "unknown"), q->name, qe->pos, q->count );
+ "Channel: %s\r\nCallerID: %s\r\nCallerIDName: %s\r\nQueue: %s\r\nPosition: %d\r\nCount: %d\r\n",
+ qe->chan->name,
+ qe->chan->cid.cid_num ? qe->chan->cid.cid_num : "unknown",
+ qe->chan->cid.cid_name ? qe->chan->cid.cid_name : "unknown",
+ q->name, qe->pos, q->count );
#if 0
ast_log(LOG_NOTICE, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
#endif
@@ -569,18 +572,21 @@
tmp->chan->appl = "AppQueue";
tmp->chan->data = "(Outgoing Line)";
tmp->chan->whentohangup = 0;
- if (tmp->chan->callerid)
- free(tmp->chan->callerid);
- if (tmp->chan->ani)
- free(tmp->chan->ani);
- if (qe->chan->callerid)
- tmp->chan->callerid = strdup(qe->chan->callerid);
- else
- tmp->chan->callerid = NULL;
- if (qe->chan->ani)
- tmp->chan->ani = strdup(qe->chan->ani);
- else
- tmp->chan->ani = NULL;
+ if (tmp->chan->cid.cid_num)
+ free(tmp->chan->cid.cid_num);
+ tmp->chan->cid.cid_num = NULL;
+ if (tmp->chan->cid.cid_name)
+ free(tmp->chan->cid.cid_name);
+ tmp->chan->cid.cid_name = NULL;
+ if (tmp->chan->cid.cid_ani)
+ free(tmp->chan->cid.cid_ani);
+ tmp->chan->cid.cid_ani = NULL;
+ if (qe->chan->cid.cid_num)
+ tmp->chan->cid.cid_num = strdup(qe->chan->cid.cid_num);
+ if (qe->chan->cid.cid_name)
+ tmp->chan->cid.cid_name = strdup(qe->chan->cid.cid_name);
+ if (qe->chan->cid.cid_ani)
+ tmp->chan->cid.cid_ani = strdup(qe->chan->cid.cid_ani);
/* Presense of ADSI CPE on outgoing channel follows ours */
tmp->chan->adsicpe = qe->chan->adsicpe;
/* Place the call, but don't wait on the answer */
@@ -601,11 +607,13 @@
"AgentCalled: %s/%s\r\n"
"ChannelCalling: %s\r\n"
"CallerID: %s\r\n"
+ "CallerIDName: %s\r\n"
"Context: %s\r\n"
"Extension: %s\r\n"
"Priority: %d\r\n",
tmp->tech, tmp->numsubst, qe->chan->name,
- tmp->chan->callerid ? tmp->chan->callerid : "unknown <>",
+ tmp->chan->cid.cid_num ? tmp->chan->cid.cid_num : "unknown",
+ tmp->chan->cid.cid_name ? tmp->chan->cid.cid_name : "unknown",
qe->chan->context, qe->chan->exten, qe->chan->priority);
}
if (option_verbose > 2)
@@ -700,7 +708,7 @@
return 0;
tmp[0] = digit;
tmp[1] = '\0';
- if (ast_exists_extension(qe->chan, qe->context, tmp, 1, qe->chan->callerid)) {
+ if (ast_exists_extension(qe->chan, qe->context, tmp, 1, qe->chan->cid.cid_num)) {
strncpy(qe->chan->context, qe->context, sizeof(qe->chan->context) - 1);
strncpy(qe->chan->exten, tmp, sizeof(qe->chan->exten) - 1);
qe->chan->priority = 0;
@@ -1410,7 +1418,7 @@
break;
case RES_EXISTS:
ast_log(LOG_WARNING, "Unable to remove interface '%s' from queue '%s': Not there\n", interface, queuename);
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid)) {
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num)) {
chan->priority += 100;
}
res = 0;
@@ -1487,7 +1495,7 @@
break;
case RES_EXISTS:
ast_log(LOG_WARNING, "Unable to add interface '%s' to queue '%s': Already there\n", interface, queuename);
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid)) {
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num)) {
chan->priority += 100;
}
res = 0;
@@ -1598,7 +1606,7 @@
qe.last_pos_said = 0;
qe.last_pos = 0;
if (!join_queue(queuename, &qe)) {
- ast_queue_log(queuename, chan->uniqueid, "NONE", "ENTERQUEUE", "%s|%s", url ? url : "", chan->callerid ? chan->callerid : "");
+ ast_queue_log(queuename, chan->uniqueid, "NONE", "ENTERQUEUE", "%s|%s", url ? url : "", chan->cid.cid_num ? chan->cid.cid_num : "");
/* Start music on hold */
check_turns:
if (ringing) {
@@ -2108,10 +2116,14 @@
"Position: %d\r\n"
"Channel: %s\r\n"
"CallerID: %s\r\n"
+ "CallerIDName: %s\r\n"
"Wait: %ld\r\n"
"%s"
"\r\n",
- q->name, pos++, qe->chan->name, (qe->chan->callerid ? qe->chan->callerid : ""), (long)(now - qe->start), idText);
+ q->name, pos++, qe->chan->name,
+ qe->chan->cid.cid_num ? qe->chan->cid.cid_num : "unknown",
+ qe->chan->cid.cid_name ? qe->chan->cid.cid_name : "unknown",
+ (long)(now - qe->start), idText);
ast_mutex_unlock(&s->lock);
ast_mutex_unlock(&q->lock);
}
Index: app_sendtext.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_sendtext.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- app_sendtext.c 22 Jun 2004 19:32:52 -0000 1.2
+++ app_sendtext.c 2 Oct 2004 00:58:31 -0000 1.3
@@ -3,9 +3,9 @@
*
* App to transmit a text message
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -54,7 +54,7 @@
if (!chan->pvt->send_text) {
ast_mutex_unlock(&chan->lock);
/* Does not support transport */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
LOCAL_USER_REMOVE(u);
return 0;
Index: app_setcallerid.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_setcallerid.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- app_setcallerid.c 7 Aug 2004 15:51:11 -0000 1.4
+++ app_setcallerid.c 2 Oct 2004 00:58:31 -0000 1.5
@@ -89,7 +89,7 @@
return 0;
}
LOCAL_USER_ADD(u);
- chan->callingpres = pres;
+ chan->cid.cid_pres = pres;
LOCAL_USER_REMOVE(u);
return res;
}
@@ -110,6 +110,8 @@
{
int res = 0;
char tmp[256] = "";
+ char name[256];
+ char num[256];
struct localuser *u;
char *opt;
int anitoo = 0;
@@ -123,7 +125,8 @@
anitoo = 1;
}
LOCAL_USER_ADD(u);
- ast_set_callerid(chan, strlen(tmp) ? tmp : NULL, anitoo);
+ ast_callerid_split(tmp, name, sizeof(name), num, sizeof(num));
+ ast_set_callerid(chan, num, name, anitoo ? num : NULL);
LOCAL_USER_REMOVE(u);
return res;
}
Index: app_setcidname.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_setcidname.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- app_setcidname.c 14 Jul 2004 07:48:47 -0000 1.4
+++ app_setcidname.c 2 Oct 2004 00:58:31 -0000 1.5
@@ -34,7 +34,7 @@
" SetCIDName(cname[|a]): Set Caller*ID Name on a call to a new\n"
"value, while preserving the original Caller*ID number. This is\n"
"useful for providing additional information to the called\n"
-"party. Sets ANI as well if a flag is used. Always returns 0\n";
+"party. Always returns 0\n";
STANDARD_LOCAL_USER;
@@ -44,36 +44,16 @@
{
int res = 0;
char tmp[256] = "";
- char oldcid[256] = "", *l, *n;
- char newcid[256] = "";
struct localuser *u;
char *opt;
- int anitoo = 0;
if (data)
strncpy(tmp, (char *)data, sizeof(tmp) - 1);
opt = strchr(tmp, '|');
if (opt) {
*opt = '\0';
- opt++;
- if (*opt == 'a')
- anitoo = 1;
}
LOCAL_USER_ADD(u);
- if (chan->callerid) {
- strncpy(oldcid, chan->callerid, sizeof(oldcid) - 1);
- ast_callerid_parse(oldcid, &n, &l);
- n = tmp;
- if (!ast_strlen_zero(n)) {
- if (l && !ast_strlen_zero(l))
- snprintf(newcid, sizeof(newcid), "\"%s\" <%s>", n, l);
- else
- strncpy(newcid, tmp, sizeof(newcid) - 1);
- } else if (l && !ast_strlen_zero(l)) {
- strncpy(newcid, l, sizeof(newcid) - 1);
- }
- } else
- strncpy(newcid, tmp, sizeof(newcid) - 1);
- ast_set_callerid(chan, !ast_strlen_zero(newcid) ? newcid : NULL, anitoo);
+ ast_set_callerid(chan, NULL, tmp, NULL);
LOCAL_USER_REMOVE(u);
return res;
}
Index: app_setcidnum.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_setcidnum.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- app_setcidnum.c 14 Jul 2004 07:34:34 -0000 1.4
+++ app_setcidnum.c 2 Oct 2004 00:58:31 -0000 1.5
@@ -3,9 +3,9 @@
*
* App to set callerid
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
* Oliver Daudey <traveler at xs4all.nl>
*
* This program is free software, distributed under the terms of
@@ -44,12 +44,10 @@
static int setcallerid_exec(struct ast_channel *chan, void *data)
{
int res = 0;
- char tmp[256] = "";
- char oldcid[256] = "", *l, *n;
- char newcid[256] = "";
struct localuser *u;
char *opt;
int anitoo = 0;
+ char tmp[256];
if (data)
strncpy(tmp, (char *)data, sizeof(tmp) - 1);
opt = strchr(tmp, '|');
@@ -60,21 +58,7 @@
anitoo = 1;
}
LOCAL_USER_ADD(u);
- if (chan->callerid) {
- strncpy(oldcid, chan->callerid, sizeof(oldcid) - 1);
- ast_callerid_parse(oldcid, &n, &l);
- l = tmp;
- if (!ast_strlen_zero(l)) {
- if (n && !ast_strlen_zero(n))
- snprintf(newcid, sizeof(newcid), "\"%s\" <%s>", n, l);
- else
- strncpy(newcid, tmp, sizeof(newcid) - 1);
- } else if (n && !ast_strlen_zero(n)) {
- strncpy(newcid, n, sizeof(newcid) - 1);
- }
- } else
- strncpy(newcid, tmp, sizeof(newcid) - 1);
- ast_set_callerid(chan, !ast_strlen_zero(newcid) ? newcid : NULL, anitoo);
+ ast_set_callerid(chan, tmp, NULL, anitoo ? tmp : NULL);
LOCAL_USER_REMOVE(u);
return res;
}
Index: app_sms.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_sms.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- app_sms.c 31 Aug 2004 13:32:11 -0000 1.10
+++ app_sms.c 2 Oct 2004 00:58:31 -0000 1.11
@@ -1050,17 +1050,8 @@
return -1;
}
- if (chan->callerid) {
- /* get caller ID. Used as originating address on sc side receives */
- char temp[256], *name, *num;
- strncpy (temp, chan->callerid, sizeof(temp) - 1);
- ast_callerid_parse (temp, &name, &num);
- if (!num)
- num = temp;
- ast_shrink_phone_number (num);
- if (strlen (num) < sizeof (h.cli))
- strncpy(h.cli, num, sizeof(h.cli) - 1);
- }
+ if (chan->cid.cid_num)
+ strncpy(h.cli, chan->cid.cid_num, sizeof(h.cli) - 1);
{
char *d = data, *p, answer = 0;
Index: app_system.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_system.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- app_system.c 18 Sep 2004 14:14:15 -0000 1.11
+++ app_system.c 2 Oct 2004 00:58:31 -0000 1.12
@@ -72,7 +72,7 @@
} else {
if (res < 0)
res = 0;
- if (res && ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (res && ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority+=100;
res = 0;
}
Index: app_talkdetect.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_talkdetect.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- app_talkdetect.c 7 Aug 2004 22:57:13 -0000 1.4
+++ app_talkdetect.c 2 Oct 2004 00:58:31 -0000 1.5
@@ -124,7 +124,7 @@
char t[2];
t[0] = fr->subclass;
t[1] = '\0';
- if (ast_canmatch_extension(chan, chan->context, t, 1, chan->callerid)) {
+ if (ast_canmatch_extension(chan, chan->context, t, 1, chan->cid.cid_num)) {
/* They entered a valid extension, or might be anyhow */
res = fr->subclass;
ast_frfree(fr);
@@ -146,7 +146,7 @@
ms = 0;
if ((ms > min) && ((max < 0) || (ms < max))) {
ast_log(LOG_DEBUG, "Found qualified token of %d ms\n", ms);
- if (ast_exists_extension(chan, chan->context, "talk", 1, chan->callerid)) {
+ if (ast_exists_extension(chan, chan->context, "talk", 1, chan->cid.cid_num)) {
strncpy(chan->exten, "talk", sizeof(chan->exten) -1 );
chan->priority = 0;
}
Index: app_transfer.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_transfer.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- app_transfer.c 22 Jun 2004 19:32:52 -0000 1.4
+++ app_transfer.c 2 Oct 2004 00:58:31 -0000 1.5
@@ -3,9 +3,9 @@
*
* Transfer a caller
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -53,7 +53,7 @@
}
if (!res) {
/* Look for a "busy" place */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
}
if (res > 0)
Index: app_txtcidname.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_txtcidname.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- app_txtcidname.c 14 Jul 2004 07:34:34 -0000 1.7
+++ app_txtcidname.c 2 Oct 2004 00:58:31 -0000 1.8
@@ -75,7 +75,7 @@
}
if (!res) {
/* Look for a "busy" place */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
} else if (res > 0)
res = 0;
Index: app_url.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_url.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- app_url.c 22 Jun 2004 19:32:52 -0000 1.5
+++ app_url.c 2 Oct 2004 00:58:31 -0000 1.6
@@ -3,9 +3,9 @@
*
* App to transmit a URL
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -65,7 +65,7 @@
LOCAL_USER_ADD(u);
if (!ast_channel_supports_html(chan)) {
/* Does not support transport */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
LOCAL_USER_REMOVE(u);
return 0;
@@ -92,7 +92,7 @@
break;
case AST_HTML_NOSUPPORT:
/* Does not support transport */
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority += 100;
res = 0;
goto out;
Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- app_voicemail.c 30 Sep 2004 04:00:41 -0000 1.151
+++ app_voicemail.c 2 Oct 2004 00:58:31 -0000 1.152
@@ -830,19 +830,22 @@
return 1;
}
-static void prep_email_sub_vars(struct ast_channel *ast, struct ast_vm_user *vmu, int msgnum, char *mailbox, char *callerid, char *dur, char *date, char *passdata, size_t passdatasize)
+static void prep_email_sub_vars(struct ast_channel *ast, struct ast_vm_user *vmu, int msgnum, char *mailbox, char *cidnum, char *cidname, char *dur, char *date, char *passdata, size_t passdatasize)
{
+ char callerid[256];
/* Prepare variables for substition in email body and subject */
pbx_builtin_setvar_helper(ast, "VM_NAME", vmu->fullname);
pbx_builtin_setvar_helper(ast, "VM_DUR", dur);
snprintf(passdata, passdatasize, "%d", msgnum);
pbx_builtin_setvar_helper(ast, "VM_MSGNUM", passdata);
pbx_builtin_setvar_helper(ast, "VM_MAILBOX", mailbox);
- pbx_builtin_setvar_helper(ast, "VM_CALLERID", (callerid ? callerid : "an unknown caller"));
+ pbx_builtin_setvar_helper(ast, "VM_CALLERID", ast_callerid_merge(callerid, sizeof(callerid), cidname, cidnum));
+ pbx_builtin_setvar_helper(ast, "VM_CIDNAME", (cidname ? cidname : "an unknown caller"));
+ pbx_builtin_setvar_helper(ast, "VM_CIDNUM", (cidnum ? cidnum : "an unknown caller"));
pbx_builtin_setvar_helper(ast, "VM_DATE", date);
}
-static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *mailbox, char *callerid, char *attach, char *format, int duration, int attach_user_voicemail)
+static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *mailbox, char *cidnum, char *cidname, char *attach, char *format, int duration, int attach_user_voicemail)
{
FILE *p=NULL;
int pfd;
@@ -912,7 +915,7 @@
int vmlen = strlen(fromstring)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- prep_email_sub_vars(ast,vmu,msgnum + 1,mailbox,callerid,dur,date,passdata, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
pbx_substitute_variables_helper(ast,fromstring,passdata,vmlen);
fprintf(p, "From: %s <%s>\n",passdata,who);
} else ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
@@ -929,7 +932,7 @@
int vmlen = strlen(emailsubject)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- prep_email_sub_vars(ast,vmu,msgnum + 1,mailbox,callerid,dur,date,passdata, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
pbx_substitute_variables_helper(ast,emailsubject,passdata,vmlen);
fprintf(p, "Subject: %s\n",passdata);
} else ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
@@ -965,7 +968,7 @@
int vmlen = strlen(emailbody)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- prep_email_sub_vars(ast,vmu,msgnum + 1,mailbox,callerid,dur,date,passdata, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
pbx_substitute_variables_helper(ast,emailbody,passdata,vmlen);
fprintf(p, "%s\n",passdata);
} else ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
@@ -976,7 +979,7 @@
"in mailbox %s from %s, on %s so you might\n"
"want to check it when you get a chance. Thanks!\n\n\t\t\t\t--Asterisk\n\n", vmu->fullname,
- dur, msgnum + 1, mailbox, (callerid ? callerid : "an unknown caller"), date);
+ dur, msgnum + 1, mailbox, (cidname ? cidname : (cidnum ? cidnum : "an unknown caller")), date);
}
if (attach_user_voicemail) {
fprintf(p, "--%s\n", bound);
@@ -1000,7 +1003,7 @@
return 0;
}
-static int sendpage(char *srcemail, char *pager, int msgnum, char *mailbox, char *callerid, int duration, struct ast_vm_user *vmu)
+static int sendpage(char *srcemail, char *pager, int msgnum, char *mailbox, char *cidnum, char *cidname, int duration, struct ast_vm_user *vmu)
{
FILE *p=NULL;
int pfd;
@@ -1062,7 +1065,7 @@
int vmlen = strlen(fromstring)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- prep_email_sub_vars(ast,vmu,msgnum + 1,mailbox,callerid,dur,date,passdata, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
pbx_substitute_variables_helper(ast,pagerfromstring,passdata,vmlen);
fprintf(p, "From: %s <%s>\n",passdata,who);
} else
@@ -1075,7 +1078,7 @@
fprintf(p, "Subject: New VM\n\n");
strftime(date, sizeof(date), "%A, %B %d, %Y at %r", &tm);
fprintf(p, "New %s long msg in box %s\n"
- "from %s, on %s", dur, mailbox, (callerid ? callerid : "unknown"), date);
+ "from %s, on %s", dur, mailbox, (cidname ? cidname : (cidnum ? cidnum : "unknown")), date);
fclose(p);
snprintf(tmp2, sizeof(tmp2), "( %s < %s ; rm -f %s ) &", mailcmd, tmp, tmp);
ast_safe_system(tmp2);
@@ -1218,7 +1221,7 @@
#endif
}
-static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, int msgnum, long duration, char *fmt, char *callerid);
+static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, int msgnum, long duration, char *fmt, char *cidnum, char *cidname);
static void copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt)
{
@@ -1259,7 +1262,7 @@
ast_log(LOG_ERROR, "Recipient mailbox %s@%s is full\n", recip->mailbox, recip->context);
}
- notify_new_message(chan, recip, recipmsgnum, duration, fmt, chan->callerid);
+ notify_new_message(chan, recip, recipmsgnum, duration, fmt, chan->cid.cid_num, chan->cid.cid_name);
}
static void run_externnotify(char *context, char *extension)
@@ -1282,6 +1285,7 @@
static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int busy, int unavail)
{
char txtfile[256];
+ char callerid[256];
FILE *txt;
int res = 0;
int msgnum;
@@ -1341,21 +1345,21 @@
/* Check current or macro-calling context for special extensions */
if (!ast_strlen_zero(vmu->exit)) {
- if (ast_exists_extension(chan, vmu->exit, "o", 1, chan->callerid))
+ if (ast_exists_extension(chan, vmu->exit, "o", 1, chan->cid.cid_num))
strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
- } else if (ast_exists_extension(chan, chan->context, "o", 1, chan->callerid))
+ } else if (ast_exists_extension(chan, chan->context, "o", 1, chan->cid.cid_num))
strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
- else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->callerid)) {
+ else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num)) {
strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
ousemacro = 1;
}
if (!ast_strlen_zero(vmu->exit)) {
- if (ast_exists_extension(chan, vmu->exit, "a", 1, chan->callerid))
+ if (ast_exists_extension(chan, vmu->exit, "a", 1, chan->cid.cid_num))
strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
- } else if (ast_exists_extension(chan, chan->context, "a", 1, chan->callerid))
+ } else if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num))
strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
- else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->callerid)) {
+ else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num)) {
strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
ausemacro = 1;
}
@@ -1463,7 +1467,7 @@
chan->exten,
chan->priority,
chan->name,
- chan->callerid ? chan->callerid : "Unknown",
+ ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num),
date, (long)time(NULL));
fclose(txt);
} else
@@ -1505,7 +1509,7 @@
free_user(recip);
}
}
- notify_new_message(chan, vmu, msgnum, duration, fmt, chan->callerid);
+ notify_new_message(chan, vmu, msgnum, duration, fmt, chan->cid.cid_num, chan->cid.cid_name);
} else {
res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
if (!res)
@@ -1519,7 +1523,7 @@
} else {
ast_log(LOG_WARNING, "No entry in voicemail config file for '%s'\n", ext);
/*Send the call to n+101 priority, where n is the current priority*/
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
chan->priority+=100;
}
@@ -2158,7 +2162,7 @@
return cmd;
}
-static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, int msgnum, long duration, char *fmt, char *callerid)
+static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, int msgnum, long duration, char *fmt, char *cidnum, char *cidname)
{
char todir[256], fn[256], ext_context[256], *stringp;
@@ -2179,14 +2183,14 @@
attach_user_voicemail = vmu->attach;
if (!ast_strlen_zero(vmu->serveremail))
myserveremail = vmu->serveremail;
- sendmail(myserveremail, vmu, msgnum, vmu->mailbox, callerid, fn, fmt, duration, attach_user_voicemail);
+ sendmail(myserveremail, vmu, msgnum, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail);
}
if (!ast_strlen_zero(vmu->pager)) {
char *myserveremail = serveremail;
if (!ast_strlen_zero(vmu->serveremail))
myserveremail = vmu->serveremail;
- sendpage(myserveremail, vmu->pager, msgnum, vmu->mailbox, callerid, duration, vmu);
+ sendpage(myserveremail, vmu->pager, msgnum, vmu->mailbox, cidnum, cidname, duration, vmu);
}
} else {
ast_log(LOG_ERROR, "Out of memory\n");
@@ -2312,14 +2316,14 @@
attach_user_voicemail = vmtmp->attach;
if (!ast_strlen_zero(vmtmp->serveremail))
myserveremail = vmtmp->serveremail;
- sendmail(myserveremail, vmtmp, todircount, vmtmp->mailbox, callerid, fn, tmp, duration, attach_user_voicemail);
+ sendmail(myserveremail, vmtmp, todircount, vmtmp->mailbox, chan->cid.cid_num, chan->cid.cid_name, fn, tmp, duration, attach_user_voicemail);
}
if (!ast_strlen_zero(vmtmp->pager)) {
char *myserveremail = serveremail;
if (!ast_strlen_zero(vmtmp->serveremail))
myserveremail = vmtmp->serveremail;
- sendpage(myserveremail, vmtmp->pager, todircount, vmtmp->mailbox, callerid, duration, vmtmp);
+ sendpage(myserveremail, vmtmp->pager, todircount, vmtmp->mailbox, chan->cid.cid_num, chan->cid.cid_name, duration, vmtmp);
}
ast_destroy(mif); /* or here */
@@ -3177,7 +3181,6 @@
struct ast_vm_user *vmu = NULL, vmus;
char *context=NULL;
int silentexit = 0;
- char cid[256]="";
char *passptr;
LOCAL_USER_ADD(u);
@@ -3239,21 +3242,14 @@
goto out;
}
if (ast_strlen_zero(vms.username)) {
- char *callerid=NULL, *name=NULL;
- if(chan->callerid != NULL) {
- strncpy(cid, chan->callerid, sizeof(cid) - 1);
- ast_callerid_parse(cid, &name, &callerid);
- }
- if(callerid != NULL) {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "No username but # key pressed. Using CID '%s'\n",callerid);
- strncpy(vms.username, callerid, sizeof(vms.username) - 1);
- } else {
- if (option_verbose > 2)
+ if (chan->cid.cid_num) {
+ strncpy(vms.username, chan->cid.cid_num, sizeof(vms.username) - 1);
+ } else {
+ if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Username not entered\n");
- res = 0;
- goto out;
- }
+ res = 0;
+ goto out;
+ }
}
if (useadsi)
adsi_password(chan);
@@ -3746,7 +3742,7 @@
}
if (find_user(&svm, context, box)) {
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid)) {
+ if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num)) {
chan->priority += 100;
} else
ast_log(LOG_WARNING, "VM box %s@%s exists, but extension %s, priority %d doesn't exist\n", box, context, chan->exten, chan->priority + 101);
Index: app_zapateller.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_zapateller.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- app_zapateller.c 22 Jun 2004 19:32:52 -0000 1.5
+++ app_zapateller.c 2 Oct 2004 00:58:31 -0000 1.6
@@ -3,9 +3,9 @@
*
* Playback the special information tone to get rid of telemarketers
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -70,7 +70,7 @@
res = ast_safe_sleep(chan, 500);
}
}
- if (chan->callerid && nocallerid) {
+ if (chan->cid.cid_num && nocallerid) {
LOCAL_USER_REMOVE(u);
return res;
}
More information about the svn-commits
mailing list