Asterisk IAX loop call - please help to understand!

Hello, Dear Asterisk community !

Please help to figure out with my situation.

What I am doing:
I have a loop dial plan workaround for 3rd party application. A background application (daemon) dials trhough “AMI originate” command something like this “91626825XXXX” and connects other side to the 8368 extension which runs an AGI application, this call is being processed by the following dialplan:

exten => 8368,1,AGI(application.agi)
exten => 8368,2,Hangup

exten => _91626825!,1,Dial(IAX2/IAXloop/${EXTEN:2},o)
exten => _91626825!,n,Hangup
exten => _626825!,1,Answer
exten => _626825!,n,Playback(sip-silence)
exten => _626825!,n,Wait(86400)
exten => _626825!,n,Hangup

register => IAXloop:test@ ; (this port is provided by ip_relay - it points to a standard IAX2 port locally)


The problem:
The problem is when I use Asterisk 1.2.* - the AGI application recieves AGI variables and channel is equal to “IAX2/IAXloop-7383” (for example), but when I use Asterisk 1.4.44 - the channel is “Local/9162682520003@default-add1,1”. The thing is that I need to have non Local here!

The question:
I understand that it is a change in the Asterisk source code for some reason, and the best way to dig into the code and find it, but probably someone knows how to configure it (if it is possible) or disable this behaviour by any chance???

Thank you!

Both versions are obsolete. I guess that originate is using Local because you haven’t specified a channel technology and it therefore should dial the number you have specified as a default context extension. If so, I think it is an undocumented feature. You should always specify the complete technology/resource/dialed number combination.

Thank you very much!

I will try to play with “originate” and post a result.

I checked the “Originate” format for both versions - it is same:

Action: Originate
Exten: 8368
Context: default
Channel: Local/9162682520003@default
Priority: 1
Callerid: "V0321114553002258223" <0000000000>
Timeout: 60000

Channel is “Local” - you right…

Connection to extension “8368” will be made only after a connection to the Channel “Local/9162682520003@default” will be established. So, it seems to be just a different behaviour in the latest Asterisks.

But there is an interesting thing - when I have remote a peer, like this:

exten => _91626825!,1,Dial(SIP/PBX02/${EXTEN:2},,o)
exten => _91626825!,n,Hangup
  • it dials out normally and AGI gets SIP channel! Looks like there is a local loop detection in the asterisk…

Thank you

The difference will relate to exactly when the Local channel optimises out.

I’m not sure if the information is being captured when the AGI is started, or earlier, but you could try adding a delay of several milliseconds, to allow a frame to go through and trigger the optimisation.

As you are probably not generating outbound audio at that stage, there is some risk that no frame will go through to trigger the removal of the local channel. I’d actually have to experiment, or dig deep into the source code, to be sure.

This workaround is helping to 1.2 to generate an audio frames, thanks to this line:

exten => _626825!,n,Playback(sip-silence)

Thank you very much for replies and help - I will go with another workaround - I have another node, this call will go to another host instead of localhost…