Пожалуйста, войдите здесь. Часто задаваемые вопросы О нас
Задайте Ваш вопрос

История изменений [назад]

нажмите, чтобы скрыть/показать версии 1
изначальная версия
редактировать

ответил 2012-08-08 05:49:55 +0400

varnar Gravatar varnar

У меня на одном из серверов сделано следующим образом (я использую AEL)

macro CheckCallerID(CallerID) {
            // We are check in A2B v14 DB for caller id
            // If we found, returning this CID, if no returning empty string
            Noop( == Incoming CallerID is: ${CallerID} == );
            if ("${CallerID}" = "" ) {
               Noop( == No any CallerID );
            }else{
               MYSQL(Connect connid ${realdb_host} ${realdb_user} ${realdb_pass} ${realdb_db});
               MYSQL(Query resultid ${connid} SELECT cid,id_cc_card from cc_callerid where cid=${CallerID} and activated = 't');
               MYSQL(Fetch fetchid ${resultid} cid id_cc_card);
               MYSQL(Clear ${resultid});
               Noop( == CallerID found in DB ${cid} for cardid ${id_cc_card} == );
               MYSQL(Query resultid ${connid} SELECT username from cc_card where id=${id_cc_card});
               MYSQL(Fetch fetchid ${resultid} cc_card);
               MYSQL(Clear ${resultid});
               MYSQL(Disconnect ${connid});
               Noop( == Card found in DB ${cc_card} for callerid ${cid} == );
            };
            return; 
};

context InFromFXO {

    // FXO Dlink hotline to 598367 number
    598367 => {

            Noop( == Incomming call from FXO Dlink_Elit == );
            Noop( == Caller ID is: ${CALLERID(all)} == );

            Noop( == Now checking if this caller id for VLogic == );
            // If called number is in range of VLogik
            if ((${CALLERID(number):0:7}=0105017) || (${CALLERID(number):0:7}=0105018)) {
                    Noop( == if yes, jump to ViLogic extra context == );
                    jump s@VLogic; // then jump to VLogic context
            };

            Noop( == if no, continue to check, if it CC or to operator == );
            cidnumber="";
            cc_card="";
            cidnumber=${CALLERID(number)};
            CHANNEL(language)=en;

            Noop( == Checking in DB for existing callerid == );

            &CheckCallerID(${cidnumber});
            //From macros we save founded CallerID from DB in "cid" variable
            if ("${cid}" = "") {
                    Noop ( == If not found, jump to extra operator context == );
                    goto callcenter,s,1;
            } else {
                    Noop ( == If found, continue to work == );
                    Answer;
                    Wait(0.5);
                    CDR(accountcode)=${cc_card}; // Setting ClassicTimeElit account code in new Billing
                    goto s|begin; // We have find callerid, so go to "begin" label in "s" includes.
            };
            Hangup;
     };
};

У меня на одном из серверов сделано следующим образом (я использую AEL)

macro CheckCallerID(CallerID) {
            // We are check in A2B v14 DB for caller id
            // If we found, returning this CID, if no returning empty string
            Noop( == Incoming CallerID is: ${CallerID} == );
            if ("${CallerID}" = "" ) {
               Noop( == No any CallerID );
            }else{
               MYSQL(Connect connid ${realdb_host} ${realdb_user} ${realdb_pass} ${realdb_db});
               MYSQL(Query resultid ${connid} SELECT cid,id_cc_card from cc_callerid where cid=${CallerID} and activated = 't');
               MYSQL(Fetch fetchid ${resultid} cid id_cc_card);
               MYSQL(Clear ${resultid});
               Noop( == CallerID found in DB ${cid} for cardid ${id_cc_card} == );
               MYSQL(Query resultid ${connid} SELECT username from cc_card where id=${id_cc_card});
               MYSQL(Fetch fetchid ${resultid} cc_card);
               MYSQL(Clear ${resultid});
               MYSQL(Disconnect ${connid});
               Noop( == Card found in DB ${cc_card} for callerid ${cid} == );
            };
            return; 
};

context InFromFXO {

    // FXO Dlink hotline to 598367 number
    598367 => {

            Noop( == Incomming call from FXO Dlink_Elit == );
            Noop( == Caller ID is: ${CALLERID(all)} == );

            Noop( == Now checking if this caller id for VLogic == );
            // If called number is in range of VLogik
            if ((${CALLERID(number):0:7}=0105017) || (${CALLERID(number):0:7}=0105018)) {
                    Noop( == if yes, jump to ViLogic extra context == );
                    jump s@VLogic; // then jump to VLogic context
            };

            Noop( == if no, continue to check, if it CC or to operator == );
            cidnumber="";
            cc_card="";
            cidnumber=${CALLERID(number)};
            CHANNEL(language)=en;

            Noop( == Checking in DB for existing callerid == );

            &CheckCallerID(${cidnumber});
            //From macros we save founded CallerID from DB in "cid" variable
            if ("${cid}" = "") {
                    Noop ( == If not found, jump to extra operator context == );
                    goto callcenter,s,1;
            } else {
                    Noop ( == If found, continue to work == );
                    Answer;
                    Wait(0.5);
                    CDR(accountcode)=${cc_card}; // Setting ClassicTimeElit account code in new Billing
                    goto s|begin; // We have find callerid, so go to "begin" label in "s" includes.
            };
            Hangup;
     };
};

У меня на одном из серверов сделано следующим образом (я использую AEL)

macro CheckCallerID(CallerID) {
            // We are check in A2B v14 DB for caller id
            // If we found, returning this CID, if no returning empty string
            Noop( == Incoming CallerID is: ${CallerID} == );
            if ("${CallerID}" = "" ) {
               Noop( == No any CallerID );
            }else{
               MYSQL(Connect connid ${realdb_host} ${realdb_user} ${realdb_pass} ${realdb_db});
               MYSQL(Query resultid ${connid} SELECT cid,id_cc_card from cc_callerid where cid=${CallerID} and activated = 't');
               MYSQL(Fetch fetchid ${resultid} cid id_cc_card);
               MYSQL(Clear ${resultid});
               Noop( == CallerID found in DB ${cid} for cardid ${id_cc_card} == );
               MYSQL(Query resultid ${connid} SELECT username from cc_card where id=${id_cc_card});
               MYSQL(Fetch fetchid ${resultid} cc_card);
               MYSQL(Clear ${resultid});
               MYSQL(Disconnect ${connid});
               Noop( == Card found in DB ${cc_card} for callerid ${cid} == );
            };
            return; 
};

context InFromFXO {

    // FXO Dlink hotline to 598367 number
    598367 => {

            Noop( == Incomming call from FXO Dlink_Elit == );
            Noop( == Caller ID is: ${CALLERID(all)} == );

            Noop( == Now checking if this caller id for VLogic == );
            // If called number is in range of VLogik
VLogic
            if ((${CALLERID(number):0:7}=0105017) || (${CALLERID(number):0:7}=0105018)) {
                    Noop( == if yes, jump to ViLogic extra context == );
                    jump s@VLogic; // then jump to VLogic context
            };

            Noop( == if no, continue to check, if it CC or to operator == );
            cidnumber="";
            cc_card="";
            cidnumber=${CALLERID(number)};
            CHANNEL(language)=en;

            Noop( == Checking in DB for existing callerid == );

            &CheckCallerID(${cidnumber});
            //From macros we save founded CallerID from DB in "cid" variable
            if ("${cid}" = "") {
                  Noop ( == If not found, jump to extra operator context == );
                  goto callcenter,s,1;
            } else {
                  Noop ( == If found, continue to work == );
                  Answer;
                  Wait(0.5);
                  CDR(accountcode)=${cc_card}; // Setting account code in new Billing
                  goto s|begin; // We have find callerid, so go to "begin" label in "s" includes.
            };
            Hangup;
     };
};

Проект компании "АТС Дизайн"
Asterisk® и Digium® являются зарегистрированными торговыми марками компании Digium, Inc., США.
IP АТС Asterisk распространяется под лицензией GNU GPL.