Script for transfer bounce back feature

Applicable Device

Device Model: S series

Firmware Version: Not required

 

Description

No answered calls bounce back in Blind Transfer.

Works for blind transfer feature code *03 and the Transfer button on the IP Phone

Distinguish bounceback call via the caller id

 

Usage

 

Code

[macro-realstexten]
exten = s,1,Set(CHECKCALLERNUM=${IF(${LEN(${CHECKCALLERNUM})>0}?${CHECKCALLERNUM}:${CALLERID(num)})})
exten = s,2,Set(CHECKREALCALLERNUM=${IF(${LEN(${REALCALLERNUM})>0}?${REALCALLERNUM}:${CALLERID(num)})})
exten = s,3,NOOP(set timeout in endpoint)
exten = s,4,Gotoif(${LEN(${IsSystemFunc})}>0?6:5)
exten = s,5,YsWalkContext(whitelist-internal,${PBXDIALNUM},1,${CHECKREALCALLERNUM},internal)
exten = s,6,Set(CALLERID(num)=${CHECKCALLERNUM})
exten = s,n,DelVar(RINGGROUPS)
exten = s,n,DelVar(RINGTYPE)
exten = s,n,GotoIf($[${JUDGE_BLACK(${PBXDIALNUM},${CHECKREALCALLERNUM})}=yes]?blacklist-handle,s,1:)
exten = s,n,Gotoif($["${CALLERID(num)}" = "Conference"]?conf,1)
exten = s,n,Gotoif(${EXTEN_CONFIG(${ARG1},CFA)}>0?follow-me-always,1)
exten = s,n,Gotoif(${EXTEN_CONFIG(${ARG1},DND)}>0?dnd,1)
exten = s,n,NoOp(NO CLIP)
exten = s,n,set(CDR(extfield4)=${PJSIPGETIP()})
exten = s,n,Gotoif(${SIPFORKING}?forking:dial)
exten = s,n(forking),NoOp(Group counts of ${ARG1} is ${GROUP_COUNT(${ARG1})})
exten = s,n,NoOp(Group counts of ${SRCEXTENSION} is ${GROUP_COUNT(${SRCEXTENSION})})
exten = s,n,Gotoif($[${GROUP_COUNT(${ARG1})}>0]?s-BUSY,1)
exten = s,n(dial),Set(ringtimeout=${IF($[${LEN(${RINGTIME_${PBXDIALNUM}})}>0]?${RINGTIME_${PBXDIALNUM}}:${RINGTIME_GLOBAL})})
exten = s,n,Dial(${ARG2},${ringtimeout},${ARG3}b(local_add_diversion,add_diversion,1(${SRCTRUNKNAME},${PBXDIALNUM},${SRCEXTENSION}))${RINGTONE}${MEETMEING},,${RINGINGPRIORITY_${PBXDIALNUM}})
exten = s,n,Gotoif(${LEN(${CONFER_INVITER})}>1?1-out,1)
exten = s,n,Goto(s-${DIALSTATUS},1)
exten = s-CHANUNAVAIL,1,Goto(s-NOANSWER,1)
exten = s-ANSWER,1,Hangup()
#only works for blind transfer
exten = s-NOANSWER,1,GotoIf(${LEN(${BLINDTRANSFER})} > 0?bounceback,1:2)
exten = s-NOANSWER,2,Gotoif(${EXTEN_CONFIG(${PBXDIALNUM},CFN)}>0?follow-me-noanswer,1:2-out,1)
exten = s-BUSY,1,Gotoif($[${APIDIALSTATUS}==BUSY]?4)
exten = s-BUSY,2,Set(SFHANGUPCAUSE=USER_BUSY)
exten = s-BUSY,3,Gotoif(${EXTEN_CONFIG(${PBXDIALNUM},CFB)}>0?follow-me-busy,1:1-out,1)
exten = s-BUSY,4,Hangup()
exten = bounceback,1,Noop(bounceback to ${BLINDTRANSFER})
exten = bounceback,2,Set(CHECKCALLERNUM=bouncebackcall(${PBXDIALNUM}))
exten = bounceback,3,Goto(from-outside,${BLINDTRANSFER:6:4},1) #if the extension number lenth is 2 digit, please change '4' to '2'.
exten = dnd,1,UserEvent(CallFailed,Cause: DND)
exten = dnd,2,Gotoif(${LEN(${IGNORE_FOLLOWME})}>0?s-ANSWER,1)
exten = dnd,3,Goto(vm-u,1)
exten = follow-me-always,1,Gotoif(${LEN(${IGNORE_FOLLOWME})}>0?s-ANSWER,1)
exten = follow-me-always,2,Gotoif(${SIPFORKING}?+1:+2)
exten = follow-me-always,3,NoOp(Group counts of ${PBXDIALNUM} is ${GROUP_COUNT(${PBXDIALNUM})})
exten = follow-me-always,n,Gotoif(${EXTEN_CONFIG(${PBXDIALNUM},CFAH)}>0?2-out,1)
exten = follow-me-always,n,Gotoif(${EXTEN_CONFIG(${PBXDIALNUM},ACFD)}>0?vm-u,1)
exten = follow-me-always,n,Set(CFNUM=${EXTEN_CONFIG(${PBXDIALNUM},CFANUM)})
exten = follow-me-always,n,Gotoif($[${LEN(${CFNUM})}<1]?vm-u,1))
exten = follow-me-always,n,Gotoif($["${CFNUM}" = "${PBXDIALNUM}"]?vm-u,1)
exten = follow-me-always,n,Set(IsFollowme=${IF($[${IsFromOutside} = 1]?1:0)})
exten = follow-me-always,n,Set(_NOCHANGEDOD=${IF($[${IsFromOutside} = 1]?${NOPBXDIALNUM}:0)})
exten = follow-me-always,n,Set(CONTACT_ADMIN_CDR=${CONTACTS(tf${PBXDIALNUM},${CALLERID(num)},no)})
exten = follow-me-always,n,Set(CONTACT_ADMIN_CDR=${CONTACTS(tf${CFNUM},${CALLERID(num)},yes)})
exten = follow-me-always,n,Set(_DIVNUM=${PBXDIALNUM})
exten = follow-me-always,n,Followme(${PBXDIALNUM}-a,n)
exten = follow-me-always,n,Hangup()
exten = follow-me-noanswer,1,Gotoif(${LEN(${IGNORE_FOLLOWME})}>0?s-ANSWER,1)
exten = follow-me-noanswer,2,Gotoif(${SIPFORKING}?+1:+2)
exten = follow-me-noanswer,3,NoOp(Group counts of ${PBXDIALNUM} is ${GROUP_COUNT(${PBXDIALNUM})})
exten = follow-me-noanswer,n,Gotoif(${EXTEN_CONFIG(${PBXDIALNUM},NCFD)}>0?vm-u,1)
exten = follow-me-noanswer,n,Set(CFNUM=${EXTEN_CONFIG(${PBXDIALNUM},CFNNUM)})
exten = follow-me-noanswer,n,Gotoif($[${LEN(${CFNUM})}<1]?vm-u,1))
exten = follow-me-noanswer,n,Gotoif($["${CFNUM}" = "${PBXDIALNUM}"]?vm-u,1)
exten = follow-me-noanswer,n,Set(IsFollowme=${IF($[${IsFromOutside} = 1]?1:0)})
exten = follow-me-noanswer,n,Set(_NOCHANGEDOD=${IF($[${IsFromOutside} = 1]?${NOPBXDIALNUM}:0)})
exten = follow-me-noanswer,n,Set(CONTACT_ADMIN_CDR=${CONTACTS(tf${PBXDIALNUM},${CALLERID(num)},no)})
exten = follow-me-noanswer,n,Set(CONTACT_ADMIN_CDR=${CONTACTS(tf${CFNUM},${CALLERID(num)},yes)})
exten = follow-me-noanswer,n,Set(_DIVNUM=${PBXDIALNUM})
exten = follow-me-noanswer,n,Followme(${PBXDIALNUM}-n,n)
exten = follow-me-noanswer,n,Hangup()
exten = follow-me-busy,1,Gotoif(${LEN(${IGNORE_FOLLOWME})}>0?s-ANSWER,1)
exten = follow-me-busy,2,Gotoif(${SIPFORKING}?+1:+2)
exten = follow-me-busy,3,NoOp(Group counts of ${PBXDIALNUM} is ${GROUP_COUNT(${PBXDIALNUM})})
exten = follow-me-busy,n,Gotoif(${EXTEN_CONFIG(${PBXDIALNUM},BCFD)}>0?vm-b,1)
exten = follow-me-busy,n,Set(CFNUM=${EXTEN_CONFIG(${PBXDIALNUM},CFBNUM)})
exten = follow-me-busy,n,Gotoif($[${LEN(${CFNUM})}<1]?vm-b,1)
exten = follow-me-busy,n,Gotoif($["${CFNUM}" = "${PBXDIALNUM}"]?vm-b,1)
exten = follow-me-busy,n,Set(IsFollowme=${IF($[${IsFromOutside} = 1]?1:0)})
exten = follow-me-busy,n,Set(_NOCHANGEDOD=${IF($[${IsFromOutside} = 1]?${NOPBXDIALNUM}:0)})
exten = follow-me-busy,n,Set(CONTACT_ADMIN_CDR=${CONTACTS(tf${PBXDIALNUM},${CALLERID(num)},no)})
exten = follow-me-busy,n,Set(CONTACT_ADMIN_CDR=${CONTACTS(tf${CFNUM},${CALLERID(num)},yes)})
exten = follow-me-busy,n,Set(_DIVNUM=${PBXDIALNUM})
exten = follow-me-busy,n,Followme(${PBXDIALNUM}-b,n)
exten = follow-me-busy,n,Hangup()
exten = vm-u,1,Gotoif(${LEN(${MEETMEING})}>1?vm-u,2:vm-u,3)
exten = vm-u,2,ChannelRedirect(${CHANNEL(name)},conferences_invite,${CONFERENCENO},1)
exten = vm-u,3,Gotoif($[${PRESS5TOLEVMSG_ENABLE} = 1]?vm-u,4:vm-unavail,1)
exten = vm-u,n,Read(digito,,1,,,7)
exten = vm-u,n,Gotoif($[${digito}=5]?vm-s,1)
exten = vm-u,n,Hangup()
exten = vm-b,1,Gotoif($[${PRESS5TOLEVMSG_ENABLE} = 1]?vm-b,2:vm-busy,1)
exten = vm-b,n,Read(digito,,1,,,7)
exten = vm-b,n,Gotoif($[${digito}=5]?vm-s,1)
exten = vm-b,n,Hangup()
exten = vm-unavail,1,Voicemail(${PBXDIALNUM},u)
exten = vm-unavail,n,Hangup()
exten = vm-busy,1,Voicemail(${PBXDIALNUM},b)
exten = vm-busy,n,ExecIf($[${SFHANGUPCAUSE}=USER_BUSY]?Hangup(USER_BUSY):Hangup())
exten = vm-s,1,Voicemail(${PBXDIALNUM},)
exten = vm-s,n,Hangup()
exten = 1-out,1,Gotoif(${LEN(${MEETMEING})}>1?1-out,2:1-out,3)
exten = 1-out,2,ChannelRedirect(${CHANNEL(name)},conferences_invite,${CONFERENCENO},1)
exten = 1-out,3,ExecIf($[${SFHANGUPCAUSE}=USER_BUSY]?Hangup(USER_BUSY):Hangup())
exten = 2-out,1,Hangup(NO_ANSWER)
exten = conf,1,Gotoif(${EXTEN_CONFIG(${ARG1},CFA)}>0?8:2)
exten = conf,2,Set(ringtimeout=${IF($[${LEN(${RINGTIME_${PBXDIALNUM}})}>0]?${RINGTIME_${PBXDIALNUM}}:${RINGTIME_GLOBAL})})
exten = conf,3,Gotoif($[${AutoAnswer}=1]?6:4)
exten = conf,4,Dial(${ARG2},${ringtimeout},${ARG3}${RINGTONE}b(conf-pjsip-addheader,add_header,1(${AutoAnswer},${CONFID},${MEMBERINFO},${CONFINFO})),,${RINGTYPE})
exten = conf,5,Hangup()
exten = conf,6,Set(ringstrategy=2)
exten = conf,7,Dial(${ARG2},${ringtimeout},${ARG3}${RINGTONE}b(conf-pjsip-addheader,add_header,1(${AutoAnswer},${CONFID},${MEMBERINFO},${CONFINFO})),,${RINGTYPE})
exten = conf,8,Hangup()

 

Have more questions? Submit a request

3 Comments

  • 1
    Avatar

    Is there a version of this for the P series?

    Can it be included as an option in the setup interface?

  • 0
    Avatar

    Is it work for attendant transfer too?

    Please develop it as a feature in WebGUI for S and P-Series.

  • 0
    Avatar

    If you can't find the [macro_realstexten] section by using command 'cat extensions.conf | tail -n +400', then you can use command 'cat /etc/asterisk/extensions.conf' and then you can find it. 

    Edited by Gary
Please sign in to leave a comment.