[Asterisk-Users] Voicemail

Sharon asteriskgirl at gmail.com
Fri Dec 10 07:54:02 MST 2004


In extensions.conf

exten => _1NXXNXXXXXX,1,MySQLExtension(SIPE=${EXTEN:1}/${CALLERIDNUM})
exten => _1NXXNXXXXXX,2,GoToIf($[empty${SIPE} = empty]?6:3)
exten => _1NXXNXXXXXX,3,MySQLExtension(MATCH=${EXTEN:1}/${CALLERIDNUM})
exten => _1NXXNXXXXXX,4,GoToIf($[empty${MATCH} = empty]?5:20)
exten => _1NXXNXXXXXX,5,MySQLExtension(SIXNINE=${EXTEN:1}/${CALLERIDNUM})
exten => _1NXXNXXXXXX,6,Goto(tendigit,${EXTEN:1},1)
exten => _1NXXNXXXXXX,20,MySQLExtension(VM=${EXTEN:1}/${CALLERIDNUM})
exten => _1NXXNXXXXXX,21,GoToIf($[empty${VM} = empty]?102:22)
exten => _1NXXNXXXXXX,22,VoicemailMain2(${VM})
exten => _1NXXNXXXXXX,102,Playback(pbx-invalid)
exten => _1NXXNXXXXXX,103,Hangup


in our own c file in directory /usr/local/src/asterisk/apps

if (strcmp(varname, "VM") == 0) {
                        memset (query,'\0',256);
                        sprintf(query,"SELECT vmbox FROM voicemail WHERE "\
                                "extension='%s'", exten);
                        if (mysql_query(&mysql,query)) {
                                ast_log(LOG_ERROR, "VM query failed %s.\n",
                                        query);
                                ast_mutex_unlock(&db_lock);
                                return 0; 
                        }
                        if ((result = mysql_store_result(&mysql)) == NULL) {
                                ast_log(LOG_ERROR, "VM fetch failed.\n");
                                ast_mutex_unlock(&db_lock);
                                return 0;
                        }
                        if ((row = mysql_fetch_row(result)) != NULL) {
                                pbx_builtin_setvar_helper(chan,varname,row[0]);
                        }
                        else {
                                ast_log(LOG_ERROR, "VM not present %s.\n",
                                        query);
                        }
                        mysql_free_result(result);
                        ast_mutex_unlock(&db_lock);
                        return 0;
                }


On Fri, 10 Dec 2004 07:47:21 +0100, Wilson Pickett
<wilson.pickett at gmail.com> wrote:
> >  when a customer is
> >  having more than 1 phone numbers and he wants to check his mailbox
> >  when he dials in to check his voicemail it should pick the primary
> >  mailbox but it is picking up the wrong phone extension and verifying
> Sounds like it uses the callerid extension as the mailbox. What you
> want for a global mailbox is to supply it in the Voicemail command as
> in u2000 or b2000 or s2000.
>



More information about the asterisk-users mailing list