diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-04 19:08:30 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-04 19:08:30 +0000 |
commit | bdd896e7bec050adc63834cce2e24e224d689a24 (patch) | |
tree | 8318f4e72b28df714bd428f21e35691be91838f7 /main/callerid.c | |
parent | b31b092cff69a0cf9fc65d94cebde5200fba2e73 (diff) |
Add support for monitoring MWI on FXO lines.
This introduces two new options for zapata.conf: mwimonitor and mwimonitornotify.
The mwimonitor option enables MWI monitoring. When the MWI state on a line changes,
then the script specified by mwimonitornotify will be executed for custom handling
of the state change, similar to the externnotify option of voicemail.conf.
Also, when the MWI state on an FXO line changes, an internal Asterisk event is
generated to indicate the new state of the associated mailbox. That may, any
module that cares about MWI information will get notified and can handle it
just as if app_voicemail had sent this notification.
(BE-253, original patch from markster, with some minor modifications by me to
add comments, documentation, and internal event support)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@90949 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/callerid.c')
-rw-r--r-- | main/callerid.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/main/callerid.c b/main/callerid.c index 04b45ab4f..c1d5e80b9 100644 --- a/main/callerid.c +++ b/main/callerid.c @@ -555,7 +555,7 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, int cid->sawflag = 2; break; case 2: /* Get lead-in */ - if ((b == 0x04) || (b == 0x80)) { + if ((b == 0x04) || (b == 0x80) || (b == 0x06) || (b == 0x82)) { cid->type = b; cid->sawflag = 3; cid->cksum = b; @@ -591,8 +591,10 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, int cid->number[0] = '\0'; cid->name[0] = '\0'; + /* Update flags */ + cid->flags = 0; /* If we get this far we're fine. */ - if (cid->type == 0x80) { + if ((cid->type == 0x80) || (cid->type == 0x82)) { /* MDMF */ /* Go through each element and process */ for (x = 0; x < cid->pos;) { @@ -626,6 +628,13 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, int memcpy(cid->name, cid->rawdata + x + 1, res); cid->name[res] = '\0'; break; + case 11: /* Message Waiting */ + res = cid->rawdata[x + 1]; + if (res) + cid->flags |= CID_MSGWAITING; + else + cid->flags |= CID_NOMSGWAITING; + break; case 17: /* UK: Call type, 1=Voice Call, 2=Ringback when free, 129=Message waiting */ case 19: /* UK: Network message system status (Number of messages waiting) */ case 22: /* Something French */ @@ -643,12 +652,17 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, int x += cid->rawdata[x]; x++; } + } else if (cid->type == 0x6) { + /* VMWI SDMF */ + if (cid->rawdata[2] == 0x42) { + cid->flags |= CID_MSGWAITING; + } else if (cid->rawdata[2] == 0x6f) { + cid->flags |= CID_NOMSGWAITING; + } } else { /* SDMF */ ast_copy_string(cid->number, cid->rawdata + 8, sizeof(cid->number)); } - /* Update flags */ - cid->flags = 0; if (!strcmp(cid->number, "P")) { strcpy(cid->number, ""); cid->flags |= CID_PRIVATE_NUMBER; |