############################################################################################################################### Asterisk GW2 Asterisk 1.6.2.10 asterisk-addons-1.6.1.1 dahdi-linux-complete-2.1.0.4+2.1.0.2 libpri-1.4.10 Placa - T4XXP IP: 192.168.200.24 ############################################################################################################################### =============================================================================================================================== SIP.CONF =============================================================================================================================== [general] disallow=all allow=alaw allow=ulaw allowtransfer=yes localnet=192.168.0.0/255.255.0.0 Port=5060 srvlookup=yes language=pt_BR message=yes bindaddr=0.0.0.0 dtmfmode=rfc2833 allowguest=yes rtptimeout=60 rtpholdtimeout=600 bindport=5060 tos_sip=cs3 tos_audio=ef canreinvite=no maxexpiry=30 minexpiry=10 defaultexpiry=20 t38pt_udptl = yes jbenable = yes jbforce = yes jbmaxsize = 200 jbresyncthreshold = 1000 jbimpl = fixed jblog = no register => gw2:gw2@192.168.200.22:5060 [sipserver] username=gw2 type=peer secret=gw2 port=5060 insecure=port,invite host=192.168.200.22 fromuser=gw2 fromdomain=192.168.200.22 dtmfmode=rfc2833 context=outbound =============================================================================================================================== EXTENSIONS.CONF =============================================================================================================================== [publica] exten => _xxxx,1,NoOp(${CALLERID(num)}) exten => _xxxx,n,GotoIf($[!${ISNULL(${CALLERID(num)})}}]?jump) exten => _xxxx,n,Set(CALLERID(num)=0) exten => _xxxx,n(jump),Goto(ike_inbound,${EXTEN},1) exten => _xxxx,n,hangup [ike_inbound] ;#############Retencao exten => 2864,1,NoOp() exten => 2864,n,hangup exten => 2864,n,Set(ARRAY(CDR(accountcode),CDR(userfield),CDR(dialednumber))=001,99,${EXTEN}) exten => 2864,n,Set(id_project=002864) exten => 2864,n,Set(nm_queue=Retencao) exten => 2864,n,Set(queue=2864) exten => 2864,n,Answer exten => 2864,n,Goto(recebe,${EXTEN},1) exten => 2864,n,hangup [recebe] ;#############Inicio de uma chamada entrante exten => _xxxx,1,NoOp() exten => _xxxx,n,Set(ARRAY(1,2,3,4,5,6,7,8,9)=00000000,0000000,000000,00000,0000,000,00,0,) ;#############Primeira interacao com o Banco exten => _xxxx,n,NoOp(Inicia interacao com o Banco Mysql) exten => _xxxx,n,MYSQL(Connect connid 192.168.200.22 root senha aytydb) exten => _xxxx,n,MYSQL(Query insert ${connid} insert into aytycall (dt_start) values (sysdate())) exten => _xxxx,n,MYSQL(Query insert_id ${connid} SELECT LAST_INSERT_ID()) exten => _xxxx,n,MYSQL(Fetch fetchid ${insert_id} id_call) exten => _xxxx,n,MYSQL(Clear ${insert_id}) exten => _xxxx,n,MYSQL(Disconnect ${connid}) ;############### exten => _xxxx,n,Set(lnid_call=${LEN(${id_call})}) exten => _xxxx,n,Set(id_call_9=${${lnid_call}}${id_call}) exten => _xxxx,n,Set(record_nm=0201${id_project}${id_call_9}) exten => _xxxx,n,System(sh /etc/asterisk/scripts/folder_check.sh ${id_project} inbound) exten => _xxxx,n,Set(record_dst_tmp=/var/spool/asterisk/monitor/inbound/${id_project}/temp) exten => _xxxx,n,Set(record_dst_fin=/var/spool/asterisk/monitor/inbound/${id_project}/copy_pending/${STRFTIME(${EPOCH},GMT2,%Y)}-${STRFTIME(${EPOCH},GMT2,%m)}-${STRFTIME(${EPOCH},GMT2,%d)}) ; ##### Vai para o SIP Server e lah eh 1.4, por isso as barras sao desse modo (\\\\\ = \) exten => _xxxx,n,Set(nm_file=\\\\\\\\192.168.101.176\\\\aytyrecorder\\\\inbound\\\\${id_project}\\\\${STRFTIME(${EPOCH},GMT2,%Y)}-${STRFTIME(${EPOCH},GMT2,%m)}-${STRFTIME(${EPOCH},GMT2,%d)}\\\\${record_nm}.WAV) exten => _xxxx,n,MixMonitor(${record_dst_tmp}/${record_nm}.WAV,v(1)V(1), mv ${record_dst_tmp}/${record_nm}.WAV ${record_dst_fin}/${record_nm}.WAV) exten => _xxxx,n,SIPAddHeader(X-ID_PROJECT:${id_project}) exten => _xxxx,n,SIPAddHeader(X-NM_FILE:${nm_file}) exten => _xxxx,n,SIPAddHeader(X-ID_CALL:${id_call}) exten => _xxxx,n,SIPAddHeader(X-NM_QUEUE:${nm_queue}) exten => _xxxx,n,SIPAddHeader(X-QUEUE:${queue}) exten => _xxxx,n,SIPAddHeader(X-CALLERIDNUM:${CALLERID(num)}) exten => _xxxx,n,Dial(Sip/${EXTEN}@sipserver) exten => _xxxx,n,hangup exten => h,1,hangup ############################################################################################################################### Asterisk - SIPSERVER Asterisk 1.6.0.9 asterisk-addons-1.6.1.2 libpri-1.4.10 zaptel-1.4.12 IP: 192.168.200.22 ############################################################################################################################### =============================================================================================================================== SIP.CONF =============================================================================================================================== [general] context=default allowguest=no match_auth_username=no allowoverlap=no allowtransfer=yes bindport=5060 bindaddr=0.0.0.0 tcpenable=no tcpbindaddr=0.0.0.0 tlsenable=no tlsbindaddr=0.0.0.0 srvlookup=no pedantic=no tos_sip=cs3 tos_audio=ef maxexpiry=90 minexpiry=30 defaultexpiry=60 qualifyfreq=60 disallow=all allow=alaw mohinterpret=default mohsuggest=default language=en useragent=Asterisk PBX t1min=100 timert1=500 timerb=16000 rtptimeout=60 rtpholdtimeout=120 nat = no canreinvite=yes directrtpsetup=no limitonpeers = yes [gw2] type = peer username=gw2 secret=gw2 host=dynamic context=ike_inbound dtmfmode=rfc2833 allow=alaw =============================================================================================================================== QUEUES.CONF =============================================================================================================================== [general] persistentmembers = yes autofill = yes monitor-type = MixMonitor musicclass = default [2864] strategy=leastrecent timeout=120 retry=5 wrapuptime=3 autofill=yes autopause=no joinempty=yes leavewhenempty=no announce-holdtime=no announce-round-seconds=00 announce-frequency = 45 ringinuse = no =============================================================================================================================== EXTENSIONS.CONF =============================================================================================================================== [ike_inbound] ;##############Recebe chamdas do inbound sem CRM do GW a FILA exten => _2xxx,1,NoOp() exten => _2xxx,n,answer exten => _2xxx,n,Gotoif($[${SIP_HEADER(X-ID_PROJECT)}=000999]?context_adm_inbound,${EXTEN},1) exten => _2xxx,n,Set(ARRAY(id_call_type,caller_number,caller_name,CALLERID(num))=02,${SIP_HEADER(X-CALLERIDNUM)},${CALLERID(name)},${SIP_HEADER(X-CALLERIDNUM)}) exten => _2xxx,n,Set(id_call=${SIP_HEADER(X-ID_CALL)}) exten => _2xxx,n,Set(id_project=${SIP_HEADER(X-ID_PROJECT)}) exten => _2xxx,n,Set(nm_file=${SIP_HEADER(X-NM_FILE)}) exten => _2xxx,n,Set(nm_queue=${SIP_HEADER(X-NM_QUEUE)}) exten => _2xxx,n,Set(queue=${SIP_HEADER(X-QUEUE)}) exten => _2xxx,n,SIPAddHeader(X-CALL_ID:${id_call}|${nm_queue}|${SIP_HEADER(X-CALLERIDNUM)}|${STRFTIME(${EPOCH},GMT3,%H)}:${STRFTIME(${EPOCH},GMT3,%M)}:${STRFTIME(${EPOCH},GMT3,%S)}) exten => _2xxx,n,Queue(${queue}) ;#############Termino de uma chamada entrante exten => h,1,Set(var1=${CUT(CDR(dstchannel),/,2)}) exten => h,n,Set(callee_number=${CUT(var1,-,1)}) exten => h,n,Set(callee_name=${SIPPEER(${callee_number},callerid_name)}) ;#############Envia informacoes para o banco exten => h,n,NoOp(Inicia interacao com o Banco Mysql) exten => h,n,MYSQL(Connect connid 192.168.200.22 root senha aytydb) exten => h,n,MYSQL(Query update1 ${connid} update aytycall set id_project='${id_project}', id_call_type='${id_call_type}', caller_number='${caller_number}', caller_name='${caller_name}', callee_number='${callee_number}', callee_name='${callee_name}',dt_finish=sysdate(), nm_file='${nm_file}', camp_name='${nm_queue}', ivr_opt='${ivr_opt}' where id_call=${id_call}) exten => h,n,MYSQL(Query update2 ${connid} update aytycall set duration=TIME_TO_SEC(TIMEDIFF(dt_finish,dt_start)) where id_call=${id_call}) exten => h,n,MYSQL(Disconnect ${connid}) exten => h,n,hangup