Hi!
I’m running Asterisk 18.2.0 with a single ITSP and a trunk with 100 numbers. When a certain number is called I’d like Asterisk to connect the caller to an outside number instead of an internal endpoint. At its most basic the setup works.
All config files are here (extensions.conf, pjsip.conf, pjsip_wizard.conf, rtp.conf)
If a caller dials my -20
extensions from the outside for example. Asterisk goes to the subDialOutgoing
subroutine and does Dial(PJSIP/${ARG1}@itsp)
where ${ARG1}
is the external number. All great. In this case Asterisk will get out of the way and caller and callee can hear eachother fine.
An rtp set debug on
in Asterisk’s console confirms, Remotely bridged 'PJSIP/SOFTPHONE_B-0000000c' and 'PJSIP/SOFTPHONE_A-0000000d' - media will flow directly between them
.
Im struggling to use local channels to replicate this simple setup. I went with the “Asterisk: The Definitive Guide, 5th Edition” book (chapter 10) and Asterisk Wiki’s local channel examples but for reasons that are beyond me extension -30
from above does not correctly establish media streams, more on that in a sec. The only difference between -30
and -20
is an extra step via local channel.
If caller calls -30
the following Wireshark call flow unfolds.
-
Call-ID: SBC*
: ITSP sends SIP INVITE, says it wants-30
, gives its SDP media port 29952, accepts G.722 and a-law -
Call-ID: SBC*
: Asterisk says, SIP/2.0 100 Trying -
Call-ID: 986*
: Asterisk calls ITSP, wants-411
, gives its SDP media port 63136, accepts G.722, a-law, μ-law -
Call-ID: 986*
: ITSP says, SIP/2.0 100 Trying - …
-
Call-ID: 986*
: Eventually ITSP confirms callee picked up, gives its SDP media port 31708, accepts G.722 -
Call-ID: 986*
: Asterisk ACKs -
Call-ID: SBC*
: Asterisk confirms callee picked up, gives its SDP media port 63190, accepts G.722 and a-law -
Call-ID: 986*
: Meanwhile callee has started its G.722 RTP stream to Asterisk’s media port 63136 -
Call-ID: SBC*
: ITSP ACKs -
Call-ID: SBC*
: Caller starts its G.722 RTP stream as well to Asterisk’s media port 63190
Wireshark sees traffic coming from both parties. Asterisk at this time has bound UDP ports 63136 (for traffic the callee is sending) and 63190 (for traffic from the caller) but rtp set debug on
in Asterisk’s console is essentially silent whereas to my understanding it would normally log all RTP packets.
-- Called PJSIP/555-external-411@itsp
-- PJSIP/itsp-00000007 is ringing
-- Local/go-outside@localDialDelay-00000003;1 is ringing
> 0x7f29a031dd50 -- Strict RTP learning after remote address set to: 195.185.37.60:31708
-- PJSIP/itsp-00000007 answered Local/go-outside@localDialDelay-00000003;2
-- Local/go-outside@localDialDelay-00000003;1 answered PJSIP/itsp-00000006
> 0x7f29a03439a0 -- Strict RTP learning after remote address set to: 195.185.37.60:29952
-- Channel PJSIP/itsp-00000007 joined 'simple_bridge' basic-bridge <771099a7-5976-4b4a-ba97-8485ad1bae2d>
-- Channel Local/go-outside@localDialDelay-00000003;2 joined 'simple_bridge' basic-bridge <771099a7-5976-4b4a-ba97-8485ad1bae2d>
-- Channel Local/go-outside@localDialDelay-00000003;1 joined 'simple_bridge' basic-bridge <41b5316c-0ba8-47aa-ab12-3d783a84491e>
-- Channel PJSIP/itsp-00000006 joined 'simple_bridge' basic-bridge <41b5316c-0ba8-47aa-ab12-3d783a84491e>
> 0x7f29a03439a0 -- Strict RTP learning after remote address set to: 195.185.37.60:29952
-- Channel PJSIP/itsp-00000007 left 'simple_bridge' basic-bridge <771099a7-5976-4b4a-ba97-8485ad1bae2d>
-- Channel Local/go-outside@localDialDelay-00000003;2 left 'simple_bridge' basic-bridge <771099a7-5976-4b4a-ba97-8485ad1bae2d>
== Spawn extension (subDialOutgoing, entry, 2) exited non-zero on 'Local/go-outside@localDialDelay-00000003;2'
-- Channel Local/go-outside@localDialDelay-00000003;1 left 'simple_bridge' basic-bridge <41b5316c-0ba8-47aa-ab12-3d783a84491e>
-- Channel PJSIP/itsp-00000006 left 'simple_bridge' basic-bridge <41b5316c-0ba8-47aa-ab12-3d783a84491e>
== Spawn extension (ctx-get-to-sets, 30, 4) exited non-zero on 'PJSIP/itsp-00000006'
Listening to RTP streams after the Wireshark capture confirms that voice from the callee is sent to Asterisk’s listening port on the callee’s leg (but not forwarded to the caller) and voice from caller is sent to Asterisk’s listening port on the caller’s leg (but not forwarded to the callee).
Am I missing something obvious? Did I set up my minimum local channel example incorrectly? Am I misunderstanding how a local channel works?
Thanks!