Local channels are not optimizing

Asterisk Version:16.7.0

  1. my ami code is below…

fputs( $astsock, “Action: Login\r\n”);
fputs( $astsock, “UserName: $username\r\n”);
fputs( $astsock, “Secret: $password\r\n\r\n”);
fputs( $astsock, “Action: Originate\r\n”);
fputs( $astsock, “Channel: Local/s@test-dialout\r\n”);
fputs( $astsock, “Context: test-answer\r\n”);
fputs( $astsock, “Exten: s\r\n”);
fputs( $astsock, “Priority: 1\r\n”);
fputs( $astsock, “Async: true\r\n\r\n”);
fputs( $astsock, “Action: Logoff\r\n\r\n”);

  1. extension.conf

exten => s,1,Dial(SIP/XXXXXXXXXX@siptrunk,30)
exten => s,n,Hangup()

exten => s,1,Wait(30)
exten => s,n,Hangup()

  1. asterisk cli “core show channels” output when call connected.

CLI> core show channels
Channel Location State Application(Data)
Local/s@test-dialout s@test-answer:1 Up Wait(30)
Local/s@test-dialout s@test-dialout:6 Up Dial(SIP/XXXXXXXXXX@siptrunk,
SIP/siptrunk-000007c (None) Up AppDial((Outgoing Line))
3 active channels
2 active calls

As per documentation Local channels should get merged / optimized if \n is not mentioned with local channel. But this is not happening in my case.

Please help me to understand this issue. Please let me know if more details required.


Both sides have to be in a bridge talking to another channel in order for optimization to occur[1]. If one side is merely executing dialplan (as you are) then it won’t occur.

[1] https://wiki.asterisk.org/wiki/display/AST/Local+Channel+Optimization

Thanks for your help…

I am executing same dialplan and same code in asterisk 1.8 version and and local channels getting optimized perfectly.

Only difference is that in asterisk 1.8 box (using DAHDI for outgoing calls)its switching to nating bridge and in asterisk 16 box (using SIP for outgoing calls) its switching to simple bridge.

Can you please shed some light on this ?

Local channel support and bridging was rewritten and changed in later versions. It is certainly possible that Local channel optimization is no longer supported in your specific scenario.


Can you please help me to identify on which specific versions after 1.8 similar Local channel support and bridging available.

Asterisk 11/12/13/14/15?


11 would be it, that would not have the major changes.

But 11 is EOL, any supported version of asterisk on which i can get similar functionalities for local channel and bridge?


If the reason is due to what I previously mentioned, then no. All current supported versions would behave that way.

@jcolp Many thanks for your help!!

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