To-way trunk for one call

Hello everybody.
I have the Asterisk 16.21.1 built by mockbuild @ on a x86_64 running Linux on 2021-10-11 22:54:58 UTC
I have trunk to the service provider (SP) for call recording and analyzing.
SP after receiving incoming call instantly make call via same trunk with the same CID and EXTEN.
But the incoming call Asterisk proccesses in the context of the original call, not in the trunk context.
Question: is it possible to implement such scheme (with single trunk to SP) of a call routing?

exten => _XXXX,1,NoOp(Call via Mango)
same => n,Answer()
same => n,BackGround(beep)
same => n,BackGround(_nomer)
same => n,SayDigits(${CALLERID(number)},c)
same => n,HangUp

exten => s,1,NoOp( From mango )
same => n,BackGround(beep)
same => n,HangUp()

This is the result of using type=friend, instead of type=peer, for your local phones. It usually results in an authentication failure, as local phones normally have to authenticate. You should use type=peer everywhere, unless two peers share the same IP address, in which case the best solution is to use device names that are unrelated to the extension used to call them and the caller ID.

Also note that chan_sip is deprecated, and chan_pjsip is different, including options not available in chan_sip.

As you haven’t provided logs, haven’t provided the parts of sip.conf relating to the local devices, and haven’t provide the dialplan for outbound calls, I am guessing as to what exactly you are doing.

To expand on what I wrote, chan_sip gives priority to matching on username, which it takes from the user part of the From header, which is also the default location for outbound caller ID.

type=friend is a combination of type=user, which matches on user name,and type=peer, which doesn’t match on user name, but does still match on the address of record in a register, but for other purposes matches on IP address, including that learned during registration.

If an inbound call has a From user that matches a type=user (and therefore also type=friend) entry’s name, that type=user match is used in preference to the IP match of the peer from which it arrived.

I think you have the caller ID for the phone the same as its sip.conf section name, and the provider is reflecting that back. I you don’t set a caller ID in Asterisk (and don’t set fromuser for the the t"trunk", the caller ID is likely to match the user entry for the phone making the call, so, when it comes back, you will have the wrong section matched.

The one time when you need type=friend is when the same IP address can represent more than one phone, in which case the user name can be the only way of distinguishing them. Even then, I’m not sure it is always necessary.

Unfortunately, a lot of crib sheets fail to understand this, and tend to recommend type=friend, when it isn’t needed.

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