AMI not returning correct information for one call leg

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):

Action: Getvar
Channel: (channelid)
Variable: CHANNEL(PJSIP,Local_Addr)

Action: Getvar
Channel: (channelid)
Variable: CHANNEL(PJSIP,Remote_Addr)

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.

I would suggest actually providing the complete AMI exchange and events related to each channel.

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:

ActionID: asteriskcache-{fe29185e-bad7-469e-a323-817e9b6eaa07}
Action:Getvar
Channel:1725224596.37
Variable:CHANNEL(pjsip,call-id)


Response: Success
ActionID: asteriskcache-{fe29185e-bad7-469e-a323-817e9b6eaa07}
Variable: CHANNEL(pjsip,call-id)
Value: 9d8dbc9b-b2f4-43ed-beb5-5b52defea202


ActionID: asteriskcache-{923e4137-623e-46c7-a689-f7e25aeb1880}
Action:Getvar
Channel:1725224596.37
Variable:CHANNEL(pjsip,local_addr)


Response: Success
ActionID: asteriskcache-{923e4137-623e-46c7-a689-f7e25aeb1880}
Variable: CHANNEL(pjsip,local_addr)
Value: 


ActionID: asteriskcache-{e77d556a-c8e4-4503-96e6-df76fdc3b6f6}
Action:Getvar
Channel:1725224596.37
Variable:CHANNEL(pjsip,local_tag)


Response: Success
ActionID: asteriskcache-{e77d556a-c8e4-4503-96e6-df76fdc3b6f6}
Variable: CHANNEL(pjsip,local_tag)
Value: db240a90-6061-4934-a32f-00914743e9ed


ActionID: asteriskcache-{2dfdfe3b-2da8-4904-be56-8ed292828631}
Action:Getvar
Channel:1725224596.37
Variable:CHANNEL(pjsip,local_uri)


Response: Success
ActionID: asteriskcache-{2dfdfe3b-2da8-4904-be56-8ed292828631}
Variable: CHANNEL(pjsip,local_uri)
Value: (** OBFUSCATED **)


ActionID: asteriskcache-{4cdc81bb-7d06-4098-abcd-533b514463ad}
Action:Getvar
Channel:1725224596.37
Variable:CHANNEL(pjsip,remote_addr)


Response: Success
ActionID: asteriskcache-{4cdc81bb-7d06-4098-abcd-533b514463ad}
Variable: CHANNEL(pjsip,remote_addr)
Value: 


ActionID: asteriskcache-{4f95f116-6fe7-4bb3-89b3-4f0eeca00add}
Action:Getvar
Channel:1725224596.37
Variable:CHANNEL(pjsip,remote_tag)


Response: Success
ActionID: asteriskcache-{4f95f116-6fe7-4bb3-89b3-4f0eeca00add}
Variable: CHANNEL(pjsip,remote_tag)
Value: qbzsll

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.

I’d start by upgrading to the latest 20, to eliminate the possibility it is already fixed.

1 Like

Ok, I upgraded to 20.9.3 and the problem remains…(with a minor difference)

The error on the CLI (about unknown or unavailable item requested) is no longer present. But getvar returns empty strings for those two values.

You can file an issue[1].

[1] Issues · asterisk/asterisk · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.