aboutsummaryrefslogtreecommitdiffstats
path: root/main/callerid.c
diff options
context:
space:
mode:
authordbailey <dbailey@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-16 21:42:46 +0000
committerdbailey <dbailey@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-16 21:42:46 +0000
commit8e4b74040ff76dc41913d28b51eea162b5b29beb (patch)
treeb4b7eddc0519eba2dddaf417597a90020c2d3e2a /main/callerid.c
parent684c1e616e0aff30e85f09d8c1a5ff198b67f951 (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: http://svn.digium.com/svn/asterisk/trunk@123203 f38db490-d61c-443f-a65b-d21fe96a405b
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 */