*** asterisk-1.4.42/apps/app_voicemail.c Wed May 4 17:08:50 2011 --- asterisk-1.4.42.rbmod/apps/app_voicemail.c Fri Sep 16 09:00:05 2011 *************** *** 5790,5797 **** } ! static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, char *cid, const char *context, int callback) { int res = 0; int i; --- 5790,5799 ---- } + /* Added the saycidnumber arg to force Asterisk to say the number instead of the recording of the + * callers name when playing the message envelope or replying */ ! static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, char *cid, const char *context, int callback, int saycidnumber) { int res = 0; int i; *************** *** 5821,5827 **** if (!res) { snprintf(prefile, sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, context, callerid); if (!ast_strlen_zero(prefile)) { ! /* See if we can find a recorded name for this person instead of their extension number */ if (ast_fileexists(prefile, NULL, NULL) > 0) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: CID number '%s' matches mailbox number, playing recorded name\n", callerid); --- 5823,5830 ---- if (!res) { snprintf(prefile, sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, context, callerid); if (!ast_strlen_zero(prefile)) { ! /* See if we can find a recorded name for this callerid ! * and if found, use that instead of saying number . */ if (ast_fileexists(prefile, NULL, NULL) > 0) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: CID number '%s' matches mailbox number, playing recorded name\n", callerid); *************** *** 5843,5852 **** else if (!res){ if (option_debug > 2) ast_log(LOG_DEBUG, "VM-CID: Numeric caller id: (%s)\n",callerid); ! /* BB: Since this is all nicely figured out, why not say "from phone number" in this case" */ ! if (!callback) ! res = wait_file2(chan, vms, "vm-from-phonenumber"); ! res = ast_say_digit_str(chan, callerid, AST_DIGIT_ANY, chan->language); } } else { /* Number unknown */ --- 5846,5870 ---- else if (!res){ if (option_debug > 2) ast_log(LOG_DEBUG, "VM-CID: Numeric caller id: (%s)\n",callerid); ! /* RB: If there is a recording for this numeric callerid then play that */ ! if (!callback) { ! /* See if we can find a recorded name for this person instead of their extension number */ ! snprintf(prefile, sizeof(prefile), "%s/Callerids/%s", VM_SPOOL_DIR, callerid); ! if ( !saycidnumber && ast_fileexists(prefile, NULL, NULL) > 0 ) { ! if (option_verbose > 2) ! ast_verbose(VERBOSE_PREFIX_3 "Playing recorded name for CID number '%s' - '%s'\n", callerid,prefile); ! res = wait_file2(chan, vms, "vm-from"); ! res = ast_stream_and_wait(chan, prefile, chan->language, ""); ! if (option_verbose > 2) ! ast_verbose(VERBOSE_PREFIX_3 "Played recorded name result '%d'\n", res); ! } else { ! /* BB: Since this is all nicely figured out, why not say "from phone number" in this case" */ ! ast_verbose(VERBOSE_PREFIX_3 "HERE 1 '%d'\n",res); ! res = wait_file2(chan, vms, "vm-from-phonenumber"); ! res = ast_say_digit_str(chan, callerid, AST_DIGIT_ANY, chan->language); ! } ! } else ! res = ast_say_digit_str(chan, callerid, AST_DIGIT_ANY, chan->language); } } else { /* Number unknown */ *************** *** 6022,6028 **** if ((!res) && (ast_test_flag(vmu, VM_ENVELOPE))) 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_SAYDURATION))) res = play_message_duration(chan, vms, duration, vmu->saydurationm); /* Allow pressing '1' to skip envelope / callerid */ --- 6040,6046 ---- if ((!res) && (ast_test_flag(vmu, VM_ENVELOPE))) 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, 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 */ *************** *** 9383,9389 **** if (!res) res = play_message_datetime(chan, vmu, origtime, filename); if (!res) ! res = play_message_callerid(chan, vms, cid, context, 0); res = 't'; break; --- 9401,9407 ---- if (!res) res = play_message_datetime(chan, vmu, origtime, filename); if (!res) ! res = play_message_callerid(chan, vms, cid, context, 0, 1); res = 't'; break; *************** *** 9445,9451 **** ast_verbose( VERBOSE_PREFIX_3 "Confirm CID number '%s' is number to use for callback\n", num); res = ast_play_and_wait(chan, "vm-num-i-have"); if (!res) ! res = play_message_callerid(chan, vms, num, vmu->context, 1); if (!res) res = ast_play_and_wait(chan, "vm-tocallnum"); /* Only prompt for a caller-specified number if there is a dialout context specified */ --- 9463,9469 ---- ast_verbose( VERBOSE_PREFIX_3 "Confirm CID number '%s' is number to use for callback\n", num); res = ast_play_and_wait(chan, "vm-num-i-have"); if (!res) ! res = play_message_callerid(chan, vms, num, vmu->context, 1, 1); if (!res) res = ast_play_and_wait(chan, "vm-tocallnum"); /* Only prompt for a caller-specified number if there is a dialout context specified */