There is a channel variable that gives the bridged channel, after it answers, which you can use with IMPORT (although dialplan will not have control at that point), or you can run the code in an answer subroutine, again after the call is answered. I’m not sure how easy it is to get this with AMI, before the call is answered; you may have to infer the outgoing channel.
There might be ways of doing by replacing Dial with Stasis and using ARI, but I don’t know enough about that.
Thank you David, I just need to set the outbound IP address and port number to a CDR variable. At the moment the CDR fields that I have show the following for the outbound leg:
PJSIP/123456789@provider_name
I’d like to have a separate field just showing the outbound SIP IP address and port.