Idea is simple ... the macro will set whether to bill or not, based on whether the route used vgw1.nycmnycz (sip peer) In the case that it is using the sip peer, it is an outgoing call and I want another record in which the source is the old destination and the destination is the dialed peer number variable.
[macro-weh]
exten => s,1,Cut(gwweh=DIALEDPEERNUMBER,@,2)
exten => s,2,ResetCDR(w)
exten => s,3,Cut(exweh=DIALEDPEERNUMBER,@,1)
exten => s,4,Set(CDR(dst)=${exweh})
exten => s,5,GoToIf($["${gwweh}" = "vgw1.nycmnycz"]?55:65)
exten => s,55,SetAMAFlags(BILLING)
exten => s,65,SetAMAFlags(DOCUMENTATION)
CLI log:
-- Executing SetAccount("SIP/69.9.166.254-08196c60", "7262") in new stack
-- Executing SetCIDName("SIP/69.9.166.254-08196c60", "3: 6468255753") in new stack
-- Executing SetMusicOnHold("SIP/69.9.166.254-08196c60", "7262") in new stack
-- Executing DigitTimeout("SIP/69.9.166.254-08196c60", "5") in new stack
-- Set Digit Timeout to 5
-- Executing ResponseTimeout("SIP/69.9.166.254-08196c60", "10") in new stack
-- Set Response Timeout to 10
-- Executing Answer("SIP/69.9.166.254-08196c60", "") in new stack
-- Executing Dial("SIP/69.9.166.254-08196c60", "SIP/2019786703@vgw1.nycmnycz|30|M(weh)g") in new stack
-- Called 2019786703@vgw1.nycmnycz
-- SIP/vgw1.nycmnycz-833c is making progress passing it to SIP/69.9.166.254-08196c60
-- SIP/vgw1.nycmnycz-833c answered SIP/69.9.166.254-08196c60
-- Executing Cut("SIP/vgw1.nycmnycz-833c", "gwweh=DIALEDPEERNUMBER|@|2") in new stack
-- Executing ResetCDR("SIP/vgw1.nycmnycz-833c", "w") in new stack
-- Executing Cut("SIP/vgw1.nycmnycz-833c", "exweh=DIALEDPEERNUMBER|@|1") in new stack
-- Executing Set("SIP/vgw1.nycmnycz-833c", "CDR(dst)=2128124177") in new stack
-- Executing GotoIf("SIP/vgw1.nycmnycz-833c", "1?55:65") in new stack
-- Goto (macro-weh,s,55)
-- Executing SetAMAFlags("SIP/vgw1.nycmnycz-833c", "BILLING") in new stack
app1*CLI>
Disconnected from Asterisk server
Executing last minute cleanups
root@app1:~#