diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-21 04:29:50 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-21 04:29:50 +0000 |
commit | 8bb793aa0b9f55faf60248bafa7e4e0d73f927e1 (patch) | |
tree | 5d100e519b6134064e138459063c486568e3106f /channels/chan_modem_i4l.c | |
parent | 8c7c364aeb0faf889ca763fb8def30a1da045cfa (diff) |
Merge outgoing MSN support + Remote Party ID for SIP (bug #1841) with cleanups
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3253 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_modem_i4l.c')
-rwxr-xr-x | channels/chan_modem_i4l.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/channels/chan_modem_i4l.c b/channels/chan_modem_i4l.c index a7c28b621..ec854d06d 100755 --- a/channels/chan_modem_i4l.c +++ b/channels/chan_modem_i4l.c @@ -528,6 +528,32 @@ 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(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); + if (ast_modem_send(p, cmd, strlen(cmd))) { + ast_log(LOG_WARNING, "Unable to set A number to %s\n",num); + } + + } else { + ast_log(LOG_WARNING, "Outgoing MSN %s not allowed (see outgoingmsn=%s in modem.conf)\n",num,p->outgoingmsn); + } + } + } + snprintf(cmd, sizeof(cmd), "ATD%c %s\n", p->dialtype,stuff); if (ast_modem_send(p, cmd, strlen(cmd))) { ast_log(LOG_WARNING, "Unable to dial\n"); |