diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-14 19:43:41 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-14 19:43:41 +0000 |
commit | 81151ce93848a42b06ba4e74172870c29f6d902f (patch) | |
tree | b0ab1b18c895ef00b6ec7935901f807bd1058ea8 /apps/app_dial.c | |
parent | d00f8d093cc85b76698deb48b4da17de20929818 (diff) |
Merge Matt's work
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3204 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rwxr-xr-x | apps/app_dial.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c index 3f145ae01..58b0fae01 100755 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -63,6 +63,9 @@ static char *descrip = "The option string may contain zero or more of the following characters:\n" " 't' -- allow the called user transfer the calling user by hitting #.\n" " 'T' -- allow the calling user to transfer the call by hitting #.\n" +" 'f' -- Forces callerid to be set as the extension of the line making/redirecting the outgoing call.\n" +" For example, some PSTNs don't allow callerids from other extensions then the ones\n" +" that are assigned to you.\n" " 'r' -- indicate ringing to the calling party, pass no audio until answered.\n" " 'm' -- provide hold music to the calling party until answered.\n" " 'H' -- allow caller to hang up by hitting *.\n" @@ -99,6 +102,7 @@ struct localuser { int ringbackonly; int musiconhold; int allowdisconnect; + int forcecallerid; struct localuser *next; }; @@ -219,15 +223,28 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu o->stillgoing = 0; numbusies++; } else { - if (in->callerid) { - if (o->chan->callerid) - free(o->chan->callerid); - o->chan->callerid = malloc(strlen(in->callerid) + 1); - if (o->chan->callerid) - strncpy(o->chan->callerid, in->callerid, strlen(in->callerid) + 1); + if (o->chan->callerid) + free(o->chan->callerid); + + o->chan->callerid = NULL; + + if (o->forcecallerid) { + char *newcid = NULL; + + if (strlen(in->macroexten)) + newcid = in->macroexten; else + newcid = in->exten; + o->chan->callerid = strdup(newcid); + if (!o->chan->callerid) + ast_log(LOG_WARNING, "Out of memory\n"); + } else { + if (in->callerid) + o->chan->callerid = strdup(in->callerid); + if (!o->chan->callerid) ast_log(LOG_WARNING, "Out of memory\n"); } + if (in->ani) { if (o->chan->ani) free(o->chan->ani); @@ -658,6 +675,9 @@ static int dial_exec(struct ast_channel *chan, void *data) else allowdisconnect = tmp->allowdisconnect = 0; if(strchr(transfer, 'g')) go_on=1; + if (strchr(transfer, 'f')) + tmp->forcecallerid = 1; + else tmp->forcecallerid = 0; } strncpy(numsubst, number, sizeof(numsubst)-1); /* If we're dialing by extension, look at the extension to know what to dial */ |