"Unknown" in the From Header

I everyone. I have a problem with an asterisk switch. Its purpose is very simple: route the calls incoming from a single IAX trunk to different SIP providers.
With one i get this very weird error: while the CALLERID variable is set correctly, the INVITE message for my provider (Digitel) is built with “Unknown” in the From header.

INVITE sip:5193288108162@213.XXX.XXX.XXX SIP/2.0
Via: SIP/2.0/UDP 62.XXX.XXX.XXX:5060;branch=z9hG4bK11e25faf;rport
From: "Unknown" <sip:Unknown@62.XXX.XXX.XXX>;tag=as24b1f3e8
To: <sip:5193288108162@213.XXX.XXX.XXX>
Contact: <sip:Unknown@62.XXX.XXX.XXX>

And so i get a CONGESTION from my provider. The rules in the dialplan are very simple: the IAX trunk is routed in the context “incoming”.


exten = _6X.,1,NoOp(${EXTEN})
exten = _6X.,n,Set(NUMERO=${EXTEN:1})
exten = _6X.,n,GoTo(to-digitel,${NUMERO},1)


exten => _X.,1,NoOp(DIREZIONE: OUTGOING)
exten => _X.,2,Set(NUMERO=519${EXTEN})
exten => _X.,3,Set(TRUNK=SIP/digitel_in)
exten => _X.,4,Set(CALLERID(name)=${CALLERID(num)})
exten => _X.,5,Noop(${CALLERID(all)})
exten => _X.,6,Dial(${TRUNK}/${NUMERO})
exten => _X.,7,Goto(s-${DIALSTATUS},1)

exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Busy
exten => s-STD,1,Hangup
exten => _s-.,1,Goto(s-NOANSWER,1

The callerid variable is set correctly since in the console from the Noop(${CALLERID(all)}) i can see is right:

-- Executing NoOp("IAX2/iax_gw-7", ""0521700099" <0521700099>") in new stack

Also, other calls going in the “to-digitel” context work right without problems…

Anyone can help?


SOLVED! Adding this in the dialplan did the trick…