--- app_voicemail_original.c 2005-04-24 05:22:48.067035535 -0400 +++ app_voicemail_cnam.c 2005-04-24 05:58:09.226773935 -0400 @@ -84,6 +84,7 @@ #define VM_ATTACH (1 << 11) #define VM_DELETE (1 << 12) #define VM_ALLOCED (1 << 13) +#define VM_SAYCNAM (1 << 14) static int load_config(void); @@ -358,6 +359,8 @@ ast_set2_flag(vmu, ast_true(value), VM_OPERATOR); } else if (!strcasecmp(var, "envelope")){ ast_set2_flag(vmu, ast_true(value), VM_ENVELOPE); + } else if (!strcasecmp(var, "saycnam")){ + ast_set2_flag(vmu, ast_true(value), VM_SAYCNAM); } else if (!strcasecmp(var, "sayduration")){ ast_set2_flag(vmu, ast_true(value), VM_SAYDURATION); } else if (!strcasecmp(var, "saydurationm")){ @@ -3227,13 +3230,16 @@ -static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, char *cid, char *context, int callback) +static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, char *cid_orig, char *context, int callback) { int res = 0; int i; + char *cid = NULL; char *callerid, *name; char prefile[256]=""; + /* Make a copy of the cid info so that when parsed, the original information is not destroyed by ast_callerid_parse */ + cid = ast_strdupa(cid_orig); /* If voicemail cid is not enabled, or we didn't get cid or context from the attribute file, leave now. */ /* BB: Still need to change this so that if this function is called by the message envelope (and someone is explicitly requesting to hear the CID), it does not check to see if CID is enabled in the config file */ @@ -3290,6 +3296,23 @@ return res; } +static int play_message_callername(struct ast_channel *chan, struct vm_state *vms, char *cid_orig, char *context, int callback) +{ + int res = 0; + char *cid = NULL; + char *callerid, *name; + + /* Make a copy of the cid info so that when parsed, the original information is not destroyed by ast_callerid_parse */ + cid = ast_strdupa(cid_orig); + + /* Strip off caller ID number from name */ + ast_log(LOG_DEBUG, "VM-CNAM: composite caller name received: %s, context: %s\n", cid, context); + ast_callerid_parse(cid, &name, &callerid); + + res = ast_say_character_str(chan, name, "", chan->language); + return res; +} + static int play_message_duration(struct ast_channel *chan, struct vm_state *vms, char *duration, int minduration) { int res = 0; @@ -3364,6 +3387,8 @@ res = play_message_datetime(chan, vmu, origtime, filename); if ((!res) && (ast_test_flag(vmu, VM_SAYCID))) res = play_message_callerid(chan, vms, cid, context, 0); + if ((!res) && (ast_test_flag(vmu, VM_SAYCNAM))) + res = play_message_callername(chan, vms, cid, context, 0); if ((!res) && (ast_test_flag(vmu, VM_SAYDURATION))) res = play_message_duration(chan, vms, duration, vmu->saydurationm); /* Allow pressing '1' to skip envelope / callerid */ @@ -5149,6 +5174,7 @@ char *astreview; char *astskipcmd; char *asthearenv; + char *astsaycnam; char *astsaydurationinfo; char *astsaydurationminfo; char *silencestr; @@ -5332,7 +5358,15 @@ send_voicemail = "no"; } ast_set2_flag((&globalflags), ast_true(send_voicemail), VM_SVMAIL); + + if (!(astsaycnam = ast_variable_retrieve(cfg,"general", "saycnam"))) { + ast_log(LOG_DEBUG,"Say Caller Name following CID Disabled Globally\n"); + astsaycnam = "no"; + } + ast_set2_flag((&globalflags), ast_true(astsaycnam), VM_SAYCNAM); + + if (!(asthearenv = ast_variable_retrieve(cfg, "general", "envelope"))) { ast_log(LOG_DEBUG,"ENVELOPE before msg enabled globally\n"); asthearenv = "yes";