Incase anyone else has an issue, here is the final code
Action: originate
Channel: Local/s@outbound-dialer-custom;
Exten: 0
Context: speech-rec
Variable: toNum=6305559999
Priority: 1
The below items show how you can add multiple trunks or do lcr routing, if it’s a NO ANSWER or Answer it stops trying, otherwise it will go to the next one as many wholesale sip providers will return a 503 error and that does not necessarly mean another provider cannot connect.
[outbound-dialer-custom]
exten => s,1,NoOp(${toNum})
;exten => s,n,Dial(IAX2/voipMSTEST/6305551212,5) ;try 1
;exten => s,n,NoOp(${DIALSTATUS})
;exten => s,n,GotoIf($[${DIALSTATUS}=NOANSWER | ${DIALSTATUS}=BUSY]?noanswer)
;exten => s,n,GotoIf($[${DIALSTATUS}=NOANSWER | ${DIALSTATUS}=BUSY]?noanswer)
same=>n,NoOp(Start of CALL ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)}) ;try 2
exten => s,n,Dial(IAX2/voipMSTEST/${toNum},30) ;try 2
exten => s,n,GotoIf($[${DIALSTATUS}=NOANSWER | ${DIALSTATUS}=BUSY]?noanswer)
exten => s,n(noanswer),Hangup()
exten => 0,1,NoOp(Start of Answer ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 0,n,Wait(3)
same=>n,NoOp(Start of transfer ${STRFTIME(${EPOCH},%Y-%m-%d %H:%M:%S)})
same=>n,Set(transfer=1)
same=>n,Set(transferhangup=0)
same=>n,Dial(IAX2/voipMSTEST/6302063333,30,e)
exten => h,1,NoOp(STATUS ${DIALSTATUS})
exten => h,n,GotoIf($[${transfer}=1 & ${transferhangup}=0]?transferanswer:transferhangup)
same=>n(transferanswer),Set(transferhangup=1)
same=>n,NoOp(Transfer Was Answered at : ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
same=>n,NoOp(STATUS ${CDR(start)}) ;start of record
same=>n,NoOp(STATUS ${DIALSTATUS})
same=>n,NoOp(AnsweredTime ${ANSWEREDTIME})
same=>n,NoOp(DialedTime ${DIALEDTIME})
same=>n,NoOp(TransferTime ${CDR(billsec)})
same=>n,NoOp(RINGTIME ${CDR(duration)})
same=>n,Hangup()
same=>n(transferhangup),NoOp(HANGUP TRANSFER)
same=>n,NoOp(Transfer Terminated ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)}) ;start of record
same=>n,NoOp(STATUS ${CDR(start)}) ;start of record
same=>n,NoOp(STATUS ${DIALSTATUS})
same=>n,NoOp(AnsweredTime ${ANSWEREDTIME})
same=>n,NoOp(DialedTime ${DIALEDTIME})
same=>n,NoOp(TransferTime ${CDR(billsec)})
same=>n,NoOp(RINGTIME ${CDR(duration)})
same=>n,Hangup()
So the start of call ringing gives us the start time
The start of Answer shows the time the call actually picked up
The start of transfer is when it starts ringing
The Transfer Was answered is when the call was answered
The transfer Ended is the call/transfer end time.
With those variables you can figure out everything else you need.