- ;extensions_custom.conf
- ; ----- External calls, lock codec to prevent video
- exten => _0.,1,Set(__SIP_CODEC=alaw)
- same => next,Goto(outbound-allroutes,${EXTEN},1)
- ; ----- Feature codes, lock codec to prevent video
- exten => _*.,1,Set(__SIP_CODEC=g722)
- same => next,Goto(from-internal,${EXTEN},4)
- ; ----- CISCO custom
- [from-internal-custom]
- ; ----- Strip the x-cisco-serviceuri- prefix to make handling the cisco events in the dialplan a little simpler
- exten => _[x].,1,Goto(${EXTEN:19},1)
- ; ----- Group Pickup softkey
- exten => pickup,1,Pickup()
- same => next,Hangup(normal_circuit_congestion)
- ; ----- BLF Pickup softkey
- exten => _blfpickup-.,1,PickupChan(SIP/${EXTEN:10})
- same => next,Hangup(normal_circuit_congestion)
- ; ----- AdHoc call recording softkey
- exten => record,1,Answer()
- same => next,Wait(0.5)
- same => next,Set(CONFBRIDGE(bridge,record_conference)=yes)
- same => next,Set(CONFBRIDGE(bridge,record_file)=${RECORD_PEERNAME})
- same => next,Set(CONFBRIDGE(user,quiet)=yes)
- same => next,ConfBridge(${RECORD_UNIQUEID})
- same => next,Hangup(normal_clearing)
- ; Cisco SIP phones support displaying diversion information
- ; ** this part not currently working **
- ; exten => forward,SIPAddHeader(Diversion: "${SIPPEER(${PEERNAME},callerid_name)}" <sip:${PEERNAME}@localhost>\;screen=yes\;privacy=off)
- ; same => Goto(extensions,${CALLFORWARD},1)
- ; Enable forwarding
- exten => _cfwdall-.,1,Answer
- same => next,Set(SIPPEER(${CHANNEL(peername)},callforward)=${EXTEN:8})
- same => next,Hangup(normal_clearing)
- ; Disable forwarding
- exten => cfwdall,1,Answer
- same => next,Set(SIPPEER(${CHANNEL(peername)},callforward)=)
- same => next,Hangup(normal_clearing)
- [call-extension]
- exten => _X.,1,Set(PEERNAME=${EXTEN})
- ; By manually checking for call-forwarding, the call can be forwarded even if the phone is unregistered
- same => next,Set(CALLFORWARD=${SIPPEER(${PEERNAME},callforward)})
- same => next,GotoIf($[${LEN(${CALLFORWARD})} != 0]?callforward,1)
- same => next,Set(MAILBOX=${SIPPEER(${PEERNAME},mailbox)})
- ; Phones can be made to play a different ring using the Alert-Info header, see Ring Tones for examples
- same => next,ExecIf($[${LEN(${ALERT_INFO})} != 0]?SIPAddHeader(Alert-Info: <${ALERT_INFO}>))
- same => next,Dial(SIP/${PEERNAME},30)
- same => next,Goto(${TOLOWER(${DIALSTATUS})},1)
- ; Check if forwarded to the phone's voicemail extension
- exten => callforward,1,GotoIf($[${CALLFORWARD} = ${SIPPEER(${PEERNAME},vmexten)}]?busy,1)
- ; Cisco SIP phones support displaying diversion information
- same => next,Set(REDIRECTING(from-all,i)="${SIPPEER(${PEERNAME},callerid_name)}" <${SIPPEER(${PEERNAME},callerid_num)}>)
- same => next,Set(REDIRECTING(reason,i)=cfu)
- same => next,Goto(extensions,${CALLFORWARD},1)
- ; If ${MAILBOX} is empty send congestion, otherwise go to voicemail extension below
- exten => congestion,1,ExecIf($[${LEN(${MAILBOX})} = 0]?Congestion(10))
- same => next,Set(GREETING=u)
- same => next,Goto(voicemail,1)
- ; If ${MAILBOX} is empty send busy, otherwise go to voicemail extension below
- exten => busy,1,ExecIf($[${LEN(${MAILBOX})} = 0]?Busy(10))
- same => next,Set(GREETING=b)
- same => next,Goto(voicemail,1)
- exten => noanswer,1,Goto(congestion,1)
- exten => chanunavail,1,Goto(congestion,1)
- exten => voicemail,1,Answer()
- same => next,Wait(0.5)
- same => next,VoiceMail(${MAILBOX},${GREETING})
- same => next,Hangup(normal_clearing)
- [extensions]
- exten => 2001,1,Goto(call-extension,${EXTEN},1)
- ; Note the duplication of the hint peername
- same => hint,SIP/2001,SIP/2001
- exten => 2452,1,Goto(call-extension,${EXTEN},1)
- same => hint,SIP/2452,SIP/2452
- exten => 2271,1,Goto(call-extension,${EXTEN},1)
- same => hint,SIP/2271,SIP/2271
- exten => 2861,1,Goto(call-extension,${EXTEN},1)
- same => hint,PJSIP/2861,PJSIP/2861
- ; Clear dial group first
- exten => 70001,1,Set(DIALGROUP(huntgroup)=)
- same => next,Set(PEERNAMES=301&302&303)
- same => next,While($[${LEN(${PEERNAMES})} != 0])
- same => next,Set(PEERNAME=${SHIFT(PEERNAMES,&)})
- ; Check if peer is logged-in to the hunt group and add them to the dial group if they are
- same => next,ExecIf($[${SIPPEER(${PEERNAME},huntgroup)} = yes]?Set(DIALGROUP(huntgroup,add)=SIP/${PEERNAME}))
- same => next,EndWhile()
- ; Send congestion if the dial group is empty
- same => next,ExecIf($[${LEN(${DIALGROUP(huntgroup)})} = 0]?Congestion(10))
- ; Phones support 'Answered Elsewhere' so the 'c' flag is included
- ; Later series need to be logged into the hunt-group and have CISCO_HUNTPILOT set to not record answered calls as missed
- same => next,Set(_CISCO_HUNTPILOT="Ring All" <${EXTEN}>)
- same => next,Dial(${DIALGROUP(huntgroup)},30,ic)
- same => next,Hangup(${HANGUPCAUSE})
- ; Clear dial group first
- exten => 70002,1,Set(DIALGROUP(huntgroup)=)
- same => next,Set(PEERNAMES=301&302&303)
- same => next,While($[${LEN(${PEERNAMES})} != 0])
- same => next,Set(PEERNAME=${SHIFT(PEERNAMES,&)})
- ; Check if peer is logged-in to the hunt group and add them to the dial group if they are
- same => next,ExecIf($[${SIPPEER(${PEERNAME},huntgroup)} = yes]?Set(DIALGROUP(huntgroup,add)=SIP/${PEERNAME}))
- same => next,EndWhile()
- ; Send congestion if the dial group is empty
- same => next,ExecIf($[${LEN(${DIALGROUP(huntgroup)})} = 0]?Congestion(10))
- ; Phones support 'Answered Elsewhere' so the 'c' flag is included
- ; Later series need to be logged into the hunt-group and have CISCO_HUNTPILOT set to not record answered calls as missed
- same => next,Set(_CISCO_HUNTPILOT="Ring All" <${EXTEN}>)
- same => next,Dial(${DIALGROUP(huntgroup)},30,ic)
- same => next,Hangup(${HANGUPCAUSE})
- ; Clear dial group first
- exten => 70003,1,Set(DIALGROUP(huntgroup)=)
- same => next,Set(PEERNAMES=301&302&303)
- same => next,While($[${LEN(${PEERNAMES})} != 0])
- same => next,Set(PEERNAME=${SHIFT(PEERNAMES,&)})
- ; Check if peer is logged-in to the hunt group and add them to the dial group if they are
- same => next,ExecIf($[${SIPPEER(${PEERNAME},huntgroup)} = yes]?Set(DIALGROUP(huntgroup,add)=SIP/${PEERNAME}))
- same => next,EndWhile()
- ; Send congestion if the dial group is empty
- same => next,ExecIf($[${LEN(${DIALGROUP(huntgroup)})} = 0]?Congestion(10))
- ; Phones support 'Answered Elsewhere' so the 'c' flag is included
- ; Later series need to be logged into the hunt-group and have CISCO_HUNTPILOT set to not record answered calls as missed
- same => next,Set(_CISCO_HUNTPILOT="Ring All" <${EXTEN}>)
- same => next,Dial(${DIALGROUP(huntgroup)},30,ic)
- same => next,Hangup(${HANGUPCAUSE})
- ; Only allow one page at a time
- exten => 7255,1,Set(GROUP()=paging)
- same => next,ExecIf($[${GROUP_COUNT(paging)} != 1]?Busy(10))
- ; Multicast audio mode is enabled using the m() option
- same => next,SIPCiscoPage(2452&2001&2271,om(224.0.1.1)d(From ${CALLERID(number)}))
- same => next,Hangup(normal_clearing)
- exten => _blfpickup-.,1,PickupChan(SIP/${EXTEN:10})
- same => next,Hangup(normal_circuit_congestion)
- ; Enable call-forwarding
- exten => _cfwdall-.,1,Answer()
- same => next,Set(SIPPEER(${CHANNEL(peername)},callforward)=${EXTEN:8})
- same => next,Hangup(normal_clearing)
- ; Disable call-forwarding
- exten => cfwdall,1,Answer()
- same => next,Set(SIPPEER(${CHANNEL(peername)},callforward)=)
- same => next,Hangup(normal_clearing)
- exten => record,1,Answer()
- same => next,Wait(0.5)
- same => next,Set(CONFBRIDGE(bridge,record_conference)=yes)
- same => next,Set(CONFBRIDGE(bridge,record_file)=${RECORD_PEERNAME})
- same => next,Set(CONFBRIDGE(user,quiet)=yes)
- ; Other channel variables available are ${RECORD_CHANNEL} and ${RECORD_DIRECTION}.
- same => next,ConfBridge(${RECORD_UNIQUEID})
- same => next,Hangup(normal_clearing)
- exten => _X.,1,Set(_CISCO_AUTOANSWER=yes)
- same => next,Page(SIP/2001&SIP/2452,sni,30)