Monthly Archives: November 2011

How to overcome Call Failed “Busy Here” continuous on xlite


Ketika anda menelepon via xlite atau sejenisnya, dimana nomor yang di tuju sibuk, me-reject dll, maka yang terlihat di xlite adalah Call Failed “Busy Here” dan secara terus menerus akan terdegar tone ” tut tut tut tut” yang berkepanjangan.

Berikut adalah tip private bagaimana cara mengatasi call Failed “Busy here” pada xlite sehingga apapun kondisinya otomatis hangup.

Pada script dialplan dibawah ini maka saya menangkap ${DIALSTATUS} dan ${HANGUPCAUSE} setip ada call outbound. Nah misalnya saja , nomor yang dituju me-REJECT maka akan kita dapatkan ${DIALSTATUS} or ${CAUSEHANUP} dan pasti pasti ada bunyi ” tut tut tut: yang secara terus menurus, maka ke priority hangup say menambahkan sebuah voice “silence” di command playback:) dan pastinya otomatis hangup:)

exten => _9X.,1,Dial(SIP/1000/${EXTEN:1},30,tT)
;exten => _9X.,n,NoOp(DIALSTATUS=${DIALSTATUS} dan HANGUPCAUSE=${HANGUPCAUSE})
exten => _9X.,n,Macro(dial-result,${DIALSTATUS})
exten => _9X.,n,Hangup()

[macro-dial-result]
#include “macro-dial-result.conf”

exten => s,1,Wait(1)
exten => s,2,Noop(${CHANNEL})
exten => s,3,NoCDR()
exten => s,4,GotoIf($[${ISNULL(${ARG1})}]?7:5)
exten => s,5,Set(RC=${ARG1})
exten => s,6,Goto(s,9)
exten => s,7,GotoIf($[${ISNULL(${DIALSTATUS})}]?8:rc-${DIALSTATUS},1)
exten => s,8,Set(RC=${IF($[${ISNULL(${HANGUPCAUSE})}]?0:${HANGUPCAUSE})})
exten => s,9,Goto(rc-${RC},1)
exten => s,10,Hangup(${RC})
exten => i,1,Set(RC=0)
exten => i,2,Goto(s,9)

;; remap DIALSTATUS to HANGUPCAUSE
exten => rc-ANSWER,1,Set(RC=16)
exten => rc-ANSWER,2,Goto(s,9)

exten => rc-BUSY,1,Set(RC=17)
exten => rc-BUSY,2,Goto(s,9)

exten => rc-CANCEL,1,Set(RC=16)
exten => rc-CANCEL,2,Goto(s,9)

exten => rc-CHANUNAVAIL,1,Set(RC=44)
exten => rc-CHANUNAVAIL,2,Goto(s,9)

exten => rc-CONGESTION,1,Set(RC=34)
exten => rc-CONGESTION,2,Goto(s,9)

exten => rc-NOANSWER,1,Set(RC=19)
exten => rc-NOANSWER,2,Goto(s,9)

;; HANGUPCAUSE mapping
exten => rc-0,1,NoOp(NOTDEFINED)
exten => rc-0,n,Goto(s,10)

exten => rc-1,1,NoOp(UNALLOCATED)
exten => rc-1,n,Goto(s,10)

exten => rc-2,1,NoOp(NO_ROUTE_TRANSIT_NET)
exten => rc-2,n,Goto(s,10)

exten => rc-3,1,NoOp(NO_ROUTE_DESTINATION)
exten => rc-3,n,Goto(s,10)

exten => rc-6,1,NoOp(CHANNEL_UNACCEPTABLE)
exten => rc-6,n,Goto(s,10)

exten => rc-7,1,NoOp(CALL_AWARDED_DELIVERED)
exten => rc-7,n,Goto(s,10)

exten => rc-16,1,NoOp(NORMAL_CLEARING)
exten => rc-16,n,Goto(s,10)

exten => rc-17,1,NoOp(USER_BUSY)
;exten => rc-17,n,Busy() ; we need this for bristuff, because bristuff seems not to support Hangup(17)
;exten => rc-17,n,SoftHangup()
exten => rc-17,n,Playback(silence)
exten => rc-17,n,Goto(s,10)

exten => rc-18,1,NoOp(NO_USER_RESPONSE)
exten => rc-18,n,Goto(s,10)

exten => rc-19,1,NoOp(NO_ANSWER)
exten => rc-19,n,Playback(silence)
exten => rc-19,n,Goto(s,10)

exten => rc-21,1,NoOp(CALL_REJECTED)
exten => rc-21,n,Goto(s,10)

exten => rc-22,1,NoOp(NUMBER_CHANGED)
exten => rc-22,n,Goto(s,10)

exten => rc-27,1,NoOp(DESTINATION_OUT_OF_ORDER)
exten => rc-27,n,Goto(s,10)

exten => rc-28,1,NoOp(INVALID_NUMBER_FORMAT)
exten => rc-28,n,Goto(s,10)

exten => rc-29,1,NoOp(FACILITY_REJECTED)
exten => rc-29,n,Goto(s,10)

exten => rc-30,1,NoOp(RESPONSE_TO_STATUS_ENQUIRY)
exten => rc-30,n,Goto(s,10)

exten => rc-31,1,NoOp(NORMAL_UNSPECIFIED)
exten => rc-31,n,Goto(s,10)

exten => rc-34,1,NoOp(NORMAL_CIRCUIT_CONGESTION)
;exten => rc-34,n,Congestion() ; we need this for bristuff, because bristuff seems not to support Hangup(34)
exten => rc-34,n,Playback(vm-goodbye)
exten => rc-34,n,Goto(s,10)

exten => rc-38,1,NoOp(NETWORK_OUT_OF_ORDER)
exten => rc-38,n,Goto(s,10)

exten => rc-41,1,NoOp(NORMAL_TEMPORARY_FAILURE)
exten => rc-41,n,Goto(s,10)

exten => rc-42,1,NoOp(SWITCH_CONGESTION)
exten => rc-42,n,Goto(s,10)

exten => rc-43,1,NoOp(ACCESS_INFO_DISCARDED)
exten => rc-43,n,Goto(s,10)

exten => rc-44,1,NoOp(REQUESTED_CHAN_UNAVAIL)
exten => rc-44,n,Goto(s,10)

exten => rc-45,1,NoOp(PRE_EMPTED)
exten => rc-45,n,Goto(s,10)

exten => rc-50,1,NoOp(FACILITY_NOT_SUBSCRIBED)
exten => rc-50,n,Goto(s,10)

exten => rc-52,1,NoOp(OUTGOING_CALL_BARRED)
exten => rc-52,n,Goto(s,10)

exten => rc-54,1,NoOp(INCOMING_CALL_BARRED)
exten => rc-54,n,Goto(s,10)

exten => rc-57,1,NoOp(BEARERCAPABILITY_NOTAUTH)
exten => rc-57,n,Goto(s,10)

exten => rc-58,1,NoOp(BEARERCAPABILITY_NOTAVAIL)
exten => rc-58,n,Goto(s,10)

exten => rc-65,1,NoOp(BEARERCAPABILITY_NOTIMPL)
exten => rc-65,n,Goto(s,10)

exten => rc-66,1,NoOp(CHAN_NOT_IMPLEMENTED)
exten => rc-66,n,Goto(s,10)

exten => rc-69,1,NoOp(FACILITY_NOT_IMPLEMENTED)
exten => rc-69,n,Goto(s,10)

exten => rc-81,1,NoOp(INVALID_CALL_REFERENCE)
exten => rc-81,n,Goto(s,10)

exten => rc-88,1,NoOp(INCOMPATIBLE_DESTINATION)
exten => rc-88,n,Goto(s,10)

exten => rc-95,1,NoOp(INVALID_MSG_UNSPECIFIED)
exten => rc-95,n,Goto(s,10)

exten => rc-96,1,NoOp(MANDATORY_IE_MISSING)
exten => rc-96,n,Goto(s,10)

exten => rc-97,1,NoOp(MESSAGE_TYPE_NONEXIST)
exten => rc-97,n,Goto(s,10)

exten => rc-98,1,NoOp(WRONG_MESSAGE)
exten => rc-98,n,Goto(s,10)
exten => rc-99,1,NoOp(IE_NONEXIST)
exten => rc-99,n,Goto(s,10)

exten => rc-100,1,NoOp(INVALID_IE_CONTENTS)
exten => rc-100,n,Goto(s,10)

exten => rc-101,1,NoOp(WRONG_CALL_STATE)
exten => rc-101,n,Goto(s,10)

exten => rc-102,1,NoOp(RECOVERY_ON_TIMER_EXPIRE)
exten => rc-102,n,Goto(s,10)

exten => rc-103,1,NoOp(MANDATORY_IE_LENGTH_ERROR)
exten => rc-103,n,Goto(s,10)

exten => rc-111,1,NoOp(PROTOCOL_ERROR)
exten => rc-111,n,Goto(s,10)

exten => rc-127,1,NoOp(INTERWORKING)
exten => rc-127,n,Goto(s,10)

exten => rc-.,1,Noop(TRUNK Dial failed due to ${DIALSTATUS} and hangupCause ${HANGUPCAUSE}- failing through to other trunks)
exten => rc-.,n,Busy()
exten => rc-.,n,Goto(s,10)

TIP’S DRBD


Langkah-langkahnya adalah sbb:

1. Tambahkan resources baru di /etc/drbd.conf
2. Create metadata untuk node1
[root@node1 ~]# drbdadm create-md asterisk
[root@node1 ~]# /etc/init.d/drbd start
[root@node1 ~]# /etc/init.d/drbd (harusnya ini masih secondary/secondary dan inconsistence
[root@node2 ~]# /etc/init.d/drbd start
3. Jadikan node1 sebagai primary
[root@node1 ~]# drbdadm — –overwrite-data-of-peer asterisk
4. Format /dev/drdb1 (lakukan hanya di node1
[root@node1 ~]# mkfs -j /dev/drbd1
[root@node1 ~]# tune2fs -j 1 -c 0 /dev/drdb1
[root@node1 ~]# mkdir /asterisk
[root@node2 ~]# mkdir /asterisk
[root@node1 ~]# mount -o rw /dev/drbd1 /asterisk
[root@node1 ~]# mkdir -p /asterisk/{01,02}
5. Jadikan node1 sbg secondary
[root@node1 ~]# umount /asterisk
[root@node1 ~]# drbdam secondary asterisk
6. Jadikan node2 sebagai primary
[root@node2 ~]# drbdadm primary asterisk
[root@node2 ~]# mount -o rw /dev/drbd1 /asterisk
[root@node2 ~]# ls -l /asterisk ( harusnya folder 01, dan 02 harus muncul)
7. Kembalikan node1 sbg primary
[root@node2 ~]# umount /asterisk
[root@node2 ~]# drbdam secondary asterisk
[root@node1 ~]# drbdadm primary asterisk
[root@node1 ~]# mount -o rw /dev/drbd1 /asterisk
[root@node1 ~]# ls -l /asterisk
8. Tambahkan di /etc/ha.d/haresources (node1 & node2)
node1 IPaddr::192.168.137.100 drbddisk::mydrbd Filesystem::/dev/drbd0::/asterisk::ext3 mysql httpd drbddisk::asterisk Filesystem::/dev/drbd1::/asterisk::ext3 asterisk
9. Restat heartbeat di masing-masing node
10.Check hasilnya
============================================================================================

[root@node1 ~]# lvcreate -n lvasterisk -L+100M /dev/vgdata
[root@node2 /]# lvcreate -n lvasterisk -L+100M /dev/vgdata
[root@node1 ~]# drbdadm create-md asterisk
[root@node1 ~]# /etc/init.d/drbd start
[root@node1 ~]# cat /proc/drbd

[root@node1 etc]# cat /proc/drbd
version: 8.0.16 (api:86/proto:86)
GIT-hash: d30881451c988619e243d6294a899139eed1183d build by mockbuild@v20z-x86-64.home.local, 2009-08-22 13:23:34
0: cs:Connected st:Secondary/Secondary ds:UpToDate/UpToDate C r—
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
resync: used:0/61 hits:0 misses:0 starving:0 dirty:0 changed:0
act_log: used:0/257 hits:0 misses:0 starving:0 dirty:0 changed:0
1: cs:Connected st:Secondary/Secondary ds:Inconsistent/Inconsistent C r—
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
resync: used:0/61 hits:0 misses:0 starving:0 dirty:0 changed:0
act_log: used:0/257 hits:0 misses:0 starving:0 dirty:0 changed:0

[root@node1 etc]# /etc/init.d/drbd status
drbd driver loaded OK; device status:
version: 8.0.16 (api:86/proto:86)
GIT-hash: d30881451c988619e243d6294a899139eed1183d build by mockbuild@v20z-x86-64.home.local, 2009-08-22 13:23:34
m:res cs st ds p mounted fstype
0:mydrbd Connected Secondary/Secondary UpToDate/UpToDate C
1:asterisk Connected Secondary/Secondary Inconsistent/Inconsistent C

[root@node2 ha.d]# cat /proc/drbd
version: 8.0.16 (api:86/proto:86)
GIT-hash: d30881451c988619e243d6294a899139eed1183d build by mockbuild@v20z-x86-64.home.local, 2009-08-22 13:23:34
0: cs:Connected st:Secondary/Secondary ds:UpToDate/UpToDate C r—
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
resync: used:0/61 hits:0 misses:0 starving:0 dirty:0 changed:0
act_log: used:0/257 hits:0 misses:0 starving:0 dirty:0 changed:0
1: cs:Connected st:Secondary/Secondary ds:Inconsistent/Inconsistent C r—
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
resync: used:0/61 hits:0 misses:0 starving:0 dirty:0 changed:0
act_log: used:0/257 hits:0 misses:0 starving:0 dirty:0 changed:0
[root@node2 ha.d]# /etc/init.d/drbd status
drbd driver loaded OK; device status:
version: 8.0.16 (api:86/proto:86)
GIT-hash: d30881451c988619e243d6294a899139eed1183d build by mockbuild@v20z-x86-64.home.local, 2009-08-22 13:23:34
m:res cs st ds p mounted fstype
0:mydrbd Connected Secondary/Secondary UpToDate/UpToDate C
1:asterisk Connected Secondary/Secondary Inconsistent/Inconsistent C
[root@node1 etc]# drbdadm — –overwrite-data-of-peer primary asterisk
[root@node1 etc]# /etc/init.d/drbd status
drbd driver loaded OK; device status:
version: 8.0.16 (api:86/proto:86)
GIT-hash: d30881451c988619e243d6294a899139eed1183d build by mockbuild@v20z-x86-64.home.local, 2009-08-22 13:23:34
m:res cs st ds p mounted fstype
0:mydrbd Connected Secondary/Secondary UpToDate/UpToDate C
… sync’ed: 36.0% (65976/102360)K
1:asterisk SyncSource Primary/Secondary UpToDate/Inconsistent C

[root@node2 ha.d]# /etc/init.d/drbd status
drbd driver loaded OK; device status:
version: 8.0.16 (api:86/proto:86)
GIT-hash: d30881451c988619e243d6294a899139eed1183d build by mockbuild@v20z-x86-64.home.local, 2009-08-22 13:23:34
m:res cs st ds p mounted fstype
0:mydrbd Connected Secondary/Secondary UpToDate/UpToDate C
1:asterisk Connected Secondary/Primary UpToDate/UpToDate C
[root@node1 etc]# mkfs -j /dev/drbd1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
25688 inodes, 102360 blocks
5118 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
13 block groups
8192 blocks per group, 8192 fragments per group
1976 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@node1 etc]#
[root@node1 etc]# tune2fs -c 1 -i 0 /dev/drbd1
tune2fs 1.39 (29-May-2006)
Setting maximal mount count to 1
Setting interval between checks to 0 seconds
[root@node1 etc]# mkdir /asterisk
[root@node2 ha.d]# mkdir /asterisk
[root@node1 etc]# mount -o rw /dev/drbd1 /asterisk/

[root@node1 etc]# vim /etc/ha.d/haresources
node1 IPaddr::192.168.137.100 drbddisk::mydrbd Filesystem::/dev/drbd0::/data::ext3 httpd mysqld drbddisk::asterisk Filesystem::/dev/drbd1::/asterisk::ext3 asterisk

[root@node2 ha.d]# vim /etc/ha.d/haresources
node1 IPaddr::192.168.137.100 drbddisk::mydrbd Filesystem::/dev/drbd0::/data::ext3 httpd mysqld drbddisk::asterisk Filesystem::/dev/drbd1::/asterisk::ext3 asterisk
[root@node1 etc]# /etc/init.d/drdbd restart
[root@node2 etc]# /etc/init.d/drdbd restart

Apabila terjadi WFCONNECTION OR STANDALONE

[root@node2 etc]# drbdadm secondary mydrbd
[root@node2 etc]# drbdadm — –discard-my-data connect mydrbd

[root@node1 etc]# drbdadm primary mydrbd
[root@node1 etc]# drbdadm connect mydrbd

IMPLEMENTASI RESULT CALL ASTERISK + DIALSTATUS & CAUSEHANGUP


Pada tutorial ini akan dijelaskan routing di Asterisk dengan macro untuk menghandle multiple provider, tujuannya adalah agar agent tidak kehilangan call ke ketika salah satu provider sudah full.

Contoh:

Call center anda memiliki agent 100 orang (telesales). Maka jumlah max channel yang harus disediakan adalah 100 channel. Maka untuk kebutuhan ini anda harus menyediakan 4E1 (4×31 channel) = 124 channel.

Anda memiliki 4 provider atau 4 line E1 dan terhubung ke quintum dengan masing-masing SIP trunk 1001,1002,1003,1004 dan masing-masing provider bisa menghandle call simultan 31 call per provider.

Config di sip.conf (asumsi anda menggunakan welgate / quintum digintal (DX))

[1001]
context=wellgate
callerid=”1001″ <1000>
type=friend
secret=1000
qualify=no
host=dynamic
nat=no
disallow=all
allow=g729

[1002]
context=wellgate
callerid=”1002″ <1002>
type=friend
secret=1002
qualify=no
host=dynamic
nat=no
disallow=all
allow=g729

[1003]
context=wellgate
callerid=”1003″ <1003>
type=friend
secret=1003
qualify=no
host=dynamic
nat=no
disallow=all
allow=g729

[1004]
context=wellgate
callerid=”1004″ <1004>
type=friend
secret=1004
qualify=no
host=dynamic
nat=no
disallow=all
allow=g729

 

[4001]
context=ecentrix-agents
callerid=”4001″ <4001>
type=friend
secret=4001
qualify=no
host=dynamic
nat=no
disallow=all
allow=g729

[4002]
context=ecentrix-agents
callerid=”4002″ <4002>
type=friend
secret=4002
qualify=no
host=dynamic
nat=no
disallow=all
allow=g729

[4003]
context=ecentrix-agents
callerid=”4003″ <4003>
type=friend
secret=4003
qualify=no
host=dynamic
nat=no
disallow=all
allow=g729

[4004]
context=ecentrix-agents
callerid=”4004″ <4004>
type=friend
secret=4004
qualify=no
host=dynamic
nat=no
disallow=all
allow=g729

Jika anda menggunakan card E1 + DAHDI maka cukup ganti SIP menjadi DAHDI dan sip trunk menjadi g0,g1,g2,g3 dan anda tidak perlu mendaftarkan sip trunk di sip.conf yang anda edit di chan_dahdi, sehingga pemanggilannya di extension.conf seperti DAHDI/g1/${A_NUMBER}

 

[ecentrix-agents]
exten => _9X.,1,Macro(dial,g0,g1,g2,g3,31,31,31,31,${EXTEN:1})
exten => _9X.,2,Hangup()

dan di [macro-dial] menjadi
exten => s,9,Dial(DAHDI/${ARG${TRUNK_SIP}}/${A_NUMBER},${DIAL_OPTIONS},tT${DIAL_TIMEOUT})

config di extension.conf

[globals]
MAX_PROVIDER=4

[ecentrix-agents]
exten => _9X.,1,Macro(dial,1000,1001,1002,1003,31,31,31,31,${EXTEN:1})
exten => _9X.,2,Hangup()
[macro-dial]
exten => s,1,Set(A_NUMBER=${ARG9})
exten => s,2,Set(CALL_ATTEMPT=1)
exten => s,3,Set(LIMIT_CALL=$[${CALL_ATTEMPT} + 4])
exten => s,4,Set(TRUNK_SIP=${EVAL(${ARG${CALL_ATTEMPT}}))
exten => s,5,GotoIf($[“${CALL_ATTEMPT}” <= “${MAX_PROVIDERS}”]?6:rc-CANCEL,1)
exten => s,6,Set(GROUP()=${ARG${TRUNK_SIP}})
exten => s,7,Noop(Current Channel Used On SIP Trunk ${ARG${CALL_ATTEMPT}} = ${GROUP_COUNT(${ARG${CALL_ATTEMPT}})})
exten => s,8,Gotoif($[ ${GROUP_COUNT(${ARG${CALL_ATTEMPT}})} <= ${ARG${LIMIT_CALL}} ]?9:rc-CANCEL,1)
exten => s,9,Dial(SIP/${ARG${TRUNK_SIP}}/${A_NUMBER},${DIAL_OPTIONS},tT${DIAL_TIMEOUT})
exten => s,10,NoOp(HANGUPCAUSE=${HANGUPCAUSE} DAN DIALSTATUS=${DIALSTATUS})
exten => s,11,GotoIf($[${ISNULL(${HANGUPCAUSE})}]?13:12)
exten => s,12,Set(RC=${HANGUPCAUSE})
exten => s,13,GotoIf($[${ISNULL(${DIALSTATUS})}]?14:rc-${DIALSTATUS},1))
exten => s,14,Set(RC=IF($[$ISNULL(${HANGUPCAUSE})]?0:${HANGUPCAUSE})})
exten => s,15,Goto(rc-${RC},1)
exten => s,16,Hangup(${RC})
exten => i,1,Set(RC=0)
exten => i,2,Goto(s,15)

;; remap DIALSTATUS to HANGUPCAUSE
exten => rc-ANSWER,1,Set(RC=16)
exten => rc-ANSWER,n,Playback(tutut)
exten => rc-ANSWER,n,Goto(s,16)

exten => rc-CANCEL,1,Set(RC=16)
exten => rc-CANCEL,n,Playback(tutut)
exten => rc-CANCEL,n,Goto(s,16)

exten => rc-NOANSWER,1,Set(RC=19)
exten => rc-NOANSWER,n,Playback(tutut)
exten => rc-NOANSWER,n,Goto(s,16)

exten => rc-BUSY,1,Set(RC=17)
exten => rc-BUSY,n,Playback(tutut)
exten => rc-BUSY,n,Goto(s,16)

exten => rc-CONGESTION,1,GotoIf($[“${HANGUPCAUSE}” = “34” ]?2:4)
exten => rc-CONGESTION,2,Set(CALL_ATTEMPT=($[${EVAL(${CALL_ATTEMPT}) + 1]))
exten => rc-CONGESTION,3,Goto(s,3)
exten => rc-CONGESTION,4,Goto(s,16)

exten => rc-CHANUNAVAIL,1,GotoIf($[“${HANGUPCAUSE}” = “34” ]?2:4)
exten => rc-CHANUNAVAIL,2,Set(CALL_ATTEMPT=($[${EVAL(${CALL_ATTEMPT}) + 1]))
exten => rc-CHANUNAVAIL,3,Goto(s,3)
exten => rc-CHANUNAVAIL,4,Goto(s,16)

;; HANGUPCAUSE mapping
exten => rc-0,1,NoOp(NOTDEFINED)
exten => rc-0,n,Playback(tutut)
exten => rc-0,n,Goto(s,16)

exten => rc-1,1,NoOp(UNALLOCATED)
exten => rc-1,n,Playback(tutut)
exten => rc-1,n,Goto(s,16)

exten => rc-2,1,NoOp(NO_ROUTE_TRANSIT_NET)
exten => rc-2,n,Playback(tutut)
exten => rc-2,n,Goto(s,16)

exten => rc-3,1,NoOp(NO_ROUTE_DESTINATION)
exten => rc-3,n,Playback(tutut)
exten => rc-3,n,Goto(s,16)

exten => rc-6,1,NoOp(CHANNEL_UNACCEPTABLE)
exten => rc-6,n,Playback(tutut)
exten => rc-6,n,Goto(s,16)

exten => rc-7,1,NoOp(CALL_AWARDED_DELIVERED)
exten => rc-7,n,Playback(tutut)
exten => rc-7,n,Goto(s,16)

exten => rc-16,1,NoOp(NORMAL_CLEARING)
exten => rc-16,n,Playback(tutut)
exten => rc-16,n,Goto(s,16)

exten => rc-17,1,NoOp(USER_BUSY)
exten => rc-17,n,Busy() ; we need this for bristuff, because bristuff seems not to support Hangup(17)
exten => rc-17,n,Goto(s,16)

exten => rc-18,1,NoOp(NO_USER_RESPONSE)
exten => rc-18,n,Playback(tutut)
exten => rc-18,n,Goto(s,16)

exten => rc-19,1,NoOp(NO_ANSWER)
exten => rc-19,n,Playback(tutut)
exten => rc-19,n,Goto(s,16)

exten => rc-21,1,NoOp(CALL_REJECTED)
exten => rc-21,n,Playback(tutut)
exten => rc-21,n,Goto(s,16)

exten => rc-22,1,NoOp(NUMBER_CHANGED)
exten => rc-22,n,Playback(tutut)
exten => rc-22,n,Goto(s,16)

exten => rc-27,1,NoOp(DESTINATION_OUT_OF_ORDER)
exten => rc-27,n,Playback(tutut)
exten => rc-27,n,Goto(s,16)

exten => rc-28,1,NoOp(INVALID_NUMBER_FORMAT)
exten => rc-28,n,Playback(tutut)
exten => rc-28,n,Goto(s,16)

exten => rc-29,1,NoOp(FACILITY_REJECTED)
exten => rc-29,n,Playback(tutut)
exten => rc-29,n,Goto(s,16)

exten => rc-30,1,NoOp(RESPONSE_TO_STATUS_ENQUIRY)
exten => rc-30,n,Playback(tutut)
exten => rc-30,n,Goto(s,16)

exten => rc-31,1,NoOp(NORMAL_UNSPECIFIED)
exten => rc-31,n,Playback(tutut)
exten => rc-31,n,Goto(s,16)

exten => rc-34,1,NoOp(NORMAL_CIRCUIT_CONGESTION)
exten => rc-34,2,GotoIf($[“${DIALSTATUS}” = “CONGESTION” ]?2:5)
exten => rc-34,3,Set(CALL_ATTEMPT=($[${EVAL(${CALL_ATTEMPT}) + 1]))
exten => rc-34,4,Goto(s,3)
exten => rc-34,5,Goto(s,16)

exten => rc-38,1,NoOp(NETWORK_OUT_OF_ORDER)
exten => rc-38,n,Playback(tutut)
exten => rc-38,n,Goto(s,16)

exten => rc-41,1,NoOp(NORMAL_TEMPORARY_FAILURE)
exten => rc-41,n,Playback(tutut)
exten => rc-41,n,Goto(s,16)

exten => rc-42,1,NoOp(SWITCH_CONGESTION)
exten => rc-42,n,Playback(tutut)
exten => rc-42,n,Goto(s,16)

exten => rc-43,1,NoOp(ACCESS_INFO_DISCARDED)
exten => rc-43,n,Playback(tutut)
exten => rc-43,n,Goto(s,16)

exten => rc-44,1,NoOp(REQUESTED_CHAN_UNAVAIL)
exten => rc-44,n,Set(CALL_ATTEMPT=$[${CALL_ATTEMPT} + 1])
exten => rc-44,n,Set(TRUNK_PREFIX=${EVAL(${ARG${CALL_ATTEMPT}})})
exten => rc-44,n,Goto(s,4)

exten => rc-45,1,NoOp(PRE_EMPTED)
exten => rc-45,n,Playback(tutut)
exten => rc-45,n,Goto(s,16)

exten => rc-50,1,NoOp(FACILITY_NOT_SUBSCRIBED)
exten => rc-50,n,Playback(tutut)
exten => rc-50,n,Goto(s,16)

exten => rc-52,1,NoOp(OUTGOING_CALL_BARRED)
exten => rc-52,n,Playback(tutut)
exten => rc-52,n,Goto(s,16)

exten => rc-54,1,NoOp(INCOMING_CALL_BARRED)
exten => rc-54,n,Playback(tutut)
exten => rc-54,n,Goto(s,16)

exten => rc-57,1,NoOp(BEARERCAPABILITY_NOTAUTH)
exten => rc-57,n,Playback(tutut)
exten => rc-57,n,Goto(s,16)

exten => rc-58,1,NoOp(BEARERCAPABILITY_NOTAVAIL)
exten => rc-58,n,Playback(tutut)
exten => rc-58,n,Goto(s,16)

exten => rc-65,1,NoOp(BEARERCAPABILITY_NOTIMPL)
exten => rc-65,n,Playback(tutut)
exten => rc-65,n,Goto(s,16)

exten => rc-66,1,NoOp(CHAN_NOT_IMPLEMENTED)
exten => rc-66,n,Playback(tutut)
exten => rc-66,n,Goto(s,16)

exten => rc-69,1,NoOp(FACILITY_NOT_IMPLEMENTED)
exten => rc-69,n,Playback(tutut)
exten => rc-69,n,Goto(s,16)

exten => rc-81,1,NoOp(INVALID_CALL_REFERENCE)
exten => rc-81,n,Playback(tutut)
exten => rc-81,n,Goto(s,16)

exten => rc-88,1,NoOp(INCOMPATIBLE_DESTINATION)
exten => rc-88,n,Playback(tutut)
exten => rc-88,n,Goto(s,16)

exten => rc-95,1,NoOp(INVALID_MSG_UNSPECIFIED)
exten => rc-95,n,Playback(tutut)
exten => rc-95,n,Goto(s,16)

exten => rc-96,1,NoOp(MANDATORY_IE_MISSING)
exten => rc-96,n,Playback(tutut)
exten => rc-96,n,Goto(s,16)

exten => rc-97,1,NoOp(MESSAGE_TYPE_NONEXIST)
exten => rc-97,n,Playback(tutut)
exten => rc-97,n,Goto(s,16)

exten => rc-98,1,NoOp(WRONG_MESSAGE)
exten => rc-98,n,Playback(tutut)
exten => rc-98,n,Goto(s,16)

exten => rc-99,1,NoOp(IE_NONEXIST)
exten => rc-99,n,Playback(tutut)
exten => rc-99,n,Goto(s,16)

exten => rc-100,1,NoOp(INVALID_IE_CONTENTS)
exten => rc-100,n,Playback(tutut)
exten => rc-100,n,Goto(s,16)

exten => rc-101,1,NoOp(WRONG_CALL_STATE)
exten => rc-101,n,Playback(tutut)
exten => rc-101,n,Goto(s,16)

exten => rc-102,1,NoOp(RECOVERY_ON_TIMER_EXPIRE)
exten => rc-102,n,Playback(tutut)
exten => rc-102,n,Goto(s,16)

exten => rc-103,1,NoOp(MANDATORY_IE_LENGTH_ERROR)
exten => rc-103,n,Playback(tutut)
exten => rc-103,n,Goto(s,16)

exten => rc-111,1,NoOp(PROTOCOL_ERROR)
exten => rc-111,n,Playback(tutut)
exten => rc-111,n,Goto(s,16)

exten => rc-127,1,NoOp(INTERWORKING)
exten => rc-127,n,Playback(tutut)
exten => rc-127,n,Goto(s,16)

 

Implementasi

Silahkan daftarkan masing IPphone anda atau xlite anda dengan nomor extension 4001 – 4004 dan dial ke luar misalnya ke nomor
9018128726000  (prefix 9)

9018128726001  (prefix 9)

9018128726002  (prefix 9)

9018128726003  (prefix 9)

Jika anda ingin menguji apakah akan dialihkan ke next trunk jika full maka cukup aktifkan satu channel di masing-masing quintum dan coba outbound call (4 orang) dan lihat hasilnya.

ATAU

Rubah parameter di di contex [ecentrix-agents]

sebelum

[ecentrix-agents]
exten => _9X.,1,Macro(dial,1000,1001,1002,1003,31,31,31,31,${EXTEN:1})
exten => _9X.,2,Hangup()

sesudah

[ecentrix-agents]
exten => _9X.,1,Macro(dial,1000,1001,1002,1003,1,1,1,1,${EXTEN:1})
exten => _9X.,2,Hangup()

 

Terimakasih

Jika ada pertanyaan silahkan email ke gozigomilis@gmail.com.

 

 

RESULT CALL ASTERISK + DIALSTATUS & CAUSEHANGUP


Pada kesempatan ini, sedikit tips yang saya dapatkan dari beberapa sumber dan sudah saya test di site client untuk mendapatkan result call ketika mendial (outbound call).

Berikut adalah lampirannya:

 

[ecentrix-agents]
exten => _8X.,1,DIAL(SIP/1000/{EXTEN:1})
exten => _8X.,n,Macro(dial-result,${DIALSTATUS})
;or you can use param ${HANGUPCAUSE}
;exten => _8X.,n,Macro(dial-result,${HANGUPCAUSE})
exten => _8X.,n,Hangup()

[macro-dial-result]
; Handles Disconnect Cause Codes
; @param ${ARG1} - cause code (optional - will try to use DIALSTATUS or HANGUPCAUSE if not set)
; @usage exten => s,1,Macro(dial-result| __CAUSECODE__ )

exten => s,1,Wait(1)
exten => s,2,ResetCDR(w)
exten => s,3,NoCDR()
exten => s,4,GotoIf($[${ISNULL(${ARG1})}]?7:5)
exten => s,5,Set(RC=${ARG1})
exten => s,6,Goto(s|9)
exten => s,7,GotoIf($[${ISNULL(${DIALSTATUS})}]?8:rc-${DIALSTATUS}|1)
exten => s,8,Set(RC=${IF($[${ISNULL(${HANGUPCAUSE})}]?0:${HANGUPCAUSE})})
exten => s,9,Goto(rc-${RC}|1)
exten => s,10,Hangup(${RC})
exten => i,1,Set(RC=0)
exten => i,2,Goto(s|9)


;; remap DIALSTATUS to HANGUPCAUSE
exten => rc-ANSWER,1,Set(RC=16)
exten => rc-ANSWER,2,Goto(s|9)

exten => rc-BUSY,1,Set(RC=17)
exten => rc-BUSY,2,Goto(s|9)

exten => rc-CANCEL,1,Set(RC=16)
exten => rc-CANCEL,2,Goto(s|9)

exten => rc-CHANUNAVAIL,1,Set(RC=44)
exten => rc-CHANUNAVAIL,2,Goto(s|9)

exten => rc-CONGESTION,1,Set(RC=34)
exten => rc-CONGESTION,2,Goto(s|9)

exten => rc-NOANSWER,1,Set(RC=19)
exten => rc-NOANSWER,2,Goto(s|9)


;; HANGUPCAUSE mapping
exten => rc-0,1,NoOp(NOTDEFINED)
exten => rc-0,n,Goto(s|10)

exten => rc-1,1,NoOp(UNALLOCATED)
exten => rc-1,n,Goto(s|10)

exten => rc-2,1,NoOp(NO_ROUTE_TRANSIT_NET)
exten => rc-2,n,Goto(s|10)

exten => rc-3,1,NoOp(NO_ROUTE_DESTINATION)
exten => rc-3,n,Goto(s|10)

exten => rc-6,1,NoOp(CHANNEL_UNACCEPTABLE)
exten => rc-6,n,Goto(s|10)

exten => rc-7,1,NoOp(CALL_AWARDED_DELIVERED)
exten => rc-7,n,Goto(s|10)

exten => rc-16,1,NoOp(NORMAL_CLEARING)
exten => rc-16,n,Goto(s|10)

exten => rc-17,1,NoOp(USER_BUSY)
exten => rc-17,n,Busy() ; we need this for bristuff, because bristuff seems not to support Hangup(17)
exten => rc-17,n,Goto(s|10)

exten => rc-18,1,NoOp(NO_USER_RESPONSE)
exten => rc-18,n,Goto(s|10)

exten => rc-19,1,NoOp(NO_ANSWER)
exten => rc-19,n,Goto(s|10)

exten => rc-21,1,NoOp(CALL_REJECTED)
exten => rc-21,n,Goto(s|10)

exten => rc-22,1,NoOp(NUMBER_CHANGED)
exten => rc-22,n,Goto(s|10)

exten => rc-27,1,NoOp(DESTINATION_OUT_OF_ORDER)
exten => rc-27,n,Goto(s|10)

exten => rc-28,1,NoOp(INVALID_NUMBER_FORMAT)
exten => rc-28,n,Goto(s|10)

exten => rc-29,1,NoOp(FACILITY_REJECTED)
exten => rc-29,n,Goto(s|10)

exten => rc-30,1,NoOp(RESPONSE_TO_STATUS_ENQUIRY)
exten => rc-30,n,Goto(s|10)

exten => rc-31,1,NoOp(NORMAL_UNSPECIFIED)
exten => rc-31,n,Goto(s|10)

exten => rc-34,1,NoOp(NORMAL_CIRCUIT_CONGESTION)
exten => rc-34,n,Congestion() ; we need this for bristuff, because bristuff seems not to support Hangup(34)
exten => rc-34,n,Goto(s|10)

exten => rc-38,1,NoOp(NETWORK_OUT_OF_ORDER)
exten => rc-38,n,Goto(s|10)

exten => rc-41,1,NoOp(NORMAL_TEMPORARY_FAILURE)
exten => rc-41,n,Goto(s|10)

exten => rc-42,1,NoOp(SWITCH_CONGESTION)
exten => rc-42,n,Goto(s|10)

exten => rc-43,1,NoOp(ACCESS_INFO_DISCARDED)
exten => rc-43,n,Goto(s|10)

exten => rc-44,1,NoOp(REQUESTED_CHAN_UNAVAIL)
exten => rc-44,n,Goto(s|10)

exten => rc-45,1,NoOp(PRE_EMPTED)
exten => rc-45,n,Goto(s|10)

exten => rc-50,1,NoOp(FACILITY_NOT_SUBSCRIBED)
exten => rc-50,n,Goto(s|10)

exten => rc-52,1,NoOp(OUTGOING_CALL_BARRED)
exten => rc-52,n,Goto(s|10)

exten => rc-54,1,NoOp(INCOMING_CALL_BARRED)
exten => rc-54,n,Goto(s|10)

exten => rc-57,1,NoOp(BEARERCAPABILITY_NOTAUTH)
exten => rc-57,n,Goto(s|10)

exten => rc-58,1,NoOp(BEARERCAPABILITY_NOTAVAIL)
exten => rc-58,n,Goto(s|10)

exten => rc-65,1,NoOp(BEARERCAPABILITY_NOTIMPL)
exten => rc-65,n,Goto(s|10)

exten => rc-66,1,NoOp(CHAN_NOT_IMPLEMENTED)
exten => rc-66,n,Goto(s|10)

exten => rc-69,1,NoOp(FACILITY_NOT_IMPLEMENTED)
exten => rc-69,n,Goto(s|10)

exten => rc-81,1,NoOp(INVALID_CALL_REFERENCE)
exten => rc-81,n,Goto(s|10)

exten => rc-88,1,NoOp(INCOMPATIBLE_DESTINATION)
exten => rc-88,n,Goto(s|10)

exten => rc-95,1,NoOp(INVALID_MSG_UNSPECIFIED)
exten => rc-95,n,Goto(s|10)

exten => rc-96,1,NoOp(MANDATORY_IE_MISSING)
exten => rc-96,n,Goto(s|10)

exten => rc-97,1,NoOp(MESSAGE_TYPE_NONEXIST)
exten => rc-97,n,Goto(s|10)

exten => rc-98,1,NoOp(WRONG_MESSAGE)
exten => rc-98,n,Goto(s|10)

exten => rc-99,1,NoOp(IE_NONEXIST)
exten => rc-99,n,Goto(s|10)

exten => rc-100,1,NoOp(INVALID_IE_CONTENTS)
exten => rc-100,n,Goto(s|10)

exten => rc-101,1,NoOp(WRONG_CALL_STATE)
exten => rc-101,n,Goto(s|10)

exten => rc-102,1,NoOp(RECOVERY_ON_TIMER_EXPIRE)
exten => rc-102,n,Goto(s|10)

exten => rc-103,1,NoOp(MANDATORY_IE_LENGTH_ERROR)
exten => rc-103,n,Goto(s|10)

exten => rc-111,1,NoOp(PROTOCOL_ERROR)
exten => rc-111,n,Goto(s|10)

exten => rc-127,1,NoOp(INTERWORKING)
exten => rc-127,n,Goto(s|10)
=======================
HangupCause itu sendiri acuannya ada di file /usr/src/asterisk-1.8.6.0/include/asterisk/causes.h
#define AST_CAUSE_UNALLOCATED                    1
#define AST_CAUSE_NO_ROUTE_TRANSIT_NET           2
#define AST_CAUSE_NO_ROUTE_DESTINATION           3
#define AST_CAUSE_MISDIALLED_TRUNK_PREFIX        5
#define AST_CAUSE_CHANNEL_UNACCEPTABLE           6
#define AST_CAUSE_CALL_AWARDED_DELIVERED         7
#define AST_CAUSE_PRE_EMPTED                     8
#define AST_CAUSE_NUMBER_PORTED_NOT_HERE        14
#define AST_CAUSE_NORMAL_CLEARING               16
#define AST_CAUSE_USER_BUSY                     17
#define AST_CAUSE_NO_USER_RESPONSE              18
#define AST_CAUSE_NO_ANSWER                     19
#define AST_CAUSE_SUBSCRIBER_ABSENT             20
#define AST_CAUSE_CALL_REJECTED                 21
#define AST_CAUSE_NUMBER_CHANGED                22
#define AST_CAUSE_REDIRECTED_TO_NEW_DESTINATION 23
#define AST_CAUSE_ANSWERED_ELSEWHERE            26
#define AST_CAUSE_DESTINATION_OUT_OF_ORDER              27
#define AST_CAUSE_INVALID_NUMBER_FORMAT                 28
#define AST_CAUSE_FACILITY_REJECTED             29
#define AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY    30
#define AST_CAUSE_NORMAL_UNSPECIFIED            31
#define AST_CAUSE_NORMAL_CIRCUIT_CONGESTION     34
#define AST_CAUSE_NETWORK_OUT_OF_ORDER          38
#define AST_CAUSE_NORMAL_TEMPORARY_FAILURE      41
#define AST_CAUSE_SWITCH_CONGESTION             42
#define AST_CAUSE_ACCESS_INFO_DISCARDED         43
#define AST_CAUSE_REQUESTED_CHAN_UNAVAIL        44
#define AST_CAUSE_FACILITY_NOT_SUBSCRIBED       50
#define AST_CAUSE_OUTGOING_CALL_BARRED          52
#define AST_CAUSE_INCOMING_CALL_BARRED          54
#define AST_CAUSE_BEARERCAPABILITY_NOTAUTH      57
#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL     58
#define AST_CAUSE_BEARERCAPABILITY_NOTIMPL      65
#define AST_CAUSE_CHAN_NOT_IMPLEMENTED          66
#define AST_CAUSE_FACILITY_NOT_IMPLEMENTED      69
#define AST_CAUSE_INVALID_CALL_REFERENCE        81
#define AST_CAUSE_INCOMPATIBLE_DESTINATION      88
#define AST_CAUSE_INVALID_MSG_UNSPECIFIED       95
#define AST_CAUSE_MANDATORY_IE_MISSING                  96
#define AST_CAUSE_MESSAGE_TYPE_NONEXIST                 97
#define AST_CAUSE_WRONG_MESSAGE                 98
#define AST_CAUSE_IE_NONEXIST                   99
#define AST_CAUSE_INVALID_IE_CONTENTS          100
#define AST_CAUSE_WRONG_CALL_STATE             101
#define AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE     102
#define AST_CAUSE_MANDATORY_IE_LENGTH_ERROR    103
#define AST_CAUSE_PROTOCOL_ERROR               111
#define AST_CAUSE_INTERWORKING                 127

/* Special Asterisk aliases */
#define AST_CAUSE_BUSY          AST_CAUSE_USER_BUSY
#define AST_CAUSE_FAILURE       AST_CAUSE_NETWORK_OUT_OF_ORDER
#define AST_CAUSE_NORMAL        AST_CAUSE_NORMAL_CLEARING
#define AST_CAUSE_NOANSWER      AST_CAUSE_NO_ANSWER
#define AST_CAUSE_CONGESTION    AST_CAUSE_NORMAL_CIRCUIT_CONGESTION
#define AST_CAUSE_UNREGISTERED  AST_CAUSE_SUBSCRIBER_ABSENT
#define AST_CAUSE_NOTDEFINED    0
#define AST_CAUSE_NOSUCHDRIVER  AST_CAUSE_CHAN_NOT_IMPLEMENTED

———————-
Selamat mencoba:)

REPLACE STRING IN MULTIPLE FILE ON DIRECTORY


Berikut adalah sedikit shell script untuk me-replace string di beberapa file or directory.

[root@node1 sort]# vim replaceString.sh
#!/bin/bash

writeLog(){
        LOG="/tmp/logReplaceString-$( date +%F)"
        echo $1
        echo [ $(date +%r) ] $1 >> $LOG
}

replaceString(){
LOG="/tmp/replaceString-$( date +%F)"
        if [ $# -ne 3 ]; then
                writeLog ""
                writeLog "---------------------------------------------------------------------------"
                writeLog "Wrong parameter!!!"
                writeLog "Format Parameter : [Full Path Directory] [TEXT TO SEARCH] [TEXT TO REPLACE]"
                writeLog "Example          : /home/ecentrix/cfg/ centrix gmosecentrix"
                writeLog "---------------------------------------------------------------------------"
        else
                if [ -d "$1" ] || [ -f "$1" ];then
                        egrep -wlRZ "$2" $1 | xargs -0 -l sed -i -e "s/$2/$3/g"
                        writeLog ""
                        writeLog "-------------------------------------------------------------------"
                        writeLog "Replace word $2 to $3 on directory $1"
                        writeLog "-------------------------------------------------------------------"
                        writeLog ""
                else
                        writeLog $1 " is not file or directory"
                fi
        fi
}

replaceString $1 $2 $3

Cara penggunaan:
[root@node1 sort]# sh /home/ecentrix/sort/replaceString.sh /home/ecentrix/cfg/ ecentrix gmosecentrix
artinya setiap kata "ecentrix" yang ditemukan di directory "/home/ecentrix/cfg" akan di replace dengan kata
gmosecentrix"
Biasanya ini digunakan untuk pergantian IP atau password di file2 configurasi atau di file2 php
atau bisa di buat di cronta
[root@node1 sort]# crontab -l
59 23 * * * /home/ecentrix/sort/replaceString.sh /home/ecentrix/cfg/ 172.10.10.0 172.10.10.10
59 23 * * * /home/ecentrix/sort/replaceString.sh /home/ecentrix/cfg/ ecentrix new-ecentrix

Semoga bermanfaat :)

DRBD & HEARTBEAT (High Availability Cluster)


Percobaan dilakukan pada virtualbox dengan mencreate 2 oS centos 5.5 32 bit dan mencreate  hardisk virtual di masing-masing node. Untuk kali hanya di testing fungsi dari si heartbeat dan next akan di uraikan lagi secara detail fungsi si DRBD.

Case I
Service yang akan di failover adalah httpd,mysql maka pastikan di kedua server sudah terinstall apache dan pastikan bisa diakses dari jaringan, dalam kasus ini http://192.168.137.200 & http://192.168.137.201

1. Config /etc/hosts

[root@node1 ~]# vim /etc/hosts
127.0.0.1 localhost.localdomain localhost
#::1 localhost6.localdomain6 localhost6
192.168.137.200 node1.intelix.co.id node1
192.168.137.201 node2.intelix.co.id node2

[root@node2~]# vim /etc/hosts
127.0.0.1 localhost.localdomain localhost
#::1 localhost6.localdomain6 localhost6
192.168.137.200 node1.intelix.co.id node1
192.168.137.201 node2.intelix.co.id node2

Config /etc/sysctl.conf


[root@node1 ~]# echo “kernel.hostname = node1” >> /etc/sysctl.conf
[root@node1 ~]# sysctl –p

[root@node2 ~]# echo “kernel.hostname = node2” >> /etc/sysctl.conf
[root@node1 ~]# sysctl -p

2. Paket yang harus di install di kedua node
[root@node1 ]yum -y install heartbeat.i386 OpenIPMI-libs heartbeat-pils.i386 heartbeat-stonith.i386 libnet.i386
[root@node2 ]yum -y install heartbeat.i386 OpenIPMI-libs heartbeat-pils.i386 heartbeat-stonith.i386 libnet.i386

3. File configuration
[root@node1 ~]# cd /usr/share/doc/heartbeat-2.1.4/
[root@node1 heartbeat-2.1.4]# cp authkeys ha.cf haresources /etc/ha.d/
a. authkeys
[root@node1 ha.d]# vim /etc/ha.d/authkeys
Tambahkan isi di baris paling bawah
auth 2
2 sha1 intelix-ha-igc
b. ha.cf
[root@node1 ha.d]# vim /etc/ha.d/ha.cf
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
initdead 120
udpport 694
bcast eth0
auto_failback on
node node1
node node2
c. haresources
[root@node1 ha.d]# vim /etc/ha.d/ haresources
node1 192.168.137.100 httpd

4. Copy semua file config /etc/ha.d/ ke node2
[root@node1 ha.d]# cd /etc/ha.d/
[root@node1 ha.d]# scp -r authkeys ha.cf haresources root@192.168.137.201:/etc/ha.d/

5. Rubah configurasi file httpd.conf di kedua node
[root@node1 ~]# vim /etc/httpd/conf/httpd.conf
Option Listen harus dalam format sbb:
Listen 192.168.137.100:80

[root@node2 ~]# vim /etc/httpd/conf/httpd.conf
Option Listen harus dalam format sbb:
Listen 192.168.137.100:80

6. Stop service httpd dengan menggunakan command “chkconfig” sehingga ketika boot service itu tidak “up”
[root@node1 ~]# chkconfig httpd off
[root@node2~]# chkconfig httpd off

7. Restart Service heartbeat di kedua node
[root@node1 ~]# /etc/init.d/heartbeat start
Starting High-Availability services:
2011/11/03_20:57:00 INFO: Resource is stopped
[ OK ]

[root@node2 ~]# /etc/init.d/heartbeat stop
Stopping High-Availability services:
[ OK ]

[root@node2 ~]# /etc/init.d/heartbeat start
Starting High-Availability services:
2011/11/03_20:57:42 INFO: Resource is stopped

8. Pengujian
Untuk menguji apakah system yang sudah di setup berjalan dengan benar maka buka masing-masing 3 terminal untuk node1 dan node2

Node 1
Terminal 1
[root@node1 ~]# echo “node01 apache test server” > /var/www/html/index.html
Terminal 2
[root@node1~]# tail –f /var/log/ha-log
Terminal 3
[root@node1~]# for i in `seq 1 199`; do ifconfig eth0:0; sleep 5; done

Node2
[root@node2 ~]# echo “node02 apache test server” > /var/www/html/index.html
Terminal 2
[root@node2~]# tail –f /var/log/ha-log
Terminal 3
[root@node2~]# for i in `seq 1 199`; do ifconfig eth0:0; sleep 5; done

Buka url via browser , http://192.168.137.100/
Maka jika muncul tulisan “node01 apache test server” maka config anda sudah benar

Stop service heartbeat di node1 dan amati masing-masing log + status eth0:0 di terminal masing-masing node
[root@node1~]# /etc/init.d/heartbeat stop
Buka kembali url http://192.168.137.100/
Maka jika muncul tulisan “node02 apache test server” maka config anda sudah benar

Start Service hearbeat di node1
[root@node1~]# /etc/init.d/heartbeat start
Buka kembali url http://192.168.137.100/
Maka jika muncul tulisan “node01 apache test server” maka config anda sudah benar berjalan 100%

MYSQL
Untuk mengimplementasikan di mysql maka pastikan di masing-masing node sudah terinstall msysql. Caranya adalah sbb:

1. Edit file /etc/ha.d/resources di node1 & node2
Sebelum
[root@node1 ]# vim /etc/ha.d/ haresources
node1 192.168.137.100 httpd

Sesudah
[root@node1d]# vim /etc/ha.d/ haresources
node1 192.168.137.100 httpd mysqld

2. Stop runlevel service mysql sehingga tidak up ketika boot

[root@node1 ]# chkconfig mysqld off
[root@node2 ]# chkconfig mysqld off

3. Restart Service heartbeat
[root@node1 ]# /etc/init.d/heartbeat restart
[root@node2 ]# /etc/init.d/heartbeat restart

4. Grant privilege di node1 sehingga bisa di remote via mysqlyog or front
[root@node1 ]# mysql -uroot –p
enter
mysql> select user,password,host from user;
mysql> update user set user=’root’,host=’%’ where user=” and host=’localhost’;
mysql> flush privileges;
mysql> exit;

5. Stop service hearbeat di node1
[root@node1 ]# /etc/init.d/heartbeat stop

6. Grant privilege di node2 sehingga bisa di remote via mysqlyog or front
[root@node2 ]# mysql -uroot –p
enter
mysql> select user,password,host from user;
mysql> update user set user=’root’,host=’%’ where user=” and host=’localhost’;
mysql> flush privileges;
mysql> exit;

7. Start Service heartbeat di node1
[root@node1 ]# /etc/init.d/heartbeat start

8. Akses ip 192.168.137.100 via mysqlfront or mysqlyog dan create 1 database
9. Stop Service heartbeat di node1
10. Akses ip 192.168.137.100 via mysqlfront or mysqlyog dan harusnya masih tetap ada nanum database yang anda create sebelumnya tidak akan muncul , itu disebabkan belum ada syncronisasi data antar node. Nah agar data tetap ada maka diperlukanlah :

“Si -DRBD(Distributed Replicated Block Device)”

Tampilan drbd.conf yang menggunakan lvm (/dev/vgdata/lvdata)

drbd.conf

ASTERISK

Bagaimana dengan service yang lain seperti ssh, asterisk,ecentrix???? Mari kita coba bersama dan persiapkan alat-alat yang kita butuhkan untuk mensimulasikan sesuai dengan “dilapangan”

Created by moses tambunan

http://dev.centos.org/centos/5/testing/i386/RPMS/

MULTIPLE INSTANCES OF MYSQL ON A SINGLE LINUX SERVER


Bagaimana membuat multipe instance mysql di 1 server linux?  Anda dapat menggunakan mysqld_multi dengan melakukan sedikit config di /etc/my.cnf.  Pastikan di my.conf tidak ada port yang sama:) Untuk mencreate multiple instance segaja dibuat dengan menggunakan shell script untuk memberikan kemudahkan kepada admin dan dapat mencreate dalam waktu 1 menit:)
Berikut adalah langkah-langkahnya:
  1. Pastikan mysql sudah terinstall di linux server anda, gunakan command rpm -aq | grep mysql , rpm -aq | grep mysql-server, atau jalankan aja service mysqlnya (/etc/init.d/mysqld restart).
  2. cat > /etc/my.cnf dan buat copykan beris berikut ini:
    mysqld]
    skip-external-locking
    [mysqld_multi]
    mysqld     = /usr/bin/mysqld_safe
    mysqladmin = /usr/bin/mysqladmin
    log        = /var/log/mysqld_multi.log
    user       = mysql
  3. cd /home/ & vim /etc/create_multiple_instance_mysql.sh
    Create file baru dan copykan baris dibawah “create_multipe_instance_mysql.sh ” dan silahkan rubah beberapa parameter, seperti “ID, PORT, CLIENT_NAME, ROOT_PASSWORD,CLIENT_USER,CLIENT_PASSWORD”

    #!/bin/bash
    # Tested on Centos 5.5 & MYSQL 5.07
    # Created : 8 Agustus 2011 By mustafa@intelix.co.id
    ID="2"
    PORT="3308"
    CLIENT_NAME="usr8000" 
    ROOT_PASSWD="rootpasswd"
    CLIENT_USER="ecentrix"
    CLIENT_PASSWD="ecentrixpwd"
     
    echo "" >> /etc/my.cnf
    echo "[mysqld${ID}]" >> /etc/my.cnf
    echo "port              = ${PORT}" >> /etc/my.cnf
    echo "datadir           = /home/${CLIENT_NAME}/mysql/" >> /etc/my.cnf
    echo "pid-file  = /home/${CLIENT_NAME}/mysql/mysql.pid" >> /etc/my.cnf
    echo "socket            = /home/${CLIENT_NAME}/mysql/mysql.sock" >> /etc/my.cnf
    echo "user              = mysql" >> /etc/my.cnf
    echo "log-error = /var/log/log-error-${CLIENT_NAME}.err" >> /etc/my.cnf
     
    mkdir -p /home/${CLIENT_NAME}/mysql
    chown -R mysql.mysql /home/${CLIENT_NAME}
    mysql_install_db --user=mysql --datadir=/home/"${CLIENT_NAME}"/mysql/
    chown -R mysql.mysql /home/${CLIENT_NAME}
    mysqld_multi start ${ID}
     
    sleep 5
     
    echo "1. USE MYSQL; UPDATE USER SET password=password('${ROOT_PASSWD}') WHERE USER='root';"
    mysql -uroot -P ${PORT} -S /home/${CLIENT_NAME}/mysql/mysql.sock -e "USE mysql; UPDATE user SET password=password('${ROOT_PASSWD}') WHERE user='root';"
     
    sleep 5
     
    echo "2. FLUSH PRIVILEGES;"
    mysql -uroot -P ${PORT} -S /home/${CLIENT_NAME}/mysql/mysql.sock -e "FLUSH PRIVILEGES;"
     
    sleep 5
     
    echo "3. GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY '${ROOT_PASSWD}' WITH GRANT OPTION;"
    mysql -uroot -p${ROOT_PASSWD} -P ${PORT} -S /home/${CLIENT_NAME}/mysql/mysql.sock -e "GRANT ALL PRIVILEGES ON *.* to root@'%' IDENTIFIED BY '${ROOT_PASSWD}' WITH GRANT OPTION;"
     
    sleep 5
    echo "4. GRANT ALL PRIVILEGES ON *.* TO ${CLIENT_USER}@'%' IDENTIFIED BY '${CLIENT_PASSWD}' WITH GRANT OPTION;"
    mysql -uroot -p${ROOT_PASSWD} -P ${PORT} -S /home/${CLIENT_NAME}/mysql/mysql.sock -e "GRANT ALL PRIVILEGES ON *.* TO ${CLIENT_USER}@'%' IDENTIFIED BY '${CLIENT_PASSWD}' WITH GRANT OPTION;"
     
    sleep 5
     
    echo "5. GRANT ALL PRIVILEGES ON *.* TO ${CLIENT_USER}@localhost IDENTIFIED BY '${CLIENT_PASSWD}' WITH GRANT OPTION;"
    mysql -uroot -p${ROOT_PASSWD} -P ${PORT} -S /home/${CLIENT_NAME}/mysql/mysql.sock -e "GRANT ALL PRIVILEGES ON *.* TO ${CLIENT_USER}@localhost IDENTIFIED BY '${CLIENT_PASSWD}' WITH GRANT OPTION;"
     
    echo ""
     
    mysqld_multi report ${ID} 
  4. chmod +x /home/create_multipe_instance_mysql.sh
    [root@node2 moses]# sh create_multipe_instance_mysql.sh
    Apabile berhasik maka akan muncul seperti tampilah dbwah ini:

    The latest information about MySQL is available on the web at
    http://www.mysql.com
    Support MySQL by buying support/licenses at http://shop.mysql.com
    1. USE MYSQL; UPDATE USER SET password=password('rootpasswd') WHERE USER='root';
    2. FLUSH PRIVILEGES;
    3. GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'rootpasswd' WITH GRANT OPTION;
    4. GRANT ALL PRIVILEGES ON *.* TO ecentrix@'%' IDENTIFIED BY 'ecentrixpwd' WITH GRANT OPTION;
    5. GRANT ALL PRIVILEGES ON *.* TO ecentrix@localhost IDENTIFIED BY 'ecentrixpwd' WITH GRANT OPTION;
     
    Reporting MySQL servers
    MySQL server from group: mysqld2 is running
  5. Untuk melakukan shutdown ke instance tertentu gunakan command:
    mysqladmin -uroot -prootpasswd -S /home/usr8000/mysql/mysql.sock  shutdown 
  6. Untuk menstart cukup menjalankan command
    mysqld_multi start 2

  7. Untuk melihat semua instance, gunakan command:
    mysqld_multi report 
shisdew

Listens until think alike

moses.spaceku@yahoo.com / voip ipbx

Hosted PBX, IP-PBX SOHO/ CALL CENTER, VOICE GATEWAY, VOICE CARD, COST EFECTIVE SOLUTIONS (LCR), GSM/CDMA GATEWAY

%d bloggers like this: