[Home]

Summary:ASTERISK-30134: IAX2 hints always return Unavailable
Reporter:Jose Miguel Rivera (jmiguel26@2016)Labels:
Date Opened:2022-07-07 18:47:10Date Closed:
Priority:MajorRegression?
Status:Open/NewComponents:Channels/chan_iax2
Versions:18.10.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Centos 7 3.10.0-1160.53.1.el7.x86_64Attachments:
Description:The monitoring for IAX2 hints always return unavailable; this makes impossible using IAX2 devices on queues. Due to the hint always return Unavailable, the call will never reach or ring agents using IAX2 devices.

Hints

asterisk*CLI> core show hint 2511
2511@extension-hints: IAX2/2511             State:Unavailable     Presence:not_set         Watchers  1
1 hint matching extension 2511

Devices

Name/Username    Host                                           Mask                                      Port           Status      Description                    
2501             (null)                                   (D)  (null)                                    (null)         UNKNOWN     IAX Reports                    
2511             192.168.0.5                              (D)  255.255.255.255                           53890          OK (1 ms)   IAX AND Queues
Comments:By: Asterisk Team (asteriskteam) 2022-07-07 18:47:11.253-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: George Joseph (gjoseph) 2022-07-11 06:07:53.832-0500

What Asterisk version did it last work with?
Can you share your iax.conf and extensions.conf entries for the extension?



By: Jose Miguel Rivera (jmiguel26@2016) 2022-07-11 09:14:33.799-0500

I really don't know in which version this did work. I just realized this issue when trying to use IAX2 extensions with queues.

iax.conf
[2511]
description=IAX AND Queues
host = dynamic
type = friend
requirecalltoken = no
qualify = 2000
qualifyfreq = 60
transfer = yes
secret=my_secure_password
callerid="IAX AND Queues" <2511>
deny=0.0.0.0/0
permit=0.0.0.0/0
parkinglot=parking-1
language=en
mohinterpret=default
mohsuggest=default
context=from-internal
mailbox=2511@default
callerid="IAX AND Queues" <2511>
setvar=DEVICENAME=2511

extensions.conf
exten => 2511,hint,iax2/2511


I also tried using the following format
exten => 2511,hint,iax/2511

None of the above worked!

By: George Joseph (gjoseph) 2022-07-12 08:19:11.260-0500

Yeah OK, I see the same thing.


By: N A (InterLinked) 2022-07-23 15:54:27.193-0500

If you do core set debug 3 chan_iax2 and then try to read {noformat}${DEVICE_STATE(IAX2/2511)}{noformat}, what do you get? (may need to add debug to console => log in logger.conf)

By: N A (InterLinked) 2022-07-23 16:04:52.742-0500

chan_iax2 doesn't really implement device state natively. Looking at the device state function for it, you can see "/* let the core figure out whether it is in use or not */" pretty much sums it up.

I suspect this is because IAX2 is mainly a trunking protocol, not an individual endpoint protocol, and asking for the device state of a trunk generally isn't what people are trying to do.

What this means in practice is that the core device state handler, ast_parse_device_state, is going to be used, and that checks if there are any channels in use for that prefix, e.g. IAX2/2511-123 - if so, the device state will be that prefix. Otherwise, it'll be "UNKNOWN".

I'm not so sure this is as much a bug as perhaps a design deficiency or limitation, since that's how the channel driver was set up.

In the meantime, UNKNOWN = registered and reachable and UNAVAILABLE = not registered/reachable, and occasionally you may get other states. You may want to try DEVICE_STATE as suggested during a call.

By: Jose Miguel Rivera (jmiguel26@2016) 2022-07-26 10:33:48.092-0500

I guess it's not possible to use the function DEVICE_STATE to monitor a HINT. The main problem here is that you cannot use the IAX2 devices on the queues because it's not possible to monitor their status.

By: N A (InterLinked) 2022-07-30 08:04:10.564-0500

I'm not sure why that necessarily means you can't use IAX2 devices in queues. I have IAX2 endpoints in queues and they work as expected, meaning that on an incoming queue call, it will try to ring that endpoint if it can. If your IAX2 endpoint is a specific device as opposed to a trunk, it might not make as much sense in this context but it does work.

By: Jose Miguel Rivera (jmiguel26@2016) 2022-08-01 13:01:02.775-0500

Without the HINT, the Queue cannot monitor if the device is connected or not. Additionally, it cannot monitor if the device is busy or not.

By: N A (InterLinked) 2022-08-01 15:37:06.521-0500

You haven't answered the question of whether this is a trunk or a single endpoint.

Generally, my answer to "monitor whether it's connected or not" would be "who cares??" Just ring the endpoint anyways. That's really all you'd generally do with IAX2 endpoints - you generally wouldn't know the status of an endpoint on another switch. If the call can go through, it will.

By: Jose Miguel Rivera (jmiguel26@2016) 2022-08-01 16:06:24.742-0500

Why do you think someone would use a trunk in a Queue? I am 100% talking about Phone devices.

By: N A (InterLinked) 2022-08-01 17:05:00.984-0500

Hence why I am asking a question. It's not obvious from your question.
It's also not clear if you just want to be able to ring the endpoint or you care about the device state itself.

All my IAX2 endpoints ring phones too, but they are phones on other Asterisk systems, so the hint would only indicate the status of the trunk registration, not whether the remote endpoint being rung is actually available or not.

Given the way device state is done, I suggest ignoring the hint and always trying to ring the endpoint. I don't recall needing to do anything to work around this, it just tries to go in for a ring, but you could always set up a phony hint or use a local channel to work around.

By: Jose Miguel Rivera (jmiguel26@2016) 2022-08-01 17:10:35.759-0500

The point here is that the HINTS works with SIP, and PJSIP but doesn't work with IAX2.

I guess the topic explains the issue. I am not looking for a workaround.



By: N A (InterLinked) 2022-08-01 17:23:21.281-0500

> The point here is that the HINTS works with SIP, and PJSIP but doesn't work with IAX2.
> I guess the topic explains the issue. I am not looking for a workaround.

Your earlier comments suggested otherwise:
"The monitoring for IAX2 hints always return unavailable; this makes impossible using IAX2 devices on queues. Due to the hint always return Unavailable, the call will never reach or ring agents using IAX2 devices."

and

"The main problem here is that you cannot use the IAX2 devices on the queues because it's not possible to monitor their status."

That made it seem like you just want to be able to ring your individual IAX2 endpoints.
The fact is it's not impossible to use IAX2 devices in queues, as you implied. You can use IAX2 endpoints in a queue if you want to.

As I already stated, UNKNOWN / UNAVAILABLE seem to be used to indicate IAX2 device state. There is no native device state functionality otherwise for IAX2, and never has been. This isn't really a bug, just a limitation, and if this were added, it would probably be a new feature, not a bug fix.

By: Birger "WIMPy" Harzenetter (wimpy) 2022-11-30 10:49:16.246-0600

This seems to be a regression. On Asterisk 11 I get a State:Idle as expected.

By: N A (InterLinked) 2022-11-30 13:35:36.749-0600

I haven't looked into this in any depth, but is it possible either of these may have been the cause (just looking at possible relevant changes during that timeframe)?

https://github.com/asterisk/asterisk/commit/cce4fad52281001b51f61a8c33ebe04838e8f18c
https://github.com/asterisk/asterisk/commit/699d2bd705ed98fa6917fe4e966ad9c7394a2076

It does seem reasonable it should be UNAVAILABLE if not registered, IDLE if registered with no channels of that prefix, and IN_USE if there are channels with that prefix.

By: N A (InterLinked) 2022-11-30 13:38:59.440-0600

As well, I just tried this on an Asterisk 20.0.0 system and I do see IDLE when there are no channels and Ringing if I call it:

iax@hints-test: IAX2/test             State:Idle            Presence:not_set         Watchers  0
iax@hints-test: IAX2/test             State:Ringing         Presence:not_set       Watchers  0

If the OP can post a minimally reproducible example for others to use, that would probably expedite any resolution of this.