Tag Archives: FAILOVER ASTERISK

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.

 

 

Advertisements
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: