I am experiencing an unusual situation (bug?) when I request variable information from the AMI. This happens consistantly.
If caller A dials caller B, I try to get the local and remote addresses for both channel A and B, by issuing the following two commands for each channel ID (along with a bunch of other getvar commands):
All of the data I request for channel A comes back perfectly. But, for channel B the local and remote addresses are returned as blank (empty string).
Is this a bug? Or is this expected behavior, and I have to determine the channel B remote & local addresses differently? (Everything else I request using getvar for legs A and B returns properly)
There’s insufficient information. What state is channel ‘B’ in? Is it up? Has an INVITE been sent if outbound? What actually is channel ‘B’? Is it actually a PJSIP channel?
Yes, once the call is bridged (both channels up), I initiate the getvar for more information. All information comes back, except local/remote address for channel B.
It’s a PJSIP protocol on both legs, both are regular SIP phones.
Here is a full capture of the AMI communications for channel B. (Channel A looks very similar, but the local_addr and remote_addr values are populated). Notice how channel B below receives blank values for those variables…again, only for channel B:
I actually wanted more events and information about the channels to verify statements you previously provided about them. Providing the Asterisk console log would also do that to a lesser degree.
I hadn’t thought of watching the call from the Asterisk console, so I created another call and saw the following:
Connected to Asterisk 20.3.0 currently running on pbx (pid = 12869)
[2024-09-01 18:27:31] WARNING[17772]: pjsip/dialplan_functions.c:903 channel_read_pjsip: No transport information for channel PJSIP/360-0000002c
[2024-09-01 18:27:31] WARNING[59953]: func_channel.c:527 func_channel_read: Unknown or unavailable item requested: 'pjsip,local_addr'
[2024-09-01 18:27:31] WARNING[15260]: pjsip/dialplan_functions.c:917 channel_read_pjsip: No transport information for channel PJSIP/360-0000002c
[2024-09-01 18:27:31] WARNING[59953]: func_channel.c:527 func_channel_read: Unknown or unavailable item requested: 'pjsip,remote_addr'
PJSIP/360 is the B leg of the call.
Interesting…why would that information (local_addr and remote_addr) not be available for the B leg of the call, but it is available for the A leg? I can increase verbosity if that helps, but I think I’ve stumbled onto something here. I can post the ‘full’ log excerpt but its lengthy because it’s the FreePBX dialplan with lots of ‘stuff’.
I don’t perform the above getvars until the bridge is created and both channels have been added to the bridge.