I have 4 sip accounts, I need to make a call from 4 sips at once, and when you pick up the phone on one of them, then the others will be canceled
[globals]
TRANSFER_CONTEXT=internal-transfer;
MONITOR_DIR=/storage/usbdisk1/mikopbx/astspool/monitor
MONITOR_STEREO=0
MONITOR_INNER=1
PBX_REC_ANNONCE_IN=
PBX_REC_ANNONCE_OUT=
PARKING_DURATION=50
PICKUP_EXTEN=*8
[general]
[playback-exit]
exten => _[0-9*#+a-zA-Z]!,1,Gosub(dial_outworktimes,${EXTEN},1)
same => n,Playback(${filename})
same => n,Hangup()
exten => _[hit],1,Hangup()
[check-out-work-time]
exten => _[0-9*#+a-zA-Z]!,1,Set(currentYear=${STRFTIME(,,%Y)})
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-${contextID},${EXTEN},1)}" == "1"]?${CONTEXT}-${contextID},${EXTEN},1)
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-${currentYear},${EXTEN},1)}" == "1"]?${CONTEXT}-${currentYear},${EXTEN},1)
same => n,ExecIfTime(00:00-09:00,mon-fri,*,*?Goto(work-time-set-var-1,${EXTEN},1))
same => n,ExecIfTime(18:00-23:00,mon-fri,*,*?Goto(work-time-set-var-2,${EXTEN},1))
same => n,ExecIfTime(00:00-23:00,sat-sun,*,*?Goto(work-time-set-var-3,${EXTEN},1))
same => n,return
exten => _[hit],1,Hangup()
[work-time-set-var-1]
exten => _[0-9*#+a-zA-Z]!,1,Set(filename=/storage/usbdisk1/mikopbx/media/custom/out_work_times)
same => n,Goto(playback-exit,${EXTEN},1)
exten => _[hit],1,Hangup()
[work-time-set-var-2]
exten => _[0-9*#+a-zA-Z]!,1,Set(filename=/storage/usbdisk1/mikopbx/media/custom/out_work_times)
same => n,Goto(playback-exit,${EXTEN},1)
exten => _[hit],1,Hangup()
[work-time-set-var-3]
exten => _[0-9*#+a-zA-Z]!,1,Set(filename=/storage/usbdisk1/mikopbx/media/custom/out_work_times)
same => n,Goto(playback-exit,${EXTEN},1)
exten => _[hit],1,Hangup()
[work-time-set-var-6]
exten => _[0-9*#+a-zA-Z]!,1,Set(filename=/storage/usbdisk1/mikopbx/media/custom/out_work_times)
same => n,Goto(playback-exit,${EXTEN},1)
exten => _[hit],1,Hangup()
[work-time-set-var-5]
exten => _[0-9*#+a-zA-Z]!,1,Set(filename=/storage/usbdisk1/mikopbx/media/custom/out_work_times)
same => n,Goto(playback-exit,${EXTEN},1)
exten => _[hit],1,Hangup()
[check-out-work-time-2019]
exten => _[0-9*#+a-zA-Z]!,1,NoOp(check time 2019 year)
same => n,ExecIfTime(*,*,1-8,jan-jan?Goto(work-time-set-var-6,${EXTEN},1))
same => n,ExecIfTime(*,*,8-8,mar-mar?Goto(work-time-set-var-5,${EXTEN},1))
same => n,return
exten => _[hit],1,Hangup()
[hangup_handler_meetme]
exten => s,1,AGI(cdr_connector.php,hangup_chan_meetme)
same => n,return
[conference-rooms]
exten => 1111,1,NoOp(---)
same => n,Set(bridgePeer=${CHANNEL})
same => n,Set(i=1)
same => n,While($[${i} < 10])
same => n,ExecIf($[ "${bridgePeer:0:5}" != "Local" ]?ExitWhile())
same => n,ExecIf($[ "${bridgePeer:0:5}" == "Local" ]?Set(pl=${IF($["${CHANNEL:-1}" == "1"]?2:1)}))
same => n,ExecIf($[ "${bridgePeer:0:5}" == "Local" ]?Set(bridgePeer=${IMPORT(${CUT(bridgePeer,\;,1)}\;${pl},BRIDGEPEER)}))
same => n,ExecIf($[ "${bridgePeer}x" == "x" ]?ExitWhile())
same => n,Set(i=$[${i} + 1])
same => n,EndWhile
same => n,ExecIf($[ "${bridgePeer}" != "${CHANNEL}" && "${bridgePeer:0:5}" != "Local" && "${bridgePeer}x" != "x" ]?ChannelRedirect(${bridgePeer},${CONTEXT},${EXTEN},${PRIORITY}))
same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Hangup())
same => n,AGI(cdr_connector.php,meetme_dial)
same => n,Answer()
same => n,Gosub(set-answer-state,${EXTEN},1)
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler_meetme,s,1)
same => n,Set(CONFBRIDGE(bridge,record_file)=${MEETME_RECORDINGFILE}.wav)
same => n,Set(CONFBRIDGE(bridge,record_file_timestamp)=false)
same => n,Set(CONFBRIDGE(bridge,record_conference)=yes)
same => n,Set(CONFBRIDGE(bridge,video_mode)=follow_talker)
same => n,Set(CONFBRIDGE(user,talk_detection_events)=yes)
same => n,Set(CONFBRIDGE(user,quiet)=yes)
same => n,Set(CONFBRIDGE(user,music_on_hold_when_empty)=yes)
same => n,ConfBridge(${EXTEN})
same => n,Hangup()
[SIP-BCD44BCA-incoming]
exten => _X!,1,NoOp(--- Incoming call ---)
same => n,Set(CHANNEL(language)=en-en)
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,Set(__FROM_DID=${EXTEN})
same => n,Set(__FROM_CHAN=${CHANNEL})
same => n,Set(__M_CALLID=${CHANNEL(callid)})
same => n,ExecIf($["${CHANNEL(channeltype)}" != "Local"]?Gosub(set_from_peer,s,1))
same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Set(__FROM_PEER=${CALLERID(num)}))
same => n,Gosub(add-trim-prefix-clid,${EXTEN},1)
same => n,Set(__TRANSFER_OPTIONS=t)
same => n,ExecIf($["${CONTEXT}" == "public-direct-dial"]?Set(contextID=none-incoming))
same => n,ExecIf($["${contextID}x" == "x"]?Set(contextID=${CONTEXT}))
same => n,GosubIf($["${IGNORE_TIME}" != "1"]?check-out-work-time,${EXTEN},1)
same => n,Set(IN_NEED_ANNONCE=1)
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-custom,${EXTEN},1)
same => n,Set(M_TIMEOUT=0)
same => n,ExecIf($["${M_DIALSTATUS}" != "ANSWER" && "${M_DIALSTATUS}" != "BUSY"]?Dial(Local/201@internal,,${TRANSFER_OPTIONS}Kg)); default action
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-after-dial-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-after-dial-custom,${EXTEN},1)
same => n,ExecIf($["${M_DIALSTATUS}" == "BUSY"]?Busy(2));
same => n,Hangup()
exten => krinz,1,NoOp(--- Incoming call ---)
same => n,Set(CHANNEL(language)=en-en)
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,Set(__FROM_DID=${EXTEN})
same => n,Set(__FROM_CHAN=${CHANNEL})
same => n,Set(__M_CALLID=${CHANNEL(callid)})
same => n,ExecIf($["${CHANNEL(channeltype)}" != "Local"]?Gosub(set_from_peer,s,1))
same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Set(__FROM_PEER=${CALLERID(num)}))
same => n,Gosub(add-trim-prefix-clid,${EXTEN},1)
same => n,Set(__TRANSFER_OPTIONS=t)
same => n,ExecIf($["${CONTEXT}" == "public-direct-dial"]?Set(contextID=none-incoming))
same => n,ExecIf($["${contextID}x" == "x"]?Set(contextID=${CONTEXT}))
same => n,GosubIf($["${IGNORE_TIME}" != "1"]?check-out-work-time,${EXTEN},1)
same => n,Set(IN_NEED_ANNONCE=1)
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-custom,${EXTEN},1)
same => n,Set(M_TIMEOUT=0)
same => n,ExecIf($["${M_DIALSTATUS}" != "ANSWER" && "${M_DIALSTATUS}" != "BUSY"]?Dial(Local/201@internal,,${TRANSFER_OPTIONS}Kg)); default action
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-after-dial-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-after-dial-custom,${EXTEN},1)
same => n,ExecIf($["${M_DIALSTATUS}" == "BUSY"]?Busy(2));
same => n,Hangup()
[monitor-internal]
exten => 201,1,NoOp(-)
exten => 261111111,1,NoOp(-)
exten => 203,1,NoOp(-)
exten => 251111111,1,NoOp(-)
exten => 01,1,NoOp(-)
[monitor-exceptions]
[applications]
exten => _000063,1,Answer()
same => n,AGI(cdr_connector.php,${ISTRANSFER}dial_answer)
same => n,Playback(beep)
same => n,SayDigits(${CALLERID(number)})
same => n,Playback(silence/1)
same => n,Playback(silence/1)
same => n,Playback(silence/1)
same => n,Goto(3)
exten => _000064,1,Answer()
same => 2,Milliwatt()
same => 3,Hangup()
exten => _10003246,1,Answer()
same => n,AGI(cdr_connector.php,${ISTRANSFER}dial_answer)
same => n,Echo()
same => n,Hangup()
[ivr-2003]
exten => s,1,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))
same => n,Set(APPEXTEN=2003)
same => n,Gosub(dial_app,${EXTEN},1)
same => n,Answer()
same => n,Set(try_count=0);
same => n,GotoIf($[${try_count} > 3]?internal,201,1)
same => n,Set(try_count=$[${try_count} + 1])
same => n,Set(TIMEOUT(digit)=2)
same => n,Background(/storage/usbdisk1/mikopbx/media/custom/miko_hello)
same => n,WaitExten(7)
exten => 1,1,Goto(internal,2001,1)
exten => 2,1,Goto(internal,2002,1)
exten => i,1,Goto(s,6)
exten => t,1,Goto(s,6)
exten => _XXX,1,ExecIf($["${DIALPLAN_EXISTS(internal,${EXTEN},1)}" == "0"]?Goto(i,1))
same => n,ExecIf($["${PJSIP_ENDPOINT(${EXTEN},auth)}x" == "x"]?Goto(i,1))
same => n,Goto(internal,${EXTEN},1)
exten => _XX,1,ExecIf($["${DIALPLAN_EXISTS(internal,${EXTEN},1)}" == "0"]?Goto(i,1))
same => n,ExecIf($["${PJSIP_ENDPOINT(${EXTEN},auth)}x" == "x"]?Goto(i,1))
same => n,Goto(internal,${EXTEN},1)
[queue_agent_answer]
exten => s,1,Gosub(queue_answer,${EXTEN},1)
same => n,Return()
[annonce-spy]
exten => _.!,1,ExecIf($[ "${EXTEN}" == "h" ]?Hangup())
same => n,ExecIf($["${CHANNELS(PJSIP/${EXTEN})}x" != "x"]?Chanspy(PJSIP/${EXTEN},uBq))
same => n,Hangup()
[annonce-playback-in]
exten => annonce,1,Answer()
same => n,ExecIf("${PBX_REC_ANNONCE_IN}x" != "x"]?Playback(${PBX_REC_ANNONCE_IN}))
same => n,Hangup()
[annonce-playback-out]
exten => annonce,1,Answer()
same => n,ExecIf("${PBX_REC_ANNONCE_OUT}x" != "x"]?Playback(${PBX_REC_ANNONCE_OUT}))
same => n,Hangup()
[parked-calls]
exten => _X!,2,NoOp()
same => n,AGI(cdr_connector.php,unpark_call)
same => n,ExecIf($["${pt1c_PARK_CHAN}x" != "x"]?Bridge(${pt1c_PARK_CHAN},kKTt))
same => n,ExecIf($["${pt1c_PARK_CHAN}x" == "x"]?ParkedCall(default,${EXTEN}))
same => n,Hangup()
[parked-calls-timeout]
exten => s,1,NoOp(This is all that happens to parked calls if they time out.)
same => n,Set(FROM_PEER=${EMPTYVAR})
same => n,AGI(cdr_connector.php,unpark_call_timeout)
same => n,Goto(internal,${CUT(PARKER,/,2)},1)
same => n,Hangup()
[interception-bridge]
exten => failed,1,Hangup()
exten => _[0-9*#+a-zA-Z][0-9*#+a-zA-Z]!,1,ExecIf($[ "${ORIGINATE_SRC_CHANNEL}x" != "x" ]?Wait(0.2))
same => n,ExecIf($[ "${ORIGINATE_SRC_CHANNEL}x" != "x" ]?ChannelRedirect(${ORIGINATE_SRC_CHANNEL},${CONTEXT},${ORIGINATE_DST_EXTEN},1))
same => n,ExecIf($[ "${ORIGINATE_SRC_CHANNEL}x" != "x" ]?Hangup())
same => n,Set(M_DIALSTATUS=${IMPORT(${INTECEPTION_CNANNEL},M_DIALSTATUS)})
same => n,ExecIf($[ "${M_DIALSTATUS}" == "ANSWER" ]?Hangup())
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,Set(FROM_CHAN=${INTECEPTION_CNANNEL})
same => n,Set(MASTER_CHANNEL(M_TIMEOUT_CHANNEL)=${INTECEPTION_CNANNEL})
same => n,Gosub(set-answer-state,${EXTEN},1)
same => n,Gosub(dial_interception,${EXTEN},1)
same => n,Gosub(dial_answer,${EXTEN},1)
same => n,Bridge(${INTECEPTION_CNANNEL},Tk)
same => n,Hangup()
[voice_mail_peer]
exten => voicemail,1,Answer()
same => n,ExecIf($["${CHANNEL:0:5}" == "Local"]?Set(pl=${IF($["${CHANNEL:-1}" == "1"]?2:1)}))
same => n,ExecIf($["${CHANNEL:0:5}" == "Local"]?Set(bridgePeer=${IMPORT(${CUT(CHANNEL,\;,1)}\;${pl},BRIDGEPEER)}))
same => n,ExecIf($[ "${FROM_CHAN}" == "${bridgePeer}" ]?ChannelRedirect(${bridgePeer},${CONTEXT},${EXTEN},2))
same => n,Gosub(set-answer-state,${EXTEN},1)
same => n,Gosub(voicemail_start,${EXTEN},1)
same => n,VoiceMail(admin@voicemailcontext)
same => n,Hangup()
[internal-num-undefined]
exten => _X!,1,ExecIf($["${ISTRANSFER}x" != "x"]?Goto(transfer_dial_hangup,${EXTEN},1))
same => n,ExecIf($["${BLINDTRANSFER}x" != "x"]?AGI(check_redirect.php,${BLINDTRANSFER}))
same => n,Playback(pbx-invalid,noanswer)
[set-answer-state]
exten => _.!,1,ExecIf($["${CHANNEL_EXISTS(${FROM_CHAN})}" == "0"]?return)
same => n,Set(EXPORT(${FROM_CHAN},MASTER_CHANNEL(M_DIALSTATUS))=ANSWER)
same => n,Set(EXPORT(${FROM_CHAN},M_DIALSTATUS)=ANSWER)
same => n,return
exten => _[hit],1,Hangup()
[set-dial-contacts]
exten => _X!,1,NoOp()
same => n,Set(DST_CONTACT=${PJSIP_DIAL_CONTACTS(${EXTEN})})
same => n,return
[internal-fw]
exten => h,1,ExecIf($["${ISTRANSFER}x" != "x"]?Goto(transfer_dial_hangup,${EXTEN},1))
exten => _X!,1,NoOp(DIALSTATUS - ${DIALSTATUS})
same => n,ExecIf($["${DIALSTATUS}" == "CANCEL"]?Hangup())
same => n,ExecIf($["${DIALSTATUS}" == "BUSY"]?Set(dstatus=FW_BUSY))
same => n,ExecIf($["${DIALSTATUS}" == "CHANUNAVAIL"]?Set(dstatus=FW_UNAV))
same => n,ExecIf($["${dstatus}x" == "x"]?Set(dstatus=FW))
same => n,Set(fw=${DB(${dstatus}/${EXTEN})})
same => n,ExecIf($["${fw}x" != "x"]?Set(__pt1c_UNIQUEID=${UNDEFINED})
same => n,ExecIf($["${fw}x" != "x"]?Wait(1))
same => n,ExecIf($["${fw}x" != "x"]?Goto(internal,${fw},1))
same => n,ExecIf($["${BLINDTRANSFER}x" != "x"]?AGI(check_redirect.php,${BLINDTRANSFER}))
same => n,ExecIf($["${DIALSTATUS}" == "BUSY"]?Busy(2):Hangup())
[all_peers]
include => internal-hints
exten => failed,1,Hangup()
exten => _[0-9*#+a-zA-Z]!,1,ExecIf($[ "${ORIGINATE_SRC_CHANNEL}x" != "x" ]?Wait(0.2))
same => n,ExecIf($[ "${ORIGINATE_SRC_CHANNEL}x" != "x" ]?ChannelRedirect(${ORIGINATE_SRC_CHANNEL},${CONTEXT},${ORIGINATE_DST_EXTEN},1))
same => n,ExecIf($[ "${ORIGINATE_SRC_CHANNEL}x" != "x" ]?Set(EXPORT(${ORIGINATE_SRC_CHANNEL},__ORIG_CALLID)=${CHANNEL(callid)}))
same => n,ExecIf($[ "${ORIGINATE_SRC_CHANNEL}x" != "x" ]?Hangup())
same => n,Set(cleanNumber=${FILTER(\*\#\+1234567890,${EXTEN})})
same => n,ExecIf($["${EXTEN}" != "${cleanNumber}"]?Goto(${CONTEXT},${cleanNumber},$[${PRIORITY} + 1]))
same => n,Set(__FROM_CHAN=${CHANNEL})
same => n,Set(__M_CALLID=${CHANNEL(callid)})
same => n,ExecIf($["${OLD_LINKEDID}x" == "x"]?Set(__OLD_LINKEDID=${CHANNEL(linkedid)}))
same => n,ExecIf($["${CHANNEL(channeltype)}" != "Local"]?Gosub(set_from_peer,s,1))
same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))
same => n,ExecIf($["${CALLERID(num)}x" == "x"]?Set(CALLERID(num)=${FROM_PEER}))
same => n,ExecIf($["${CALLERID(num)}x" == "x"]?Set(CALLERID(name)=${FROM_PEER}))
same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local" && "${FROM_PEER}x" == "x"]?Set(__FROM_PEER=${CALLERID(num)}))
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,Gosub(${ISTRANSFER}dial,${EXTEN},1)
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-custom,${EXTEN},1)
same => n,GosubIf($["${DIALPLAN_EXISTS(applications,${EXTEN},1)}" == "1"]?applications,${EXTEN},1)
same => n,GosubIf($["${DIALPLAN_EXISTS(internal,${EXTEN},1)}" == "1"]?internal,${EXTEN},1)
same => n,GosubIf($["${DIALPLAN_EXISTS(outgoing,${EXTEN},1)}" == "1"]?outgoing,${EXTEN},1)
same => n,Hangup()
exten => _[hit],1,Hangup()
exten => _*8X!,1,Set(PICKUPEER=PJSIP/${FILTER(0-9,${EXTEN:2})})
same => n,Set(pt1c_dnid=${EXTEN})
same => n,PickupChan(${PICKUPEER})
same => n,Hangup()
[internal]
include => applications
include => voice_mail_peer
exten => 1111,1,Goto(conference-rooms,1111,1)
exten => 201,1,Goto(internal-users,201,1)
exten => 203,1,Goto(internal-users,203,1)
exten => 01,1,Goto(internal-users,01,1)
exten => 2003,1,Goto(ivr-2003,s,1)
exten => 2001,1,NoOp(--- Start Queue ---)
same => n,Set(__QUEUE_SRC_CHAN=${CHANNEL})
same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,GosubIf($["${DIALPLAN_EXISTS(queue-pre-dial-custom,${EXTEN},1)}" == "1"]?queue-pre-dial-custom,${EXTEN},1)
same => n,Answer()
same => n,Gosub(queue_start,${EXTEN},1)
same => n,Queue(QUEUE-F38325E796B3FFB8938BA383AA119148,kT${MQ_OPTIONS},,,300,,,queue_agent_answer)
same => n,Gosub(queue_end,${EXTEN},1)
exten => 2002,1,NoOp(--- Start Queue ---)
same => n,Set(__QUEUE_SRC_CHAN=${CHANNEL})
same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,GosubIf($["${DIALPLAN_EXISTS(queue-pre-dial-custom,${EXTEN},1)}" == "1"]?queue-pre-dial-custom,${EXTEN},1)
same => n,Answer()
same => n,Gosub(queue_start,${EXTEN},1)
same => n,Queue(QUEUE-D676ADC7942EDBA19C2AB86177CC7A53,kT${MQ_OPTIONS},,,30,,,queue_agent_answer)
same => n,Gosub(queue_end,${EXTEN},1)
same => n,ExecIf($["${QUEUESTATUS}" == "TIMEOUT"]?Goto(internal,203,1))
exten => _89261111111,1,Set(EXTERNALPHONE=89261111111)
same => n,Goto(outgoing,89261111111,1)
same => n,AGI(check_redirect.php,${BLINDTRANSFER})
exten => _89161111111,1,Set(EXTERNALPHONE=89161111111)
same => n,Goto(outgoing,89161111111,1)
same => n,AGI(check_redirect.php,${BLINDTRANSFER})
exten => _89251111111,1,Set(EXTERNALPHONE=89251111111)
same => n,Goto(outgoing,89251111111,1)
same => n,AGI(check_redirect.php,${BLINDTRANSFER})
exten => 801,1,Goto(parked-calls,${EXTEN},2)
exten => 802,1,Goto(parked-calls,${EXTEN},2)
exten => 803,1,Goto(parked-calls,${EXTEN},2)
exten => 804,1,Goto(parked-calls,${EXTEN},2)
exten => 805,1,Goto(parked-calls,${EXTEN},2)
exten => 806,1,Goto(parked-calls,${EXTEN},2)
exten => 807,1,Goto(parked-calls,${EXTEN},2)
exten => 808,1,Goto(parked-calls,${EXTEN},2)
exten => 809,1,Goto(parked-calls,${EXTEN},2)
exten => 810,1,Goto(parked-calls,${EXTEN},2)
exten => 811,1,Goto(parked-calls,${EXTEN},2)
exten => 812,1,Goto(parked-calls,${EXTEN},2)
exten => 813,1,Goto(parked-calls,${EXTEN},2)
exten => 814,1,Goto(parked-calls,${EXTEN},2)
exten => 815,1,Goto(parked-calls,${EXTEN},2)
exten => 816,1,Goto(parked-calls,${EXTEN},2)
exten => 817,1,Goto(parked-calls,${EXTEN},2)
exten => 818,1,Goto(parked-calls,${EXTEN},2)
exten => 819,1,Goto(parked-calls,${EXTEN},2)
exten => 820,1,Goto(parked-calls,${EXTEN},2)
exten => i,1,NoOp(-- INVALID NUMBER --)
same => n,Set(DIALSTATUS=INVALID_NUMBER)
same => n,Playback(privacy-incorrect,noanswer)
same => n,Hangup()
exten => h,1,ExecIf($["${ISTRANSFER}x" != "x"]?Goto(transfer_dial_hangup,${EXTEN},1))
exten => hangup,1,Set(MASTER_CHANNEL(M_DIALSTATUS)=ANSWER)
same => n,Hangup()
exten => busy,1,Set(MASTER_CHANNEL(M_DIALSTATUS)=BUSY)
same => n,Busy(2)
exten => did2user,1,ExecIf($["${FROM_DID}x" != "x" && ${DIALPLAN_EXISTS(internal,${FROM_DID},1)} ]?Goto(internal,${FROM_DID},1))
same => n,Hangup()
[internal-incoming]
exten => _[0-9*#+a-zA-Z][0-9*#+a-zA-Z]!,1,ExecIf($["${MASTER_CHANNEL(M_TIMEOUT)}x" != "x"]?Set(TIMEOUT(absolute)=${MASTER_CHANNEL(M_TIMEOUT)}))
same => n,Set(MASTER_CHANNEL(M_TIMEOUT_CHANNEL)=${CHANNEL})
same => n,Set(MASTER_CHANNEL(M_TIMEOUT)=${EMPTY_VAR})
same => n,Goto(internal,${EXTEN},1)
[internal-users]
exten => _X!,1,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,ExecIf($["${ISTRANSFER}x" != "x"]?Set(SIPADDHEADER01=${EMPTY_VAR})
same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))
same => n,Gosub(${ISTRANSFER}dial,${EXTEN},1)
same => n,ExecIf($["${PJSIP_ENDPOINT(${EXTEN},auth)}x" == "x"]?Goto(internal-num-undefined,${EXTEN},1))
same => n,ExecIf($["${DEVICE_STATE(PJSIP/${EXTEN})}" == "BUSY" || "${DEVICE_STATE(PJSIP/${EXTEN}-WS)}" == "BUSY"]?Set(IS_BUSY=1))
same => n,ExecIf($["${IS_BUSY}" == "1"]?Set(DIALSTATUS=BUSY))
same => n,GotoIf($["${IS_BUSY}" == "1" && "${QUEUE_SRC_CHAN}x" == "x"]?fw_start)
same => n,Set(ringlength=${DB(FW_TIME/${EXTEN})})
same => n,ExecIf($["${ringlength}x" == "x"]?Set(ringlength=600))
same => n,ExecIf($["${QUEUE_SRC_CHAN}x" != "x" && "${ISTRANSFER}x" == "x"]?Set(ringlength=600))
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-custom,${EXTEN},1)
same => n,Gosub(set-dial-contacts,${EXTEN},1)
same => n,ExecIf($["${FIELDQTY(DST_CONTACT,&)}" != "1"]?Set(__PT1C_SIP_HEADER=${EMPTY_VAR}))
same => n,ExecIf($["${TRANSFER_OPTIONS}x" == "x" || "${ISTRANSFER}x" != "x"]?Set(TRANSFER_OPTIONS=Tt))
same => n,ExecIf($["${DST_CONTACT}x" != "x"]?Dial(${DST_CONTACT},${ringlength},${TRANSFER_OPTIONS}ekKHhU(${ISTRANSFER}dial_answer)b(dial_create_chan,s,1)):Set(DIALSTATUS=CHANUNAVAIL))
same => n,ExecIf($["${DST_CONTACT}x" == "x"]?Gosub(dial_end,${EXTEN},1))
same => n(fw_start),NoOp(start dial hangup)
same => n,ExecIf($["${DIALSTATUS}" != "ANSWER" && "${ISTRANSFER}x" != "x"]?Goto(internal-fw,${EXTEN},1))
same => n,ExecIf($["${DIALSTATUS}" != "ANSWER" && "${QUEUE_SRC_CHAN}x" == "x"]?Goto(internal-fw,${EXTEN},1))
same => n,ExecIf($["${BLINDTRANSFER}x" != "x"]?AGI(check_redirect.php,${BLINDTRANSFER}))
same => n,Hangup()
exten => h,1,ExecIf($["${ISTRANSFER}x" != "x"]?Goto(transfer_dial_hangup,${EXTEN},1))
[sipregistrations]
[messages]
exten => _X.,1,NoOp("Sending message, To ${MESSAGE(to)}, Hint ${ARG1}, From ${MESSAGE(from)}, CID ${CALLERID}, Body ${MESSAGE(body)}")
same => n,Gosub(set-dial-contacts,${EXTEN},1)
same => n,While($["${SET(contact=${SHIFT(DST_CONTACT,&):6})}" != ""])
same => n,MessageSend(pjsip:${contact},${REPLACE(MESSAGE(from),-WS)})
same => n,NoOp("Send status is ${MESSAGE_SEND_STATUS}")
same => n,EndWhile
same => n,HangUp()
[internal-originate]
exten => _[0-9*#+a-zA-Z]!,1,Set(pt1c_cid=${FILTER(\*\#\+1234567890,${pt1c_cid})})
same => n,Set(MASTER_CHANNEL(ORIGINATE_DST_EXTEN)=${pt1c_cid})
same => n,Set(number=${FILTER(\*\#\+1234567890,${EXTEN})})
same => n,ExecIf($["${EXTEN}" != "${number}"]?Goto(${CONTEXT},${number},$[${PRIORITY} + 1]))
same => n,Set(__IS_ORGNT=${EMPTY})
same => n,Gosub(interception_start,${EXTEN},1)
same => n,ExecIf($["${pt1c_cid}x" != "x"]?Set(CALLERID(num)=${pt1c_cid}))
same => n,ExecIf($["${origCidName}x" != "x"]?Set(CALLERID(name)=${origCidName}))
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-custom,${EXTEN},1)
same => n,ExecIf($["${SRC_QUEUE}x" != "x"]?Goto(internal-originate-queue,${EXTEN},1))
same => n,ExecIf($["${CUT(CHANNEL,\;,2)}" == "2"]?Set(__PT1C_SIP_HEADER=${SIPADDHEADER}))
same => n,ExecIf($["${PJSIP_ENDPOINT(${EXTEN},auth)}x" == "x"]?Goto(internal-num-undefined,${EXTEN},1))
same => n,Gosub(set-dial-contacts,${EXTEN},1)
same => n,ExecIf($["${FIELDQTY(DST_CONTACT,&)}" != "1" && "${ALLOW_MULTY_ANSWER}" != "1"]?Set(__PT1C_SIP_HEADER=${EMPTY_VAR}))
same => n,ExecIf($["${DST_CONTACT}x" != "x"]?Dial(${DST_CONTACT},${ringlength},TtekKHhb(originate-create-channel,${EXTEN},1)U(originate-answer-channel),s,1)))
exten => _[hit],1,Gosub(interception_bridge_result,${EXTEN},1)
same => n,Hangup
[internal-originate-queue]
exten => _[0-9*#+a-zA-Z]!,1,Set(_NOCDR=1)
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-custom,${EXTEN},1)
same => n,ExecIf($["${SRC_QUEUE}x" != "x"]?Queue(${SRC_QUEUE},kT,,,300,,,originate-answer-channel))
exten => _[hit],1,Hangup
[originate-create-channel]
exten => _.!,1,ExecIf($[ "${EXTEN}" == "h" ]?Hangup()
same => n,ExecIf($["${PT1C_SIP_HEADER}x" != "x"]?Set(PJSIP_HEADER(add,${CUT(PT1C_SIP_HEADER,:,1)})=${CUT(PT1C_SIP_HEADER,:,2)}))
same => n,Set(__PT1C_SIP_HEADER=${UNDEFINED})
same => n,return
[originate-answer-channel]
exten => s,1,Set(IS_ORGNT=${EMPTY})
same => n,Set(orign_chan=${CHANNEL})
same => n,ExecIf($[ "${CHANNEL:0:5}" == "Local" ]?Set(pl=${IF($["${CHANNEL:-1}" == "1"]?2:1)}))
same => n,ExecIf($[ "${CHANNEL:0:5}" == "Local" ]?Set(orign_chan=${IMPORT(${CUT(CHANNEL,\;,1)}\;${pl},DIALEDPEERNAME)}))
same => n,Set(MASTER_CHANNEL(ORIGINATE_SRC_CHANNEL)=${orign_chan})
same => n,return
[dial_create_chan]
exten => s,1,Gosub(lua_${ISTRANSFER}dial_create_chan,${EXTEN},1)
same => n,Set(pt1c_is_dst=1)
same => n,ExecIf($["${PT1C_SIP_HEADER}x" != "x"]?Set(PJSIP_HEADER(add,${CUT(PT1C_SIP_HEADER,:,1)})=${CUT(PT1C_SIP_HEADER,:,2)}))
same => n,Set(__PT1C_SIP_HEADER=${UNDEFINED})
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,ExecIf($[${DIALPLAN_EXISTS(${CONTEXT}-custom,s,1)}]?Gosub(${CONTEXT}-custom,s,1))
same => n,return
[hangup_handler]
exten => s,1,NoOp(--- hangup - ${CHANNEL} ---)
same => n,Gosub(hangup_chan,${EXTEN},1)
same => n,return
[set_orign_chan]
exten => s,1,Wait(0.2)
same => n,Set(pl=${IF($["${CHANNEL:-1}" == "1"]?2:1)})
same => n,Set(orign_chan=${IMPORT(${CUT(CHANNEL,\;,1)}\;${pl},BRIDGEPEER)})
same => n,ExecIf($[ "${orign_chan}x" == "x" ]?Set(orign_chan=${IMPORT(${CUT(CHANNEL,\;,1)}\;${pl},TRANSFERERNAME)}))
same => n,ExecIf($[ "${orign_chan}x" == "x" ]?Set(orign_chan=${IMPORT(${CUT(CHANNEL,\;,1)}\;${pl},FROM_CHAN)}))
same => n,ExecIf($[ "${QUEUE_SRC_CHAN}x" != "x" ]?Set(__QUEUE_SRC_CHAN=${orign_chan}))
same => n,ExecIf($[ "${QUEUE_SRC_CHAN:0:5}" == "Local" ]?Set(__QUEUE_SRC_CHAN=${FROM_CHAN}))
same => n,ExecIf($[ "${FROM_CHAN}x" == "x" ]?Set(__FROM_CHAN=${IMPORT(${CUT(CHANNEL,\;,1)}\;${pl},BRIDGEPEER)}))
same => n,return
[playback]
exten => s,1,Playback(hello_demo,noanswer)
same => n,ExecIf($["${SRC_BRIDGE_CHAN}x" == "x"]?Wait(30))
same => n,Wait(0.3)
same => n,Bridge(${SRC_BRIDGE_CHAN},kKTthH)
exten => h,1,ExecIf($["${ISTRANSFER}x" != "x"]?Goto(transfer_dial_hangup,${EXTEN},1))
[add-trim-prefix-clid]
exten => _[0-9*#+a-zA-Z][0-9*#+a-zA-Z]!,1,NoOp(--- Incoming call from ${CALLERID(num)} ---)
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-custom,${EXTEN},1)
same => n,return
exten => _X!,1,NoOp(--- Incoming call from ${CALLERID(num)} ---)
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-custom,${EXTEN},1)
same => n,return
[internal-transfer]
exten => 800,1,Goto(parked-calls,${EXTEN},1)
exten => 1111,1,Goto(conference-rooms,1111,1)
exten => 201,1,Set(__ISTRANSFER=transfer_)
same => n,Goto(internal-users,201,1)
exten => 203,1,Set(__ISTRANSFER=transfer_)
same => n,Goto(internal-users,203,1)
exten => 01,1,Set(__ISTRANSFER=transfer_)
same => n,Goto(internal-users,01,1)
exten => _2003,1,Set(__ISTRANSFER=transfer_)
same => n,Goto(internal,${EXTEN},1)
exten => _2001,1,Set(__ISTRANSFER=transfer_)
same => n,Goto(internal,${EXTEN},1)
exten => _2002,1,Set(__ISTRANSFER=transfer_)
same => n,Goto(internal,${EXTEN},1)
exten => _89261111111,1,Set(__ISTRANSFER=transfer_)
same => n,Goto(internal,${EXTEN},1)
exten => _89161111111,1,Set(__ISTRANSFER=transfer_)
same => n,Goto(internal,${EXTEN},1)
exten => _89251111111,1,Set(__ISTRANSFER=transfer_)
same => n,Goto(internal,${EXTEN},1)
exten => h,1,Goto(transfer_dial_hangup,${EXTEN},1)
[internal-hints]
exten => 1111,hint,Custom:1111
exten => 201,hint,PJSIP/201&Custom:201
exten => 203,hint,PJSIP/203&Custom:203
exten => 01,hint,PJSIP/01&Custom:01
exten => 000063,hint,Custom:000063
exten => 000064,hint,Custom:000064
exten => 10003246,hint,Custom:10003246
exten => 2003,hint,Custom:2003
exten => 2001,hint,Custom:2001
exten => 2002,hint,Custom:2002
[outgoing]
exten => _+.!,1,NoOp(Strip + sign from number)
same => n,Goto(${CONTEXT},${EXTEN:1},1);
exten => _[0-9*#+a-zA-Z][0-9*#+a-zA-Z]!,1,Ringing()
same => n,Set(src_number=${EXTEN})
same => n,GosubIf($["${DIALPLAN_EXISTS(${CONTEXT}-custom,${EXTEN},1)}" == "1"]?${CONTEXT}-custom,${EXTEN},1)
same => n,ExecIf($["${REGEX("^79[0-9]{9}$" ${EXTEN})}" == "1"]?Gosub(SIP-BCD44BCA-24-outgoing,${EXTEN},1))
same => n,ExecIf($["${peer_mobile}x" != "x"]?Hangup())
same => n,ExecIf($["${DIALSTATUS}" != "ANSWER" && "${BLINDTRANSFER}x" != "x" && "${ISTRANSFER}x" != "x"]?Gosub(transfer_dial_hangup,${EXTEN},1))
same => n,ExecIf($["${BLINDTRANSFER}x" != "x"]?AGI(check_redirect.php,${BLINDTRANSFER}))
same => n,ExecIf($["${ROUTFOUND}x" == "x"]?Gosub(dial,${EXTEN},1))
same => n,Playback(silence/2,noanswer)
same => n,ExecIf($["${ROUTFOUND}x" != "x"]?Playback(followme/sorry,noanswer):Playback(cannot-complete-as-dialed,noanswer))
same => n,Hangup()
exten => h,1,ExecIf($["${ISTRANSFER}x" != "x"]?Goto(transfer_dial_hangup,${EXTEN},1))
[SIP-BCD44BCA-24-outgoing]
exten => _[0-9*#+a-zA-Z][0-9*#+a-zA-Z]!,1,Set(number=${EXTEN})
same => n,Set(number=${FILTER(\*\#\+1234567890,${number})})
same => n,ExecIf($["${number}x" == "x"]?Hangup())
same => n,Set(ROUTFOUND=1)
same => n,Set(PROVIDER_ID=SIP-BCD44BCA)
same => n,Gosub(${ISTRANSFER}dial,${EXTEN},1)
same => n,ExecIf($["${EXTERNALPHONE}" == "${src_number}"]?Set(DOPTIONS=tk))
same => n,Set(DIAL_COMMAND=PJSIP/${number}@SIP-BCD44BCA)
same => n,GosubIf($["${DIALPLAN_EXISTS(all-outgoing-custom,${EXTEN},1)}" == "1"]?all-outgoing-custom,${EXTEN},1)
same => n,GosubIf($["${DIALPLAN_EXISTS(SIP-BCD44BCA-outgoing-custom,${EXTEN},1)}" == "1"]?SIP-BCD44BCA-outgoing-custom,${EXTEN},1)
same => n,ExecIf($["${NEED_RETURN}" == "1"]?return)
same => n,Set(_OUT_NEED_ANNONCE=1)
same => n,Dial(${DIAL_COMMAND},600,${DOPTIONS}TKU(${ISTRANSFER}dial_answer)b(dial_create_chan,s,1))
same => n,GosubIf($["${DIALPLAN_EXISTS(SIP-BCD44BCA-outgoing-after-dial-custom,${EXTEN}),1}" == "1"]?SIP-BCD44BCA-outgoing-after-dial-custom,${EXTEN},1)
same => n,ExecIf($["${ISTRANSFER}x" != "x"]?Gosub(transfer_dial_hangup,${EXTEN},1))
same => n,ExecIf($["${DIALSTATUS}" = "ANSWER"]?Hangup())
same => n,ExecIf($["${DIALSTATUS}" = "BUSY"]?Busy(2))
same => n,Set(pt1c_UNIQUEID=${EMPTY_VALUE})
same => n,return
[none-incoming]
[public-direct-dial]
Here’s the code right now, it’s all on MikoPBX.