Fixed call barging issue

Hello.

I am trying to make call barging feature. I have agent with 6002 extension number. When caller and 6001 agent connect each other, I logged to my softphone using 6001 extesnion and I tried to join call dialing 7005. But it failed. This is my extensions.conf codes.

[call_barging]
exten => 7005,1,Answer()
   same => n,Wait(1)
   same => n,ChanSpy(PJSIP/6002,qb)
   same => n,Hangup()


include => call_barging
exten => 6001,1,Dial(PJSIP/6001)
exten => 6002,1,Dial(PJSIP/6002)
exten => 6005,1,Dial(PJSIP/6005)

how fix this issue?

You haven’t explained what “it failed” means, you haven’t provided console output to show what actually happened.

When asking for help and something doesn’t work always explain what happens and show logging.

sorry for it. this is my cli log

 -- Executing [s@annoucement_1:4] Set("PJSIP/my_sip_trunk-00000004", "UNIQUEID=1720680649.6") in new stack
    -- Executing [s@annoucement_1:5] MixMonitor("PJSIP/my_sip_trunk-00000004", "/var/spool/asterisk/monitor/1720680649.6.wav") in new stack
    -- Executing [s@annoucement_1:6] BackGround("PJSIP/my_sip_trunk-00000004", "Welcome-to-DMS-Electronic-1") in new stack
  == Begin MixMonitor Recording PJSIP/my_sip_trunk-00000004
    -- <PJSIP/my_sip_trunk-00000004> Playing 'Welcome-to-DMS-Electronic-1.slin48' (language 'en')
    -- Executing [s@annoucement_1:7] WaitExten("PJSIP/my_sip_trunk-00000004", "1") in new stack
    -- Timeout on PJSIP/my_sip_trunk-00000004, continuing...
    -- Executing [s@annoucement_1:8] Goto("PJSIP/my_sip_trunk-00000004", "annoucement_2,s,1") in new stack
    -- Goto (annoucement_2,s,1)
    -- Executing [s@annoucement_2:1] NoOp("PJSIP/my_sip_trunk-00000004", "Incoming call from Annoucement_1") in new stack
    -- Executing [s@annoucement_2:2] Set("PJSIP/my_sip_trunk-00000004", "TIMEOUT(digit)=1") in new stack
    -- Digit timeout set to 1.000
    -- Executing [s@annoucement_2:3] BackGround("PJSIP/my_sip_trunk-00000004", "Contact-the-sales-1") in new stack
    -- <PJSIP/my_sip_trunk-00000004> Playing 'Contact-the-sales-1.slin48' (language 'en')
       > 0x7f08c0065bd0 -- Strict RTP learning complete - Locking on source address 172.20.10.86:8530
    -- Executing [8@annoucement_2:1] NoOp("PJSIP/my_sip_trunk-00000004", "User Pressed 8, Wrong Input") in new stack
    -- Executing [8@annoucement_2:2] Verbose("PJSIP/my_sip_trunk-00000004", "1, User pressed 7") in new stack
  User pressed 7
    -- Executing [8@annoucement_2:3] Dial("PJSIP/my_sip_trunk-00000004", "PJSIP/6002") in new stack
    -- Called PJSIP/6002
    -- PJSIP/6002-00000005 is ringing
       > 0x7f08c0056830 -- Strict RTP learning after remote address set to: 124.43.67.53:50245
    -- PJSIP/6002-00000005 answered PJSIP/my_sip_trunk-00000004
    -- Channel PJSIP/6002-00000005 joined 'simple_bridge' basic-bridge <712e948a-19b7-4cdb-8fa3-1ba90a16858f>
    -- Channel PJSIP/my_sip_trunk-00000004 joined 'simple_bridge' basic-bridge <712e948a-19b7-4cdb-8fa3-1ba90a16858f>
       > 0x7f08c0056830 -- Strict RTP learning after ICE completion
       > 0x7f08c0056830 -- Strict RTP learning after remote address set to: 172.20.8.56:50245
       > 0x7f08c0056830 -- Strict RTP switching to RTP target address 172.20.8.56:50245 as source
    -- Executing [7005@from_external:1] NoOp("PJSIP/6001-00000006", "Outbound call from "6001" <6001>") in new stack
    -- Executing [7005@from_external:2] Set("PJSIP/6001-00000006", "UNIQUEID=1720680665.8") in new stack
    -- Executing [7005@from_external:3] MixMonitor("PJSIP/6001-00000006", "/var/spool/asterisk/monitor/1720680665.8.wav") in new stack
    -- Executing [7005@from_external:4] Dial("PJSIP/6001-00000006", "PJSIP/7005@my_sip_trunk") in new stack
  == Begin MixMonitor Recording PJSIP/6001-00000006
    -- Called PJSIP/7005@my_sip_trunk
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [7005@from_external:5] Hangup("PJSIP/6001-00000006", "") in new stack
  == Spawn extension (from_external, 7005, 5) exited non-zero on 'PJSIP/6001-00000006'
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording PJSIP/6001-00000006
       > 0x7f08c0056830 -- Strict RTP learning complete - Locking on source address 172.20.8.56:50245
    -- Executing [7005@from_external:1] NoOp("PJSIP/6001-00000008", "Outbound call from "6001" <6001>") in new stack
    -- Executing [7005@from_external:2] Set("PJSIP/6001-00000008", "UNIQUEID=1720680671.11") in new stack
    -- Executing [7005@from_external:3] MixMonitor("PJSIP/6001-00000008", "/var/spool/asterisk/monitor/1720680671.11.wav") in new stack
  == Begin MixMonitor Recording PJSIP/6001-00000008
    -- Executing [7005@from_external:4] Dial("PJSIP/6001-00000008", "PJSIP/7005@my_sip_trunk") in new stack
    -- Called PJSIP/7005@my_sip_trunk
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [7005@from_external:5] Hangup("PJSIP/6001-00000008", "") in new stack
  == Spawn extension (from_external, 7005, 5) exited non-zero on 'PJSIP/6001-00000008'
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording PJSIP/6001-00000008
    -- Executing [7005@from_external:1] NoOp("PJSIP/6001-0000000a", "Outbound call from "6001" <6001>") in new stack
    -- Executing [7005@from_external:2] Set("PJSIP/6001-0000000a", "UNIQUEID=1720680674.14") in new stack
    -- Executing [7005@from_external:3] MixMonitor("PJSIP/6001-0000000a", "/var/spool/asterisk/monitor/1720680674.14.wav") in new stack
    -- Executing [7005@from_external:4] Dial("PJSIP/6001-0000000a", "PJSIP/7005@my_sip_trunk") in new stack
  == Begin MixMonitor Recording PJSIP/6001-0000000a
    -- Called PJSIP/7005@my_sip_trunk
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [7005@from_external:5] Hangup("PJSIP/6001-0000000a", "") in new stack
  == Spawn extension (from_external, 7005, 5) exited non-zero on 'PJSIP/6001-0000000a'
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording PJSIP/6001-0000000a
    -- Executing [7005@from_external:1] NoOp("PJSIP/6001-0000000c", "Outbound call from "6001" <6001>") in new stack
    -- Executing [7005@from_external:2] Set("PJSIP/6001-0000000c", "UNIQUEID=1720680676.17") in new stack
    -- Executing [7005@from_external:3] MixMonitor("PJSIP/6001-0000000c", "/var/spool/asterisk/monitor/1720680676.17.wav") in new stack
    -- Executing [7005@from_external:4] Dial("PJSIP/6001-0000000c", "PJSIP/7005@my_sip_trunk") in new stack
  == Begin MixMonitor Recording PJSIP/6001-0000000c
    -- Called PJSIP/7005@my_sip_trunk
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [7005@from_external:5] Hangup("PJSIP/6001-0000000c", "") in new stack
  == Spawn extension (from_external, 7005, 5) exited non-zero on 'PJSIP/6001-0000000c'
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording PJSIP/6001-0000000c
    -- Channel PJSIP/6002-00000005 left 'simple_bridge' basic-bridge <712e948a-19b7-4cdb-8fa3-1ba90a16858f>
    -- Channel PJSIP/my_sip_trunk-00000004 left 'simple_bridge' basic-bridge <712e948a-19b7-4cdb-8fa3-1ba90a16858f>
  == Spawn extension (annoucement_2, 8, 3) exited non-zero on 'PJSIP/my_sip_trunk-00000004'
    -- Removed contact 'sip:tfra55sj@172.20.8.56:50378;transport=ws;x-ast-orig-host=l0utdbm7j3lg.invalid:0' from AOR '6002' due to shutdown
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording PJSIP/my_sip_trunk-00000004

The dialplan you previously provided does not match what is in use, and what is in use is resulting in other dialplan logic executing.

it failed mean, I tried to join caller and 6002 connection as a barging. it was unsuccessful.

Because dialplan logic in from_external was executed for “7005”, resulting in it trying to make an outgoing call.

should I create new extension as 7005 ?

This is my extensions.conf code.

[general]
static=yes
writeprotect=no
autofallthrough=yes
dtmfmode=rfc2833

[default]
exten => 0112019510,1,Answer() ; Replace 'SIP/chandima' with the appropriate endpoint or device
   same => n,Playback(welcomedmse)

[software_agent]
exten => 0773451602,1,NoOp(call to SOFTWARE AGENT MOBILE NUMBER)
   same => n,Dial(PJSIP/0773451602@my_sip_trunk,20)
   same => n,Hangup()

exten => 0770840517,1,NoOp(call to SOFTWARE AGENT MOBILE NUMBER)
   same => n,Dial(PJSIP/0770840517@my_sip_trunk,20)
   same => n,Hangup()

exten => 0787733966,1,NoOp(call to SOFTWARE AGENT MOBILE NUMBER)
   same => n,Dial(PJSIP/0787733966@my_sip_trunk,20)
   same => n,Hangup()


[outbound-calls]
; Context for handling specific outbound call scenarios
exten => _X.,1,NoOp(Making outbound call to ${EXTEN})
     ; Dial the number and set the call to jump to priority 2 if the call is answered
   same => n, Dial(PJSIP/${EXTEN}@my_sip_trunk,30,g)
     ; Priority 2, execute if the call is answered
   same => n, Background(welcome_en)
   same => n, Hangup()

[call_barging]
exten => 7005,1,Answer()
   same => n,Wait(1)
   same => n,ChanSpy(PJSIP/6002,qb)
   same => n,Hangup()


[from_external]

include => call_barging
exten => 6001,1,Dial(PJSIP/6001)
exten => 6002,1,Dial(PJSIP/6002)
exten => 6005,1,Dial(PJSIP/6005)

exten => 601,1,NoOp(call to Sachith(6001))
   same => n,Dial(PJSIP/6001)
   same => n,Hangup()

exten => 602,1,NoOp(call to Chandima(6002))
   same => n,Dial(PJSIP/6002)
   same => n,Hangup()

; OUTBOUND Configuration
exten => _X.,1,NoOp(Outbound call from ${CALLERID(all)})
   same => n,Set(UNIQUEID=${UNIQUEID})
   same => n,MixMonitor(/var/spool/asterisk/monitor/${UNIQUEID}.wav)
   same => n,Dial(PJSIP/${EXTEN}@my_sip_trunk)
   same => n,Hangup()

; INBOUND CONFIGURATION

exten => _0112019510,1,NoOp(Incoming call from ${EXTEN})
   same => n,Set(DIALED_NUMBER=${EXTEN})
   same => n,Goto(dmse_IVR,s,1)

exten => _0112019511,1,NoOp(Incoming call from ${EXTEN})
   same => n,Set(DIALED_NUMBER=${EXTEN})
   same => n,Goto(dmse_IVR,s,1)

exten => _0112019512,1,NoOp(Incoming call from ${EXTEN})
   same => n,Set(DIALED_NUMBER=${EXTEN})
   same => n,Goto(dmse_IVR,s,1)

exten => _0112019513,1,NoOp(Incoming call from ${EXTEN})
   same => n,Set(DIALED_NUMBER=${EXTEN})
   same => n,Goto(dmse_IVR,s,1)

exten => _0112019514,1,NoOp(Incoming call from ${EXTEN})
   same => n,Set(DIALED_NUMBER=${EXTEN})
   same => n,Goto(dmse_IVR,s,1)

exten => _0112019516,1,NoOp(Incoming call from ${EXTEN})
   same => n,Set(DIALED_NUMBER=${EXTEN})
   same => n,Goto(dmse_IVR,s,1)

exten => _0112019517,1,NoOp(Incoming call from ${EXTEN})
   same => n,Set(DIALED_NUMBER=${EXTEN})
   same => n,Goto(dmse_IVR,s,1)

exten => _0112019518,1,NoOp(Incoming call from ${EXTEN})
   same => n,Set(DIALED_NUMBER=${EXTEN})
   same => n,Goto(dmse_IVR,s,1)

exten => _0112019519,1,NoOp(Incoming call from ${EXTEN})
   same => n,Set(DIALED_NUMBER=${EXTEN})
   same => n,Goto(dmse_IVR,s,1)


; testing to 515 call routing
exten => _0112019515,1,NoOp(Incoming call from ${EXTEN})
   same => n,Set(DIALED_NUMBER=${EXTEN})
   same => n,Goto(ip_phone,s,1)

[ip_phone]
exten => s,1,NoOp(Transferring call directly to IP 172.20.10.101)
   same => n,Dial(PJSIP/105)
   same => n,Hangup()


[dmse_IVR]
exten => s,1,Answer()
   same => n,Set(FILENAME=/var/log/asterisk/call_log.txt)
   same => n,Set(CALL_DETAILS=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - Caller ID: ${CALLERID(num)}, Button Pressed: 2, Unique ID:${CONFID})
   same => n,System(echo "${CALL_DETAILS}" >> ${FILENAME})
   same => n,Set(TEST_MESSAGE=Testing logging)
   same => n,System(echo "${TEST_MESSAGE}" >> ${FILENAME})

; Use DIALED_NUMBER directly to set DESTINATION_NUMBER
   same => n,Set(DESTINATION_NUMBER=${DIALED_NUMBER})

   same => n,Set(CDR(userfield)=${DIALED_NUMBER}) ; Optional: Set custom CDR userfield
   same => n,Set(CDR(destination_number)=${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}${CALLERID(num)})

   same => n,Set(tries=0)
   same => n,Goto(time_selection,s,1)
   
[time_selection]
exten => s,1,NoOp(Entering into the system at ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
   same => n,GotoIfTime(00:01-23:59,,,*?day_ivr,s,1)
   same => n,Goto(night_ivr,s,1)
   
   
[day_ivr]
exten => s,1,NoOp(Daytime IVR)
   same => n,Goto(annoucement_1,s,1)

[night_ivr]
exten => s,1,NoOp(Nighttime IVR)
   same => n,Dial(PJSIP/6001)
   same => n,Answer()
   same => n,Playback(nighttime-greeting)  
   same => n,Wait(1)
   same => n,Hangup()
   
[annoucement_1]
exten => s,1,NoOp(Incoming Call In Daytime)
   same => n,Set(TIMEOUT(digit)=1)
   same => n,WaitExten(1)
   same => n,Set(UNIQUEID=${UNIQUEID})
   same => n,MixMonitor(/var/spool/asterisk/monitor/${UNIQUEID}.wav)
   same => n,Background(Welcome-to-DMS-Electronic-1)
   same => n, WaitExten(1)
   same => n,Goto(annoucement_2,s,1)

; MAIN MENU   
[annoucement_2]
exten => s,1,NoOp(Incoming call from Annoucement_1)
   same => n,Set(TIMEOUT(digit)=1)
   same => n,Background(Contact-the-sales-1)
   same => n,Background(press-one-1)
   
   same => n,Background(Contact-the-Service-1)
   same => n,Background(press-two-1)
   
   same => n,Background(Contact-the-Transaction-P-1)
   same => n,Background(press-three-1)
   
   same => n,Background(Contact-the-Service-Cente-1)
   same => n,Background(press-four-1)
   
   same => n,Background(Contact-the-Operator-Assi)
   same => n,Background(press-five-1)
   
   same => n,Background(Listen-again-the-menu-1)
   same => n,Background(press-star-key-1)
   
   same => n,Background(end-the-call-1)
   same => n,Background(press-zero-1)
      
   same => n,WaitExten(10)
   same => n,Set(tries=$[${tries} +1])
   same => n,GotoIf($[${tries}>=3]?Hangup,s,1)
   same => n,Playback(We-have-not-received-vali-1)
   same => n,WaitExten(1)
   same => n,Goto(annoucement_2,s,1)
   
;If user press 1, go to sales
exten => 1,1,NoOp(User Pressed 1, Goto Annoucement_3 Sales Menu)
   same => n,Verbose(1, User pressed 1)
   same => n,Set(MENU_NAME="sales")
   same => n,Goto(annoucement_3,s,1)

;If user press 2, go to Service
exten => 2,1,NoOp(User Pressed 2, Goto Service Menu)
   same => n,Verbose(1, User pressed 2)
   same => n,Set(MENU_NAME="service")
   same => n,Goto(annoucement_7,s,1)

;If user press 3, go to Transaction Processing System
exten => 3,1,NoOp(User Pressed 3, Goto Transaction Processing System)
   same => n,Verbose(1, User pressed 3)
   same => n,Set(MENU_NAME="transactionProcesSystem")
   same => n,Goto(annoucement_14,s,1)

;If user press 4, go to Service Center
exten => 4,1,NoOp(User Pressed 4, Goto Service Center)
   same => n,Verbose(1, User pressed 4)
   same => n,Set(MENU_NAME="serviceCenter")
   same => n,Goto(annoucement_8,s,1)

;If user press 5, go to Operator Assistance
exten => 5,1,NoOp(User Pressed 5, Operator Assistance)
   same => n,Verbose(1, User pressed 5)
   same => n,Set(MENU_NAME="operatorAssistance")
   same => n,Goto(annoucement_15,s,1)

exten => 6,1,NoOp(User Pressed 6, Wrong Input)
   same => n,Verbose(1, User pressed 6)
   same => n,Set(tries=$[${tries} +1])
   same => n,Goto(testVoicemail,s,1)
   ;same => n,GotoIf($[${tries}>=3]?Hangup)
   same => n,Playback(Wrong-Input-1)
   same => n,WaitExten(1)
   same => n,Goto(annoucement_2,s,1)

;exten => 7,1,NoOp(User Pressed 7, Wrong Input)
   ;same => n,Verbose(1, User pressed 7)
   ;same => n,Set(tries=$[${tries} +1])
   ;same => n,GotoIf($[${tries}>=3]?Hangup)
   ;same => n,Playback(Wrong-Input-1)
   ;same => n,WaitExten(1)
   ;same => n,Goto(annoucement_2,s,1)

exten => 7,1,NoOp(User Pressed 7, Wrong Input)
   same => n,Verbose(1, User pressed 7)
   same => n,Dial(PJSIP/6001)
   ;same => n,Set(tries=$[${tries} +1])
   ;same => n,GotoIf($[${tries}>=3]?Hangup)
   ;same => n,Playback(Wrong-Input-1)
   ;same => n,WaitExten(1)
   ;same => n,Goto(annoucement_2,s,1)

;exten => 8,1,NoOp(User Pressed 8, Wrong Input)
   ;same => n,Verbose(1, User pressed 8)
   ;same => n,Set(tries=$[${tries} +1])
   ;same => n,GotoIf($[${tries}>=3]?Hangup)
   ;same => n,Playback(Wrong-Input-1)
   ;same => n,WaitExten(1)
   ;same => n,Goto(annoucement_2,s,1)

exten => 8,1,NoOp(User Pressed 8, Wrong Input)
   same => n,Verbose(1, User pressed 7)
   same => n,Dial(PJSIP/6002)
   ;same => n,Set(tries=$[${tries} +1])
   ;same => n,GotoIf($[${tries}>=3]?Hangup)
   ;same => n,Playback(Wrong-Input-1)
   ;same => n,WaitExten(1)
   ;same => n,Goto(annoucement_2,s,1)


exten => 9,1,NoOp(User Pressed 9, Wrong Input)
   same => n,Verbose(1, User pressed 9)
   same => n,Set(tries=$[${tries} +1])
   same => n,GotoIf($[${tries}>=3]?Hangup)
   same => n,Playback(Wrong-Input-1)
   same => n,WaitExten(1)
   same => n,Goto(annoucement_2,s,1)

exten => 0,1,NoOp(User Pressed 0, End the Call)
   same => n,Verbose(1, User pressed 0)
   same => n,Goto(Thank_You,s,1)
   
exten => *,1,NoOp(User Pressed *, Listen Again the Menu)
   same => n,Verbose(1, User pressed *)
   same => n,Goto(annoucement_2,s,1)

exten => _XX.,1,NoOp(User Pressed (${_XX}), Wrong Input)
   same => n,Verbose(1, User pressed XX)
   same => n,Set(tries=$[${tries} +1])
   same => n,GotoIf($[${tries}>=3]?Hangup)
   same => n,Playback(Wrong-Input-1)
   same => n,WaitExten(1)
   same => n,Goto(annoucement_2,s,1)
   
; SALES MENU   
[annoucement_3]
exten => s,1,NoOp(Incoming call from Annoucement_3)
   same => n,Set(TIMEOUT(digit)=1)
   same => n,Set(busyCount=0)
   same => n,Set(SELECTED_PATH=annoucement_3)
   same => n,NoOp(User In Path ${SELECTED_PATH})

   same => n,Background(For-Networking-Items-and-1)
   same => n,Background(press-one-1)
   
   same => n,Background(For-Storage-and-Servers-1)
   same => n,Background(press-two-1)
   
   same => n,Background(For-End-User-Computing-1)
   same => n,Background(press-three-1)
   
   same => n,Background(For-Imaging-and-Printing-1)
   same => n,Background(press-four-1)
   
   same => n,Background(For-Software-Solutions-1)
   same => n,Background(press-five-1)
   
   same => n,Background(For-CCTV-Cabling-and-U-P-1)
   same => n,Background(press-six-1)
   
   same => n,Background(Listen-again-the-menu-1)
   same => n,Background(press-star-key-1)
   
   same => n,Background(exit-the-menu-1)
   same => n,Background(press-zero-1)
      
   same => n,WaitExten(10)
   same => n,Set(tries=$[${tries} +2])
   same => n,GotoIf($[${tries}>=3]?Hangup,s,1)
   same => n,Playback(We-have-not-received-vali-1)
   same => n,WaitExten(1)
   same => n,Goto(annoucement_3,s,1)
   



I don’t know what your dialplan really is, because you haven’t actually provided it. If you don’t understand dialplan or how things work, I would suggest learning/experimenting/brushing up on it. It is a fundamental part of Asterisk.

And there is your reason. “includes” are only checked if nothing in the current context matches. That matches, so call_barging would never be used.