diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-10-02 00:58:31 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-10-02 00:58:31 +0000 |
commit | 6868babd229a635c5fd89c7b284025a92e0a3f9d (patch) | |
tree | 25a4ee6dff29d18acfdfbbc42485333db7aa5311 /channels/chan_modem_i4l.c | |
parent | b201da1a3eb1cae654cdd3fe89ef8f9e55dd0b83 (diff) |
Huge callerid rework (might break H.323, others)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3874 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_modem_i4l.c')
-rwxr-xr-x | channels/chan_modem_i4l.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/channels/chan_modem_i4l.c b/channels/chan_modem_i4l.c index 892f4c09f..48e76aa69 100755 --- a/channels/chan_modem_i4l.c +++ b/channels/chan_modem_i4l.c @@ -345,7 +345,7 @@ static struct ast_frame *i4l_read(struct ast_modem_pvt *p) return i4l_handle_escape(p, 'b'); } else if (!strncasecmp(result, "CALLER NUMBER: ", 15 )) { - strncpy(p->cid, result + 15, sizeof(p->cid)-1); + strncpy(p->cid_num, result + 15, sizeof(p->cid_num)-1); return i4l_handle_escape(p, 0); } else if (!strcasecmp(result, "RINGING")) { @@ -584,30 +584,22 @@ static int i4l_dialdigit(struct ast_modem_pvt *p, char digit) static int i4l_dial(struct ast_modem_pvt *p, char *stuff) { char cmd[80]; - char tmp[255]; char tmpmsn[255]; - char *name, *num; struct ast_channel *c = p->owner; // Find callerid number first, to set the correct A number - if (c && c->callerid && ! c->restrictcid) { - ast_log(LOG_DEBUG, "Finding callerid from %s...\n",c->callerid); - strncpy(tmp, c->callerid, sizeof(tmp) - 1); - ast_callerid_parse(tmp, &name, &num); - if (num) { - ast_shrink_phone_number(num); - snprintf(tmpmsn, sizeof(tmpmsn), ",%s,", num); + if (c && c->cid.cid_num && !(c->cid.cid_pres & 0x20)) { + snprintf(tmpmsn, sizeof(tmpmsn), ",%s,", c->cid.cid_num); if(strlen(p->outgoingmsn) && strstr(p->outgoingmsn,tmpmsn) != NULL) { // Tell ISDN4Linux to use this as A number - snprintf(cmd, sizeof(cmd), "AT&E%s\n", num); + snprintf(cmd, sizeof(cmd), "AT&E%s\n", c->cid.cid_num); if (ast_modem_send(p, cmd, strlen(cmd))) { - ast_log(LOG_WARNING, "Unable to set A number to %s\n",num); + ast_log(LOG_WARNING, "Unable to set A number to %s\n", c->cid.cid_num); } } else { - ast_log(LOG_WARNING, "Outgoing MSN %s not allowed (see outgoingmsn=%s in modem.conf)\n",num,p->outgoingmsn); + ast_log(LOG_WARNING, "Outgoing MSN %s not allowed (see outgoingmsn=%s in modem.conf)\n",c->cid.cid_num,p->outgoingmsn); } - } } snprintf(cmd, sizeof(cmd), "ATD%c %s\n", p->dialtype,stuff); |