summaryrefslogtreecommitdiff
path: root/main/callerid.c
diff options
context:
space:
mode:
authorDoug Bailey <dbailey@digium.com>2008-06-16 21:42:46 +0000
committerDoug Bailey <dbailey@digium.com>2008-06-16 21:42:46 +0000
commit269037841164f92a3c6fd56ae22d9c9ec65210ab (patch)
treeb4b7eddc0519eba2dddaf417597a90020c2d3e2a /main/callerid.c
parentddfac77569c31007dd6ed771f96aeb29adf95157 (diff)
Clean up code that handles fsk mwi message generation by pulling it from do_monitor and creating its own thread.
Added RP-AS mwi message generation using patches from meneault as a basis. (closes issue #8587) Reported by: meneault Tested by: meneault git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123203 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/callerid.c')
-rw-r--r--main/callerid.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/main/callerid.c b/main/callerid.c
index 4dd290e5a..1e9bcad42 100644
--- a/main/callerid.c
+++ b/main/callerid.c
@@ -769,9 +769,10 @@ static int callerid_genmsg(char *msg, int size, const char *number, const char *
}
-int vmwi_generate(unsigned char *buf, int active, int mdmf, int codec)
+int vmwi_generate(unsigned char *buf, int active, int type, int codec,
+ const char* name, const char* number, int flags)
{
- unsigned char msg[256];
+ char msg[256];
int len = 0;
int sum;
int x;
@@ -779,14 +780,38 @@ int vmwi_generate(unsigned char *buf, int active, int mdmf, int codec)
float cr = 1.0;
float ci = 0.0;
float scont = 0.0;
+
+ if (type == CID_MWI_TYPE_MDMF_FULL) {
+ /* MDMF Message waiting with date, number, name and MWI parameter */
+ msg[0] = 0x82;
- if (mdmf) {
- /* MDMF Message waiting */
+ /* put date, number info at the right place */
+ len = callerid_genmsg(msg+2, sizeof(msg)-2, number, name, flags);
+
+ /* length of MDMF CLI plus Message Waiting Structure */
+ msg[1] = len+3;
+
+ /* Go to the position to write to */
+ len = len+2;
+
+ /* "Message Waiting Parameter" */
+ msg[len++] = 0x0b;
+ /* Length of IE is one */
+ msg[len++] = 1;
+ /* Active or not */
+ if (active)
+ msg[len++] = 0xff;
+ else
+ msg[len++] = 0x00;
+
+ } else if (type == CID_MWI_TYPE_MDMF) {
+ /* MDMF Message waiting only */
+ /* same as above except that the we only put MWI parameter */
msg[len++] = 0x82;
/* Length is 3 */
msg[len++] = 3;
/* IE is "Message Waiting Parameter" */
- msg[len++] = 0xb;
+ msg[len++] = 0x0b;
/* Length of IE is one */
msg[len++] = 1;
/* Active or not */