All cals from all phones to outside display nr from rezeptio

We use AsteriskNOW 13.2.0 with Sipgate trunking ( sipgate team 10 ) and have 100 numbers from Sipgate.
All our calls go outside with the number +49 (xxxx) xxxxx-0. The system is configuriert that the caller ID in the form, for example for Ring Groups 31YY. I want to see instead of 0 the YY if I am called. Internally, the number is displayed correctly, but externally, or redirects to mobile phone - number appears the number 0 whitch is configured for the reception.
Config File extension_custom.conf:

exten => _+X!,1,Noop(Stripping + from start of number)
exten => _+X!,n,Goto(from-internal,${EXTEN:1},1)
exten => h,1,Hangup()
exten => _X!,1,NoOp(Caller ID is ${CALLERID(num)})
exten => _X!,n,Set(CALLERID(name)=${CALLERID(num)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)
exten => s,1,GotoIf($["${CALLERID(num):0:2}" = “00”]?doublezero)
exten => s,n,GotoIf($["${CALLERID(num):0:1}" = “0”]?onezero)
exten => s,n,MacroExit()
exten => s,n(onezero),Set(CALLERID(num)=49${CALLERID(num):1})
exten => s,n,SIPAddHeader(P-Preferred-Identity:sip:${CALLERID(num)}
exten => s,n,MacroExit()
exten => s,n(doublezero),Set(CALLERID(num)=${CALLERID(num):2})
exten => s,n,SIPAddHeader(P-Preferred-Identity:sip:${CALLERID(num)}
exten => s,n,MacroExit()

where is the problem :confused:

Make sure, that You have the setting sendrpid=pai for the trunk in Your sip-configuration.
Normally - for SIPGATE-Trunking - this would be enough, “Extra-Headers” like in Your dialplan-example should not be needed. As the CALLERID(num) is already correct configured (when at least starting with one 0), this should work as SIPGATE expects the CALLERID (as well as the P-Asserted-Identity) to be in E164 format.

No changes with this option in the settings from the trunk :frowning: .

Here the Trunk from outgoing settings Peer details:


With XXXXXX are mask the User and PW from Sipgate.

Now you have here posted the settings from Trunk and the extensions_custom.conf file. If I must check another configuration please tell me what I must check. Thx

Please provide a log of a sample outbound call using Your macro-dialout-trunk-predial-hook. For the log, please set

core set verbose 5 sip set debug ip

Actually I suppose that there’s something wrong with CALLERID(num).