mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 03:02:15 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@90949 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user