Multi SIP trunk problem with inbound calls from same FreePbx

Hi !

I have problem with Multi SIP trunk registrations when I set caller ID on trunk and call DID on second Trunk on same FreePbx.
I have one provider but must have multi SIP trunk’s because of billing (different users etc.) and have setup:
Peer details:
username=99xxxxx
type=peer
sendrpid=yes
trustrpid=no
secret=xxxxxx
qualify=yes
insecure=port,invite
host=xx.xx.xx.xx
fromuser=99xxxxxx
dtmfmode=inband
dtmf=inband
context=from-pstn

User details:
type=user
secret=xxxxxx
context=from-trunk

Registration string:
99xxxxxxx:[email protected]:5060/99xxxxxxx

When I try to call DID on second Trunk got error:

[2019-04-03 15:16:32] NOTICE[4488][C-0000002b]: chan_sip.c:25853 handle_request_invite: Failed to authenticate device “callerID” <sip:callerID@sip IP adress>;tag=as46b5547a
[2019-04-03 15:16:32] WARNING[4488][C-0000002a]: chan_sip.c:23294 handle_response_invite: Received response: “Forbidden” from ‘<sip:99xxxxx@FreePBX IP>;tag=as3a6d988f’

If I set username on Caller ID field on trunk, all working OK, look like FROMUSER in peer details are not working ?
And from before, incoming call are always look like is coming to same TRUNK (first in line) but this is not correct and would like to solve this.

Have you checked with the provider?

I can change settings on provider side, because have admin rights (reseller), on provider side I have setup long time ago (and working till update I suppose)
Trustrpid: Yes
Senderpid: NO

But what about wrong trunk with incoming calls, this behaviour are present from start with freepbx (10+ Years) any solution to correct this ?

Correct what? You have multiple SIP trunks connecting to the same carrier and the only difference is the username/password. As far as the carrier is concerned all your calls to go a single IP and the user is how you have to manage them.

So you’re showing an inbound call that sends back a 403 to your provider. Is it hitting the right trunk? You are going to need to provide a much more detailed SIP debug than a few lines.

SIP LOG below, hope helps…

        == Using SIP RTP TOS bits 184

== Using SIP RTP CoS mark 5
– Executing [383xxx@from-internal:1] Macro(“SIP/21-000000bb”, “user-callerid,LIMIT,EXTERNAL,”) in new stack
– Executing [s@macro-user-callerid:1] Set(“SIP/21-000000bb”, “TOUCH_MONITOR=1554300576.347”) in new stack
– Executing [s@macro-user-callerid:2] Set(“SIP/21-000000bb”, “AMPUSER=21”) in new stack
– Executing [s@macro-user-callerid:3] GotoIf(“SIP/21-000000bb”, “0?report”) in new stack
– Executing [s@macro-user-callerid:4] ExecIf(“SIP/21-000000bb”, “1?Set(REALCALLERIDNUM=21)”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/21-000000bb”, “AMPUSER=21”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/21-000000bb”, “0?limit”) in new stack
– Executing [s@macro-user-callerid:7] Set(“SIP/21-000000bb”, “AMPUSERCIDNAME=Denis”) in new stack
– Executing [s@macro-user-callerid:8] GotoIf(“SIP/21-000000bb”, “0?report”) in new stack
– Executing [s@macro-user-callerid:9] Set(“SIP/21-000000bb”, “AMPUSERCID=21”) in new stack
– Executing [s@macro-user-callerid:10] Set(“SIP/21-000000bb”, “__DIAL_OPTIONS=tr”) in new stack
– Executing [s@macro-user-callerid:11] Set(“SIP/21-000000bb”, “CALLERID(all)=“Denis” <21>”) in new stack
– Executing [s@macro-user-callerid:12] GotoIf(“SIP/21-000000bb”, “0?limit”) in new stack
– Executing [s@macro-user-callerid:13] ExecIf(“SIP/21-000000bb”, “1?Set(GROUP(concurrency_limit)=21)”) in new stack
– Executing [s@macro-user-callerid:14] ExecIf(“SIP/21-000000bb”, “0?Set(CHANNEL(language)=)”) in new stack
– Executing [s@macro-user-callerid:15] GotoIf(“SIP/21-000000bb”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,28)
– Executing [s@macro-user-callerid:28] Set(“SIP/21-000000bb”, “CALLERID(number)=21”) in new stack
– Executing [s@macro-user-callerid:29] Set(“SIP/21-000000bb”, “CALLERID(name)=Denis”) in new stack
– Executing [s@macro-user-callerid:30] Set(“SIP/21-000000bb”, “CDR(cnum)=21”) in new stack
– Executing [s@macro-user-callerid:31] Set(“SIP/21-000000bb”, “CDR(cnam)=Denis”) in new stack
– Executing [s@macro-user-callerid:32] Set(“SIP/21-000000bb”, “CHANNEL(language)=en”) in new stack
– Executing [383xxx@from-internal:2] Set(“SIP/21-000000bb”, “MOHCLASS=default”) in new stack
– Executing [383xxx@from-internal:3] Set(“SIP/21-000000bb”, “_NODEST=”) in new stack
– Executing [383xxx@from-internal:4] Gosub(“SIP/21-000000bb”, “sub-record-check,s,1(out,383xxx,)”) in new stack
– Executing [s@sub-record-check:1] Set(“SIP/21-000000bb”, “REC_POLICY_MODE_SAVE=”) in new stack
– Executing [s@sub-record-check:2] GotoIf(“SIP/21-000000bb”, “1?check”) in new stack
– Goto (sub-record-check,s,7)
– Executing [s@sub-record-check:7] Set(“SIP/21-000000bb”, “__MON_FMT=wav”) in new stack
– Executing [s@sub-record-check:8] GotoIf(“SIP/21-000000bb”, “1?next”) in new stack
– Goto (sub-record-check,s,11)
– Executing [s@sub-record-check:11] ExecIf(“SIP/21-000000bb”, “0?Return()”) in new stack
– Executing [s@sub-record-check:12] ExecIf(“SIP/21-000000bb”, “0?Set(__REC_POLICY_MODE=)”) in new stack
– Executing [s@sub-record-check:13] GotoIf(“SIP/21-000000bb”, “0?out,1”) in new stack
– Executing [s@sub-record-check:14] Set(“SIP/21-000000bb”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [s@sub-record-check:15] Set(“SIP/21-000000bb”, “NOW=1554300576”) in new stack
– Executing [s@sub-record-check:16] Set(“SIP/21-000000bb”, “__DAY=03”) in new stack
– Executing [s@sub-record-check:17] Set(“SIP/21-000000bb”, “__MONTH=04”) in new stack
– Executing [s@sub-record-check:18] Set(“SIP/21-000000bb”, “__YEAR=2019”) in new stack
– Executing [s@sub-record-check:19] Set(“SIP/21-000000bb”, “__TIMESTR=20190403-160936”) in new stack
– Executing [s@sub-record-check:20] Set(“SIP/21-000000bb”, “__FROMEXTEN=21”) in new stack
– Executing [s@sub-record-check:21] Set(“SIP/21-000000bb”, “__CALLFILENAME=out-383xxx-21-20190403-160936-1554300576.347”) in new stack
– Executing [s@sub-record-check:22] Goto(“SIP/21-000000bb”, “out,1”) in new stack
– Goto (sub-record-check,out,1)
– Executing [out@sub-record-check:1] ExecIf(“SIP/21-000000bb”, “1?Set(__REC_POLICY_MODE=always)”) in new stack
– Executing [out@sub-record-check:2] GosubIf(“SIP/21-000000bb”, “1?record,1(exten,383xxx,21)”) in new stack
– Executing [record@sub-record-check:1] Set(“SIP/21-000000bb”, “AUDIOHOOK_INHERIT(MixMonitor)=yes”) in new stack
– Executing [record@sub-record-check:2] MixMonitor(“SIP/21-000000bb”, “2019/04/03/out-383xxx-21-20190403-160936-1554300576.347.wav,”) in new stack
– Executing [record@sub-record-check:3] Set(“SIP/21-000000bb”, “__REC_STATUS=RECORDING”) in new stack
== Begin MixMonitor Recording SIP/21-000000bb
– Executing [record@sub-record-check:4] Set(“SIP/21-000000bb”, “CDR(recordingfile)=out-383xxx-21-20190403-160936-1554300576.347.wav”) in new stack
– Executing [record@sub-record-check:5] Return(“SIP/21-000000bb”, “”) in new stack
– Executing [out@sub-record-check:3] Return(“SIP/21-000000bb”, “”) in new stack
– Executing [383xxx@from-internal:5] Macro(“SIP/21-000000bb”, “dialout-trunk,2,383xxx,off”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“SIP/21-000000bb”, “DIAL_TRUNK=2”) in new stack
– Executing [s@macro-dialout-trunk:2] GosubIf(“SIP/21-000000bb”, “0?sub-pincheck,s,1()”) in new stack
– Executing [s@macro-dialout-trunk:3] GotoIf(“SIP/21-000000bb”, “0?disabletrunk,1”) in new stack
– Executing [s@macro-dialout-trunk:4] Set(“SIP/21-000000bb”, “DIAL_NUMBER=383xxx”) in new stack
– Executing [s@macro-dialout-trunk:5] Set(“SIP/21-000000bb”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
– Executing [s@macro-dialout-trunk:6] Set(“SIP/21-000000bb”, “OUTBOUND_GROUP=OUT_2”) in new stack
– Executing [s@macro-dialout-trunk:7] GotoIf(“SIP/21-000000bb”, “1?nomax”) in new stack
– Goto (macro-dialout-trunk,s,9)
– Executing [s@macro-dialout-trunk:9] GotoIf(“SIP/21-000000bb”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:10] Set(“SIP/21-000000bb”, “DIAL_TRUNK_OPTIONS=”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“SIP/21-000000bb”, “outbound-callerid,2”) in new stack
– Executing [s@macro-outbound-callerid:1] ExecIf(“SIP/21-000000bb”, “0?Set(CALLERPRES()=)”) in new stack
– Executing [s@macro-outbound-callerid:2] ExecIf(“SIP/21-000000bb”, “0?Set(REALCALLERIDNUM=21)”) in new stack
– Executing [s@macro-outbound-callerid:3] GotoIf(“SIP/21-000000bb”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,6)
– Executing [s@macro-outbound-callerid:6] Set(“SIP/21-000000bb”, “USEROUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:7] Set(“SIP/21-000000bb”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:8] Set(“SIP/21-000000bb”, “TRUNKOUTCID=350xxxcallerID”) in new stack
– Executing [s@macro-outbound-callerid:9] GotoIf(“SIP/21-000000bb”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,14)
– Executing [s@macro-outbound-callerid:14] ExecIf(“SIP/21-000000bb”, “1?Set(CALLERID(all)=350xxxcallerID)”) in new stack
– Executing [s@macro-outbound-callerid:15] ExecIf(“SIP/21-000000bb”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [s@macro-outbound-callerid:16] ExecIf(“SIP/21-000000bb”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [s@macro-outbound-callerid:17] ExecIf(“SIP/21-000000bb”, “0?Set(CALLERPRES()=prohib_passed_screen)”) in new stack
– Executing [s@macro-outbound-callerid:18] Set(“SIP/21-000000bb”, “CDR(outbound_cnum)=350xxxcallerID”) in new stack
– Executing [s@macro-outbound-callerid:19] Set(“SIP/21-000000bb”, “CDR(outbound_cnam)=”) in new stack
– Executing [s@macro-dialout-trunk:12] GosubIf(“SIP/21-000000bb”, “0?sub-flp-2,s,1()”) in new stack
– Executing [s@macro-dialout-trunk:13] Set(“SIP/21-000000bb”, “OUTNUM=383xxx”) in new stack
– Executing [s@macro-dialout-trunk:14] Set(“SIP/21-000000bb”, “custom=SIP/OUT_TRUNK”) in new stack
– Executing [s@macro-dialout-trunk:15] ExecIf(“SIP/21-000000bb”, “0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default))”) in new stack
– Executing [s@macro-dialout-trunk:16] ExecIf(“SIP/21-000000bb”, “0?Set(DIAL_TRUNK_OPTIONS=M(confirm))”) in new stack
– Executing [s@macro-dialout-trunk:17] Macro(“SIP/21-000000bb”, “dialout-trunk-predial-hook,”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit(“SIP/21-000000bb”, “”) in new stack
– Executing [s@macro-dialout-trunk:18] GotoIf(“SIP/21-000000bb”, “0?bypass,1”) in new stack
– Executing [s@macro-dialout-trunk:19] ExecIf(“SIP/21-000000bb”, “1?Set(CONNECTEDLINE(num,i)=383xxx)”) in new stack
– Executing [s@macro-dialout-trunk:20] ExecIf(“SIP/21-000000bb”, “1?Set(CONNECTEDLINE(name,i)=CID:350xxxcallerID)”) in new stack
– Executing [s@macro-dialout-trunk:21] GotoIf(“SIP/21-000000bb”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:22] Dial(“SIP/21-000000bb”, “SIP/OUT_TRUNK/383xxx,300,”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/OUT_TRUNK/383xxx
[2019-04-03 16:09:36] WARNING[4488][C-00000058]: chan_sip.c:16636 check_auth: username mismatch, have <350xxxcallerID>, digest has <99356054>
[2019-04-03 16:09:36] NOTICE[4488][C-00000058]: chan_sip.c:25853 handle_request_invite: Failed to authenticate device “350xxxcallerID” sip:350xxxcallerIDat85.xx.xx.xx ;tag=as1376010e
[2019-04-03 16:09:36] WARNING[4488][C-00000057]: chan_sip.c:23294 handle_response_invite: Received response: “Forbidden” from ‘sip:99356054at10.99.17.105 ;tag=as0abbaa94’
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [s@macro-dialout-trunk:23] NoOp(“SIP/21-000000bb”, “Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 21”) in new stack
– Executing [s@macro-dialout-trunk:24] GotoIf(“SIP/21-000000bb”, “0?continue,1:s-CHANUNAVAIL,1”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] Set(“SIP/21-000000bb”, “RC=21”) in new stack
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:2] Goto(“SIP/21-000000bb”, “21,1”) in new stack
– Goto (macro-dialout-trunk,21,1)
– Executing [21@macro-dialout-trunk:1] Goto(“SIP/21-000000bb”, “continue,1”) in new stack
– Goto (macro-dialout-trunk,continue,1)
– Executing [continue@macro-dialout-trunk:1] NoOp(“SIP/21-000000bb”, “TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 21 - failing through to other trunks”) in new stack
– Executing [continue@macro-dialout-trunk:2] Set(“SIP/21-000000bb”, “CALLERID(number)=21”) in new stack
– Executing [383xxx@from-internal:6] Macro(“SIP/21-000000bb”, “outisbusy,”) in new stack
– Executing [s@macro-outisbusy:1] Progress(“SIP/21-000000bb”, “”) in new stack
– Executing [s@macro-outisbusy:2] GotoIf(“SIP/21-000000bb”, “0?emergency,1”) in new stack
– Executing [s@macro-outisbusy:3] GotoIf(“SIP/21-000000bb”, “0?intracompany,1”) in new stack
– Executing [s@macro-outisbusy:4] Playback(“SIP/21-000000bb”, “all-circuits-busy-now&pls-try-call-later, noanswer”) in new stack
– <SIP/21-000000bb> Playing ‘all-circuits-busy-now.gsm’ (language ‘en’)
> 0x7f975008dae0 – Probation passed - setting RTP source address to 192.168.10.56:60291
> 0x7f975008dae0 – Probation passed - setting RTP source address to 192.168.10.56:60291
== Spawn extension (macro-outisbusy, s, 4) exited non-zero on ‘SIP/21-000000bb’ in macro ‘outisbusy’
== Spawn extension (from-internal, 383xxx, 6) exited non-zero on ‘SIP/21-000000bb’
– Executing [h@from-internal:1] Hangup(“SIP/21-000000bb”, “”) in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/21-000000bb’
== MixMonitor close filestream (mixed)
== End MixMonitor Recording SIP/21-000000bb

Did you modify this log or is that really set to 350xxxcallerID?

modifyed log…there is real Caller ID !

Welcome to trying to run FreePBX in a multi-tenant mode. You’re calling out the PBX to the provider and the provider is then sending that call right back to you on the same IP it came from containing both the FROM header which contains a user on the PBX and the TO/RURI headers with contains a user on the PBX. If not handled properly the PBX will think that User A is calling User B from the IP that User A is not registered with.

From a provider side of things, this is a poorly handled “on-net” routing issue that should be resolved properly. Part of that is really not using FreePBX “as-is” and expect it to work for this type of scenario.

I have try with older Free PBX version, same provider, same settings…all working ok ?

SIP LOG:

-- Executing [534781@from-internal:1] Macro("SIP/222-000028ff", "user-callerid,SKIPTTL,") in new stack
-- Executing [s@macro-user-callerid:1] Set("SIP/222-000028ff", "AMPUSER=222") in new stack
-- Executing [s@macro-user-callerid:2] GotoIf("SIP/222-000028ff", "0?report") in new stack
-- Executing [s@macro-user-callerid:3] ExecIf("SIP/222-000028ff", "1?Set(REALCALLERIDNUM=222)") in new stack
-- Executing [s@macro-user-callerid:4] Set("SIP/222-000028ff", "AMPUSER=222") in new stack
-- Executing [s@macro-user-callerid:5] Set("SIP/222-000028ff", "AMPUSERCIDNAME=test") in new stack
-- Executing [s@macro-user-callerid:6] GotoIf("SIP/222-000028ff", "0?report") in new stack
-- Executing [s@macro-user-callerid:7] Set("SIP/222-000028ff", "AMPUSERCID=222") in new stack
-- Executing [s@macro-user-callerid:8] Set("SIP/222-000028ff", "CALLERID(all)="test" <222>") in new stack
-- Executing [s@macro-user-callerid:9] ExecIf("SIP/222-000028ff", "0?Set(CHANNEL(language)=)") in new stack
-- Executing [s@macro-user-callerid:10] GotoIf("SIP/222-000028ff", "1?continue") in new stack
-- Goto (macro-user-callerid,s,19)
-- Executing [s@macro-user-callerid:19] Set("SIP/222-000028ff", "CALLERID(number)=222") in new stack
-- Executing [s@macro-user-callerid:20] Set("SIP/222-000028ff", "CALLERID(name)=test") in new stack
-- Executing [s@macro-user-callerid:21] NoOp("SIP/222-000028ff", "Using CallerID "test" <222>") in new stack
-- Executing [534781@from-internal:2] NoOp("SIP/222-000028ff", "Calling Out Route: Trunk1") in new stack
-- Executing [534781@from-internal:3] Set("SIP/222-000028ff", "MOHCLASS=default") in new stack
-- Executing [534781@from-internal:4] Set("SIP/222-000028ff", "_NODEST=") in new stack
-- Executing [534781@from-internal:5] Macro("SIP/222-000028ff", "record-enable,222,OUT,") in new stack
-- Executing [s@macro-record-enable:1] GotoIf("SIP/222-000028ff", "1?check") in new stack
-- Goto (macro-record-enable,s,4)
-- Executing [s@macro-record-enable:4] ExecIf("SIP/222-000028ff", "0?MacroExit()") in new stack
-- Executing [s@macro-record-enable:5] GotoIf("SIP/222-000028ff", "0?Group:OUT") in new stack
-- Goto (macro-record-enable,s,15)
-- Executing [s@macro-record-enable:15] GotoIf("SIP/222-000028ff", "0?IN") in new stack
-- Executing [s@macro-record-enable:16] ExecIf("SIP/222-000028ff", "1?MacroExit()") in new stack
-- Executing [534781@from-internal:6] Macro("SIP/222-000028ff", "dialout-trunk,4,534781,") in new stack
-- Executing [s@macro-dialout-trunk:1] Set("SIP/222-000028ff", "DIAL_TRUNK=4") in new stack
-- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/222-000028ff", "0?sub-pincheck,s,1") in new stack
-- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/222-000028ff", "0?disabletrunk,1") in new stack
-- Executing [s@macro-dialout-trunk:4] Set("SIP/222-000028ff", "DIAL_NUMBER=534781") in new stack
-- Executing [s@macro-dialout-trunk:5] Set("SIP/222-000028ff", "DIAL_TRUNK_OPTIONS=trT") in new stack
-- Executing [s@macro-dialout-trunk:6] Set("SIP/222-000028ff", "OUTBOUND_GROUP=OUT_4") in new stack
-- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/222-000028ff", "1?nomax") in new stack
-- Goto (macro-dialout-trunk,s,9)
-- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/222-000028ff", "0?skipoutcid") in new stack
-- Executing [s@macro-dialout-trunk:10] Set("SIP/222-000028ff", "DIAL_TRUNK_OPTIONS=T") in new stack
-- Executing [s@macro-dialout-trunk:11] Macro("SIP/222-000028ff", "outbound-callerid,4") in new stack
-- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/222-000028ff", "0?Set(CALLERPRES()=)") in new stack
-- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/222-000028ff", "0?Set(REALCALLERIDNUM=222)") in new stack
-- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/222-000028ff", "1?normcid") in new stack
-- Goto (macro-outbound-callerid,s,6)
-- Executing [s@macro-outbound-callerid:6] Set("SIP/222-000028ff", "USEROUTCID=") in new stack
-- Executing [s@macro-outbound-callerid:7] Set("SIP/222-000028ff", "EMERGENCYCID=") in new stack
-- Executing [s@macro-outbound-callerid:8] Set("SIP/222-000028ff", "TRUNKOUTCID=6666666666") in new stack
-- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/222-000028ff", "1?trunkcid") in new stack
-- Goto (macro-outbound-callerid,s,12)
-- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/222-000028ff", "1?Set(CALLERID(all)=6666666666)") in new stack
-- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/222-000028ff", "0?Set(CALLERID(all)=)") in new stack
-- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/222-000028ff", "0?Set(CALLERID(all)=)") in new stack
-- Executing [s@macro-outbound-callerid:15] ExecIf("SIP/222-000028ff", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack
-- Executing [s@macro-dialout-trunk:12] GosubIf("SIP/222-000028ff", "0?sub-flp-4,s,1") in new stack
-- Executing [s@macro-dialout-trunk:13] Set("SIP/222-000028ff", "OUTNUM=534781") in new stack
-- Executing [s@macro-dialout-trunk:14] Set("SIP/222-000028ff", "custom=SIP/Trunk1") in new stack
-- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/222-000028ff", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)T)") in new stack
-- Executing [s@macro-dialout-trunk:16] Macro("SIP/222-000028ff", "dialout-trunk-predial-hook,") in new stack
-- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/222-000028ff", "") in new stack
-- Executing [s@macro-dialout-trunk:17] GotoIf("SIP/222-000028ff", "0?bypass,1") in new stack
-- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/222-000028ff", "0?customtrunk") in new stack
-- Executing [s@macro-dialout-trunk:19] Dial("SIP/222-000028ff", "SIP/Trunk1/534781,300,T") in new stack

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/Trunk1/534781
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [5555555555@from-pstn:1] Set(“SIP/Trunk2-00002901”, “__FROM_DID=5555555555”) in new stack
– Executing [5555555555@from-pstn:2] Gosub(“SIP/Trunk2-00002901”, “app-blacklist-check,s,1”) in new stack
– Executing [s@app-blacklist-check:1] GotoIf(“SIP/Trunk2-00002901”, “0?blacklisted”) in new stack
– Executing [s@app-blacklist-check:2] Set(“SIP/Trunk2-00002901”, “CALLED_BLACKLIST=1”) in new stack
– Executing [s@app-blacklist-check:3] Return(“SIP/Trunk2-00002901”, “”) in new stack
– Executing [5555555555@from-pstn:3] ExecIf(“SIP/Trunk2-00002901”, “0 ?Set(CALLERID(name)=6666666666)”) in new stack
– Executing [5555555555@from-pstn:4] Set(“SIP/Trunk2-00002901”, “__CALLINGPRES_SV=allowed_not_screened”) in new stack
– Executing [5555555555@from-pstn:5] Set(“SIP/Trunk2-00002901”, “CALLERPRES()=allowed_not_screened”) in new stack
– Executing [5555555555@from-pstn:6] Goto(“SIP/Trunk2-00002901”, “from-did-direct,650,1”) in new stack
– Goto (from-did-direct,650,1)
– Executing [650@from-did-direct:1] Macro(“SIP/Trunk2-00002901”, “exten-vm,novm,650”) in new stack
– Executing [s@macro-exten-vm:1] Macro(“SIP/Trunk2-00002901”, “user-callerid,”) in new stack
– Executing [s@macro-user-callerid:1] Set(“SIP/Trunk2-00002901”, “AMPUSER=6666666666”) in new stack
– Executing [s@macro-user-callerid:2] GotoIf(“SIP/Trunk2-00002901”, “0?report”) in new stack
– Executing [s@macro-user-callerid:3] ExecIf(“SIP/Trunk2-00002901”, “1?Set(REALCALLERIDNUM=6666666666)”) in new stack
– Executing [s@macro-user-callerid:4] Set(“SIP/Trunk2-00002901”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/Trunk2-00002901”, “AMPUSERCIDNAME=”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/Trunk2-00002901”, “1?report”) in new stack
– Goto (macro-user-callerid,s,10)
– Executing [s@macro-user-callerid:10] GotoIf(“SIP/Trunk2-00002901”, “0?continue”) in new stack
– Executing [s@macro-user-callerid:11] Set(“SIP/Trunk2-00002901”, “__TTL=64”) in new stack
– Executing [s@macro-user-callerid:12] GotoIf(“SIP/Trunk2-00002901”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,19)
– Executing [s@macro-user-callerid:19] Set(“SIP/Trunk2-00002901”, “CALLERID(number)=6666666666”) in new stack
– Executing [s@macro-user-callerid:20] Set(“SIP/Trunk2-00002901”, “CALLERID(name)=6666666666”) in new stack
– Executing [s@macro-user-callerid:21] NoOp(“SIP/Trunk2-00002901”, “Using CallerID “6666666666” <6666666666>”) in new stack
– Executing [s@macro-exten-vm:2] Set(“SIP/Trunk2-00002901”, “RingGroupMethod=none”) in new stack
– Executing [s@macro-exten-vm:3] Set(“SIP/Trunk2-00002901”, “VMBOX=novm”) in new stack
– Executing [s@macro-exten-vm:4] Set(“SIP/Trunk2-00002901”, “__EXTTOCALL=650”) in new stack
– Executing [s@macro-exten-vm:5] Set(“SIP/Trunk2-00002901”, “CFUEXT=”) in new stack
– Executing [s@macro-exten-vm:6] Set(“SIP/Trunk2-00002901”, “CFBEXT=”) in new stack
– Executing [s@macro-exten-vm:7] Set(“SIP/Trunk2-00002901”, “RT=”"") in new stack
– Executing [s@macro-exten-vm:8] Macro(“SIP/Trunk2-00002901”, “record-enable,650,IN”) in new stack
– Executing [s@macro-record-enable:1] GotoIf(“SIP/Trunk2-00002901”, “1?check”) in new stack
– Goto (macro-record-enable,s,4)
– Executing [s@macro-record-enable:4] ExecIf(“SIP/Trunk2-00002901”, “0?MacroExit()”) in new stack
– Executing [s@macro-record-enable:5] GotoIf(“SIP/Trunk2-00002901”, “0?Group:OUT”) in new stack
– Goto (macro-record-enable,s,15)
– Executing [s@macro-record-enable:15] GotoIf(“SIP/Trunk2-00002901”, “1?IN”) in new stack
– Goto (macro-record-enable,s,20)
– Executing [s@macro-record-enable:20] ExecIf(“SIP/Trunk2-00002901”, “1?MacroExit()”) in new stack
– Executing [s@macro-exten-vm:9] Macro(“SIP/Trunk2-00002901”, “dial-one,”",trT,650") in new stack
– Executing [s@macro-dial-one:1] Set(“SIP/Trunk2-00002901”, “DEXTEN=650”) in new stack
– Executing [s@macro-dial-one:2] Set(“SIP/Trunk2-00002901”, “DIALSTATUS_CW=”) in new stack
– Executing [s@macro-dial-one:3] GosubIf(“SIP/Trunk2-00002901”, “0?screen,1”) in new stack
– Executing [s@macro-dial-one:4] GosubIf(“SIP/Trunk2-00002901”, “0?cf,1”) in new stack
– Executing [s@macro-dial-one:5] GotoIf(“SIP/Trunk2-00002901”, “1?skip1”) in new stack
– Goto (macro-dial-one,s,8)
– Executing [s@macro-dial-one:8] GotoIf(“SIP/Trunk2-00002901”, “0?nodial”) in new stack
– Executing [s@macro-dial-one:9] GotoIf(“SIP/Trunk2-00002901”, “0?continue”) in new stack
– Executing [s@macro-dial-one:10] Set(“SIP/Trunk2-00002901”, “EXTHASCW=”) in new stack
– Executing [s@macro-dial-one:11] GotoIf(“SIP/Trunk2-00002901”, “1?next1:cwinusebusy”) in new stack
– Goto (macro-dial-one,s,12)
– Executing [s@macro-dial-one:12] GotoIf(“SIP/Trunk2-00002901”, “0?docfu:skip3”) in new stack
– Goto (macro-dial-one,s,16)
– Executing [s@macro-dial-one:16] GotoIf(“SIP/Trunk2-00002901”, “1?next2:continue”) in new stack
– Goto (macro-dial-one,s,17)
– Executing [s@macro-dial-one:17] GotoIf(“SIP/Trunk2-00002901”, “1?continue”) in new stack
– Goto (macro-dial-one,s,25)
– Executing [s@macro-dial-one:25] GotoIf(“SIP/Trunk2-00002901”, “0?nodial”) in new stack
– Executing [s@macro-dial-one:26] GosubIf(“SIP/Trunk2-00002901”, “1?dstring,1:dlocal,1”) in new stack
– Executing [dstring@macro-dial-one:1] Set(“SIP/Trunk2-00002901”, “DSTRING=”) in new stack
– Executing [dstring@macro-dial-one:2] Set(“SIP/Trunk2-00002901”, “DEVICES=650”) in new stack
– Executing [dstring@macro-dial-one:3] ExecIf(“SIP/Trunk2-00002901”, “0?Return()”) in new stack
– Executing [dstring@macro-dial-one:4] ExecIf(“SIP/Trunk2-00002901”, “0?Set(DEVICES=50)”) in new stack
– Executing [dstring@macro-dial-one:5] Set(“SIP/Trunk2-00002901”, “LOOPCNT=1”) in new stack
– Executing [dstring@macro-dial-one:6] Set(“SIP/Trunk2-00002901”, “ITER=1”) in new stack
– Executing [dstring@macro-dial-one:7] Set(“SIP/Trunk2-00002901”, “THISDIAL=SIP/650”) in new stack
– Executing [dstring@macro-dial-one:8] GosubIf(“SIP/Trunk2-00002901”, “1?zap2dahdi,1”) in new stack
– Executing [zap2dahdi@macro-dial-one:1] ExecIf(“SIP/Trunk2-00002901”, “0?Return()”) in new stack
– Executing [zap2dahdi@macro-dial-one:2] Set(“SIP/Trunk2-00002901”, “NEWDIAL=”) in new stack
– Executing [zap2dahdi@macro-dial-one:3] Set(“SIP/Trunk2-00002901”, “LOOPCNT2=1”) in new stack
– Executing [zap2dahdi@macro-dial-one:4] Set(“SIP/Trunk2-00002901”, “ITER2=1”) in new stack
– Executing [zap2dahdi@macro-dial-one:5] Set(“SIP/Trunk2-00002901”, “THISPART2=SIP/650”) in new stack
– Executing [zap2dahdi@macro-dial-one:6] ExecIf(“SIP/Trunk2-00002901”, “0?Set(THISPART2=DAHDI/650)”) in new stack
– Executing [zap2dahdi@macro-dial-one:7] Set(“SIP/Trunk2-00002901”, “NEWDIAL=SIP/650&”) in new stack
– Executing [zap2dahdi@macro-dial-one:8] Set(“SIP/Trunk2-00002901”, “ITER2=2”) in new stack
– Executing [zap2dahdi@macro-dial-one:9] GotoIf(“SIP/Trunk2-00002901”, “0?begin2”) in new stack
– Executing [zap2dahdi@macro-dial-one:10] Set(“SIP/Trunk2-00002901”, “THISDIAL=SIP/650”) in new stack
– Executing [zap2dahdi@macro-dial-one:11] Return(“SIP/Trunk2-00002901”, “”) in new stack
– Executing [dstring@macro-dial-one:9] Set(“SIP/Trunk2-00002901”, “DSTRING=SIP/650&”) in new stack
– Executing [dstring@macro-dial-one:10] Set(“SIP/Trunk2-00002901”, “ITER=2”) in new stack
– Executing [dstring@macro-dial-one:11] GotoIf(“SIP/Trunk2-00002901”, “0?begin”) in new stack
– Executing [dstring@macro-dial-one:12] Set(“SIP/Trunk2-00002901”, “DSTRING=SIP/650”) in new stack
– Executing [dstring@macro-dial-one:13] Return(“SIP/Trunk2-00002901”, “”) in new stack
– Executing [s@macro-dial-one:27] GotoIf(“SIP/Trunk2-00002901”, “0?nodial”) in new stack
– Executing [s@macro-dial-one:28] GotoIf(“SIP/Trunk2-00002901”, “0?skiptrace”) in new stack
– Executing [s@macro-dial-one:29] GosubIf(“SIP/Trunk2-00002901”, “1?ctset,1:ctclear,1”) in new stack
– Executing [ctset@macro-dial-one:1] Set(“SIP/Trunk2-00002901”, “DB(CALLTRACE/650)=6666666666”) in new stack
– Executing [ctset@macro-dial-one:2] Return(“SIP/Trunk2-00002901”, “”) in new stack
– Executing [s@macro-dial-one:30] Set(“SIP/Trunk2-00002901”, “D_OPTIONS=trT”) in new stack
– Executing [s@macro-dial-one:31] ExecIf(“SIP/Trunk2-00002901”, “0?SIPAddHeader(Alert-Info: )”) in new stack
– Executing [s@macro-dial-one:32] ExecIf(“SIP/Trunk2-00002901”, “0?SIPAddHeader()”) in new stack
– Executing [s@macro-dial-one:33] ExecIf(“SIP/Trunk2-00002901”, “0?Set(CHANNEL(musicclass)=)”) in new stack
– Executing [s@macro-dial-one:34] GosubIf(“SIP/Trunk2-00002901”, “0?qwait,1”) in new stack
– Executing [s@macro-dial-one:35] Set(“SIP/Trunk2-00002901”, “__CWIGNORE=”) in new stack
– Executing [s@macro-dial-one:36] Set(“SIP/Trunk2-00002901”, “__KEEPCID=TRUE”) in new stack
– Executing [s@macro-dial-one:37] Dial(“SIP/Trunk2-00002901”, “SIP/650,”",trT") in new stack
== Using SIP RTP TOS bits 184

For me it looks like trunk do not use username what must do 99356054 and use CAller ID as username that is not correct. If I put username in Trunk Caller ID it works ok ??

I’m going back to my original question. What does the provider say? They do not like the fact that the CallerID doesn’t match the username. Is the username their phone number?

Provider say that there is some problem on PBX, I can confirm that same setting on old version Free PBX working normaly, same settings !.
I use setting “fromuser=99356054” on trunk Peer details (no, Caller ID are not username, username are 99356054…) so obviously “fromuser” parameter on trunk not working ? What else ?

Not obviously. You haven’t produced a sip debug to show that it is not working or what is actually being sent to the provider. So you will need to make another test call and this time instead of “asterisk -rvvvvvvvv” you just do “asterisk -r” followed by “sip set debug on” and make the call.

Below are debug log…

  1. 10.99.17.105 are IP from Free PBX
  2. Now i register one trunk on one provider, second trunk to second provider
  3. 350000 are calling number
  4. 56 are extension that calling
  5. Calling trunk has username: 99350000
  6. 55555350000 are changed international number format (xxxxx350000)
  7. 85.xx.xx.xx are Softswitch Trunk1 (where is DID)
  8. 212.xx.xx.xx are IP Softswitch calling trunk
  9. 212.xx.xx.86 are Public IP of Free PBX
  10. Second trunk has username: 99356054

<— SIP read from UDP:192.168.10.245:60635 —>
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 192.168.8.98:60635;branch=z9hG4bK-524287-1—658d3e77a7e9dd6d;rport
Max-Forwards: 70
Contact: sip:[email protected]:60635;rinstance=399a56c2578e75a5
To: sip:[email protected]
From: "56"sip:[email protected];tag=e7cca63a
Call-ID: 97566NTQ0OWE4MjJlOTBlNjRhNGZjMGRjY2MzYzI0Zjk1ZTI
CSeq: 1 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite release 5.5.0 stamp 97566
Content-Length: 209

v=0
o=- 13198964186167136 1 IN IP4 192.168.8.98
s=X-Lite release 5.5.0 stamp 97566
c=IN IP4 192.168.8.98
t=0 0
m=audio 63288 RTP/AVP 8 101
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
— (13 headers 9 lines) —
Sending to 192.168.10.245:60635 (NAT)
Sending to 192.168.10.245:60635 (NAT)
Using INVITE request as basis request - 97566NTQ0OWE4MjJlOTBlNjRhNGZjMGRjY2MzYzI0Zjk1ZTI
Found peer ‘56’ for ‘56’ from 192.168.10.245:60635

<— Reliably Transmitting (NAT) to 192.168.10.245:60635 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.8.98:60635;branch=z9hG4bK-524287-1—658d3e77a7e9dd6d;received=192.168.10.245;rport=60635
From: "56"sip:[email protected];tag=e7cca63a
To: sip:[email protected];tag=as04f665dc
Call-ID: 97566NTQ0OWE4MjJlOTBlNjRhNGZjMGRjY2MzYzI0Zjk1ZTI
CSeq: 1 INVITE
Server: FPBX-2.11.0(11.21.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce=“4590a650”
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘97566NTQ0OWE4MjJlOTBlNjRhNGZjMGRjY2MzYzI0Zjk1ZTI’ in 8704 ms (Method: INVITE)

<— SIP read from UDP:192.168.10.245:60635 —>
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 192.168.8.98:60635;branch=z9hG4bK-524287-1—658d3e77a7e9dd6d;rport
Max-Forwards: 70
To: sip:[email protected];tag=as04f665dc
From: "56"sip:[email protected];tag=e7cca63a
Call-ID: 97566NTQ0OWE4MjJlOTBlNjRhNGZjMGRjY2MzYzI0Zjk1ZTI
CSeq: 1 ACK
Content-Length: 0

<------------->
— (8 headers 0 lines) —

<— SIP read from UDP:192.168.10.245:60635 —>
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 192.168.8.98:60635;branch=z9hG4bK-524287-1—b57ac94a4796382d;rport
Max-Forwards: 70
Contact: sip:[email protected]:60635;rinstance=399a56c2578e75a5
To: sip:[email protected]
From: “56"sip:[email protected];tag=e7cca63a
Call-ID: 97566NTQ0OWE4MjJlOTBlNjRhNGZjMGRjY2MzYzI0Zjk1ZTI
CSeq: 2 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite release 5.5.0 stamp 97566
Authorization: Digest username=“56”,realm=“asterisk”,nonce=“4590a650”,uri="sip:[email protected]”,response=“bc708e5e3b4cd0e6c4e119a78ff8eda5”,algorithm=MD5
Content-Length: 209

v=0
o=- 13198964186167136 1 IN IP4 192.168.8.98
s=X-Lite release 5.5.0 stamp 97566
c=IN IP4 192.168.8.98
t=0 0
m=audio 63288 RTP/AVP 8 101
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
— (14 headers 9 lines) —
Sending to 192.168.10.245:60635 (NAT)
Using INVITE request as basis request - 97566NTQ0OWE4MjJlOTBlNjRhNGZjMGRjY2MzYzI0Zjk1ZTI
Found peer ‘56’ for ‘56’ from 192.168.10.245:60635
Found RTP audio format 8
Found RTP audio format 101
Found audio description format telephone-event for ID 101
Capabilities: us - (gsm|ulaw|alaw), peer - audio=(alaw)/video=(nothing)/text=(nothing), combined - (alaw)
Non-codec capabilities (dtmf): us - 0x0 (nothing), peer - 0x1 (telephone-event|), combined - 0x0 (nothing)
Peer audio RTP is at port 192.168.8.98:63288
Looking for 350000 in from-internal (domain 10.99.17.105)
list_route: hop: sip:[email protected]:60635;rinstance=399a56c2578e75a5

<— Transmitting (NAT) to 192.168.10.245:60635 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.8.98:60635;branch=z9hG4bK-524287-1—b57ac94a4796382d;received=192.168.10.245;rport=60635
From: "56"sip:[email protected];tag=e7cca63a
To: sip:[email protected]
Call-ID: 97566NTQ0OWE4MjJlOTBlNjRhNGZjMGRjY2MzYzI0Zjk1ZTI
CSeq: 2 INVITE
Server: FPBX-2.11.0(11.21.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: sip:[email protected]:5060
Content-Length: 0

<------------>
Audio is at 13770
Adding codec 100004 (alaw) to SDP
Adding codec 100003 (ulaw) to SDP
Adding codec 100002 (gsm) to SDP
Reliably Transmitting (NAT) to 212.xx.xx.xx:5060:
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.99.17.105:5060;branch=z9hG4bK70df4ce4;rport
Max-Forwards: 70
From: sip:[email protected];tag=as0b4c9e21
To: sip:[email protected]
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: FPBX-2.11.0(11.21.0)
Date: Fri, 05 Apr 2019 18:56:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Remote-Party-ID: “55555350000” sip:[email protected];party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 225

v=0
o=root 178138597 178138597 IN IP4 10.99.17.105
s=Asterisk PBX 11.21.0
c=IN IP4 10.99.17.105
t=0 0
m=audio 13770 RTP/AVP 8 0 3
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=ptime:20
a=sendrecv


<— SIP read from UDP:212.xx.xx.xx:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.17.105:5060;branch=z9hG4bK70df4ce4;received=10.99.17.105;rport=5060
From: sip:[email protected]:5060;tag=as0b4c9e21
To: sip:[email protected];tag=as4bd2e035
Call-ID: [email protected]:5060
CSeq: 102 INVITE
Server: MOR Softswitch
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce=“5c8211ce”
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Transmitting (NAT) to 212.xx.xx.xx:5060:
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.99.17.105:5060;branch=z9hG4bK70df4ce4;rport
Max-Forwards: 70
From: sip:[email protected];tag=as0b4c9e21
To: sip:[email protected];tag=as4bd2e035
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 ACK
User-Agent: FPBX-2.11.0(11.21.0)
Content-Length: 0


Audio is at 13770
Adding codec 100004 (alaw) to SDP
Adding codec 100003 (ulaw) to SDP
Adding codec 100002 (gsm) to SDP
Reliably Transmitting (NAT) to 212.xx.xx.xx:5060:
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.99.17.105:5060;branch=z9hG4bK0278b64a;rport
Max-Forwards: 70
From: sip:[email protected];tag=as0b4c9e21
To: sip:[email protected]
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 103 INVITE
User-Agent: FPBX-2.11.0(11.21.0)
Authorization: Digest username=“99350000”, realm=“asterisk”, algorithm=MD5, uri=“sip:[email protected]”, nonce=“5c8211ce”, response=“1b74e3eb1940ef4053699db409eb2408”
Date: Fri, 05 Apr 2019 18:56:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Remote-Party-ID: “55555350000” sip:[email protected];party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 225

v=0
o=root 178138597 178138598 IN IP4 10.99.17.105
s=Asterisk PBX 11.21.0
c=IN IP4 10.99.17.105
t=0 0
m=audio 13770 RTP/AVP 8 0 3
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=ptime:20
a=sendrecv


<— SIP read from UDP:212.xx.xx.xx:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.99.17.105:5060;branch=z9hG4bK0278b64a;received=10.99.17.105;rport=5060
From: sip:[email protected]:5060;tag=as0b4c9e21
To: sip:[email protected]
Call-ID: [email protected]:5060
CSeq: 103 INVITE
Server: MOR Softswitch
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: sip:[email protected]:5060
Content-Length: 0

<------------->
— (12 headers 0 lines) —

<— SIP read from UDP:85.xx.xx.xx:5060 —>
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 85.xx.xx.xx:5060;branch=z9hG4bK2c78eadd;rport
Max-Forwards: 70
From: “55555350000” sip:[email protected];tag=as4f6b058a
To: sip:[email protected]:5060
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: MOR Softswitch
Date: Fri, 05 Apr 2019 18:56:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 177

v=0
o=root 567243964 567243964 IN IP4 85.xx.xx.xx
s=Asterisk PBX 1.8.32.3
c=IN IP4 85.xx.xx.xx
t=0 0
m=audio 18890 RTP/AVP 8
a=rtpmap:8 PCMA/8000
a=ptime:20
a=sendrecv
<------------->
— (14 headers 9 lines) —
Sending to 85.xx.xx.xx:5060 (NAT)
Sending to 85.xx.xx.xx:5060 (NAT)
Using INVITE request as basis request - [email protected]:5060
Found peer ‘55555350000’ for ‘55555350000’ from 85.xx.xx.xx:5060

<— Reliably Transmitting (NAT) to 85.xx.xx.xx:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 85.xx.xx.xx:5060;branch=z9hG4bK2c78eadd;received=85.xx.xx.xx;rport=5060
From: “55555350000” sip:[email protected];tag=as4f6b058a
To: sip:[email protected]:5060;tag=as72d09864
Call-ID: [email protected]:5060
CSeq: 102 INVITE
Server: FPBX-2.11.0(11.21.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce=“5d0f866d”
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘[email protected]:5060’ in 32000 ms (Method: INVITE)

<— SIP read from UDP:85.xx.xx.xx:5060 —>
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 85.xx.xx.xx:5060;branch=z9hG4bK2c78eadd;rport
Max-Forwards: 70
From: “55555350000” sip:[email protected];tag=as4f6b058a
To: sip:[email protected]:5060;tag=as72d09864
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 ACK
User-Agent: MOR Softswitch
Content-Length: 0

<------------->
— (10 headers 0 lines) —

<— SIP read from UDP:85.xx.xx.xx:5060 —>
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 85.xx.xx.xx:5060;branch=z9hG4bK135181c8;rport
Max-Forwards: 70
From: “55555350000” sip:[email protected];tag=as4f6b058a
To: sip:[email protected]:5060
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 103 INVITE
User-Agent: MOR Softswitch
Authorization: Digest username=“99356054”, realm=“asterisk”, algorithm=MD5, uri=“sip:[email protected]:1044”, nonce=“5d0f866d”, response=“eb75519de36305aa8b754277ff0502c9”
Date: Fri, 05 Apr 2019 18:56:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 177

v=0
o=root 567243964 567243965 IN IP4 85.xx.xx.xx
s=Asterisk PBX 1.8.32.3
c=IN IP4 85.xx.xx.xx
t=0 0
m=audio 18890 RTP/AVP 8
a=rtpmap:8 PCMA/8000
a=ptime:20
a=sendrecv
<------------->
— (15 headers 9 lines) —
Sending to 85.xx.xx.xx:5060 (NAT)
Using INVITE request as basis request - [email protected]:5060
Found peer ‘55555350000’ for ‘55555350000’ from 85.xx.xx.xx:5060
[2019-04-05 20:56:26] WARNING[4488][C-0000039a]: chan_sip.c:16636 check_auth: username mismatch, have <55555350000>, digest has <99356054>
[2019-04-05 20:56:26] NOTICE[4488][C-0000039a]: chan_sip.c:25853 handle_request_invite: Failed to authenticate device “55555350000” sip:[email protected];tag=as4f6b058a

<— Reliably Transmitting (NAT) to 85.xx.xx.xx:5060 —>
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 85.xx.xx.xx:5060;branch=z9hG4bK135181c8;received=85.xx.xx.xx;rport=5060
From: “55555350000” sip:[email protected];tag=as4f6b058a
To: sip:[email protected]:5060;tag=as72d09864
Call-ID: [email protected]:5060
CSeq: 103 INVITE
Server: FPBX-2.11.0(11.21.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘[email protected]:5060’ in 32000 ms (Method: INVITE)

<— SIP read from UDP:85.xx.xx.xx:5060 —>
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 85.xx.xx.xx:5060;branch=z9hG4bK135181c8;rport
Max-Forwards: 70
From: “55555350000” sip:[email protected];tag=as4f6b058a
To: sip:[email protected]:5060;tag=as72d09864
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 103 ACK
User-Agent: MOR Softswitch
Content-Length: 0

<------------->
— (10 headers 0 lines) —

<— SIP read from UDP:212.xx.xx.xx:5060 —>
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 10.99.17.105:5060;branch=z9hG4bK0278b64a;received=10.99.17.105;rport=5060
From: sip:[email protected]:5060;tag=as0b4c9e21
To: sip:[email protected];tag=as4115053a
Call-ID: [email protected]:5060
CSeq: 103 INVITE
Server: MOR Softswitch
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Transmitting (NAT) to 212.xx.xx.xx:5060:
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.99.17.105:5060;branch=z9hG4bK0278b64a;rport
Max-Forwards: 70
From: sip:[email protected];tag=as0b4c9e21
To: sip:[email protected];tag=as4115053a
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 103 ACK
User-Agent: FPBX-2.11.0(11.21.0)
Content-Length: 0


[2019-04-05 20:56:26] WARNING[4488][C-00000399]: chan_sip.c:23294 handle_response_invite: Received response: “Forbidden” from ‘sip:[email protected];tag=as0b4c9e21’
Scheduling destruction of SIP dialog ‘[email protected]:5060’ in 6400 ms (Method: INVITE)
Audio is at 13186
Adding codec 100004 (alaw) to SDP

<— Transmitting (NAT) to 192.168.10.245:60635 —>
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.168.8.98:60635;branch=z9hG4bK-524287-1—b57ac94a4796382d;received=192.168.10.245;rport=60635
From: "56"sip:[email protected];tag=e7cca63a
To: sip:[email protected];tag=as52a342a8
Call-ID: 97566NTQ0OWE4MjJlOTBlNjRhNGZjMGRjY2MzYzI0Zjk1ZTI
CSeq: 2 INVITE
Server: FPBX-2.11.0(11.21.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: sip:[email protected]:5060
Content-Type: application/sdp
Content-Length: 176

OK so this is a problem with a “loop back” call. User 99350000 is making a call out of Asterisk to the provider the fromuser=99350000, that is correct. Now it’s calling user 350000 which the provider is sending back to Asterisk. That is correct.

Here’s the tricky part, The fromuser is still 99350000 which to Asterisk sees as a local user and that it is trying to make a call into the system, so it’s going to auth the user and since this is actually coming from the provider, they can’t provider proper auth.

Again, I’ve said this before in other threads about this exact problem. This is a poor solution for what is considered On-Network routing. You’re letting everything be done like a normal user would make a call but you’re not the normal user, you’re the provider.

As far as I can see here, Asterisk is doing everything correctly. If you claim a previous box allowed this before then that means Asterisk has since fix a security bug.

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