Page 1 of 1

Change route depending on the status returned from the AGI

PostPosted: Sat Jan 07, 2023 2:56 am
by hanidhakwani
Hi,
How to recover the status (AA or NA) of the AGI to be able to switch to another voip provider?

Thanks

Re: Change route depending on the status returned from the A

PostPosted: Sat Jan 07, 2023 7:16 am
by mflorell
We have had clients do this by using the "No Agent Call URL" to automatically switch the list_id of leads to another list(using the "agc/dispo_move_list.php" script) where the other list had a different "Dial Prefix Override" set at the list level. It's not the most elegant solution, but it does work.

Re: Change route depending on the status returned from the A

PostPosted: Sat Jan 07, 2023 8:08 am
by hanidhakwani
Thank you for your answer, but where can I find "No-Answer Call URL"?

Re: Change route depending on the status returned from the A

PostPosted: Sat Jan 07, 2023 9:08 am
by hanidhakwani
agi-VDAD_ALL_outbound.agi update status to AA /NA / B ?

Re: Change route depending on the status returned from the A

PostPosted: Sat Jan 07, 2023 4:58 pm
by mflorell
Sorry, I meant "No Agent Call URL", it's a campaign setting.

Re: Change route depending on the status returned from the A

PostPosted: Mon Jan 09, 2023 4:29 pm
by hanidhakwani
hello, I propose this solution and I would like to have your opinion and correction. I tested today but just when I have AMDSTATUS in MACHINE, my DIALPLAN GO TO HANGUP

DIALPLAN :
exten => _523.,1,AGI(agi://127.0.0.1:4577/call_log)
ecten => _523.,n,Set(GLOBAL(TRNBR)=0)
exten => _523.,n,Set(GLOBAL(TRNBR)=${RAND(1,2)})
exten => _523.,n,Set(GLOBAL(APPELNBR)=1)
exten => _523.,n,Set(GLOBAL(CLIENT)=${EXTEN:3})
exten => _523.,n,NoOp(FOURNISSEUR ${TRNBR} - APPEL N ${APPELNBR})
exten => _523.,n,Gosub(FOUR_${TRNBR},s,1(${EXTEN:3}))



[FOUR_1]
exten => s,1,NoOp(--- APPEL N ${APPELNBR} Pour ${ARG1} ---)
exten => s,2,Dial(${FOURLBT1}/1023005${ARG1},,tTo)
exten => s,3,GotoIf($["${APPELNBR}"="1"]?FOUR_1,s,5)
exten => s,4,GotoIf($["${APPELNBR}"="2"]?FOUR_1,s,7)
exten => s,5,Set(GLOBAL(APPELNBR)=${IF($[ ${APPELNBR} = 1]?2:1)})
exten => s,6,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"] | $["${DIALSTATUS}" = "CONGESTION"] | $["${DIALSTATUS}" = "NOANSWER"] | $["${DIALSTATUS}" = "BUSY"] | $["${DIALSTATUS}" = "CANCEL"] | $["${AMDSTATUS}" = "MACHINE"] | $["${AMDSTATUS}" = "HANGUP"]?FOUR_2,s,1(${CLIENT}))
exten => s,7,Hangup()

[FOUR_2]
exten => s,1,NoOp(--- APPEL N ${APPELNBR} Pour ${ARG1} ---)
exten => s,2,Set(CODEREGION=${ARG1:2:1})
exten => s,3,NoOp(--- ------ CODEREGION : ${CODEREGION} ------ ---)
exten => s,4,GosubIf($[${CODEREGION} = 1]?FCFrance01,cell${RAND(1,2)},1)
exten => s,5,GosubIf($[${CODEREGION} = 2]?FCFrance02,cell${RAND(1,2)},1)
exten => s,6,GosubIf($[${CODEREGION} = 3]?FCFrance03,cell${RAND(1,2)},1)
exten => s,7,GosubIf($[${CODEREGION} = 4]?FCFrance04,cell${RAND(1,2)},1)
exten => s,8,GosubIf($[${CODEREGION} = 5]?FCFrance05,cell${RAND(1,2)},1)
exten => s,9,GosubIf($[${CODEREGION} = 6]?FCFranceMOB,cell${RAND(1,3)},1)
exten => s,10,GosubIf($[${CODEREGION} = 7]?FCFranceMOB,cell${RAND(1,3)},1)
exten => s,11,GosubIf($[${CODEREGION} = 9]?FCFranceMOB,cell${RAND(1,3)},1)
exten => s,12,NoOp(Affichage : ${CALLERID(num)})
exten => s,13,Dial(${FC2003}/${ARG1},,tTo)
exten => s,14,GotoIf($["${APPELNBR}"="1"]?FOUR_2,s,16)
exten => s,15,GotoIf($["${APPELNBR}"="2"]?FOUR_2,s,18)
exten => s,16,Set(GLOBAL(APPELNBR)=${IF($[ ${APPELNBR} = 1]?2:1)})
exten => s,17,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"] | $["${DIALSTATUS}" = "CONGESTION"] | $["${DIALSTATUS}" = "NOANSWER"] | $["${DIALSTATUS}" = "BUSY"] | $["${DIALSTATUS}" = "CANCEL"] | $["${AMDSTATUS}" = "MACHINE"] | $["${AMDSTATUS}" = "HANGUP"]?FOUR_1,s,1(${CLIENT}))
exten => s,18,Hangup()

[FCFrance01]
exten => cell1,1,Set(CALLERID(num)=331XXXXXXXX)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=331XXXXXXXX)
same => n,Return

[FCFrance02]
exten => cell1,1,Set(CALLERID(num)=332XXXXXXXX)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=332XXXXXXXX)
same => n,Return

[FCFrance03]
exten => cell1,1,Set(CALLERID(num)=333XXXXXXXX)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=333XXXXXXXX)
same => n,Return

[FCFrance04]
exten => cell1,1,Set(CALLERID(num)=334XXXXXXXX)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=334XXXXXXXX)
same => n,Return

[FCFrance05]
exten => cell1,1,Set(CALLERID(num)=335XXXXXXXX)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=335XXXXXXX)
same => n,Return

[FCFranceMOB]
exten => cell1,1,Set(CALLERID(num)=339XXXXXX)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=339XXXXXX)
same => n,Return
exten => cell3,1,Set(CALLERID(num)=339XXXXXX)
same => n,Return


IN extensions.conf :
; VICIDIAL_auto_dialer transfer script AMD with Load Balanced:
exten => 8369,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8369,n,Playback(sip-silence)
exten => 8369,n,AMD(2000,2000,1000,5000,120,50,4,256)
;HENIexten => 8369,n,AMD(2500,1500,800,5000,100,50,3,256)
exten => 8369,n,GotoIf($["${AMDSTATUS}" = "MACHINE"] | $["${AMDSTATUS}" = "HANGUP"]?default,8369,5)
exten => 8369,n,GotoIf($["${APPELNBR}"="1"]?default,8369,7)
exten => 8369,n,GotoIf($["${APPELNBR}"="2"]?default,8369,9)
exten => 8369,n,GotoIf($["${TRNBR}"="1"]?FOUR_1,s,3(${CLIENT}))
exten => 8369,n,GotoIf($["${TRNBR}"="2"]?FOUR_2,s,2(${CLIENT}))
exten => 8369,n,AGI(VD_amd.agi,${EXTEN})
exten => 8369,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB-----${CONNECTEDLINE(name)})
exten => 8369,n,Hangup()

Re: Change route depending on the status returned from the A

PostPosted: Mon Jan 09, 2023 6:56 pm
by hanidhakwani
I changed DIALSTATUS by HANGUPCAUSE, I think it works, tomorrow I test in production