Huge callerid rework (might break H.323, others)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3874 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-10-02 00:58:31 +00:00
parent 9b926b1d64
commit 04fc29c8b2
56 changed files with 1003 additions and 866 deletions

View File

@@ -23,6 +23,7 @@
#include <asterisk/pbx.h>
#include <asterisk/module.h>
#include <asterisk/astdb.h>
#include <asterisk/callerid.h>
#include <math.h>
#include <stdlib.h>
#include <unistd.h>
@@ -296,9 +297,10 @@ static void setup_env(struct ast_channel *chan, char *request, int fd, int enhan
fdprintf(fd, "agi_uniqueid: %s\n", chan->uniqueid);
/* ANI/DNIS */
fdprintf(fd, "agi_callerid: %s\n", chan->callerid ? chan->callerid : "unknown");
fdprintf(fd, "agi_dnid: %s\n", chan->dnid ? chan->dnid : "unknown");
fdprintf(fd, "agi_rdnis: %s\n", chan->rdnis ? chan->rdnis : "unknown");
fdprintf(fd, "agi_callerid: %s\n", chan->cid.cid_num ? chan->cid.cid_num : "unknown");
fdprintf(fd, "agi_calleridname: %s\n", chan->cid.cid_name ? chan->cid.cid_name : "unknown");
fdprintf(fd, "agi_dnid: %s\n", chan->cid.cid_dnid ? chan->cid.cid_dnid : "unknown");
fdprintf(fd, "agi_rdnis: %s\n", chan->cid.cid_rdnis ? chan->cid.cid_rdnis : "unknown");
/* Context information */
fdprintf(fd, "agi_context: %s\n", chan->context);
@@ -837,8 +839,19 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv
static int handle_setcallerid(struct ast_channel *chan, AGI *agi, int argc, char **argv)
{
if (argv[2])
ast_set_callerid(chan, argv[2], 0);
char tmp[256]="";
char *l = NULL, *n = NULL;
if (argv[2]) {
strncpy(tmp, argv[2], sizeof(tmp) - 1);
ast_callerid_parse(tmp, &n, &l);
if (l)
ast_shrink_phone_number(l);
else
l = "";
if (!n)
n = "";
ast_set_callerid(chan, l, n, NULL);
}
fdprintf(agi->fd, "200 result=1\n");
return RESULT_SUCCESS;

View File

@@ -210,9 +210,11 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou
"From: %s\r\n"
"Timeout: %ld\r\n"
"CallerID: %s\r\n"
"CallerIDName: %s\r\n\r\n"
,pu->parkingnum, pu->chan->name, peer->name
,(long)pu->start.tv_sec + (long)(pu->parkingtime/1000) - (long)time(NULL)
,(pu->chan->callerid ? pu->chan->callerid : "")
,(pu->chan->cid.cid_num ? pu->chan->cid.cid_num : "")
,(pu->chan->cid.cid_name ? pu->chan->cid.cid_name : "")
);
if (peer) {
@@ -450,7 +452,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
break;
*(ptr++) = res;
if (!ast_matchmore_extension(transferer, transferer_real_context
, newext, 1, transferer->callerid)) {
, newext, 1, transferer->cid.cid_num)) {
break;
}
}
@@ -479,7 +481,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
ast_log(LOG_WARNING, "Unable to park call %s\n", transferee->name);
}
/* XXX Maybe we should have another message here instead of invalid extension XXX */
} else if (ast_exists_extension(transferee, transferer_real_context, newext, 1, transferer->callerid)) {
} else if (ast_exists_extension(transferee, transferer_real_context, newext, 1, transferer->cid.cid_num)) {
ast_moh_stop(transferee);
res=ast_autoservice_stop(transferee);
if (!transferee->pbx) {
@@ -842,11 +844,13 @@ static int manager_parking_status( struct mansession *s, struct message *m )
"Channel: %s\r\n"
"Timeout: %ld\r\n"
"CallerID: %s\r\n"
"CallerIDName: %s\r\n"
"%s"
"\r\n"
,cur->parkingnum, cur->chan->name
,(long)cur->start.tv_sec + (long)(cur->parkingtime/1000) - (long)time(NULL)
,(cur->chan->callerid ? cur->chan->callerid : "")
,(cur->chan->cid.cid_num ? cur->chan->cid.cid_num : "")
,(cur->chan->cid.cid_name ? cur->chan->cid.cid_name : "")
,idText);
ast_mutex_unlock(&s->lock);